← AI Terminology

Few-Shot Learning

Few-shot learning is the ability of a model to generalise to new tasks or classes from very few labelled examples — typically 1 to 5 per class — rather than requiring thousands of training examples.

In LLMs, "few-shot" specifically refers to providing a handful of examples in the prompt to guide the model's output format or behaviour.
Why It Matters in AI
Labelling data is expensive: few-shot learning is the approach that bridges the gap when you can't afford 10,000 labelled examples per class. GPT-3's paper demonstrated that large language models can learn new tasks from just a few in-context examples with no gradient update — a paradigm shift from task-specific training. Few-shot capability is now a key evaluation criterion for every frontier LLM.
Key Points
Aspect Description
K-shot The number of examples per class provided — 1-shot, 5-shot, etc.
Benchmark miniImageNet, Omniglot (vision), Super-GLUE few-shot tracks, BIG-Bench few-shot evaluations
In-context LLMs: few-shot examples in the prompt; no weight update — learning from demonstration at inference time
Meta-learning "Learn to learn": train on many tasks so the model adapts quickly to new ones (MAML, Reptile)
Metric learning Classic approach: train embeddings so same-class examples cluster tightly (Siamese nets, Prototypical networks)
Zero-shot vs few Zero-shot: no examples; few-shot: 1–5 examples. More examples generally improve performance
Simple Analogy
A child who has seen 5 pictures of a platypus can correctly identify the 6th — even though they've never studied platypuses formally. Few-shot learning is building AI systems that generalise from minimal examples the way humans can, rather than requiring thousands of labelled training samples.
Common Usage Examples
  • GPT-4 few-shot: include 3 example (prompt, response) pairs before the actual question — dramatically improves format adherence
  • Prototypical networks: compute class prototype (mean embedding), classify by nearest prototype
  • MAML (Model-Agnostic Meta-Learning): inner loop trains on few examples, outer loop optimises for fast adaptation
  • learn2learn library: MAML, ProtoNets, MetaSGD implementations for PyTorch
  • Anthropic/OpenAI API: few-shot examples in messages array guide output style and structure
Summary
In short: Few-shot learning enables models to generalise from just a handful of examples — either through metric learning, meta-learning, or the in-context learning capability of large language models.