100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
AI Fundamentals

One-Shot Learning

Few-example machine learning technique

AdvancedTechnique2.6K learners

One-shot learning is a machine learning approach in which a model learns to correctly classify or recognize new categories from only a single labeled example per category, rather than requiring large labeled training datasets.

Definition

One-shot learning is a machine learning approach in which a model learns to correctly classify or recognize new categories from only a single labeled example per category, rather than requiring large labeled training datasets.

Overview

Traditional supervised learning models typically require hundreds or thousands of labeled examples per class to reach good accuracy. One-shot learning targets the opposite extreme: given just one example of a new category at inference (or fine-tuning) time, the model must correctly recognize further instances of that category. This is closely related to few-shot learning, which generalizes the idea to a handful of examples (commonly framed as "k-shot" learning for k examples per class), and to zero-shot learning, the even more extreme case of recognizing a category from a description alone with no labeled examples at all. The dominant technique for one-shot learning is metric learning: rather than training a classifier to directly output a class label, the model learns an embedding space in which similar things are close together and dissimilar things are far apart, using architectures like Siamese networks (which process two inputs through twin sub-networks with shared weights and compare their embeddings) or matching networks and prototypical networks (which compute a "prototype" embedding for each class from its few examples and classify new inputs by nearest-prototype comparison). Because the model is trained to learn a general notion of similarity across many different classes during a training phase, it can generalize this similarity metric to entirely new, unseen classes at test time using only their one or few provided examples. One-shot learning is essential in domains where collecting large labeled datasets per class is impractical or impossible: facial recognition systems (recognizing a person from a single enrolled photo), signature verification, drug discovery (identifying molecules similar to a single known active compound), and rare-category detection in manufacturing quality control, where defect types may be seen only once before a model needs to recognize them again. It has also become increasingly relevant to large language models, which exhibit strong one-shot and few-shot learning behavior directly through in-context prompting, without any gradient updates.

Key Concepts

  • Learns to recognize new categories from a single labeled example
  • Closely related to few-shot learning (k examples) and zero-shot learning (no examples)
  • Commonly implemented via metric learning and learned embedding spaces
  • Uses architectures like Siamese networks, matching networks, or prototypical networks
  • Trains a general similarity metric across many classes, then generalizes to new ones
  • Reduces dependence on large per-class labeled datasets
  • Naturally exhibited by large language models via in-context prompting
  • Enables recognition in domains where only rare examples are ever available

Use Cases

Facial recognition systems enrolling a person from a single photo
Signature and handwriting verification with minimal reference samples
Rare-defect detection in manufacturing quality control
Drug discovery, identifying molecules similar to one known active compound
Personalizing recommendation systems from a single user interaction
In-context learning with large language models given one example prompt

Frequently Asked Questions