Home › Prompt Engineering › Key term › Few-shot
Key term · Ground

Few-shot

Teaching a model by example instead of by instruction.

In one line

Few-shot prompting shows the model examples of the task so it copies the pattern.

DefinitionWhat it means

Few-shot prompting places a handful of worked examples, input paired with desired output, directly inside the prompt before the real query. The model conditions on those pairs and extends the pattern to the new input, without any weight updates. Zero-shot gives no examples; one-shot gives one; few-shot typically means two to eight, chosen to fit the context window and cover edge cases.

Why it mattersWhy you should care

Few-shot examples are often the fastest lever for fixing output format or tone before reaching for fine-tuning, and they are cheap to iterate on since changing them is just editing text, not retraining. Product teams use them to steer a shared foundation model toward house style, domain vocabulary, or a specific labeling scheme, and teams expect engineers to know when a few good examples beat a longer instruction.

At a glanceSee it

Few-shot diagram
Few-shot diagram 1

What the examples actually teach is the output format, the set of valid labels, and the input style — which is why even shuffled or partly-wrong labels often preserve much of the accuracy.

Few-shot diagram 2

Production few-shot is dynamic — it retrieves examples similar to each new input, balances the label mix, and orders them before assembling the prompt, rather than reusing one fixed hand-picked set.

Where you see itIn the wild

  • Prompt templates in an LLM app that embed two or three labeled examples above the user question.
  • Classification or extraction tasks where a schema is hard to describe in words alone.
  • Evaluation harnesses that compare zero-shot versus few-shot accuracy on a benchmark.
A living map of modern AI — kept current every morning