Illustration for: Teaching AI to Recognise Documents It Has Never Seen: Few-Shot Learning in Identity Verification

There are thousands of different identity document types in circulation worldwide — passports, national identity cards, residence permits, driving licences — issued by nearly two hundred countries, each with its own design, security features, and biometric specifications. A border officer quickly learns the visual characteristics of the most common document types. A machine learning system trained on a fixed dataset may never encounter the majority of them. This is the generalisation problem in document-based identity verification — and few-shot learning is one of the most promising approaches to addressing it.

The training data problem

A conventional supervised learning approach requires a substantial labelled dataset for each document type the system will encounter. For the most common document types, such datasets can be assembled. For the long tail of less common document types, creating training datasets is impractical. Yet these are precisely the document types where a fraud detection system is most likely to encounter novel attacks.

What few-shot learning offers

Few-shot learning is a machine learning paradigm in which a model is designed to learn new categories from very small numbers of examples — sometimes as few as one or five. Prototypical Networks work by learning an embedding space in which genuine documents and fraudulent documents are well-separated. At deployment time, a small number of reference examples for a new document type are used to define the prototype of that class. New documents are then classified by their distance to this prototype — no retraining required.

Results from EINSTEIN research

Research from EINSTEIN consortium partners has applied few-shot learning to presentation attack detection on ID cards, demonstrating competitive detection performance for new country document types with as few as five unique identity examples. This was demonstrated across documents from Spain and Chile as a baseline, with generalisation to Argentina and Costa Rica — countries not represented in training.

A few-shot capable system can be updated to handle a new document type in hours rather than weeks. Combining few-shot learning with foundation model representations offers a particularly promising direction: foundation models provide rich general-purpose visual representations; few-shot learning provides the adaptation mechanism.

© 2026 EINSTEIN Consortium. EINSTEIN is funded by the European Union’s Horizon Europe programme (GA No. 101121280) and by UKRI (IFS 10093453). Views expressed are those of the authors only. www.einstein-horizon.eu