AI Concepts & Fundamentals

Few-Shot Learning

Getting an AI model to pick up a new task from a small handful of examples instead of a full training run.

Quick Answer

Few-shot learning is an AI model's ability to perform a new task correctly after seeing only a handful of examples — as few as two to five — rather than thousands of labeled training examples. Large language models do this via in-context learning: examples placed directly in the prompt let the model infer the pattern without retraining.

The Full Picture

Traditional machine learning needed large labeled datasets for every new task — expensive and slow to assemble. Few-shot learning matters because it removes that bottleneck: a model that has already learned broad patterns from massive general training can often generalize to a narrow, unfamiliar task from just a few demonstrations, without anyone building a dedicated dataset or retraining anything.

With modern large language models, few-shot learning usually happens "in context" — the examples are placed directly in the prompt alongside the actual task, and the model uses its existing, frozen knowledge to infer the pattern and apply it to the new input. This differs from fine-tuning, which updates the model's weights; few-shot prompting changes nothing about the model itself, only what it's shown at the moment of use.

A team wants a model to classify RFI submissions by urgency. Instead of labeling thousands of past RFIs to train a classifier, they show the model three or four labeled examples in the prompt, and it applies the same logic to new RFIs reasonably well.

Few-shot learning works best for pattern-matching and classification-style tasks; it's less reliable for tasks requiring precise, exhaustive extraction, like counting every instance of something in a document, where the model may still miss items the examples didn't cover.

Real Examples

→Document classification: Shown three example emails labeled "urgent RFI" vs. "routine RFI," a model classifies new incoming RFIs the same way without any retraining.
→Format matching: Given two examples of how to reformat unit costs into a standard table, a model applies the same formatting to new data without further instruction.
→Style transfer: Shown a few examples of a company's preferred tone in client emails, a model drafts new correspondence that matches that tone.

Common Misconceptions

People assume: Few-shot learning means the model is being trained on those examples.

Actually: In the common large-language-model sense, the model's weights don't change at all — the examples just sit in the prompt as context for that one interaction. It's closer to giving instructions with samples attached than to training.

People assume: More examples in the prompt always improve results.

Actually: Beyond a handful of well-chosen, representative examples, adding more tends to have diminishing returns and can even confuse the model if the examples are inconsistent or too similar to each other. Quality and diversity of examples matter more than quantity.

Frequently Asked Questions

What is few-shot learning in AI?

It's a model's ability to perform a new task correctly after seeing only a small number of examples — often demonstrated directly in the prompt for large language models — instead of needing a large labeled training set.

How is few-shot learning different from fine-tuning?

Few-shot learning shows examples at the moment of use without changing the model; fine-tuning retrains the model's weights on a dataset so the adaptation persists across every future use, not just the current prompt.

What's the difference between few-shot and zero-shot learning?

Few-shot provides a handful of worked examples in the prompt; zero-shot provides none, relying entirely on the model's general training to infer what's being asked. Few-shot is generally more reliable on ambiguous or format-sensitive tasks.

How many examples does few-shot learning need?

Often as few as two to five well-chosen, representative examples. The gain comes from clarity and diversity of the examples, not from providing a large number of them.

Related Terms

More AI Concepts & Fundamentals Terms

Sources

  1. Brown et al. — Language Models are Few-Shot Learners (arXiv)
  2. NIST — AI Risk Management Framework
MELTPLAN