Learn

Few-shot: steering a model with a handful of examples

Few-shot is the practice of including a small number of worked examples directly in the prompt, so the model infers the pattern you want and follows it. It steers behaviour through examples in the input, not through any change to the model.

At a glance

What it is
Giving the model a few examples in the prompt to copy the pattern
What it changes
The prompt, not the model's weights
Opposite of
Zero-shot, where you give no examples at all
The cost
The examples take up room in the context window
Stack

What a few-shot prompt holds

A couple of worked examples sit ahead of the real request, so the model has a pattern to copy before it answers. The examples are part of the input, so they spend context too.

4
Your real request the model answers in the same shape
3
Example two, with its answer confirms the pattern
2
Example one, with its answer shows the format and tone
1
Instruction what you want done

What does few-shot mean?

Few-shot means you put a small number of worked examples inside the prompt, each showing an input and the answer you would want for it, and then add your real request. The model reads the examples, picks up the pattern, and answers your request in the same shape. You taught it nothing permanent. The lesson lives entirely in the prompt and is gone the moment that prompt ends.

It is the middle ground between describing a task and demonstrating it. Some formats are awkward to spell out in words but obvious to show, and that is exactly where a couple of examples earn their place. Show the model two answers in the layout you want, and the third tends to match.

When are the examples worth their room?

Examples are not free. They sit in the context window alongside your real request, so they spend the same budget the model needs for the input and its answer. If a plain instruction already gets the result, the examples are dead weight, and zero-shot, no examples at all, is the cleaner choice.

There is a sharper catch: the model copies what you show it, flaws included. A sloppy example teaches sloppy output. So the examples have to be the standard you actually want, because few-shot does not just suggest a pattern, it makes the model imitate the one you gave.

Few-shot helps when

  • You need a specific output format the model keeps missing
  • The task is easier to show than to describe in words
  • Tone or style matters and an example anchors it fast

Few-shot is wasteful when

  • The model already nails it from a plain instruction, so examples just cost context
  • Your examples are sloppy; the model copies their flaws too
  • The examples crowd out the room a long input or answer needs

Related terms

← All terms Reviewed: June 2026