technique

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.

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.

When to use few-shot prompting

Common mistakes

FAQ

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 I 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 most 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.