Machine Learning

Few-Shot Learning

Few-shot learning is a model's ability to learn a new task or category from only a handful of examples, with one-shot learning as the special case of a single example.

What is few-shot learning?

Few-shot learning is a model’s ability to pick up a new task or category from a small number of examples, often fewer than ten. One-shot learning is the single-example case: show the model one labeled instance and it must recognize others like it. Both depend on a pre-trained model that already knows the data type well.

In computer vision, few-shot methods often compare a new image with the stored examples instead of retraining, which is how a siamese network verifies a product from one reference photo. With large language models, few-shot learning usually means few-shot prompting: the examples go in the prompt, the model infers the pattern, and the model itself does not change. It sits between zero-shot learning (no examples) and fine-tuning (hundreds or thousands).

Few-shot learning in practice

A regional retailer adds a new private-label line every quarter, and its product-matching system must recognize each new item long before a thousand labeled examples exist. One-shot matching from a single reference image per item makes the new line searchable on launch day. The merchandising team pastes three examples of the house description style into a prompt template, and a language model writes the rest in that format.

What to watch for

  • The examples chosen matter more than their number, so pick ones that cover the edge cases.
  • Few-shot prompts add tokens to every request, which shows up in latency and cost at volume.
  • When a task is stable and high-volume, fine-tuning usually beats a permanent few-shot prompt.

← Back to AI Glossary