Few-shot prompting
Few-shot prompting supplies 2–10 input–output examples inside the prompt so the model imitates the pattern on a new input.
In more detail
What it means
Few-shot prompting (a form of in-context learning) gives the model a handful of demonstrations directly inside the prompt. It is the highest-leverage technique for steering tone, format, and edge-case handling without fine-tuning. Effective few-shot prompts use examples that mirror the real input distribution, cover failure modes, and follow a consistent format. The number of shots that helps plateaus quickly — for most tasks 3–5 well-chosen examples beat 20 mediocre ones. Newer long-context models also support "many-shot" prompts (hundreds of examples) which approach fine-tuning quality for narrow tasks.
Part 1 of 2
When to use it, and when not
Use it for
- Strict output format (JSON, CSV, custom DSL).
- Domain-specific tone (legal, medical, brand voice).
- Edge cases that zero-shot keeps getting wrong.
Part 2 of 2
Common mistakes
- Using examples that don't match the real input distribution.
- Inconsistent formatting across examples — the model copies the inconsistency.
- Padding with redundant easy examples instead of edge cases.
FAQ
Questions readers ask.
What is few-shot prompting?
Few-shot prompting supplies 2–10 input–output examples inside the prompt so the model imitates the pattern on a new input.
When should you use few-shot prompting?
Strict output format (JSON, CSV, custom DSL). Domain-specific tone (legal, medical, brand voice). Edge cases that zero-shot keeps getting wrong.
What are the common mistakes with few-shot prompting?
Using examples that don't match the real input distribution. Inconsistent formatting across examples — the model copies the inconsistency. Padding with redundant easy examples instead of edge cases.
Last updated: 2026-06-01. Raw markdown: https://promtable.com/glossary/few-shot-prompting.md. Found a mistake? Tell us.