conceptContext Engineering~1 min readUpdated 2026-06-07#prompt-engineering#few-shot#in-context-learning

Zero-shot & few-shot

The cheapest way to specify a task is to describe it (zero-shot); the next is to show it with examples (few-shot), exploiting the model's in-context learning. Knowing which to reach for saves tokens and improves reliability.

Zero-shot: just ask

A clear instruction with no examples. Modern instruct models are strong zero-shot for common tasks. Start here — it's the cheapest and often enough.

Few-shot: show the pattern

Include a handful of input → output demonstrations. Use it when:

  • The task is easier to show than to describe (a specific format, a nuanced labeling rule, a tone).
  • You need output consistency — examples pin down the exact shape.
  • Zero-shot is close but unreliable on edge cases.

Doing few-shot well

  • Match the distribution — examples should resemble real inputs, including tricky cases; the model imitates what it sees.
  • Be consistent — identical format across examples; the format is the instruction.
  • Cover the classes — for classification, include each label (and watch ordering; models can pick up position bias).
  • 2–5 is usually enough — more costs tokens and context for diminishing returns; for many tasks one good example beats three mediocre ones.

Pitfall

Few-shot examples can over-anchor the model to their surface form (it copies a quirk you didn't intend). And they consume context budget on every call — for high-volume tasks, consider whether fine-tuning beats permanent few-shot.

Connects to: in-context learning · chain-of-thought · few-shot vs fine-tune