Few-Shot Prompting
Definition
Multishot (few-shot) prompting supplies concrete input-output examples to steer Claude's output format, tone, and structure — "one of the most reliable ways to steer Claude's output."
Key points
- Include 3–5 examples for best results.
- Make examples Relevant (mirror the real use case), Diverse (cover edge cases; vary enough that Claude doesn't latch onto unintended patterns), and Structured (wrap in
<example>tags, multiple in<examples>). - Few-shot works with thinking: put
<thinking>tags inside the examples to demonstrate the reasoning pattern. - Fix inconsistent output with examples, not prose: "inconsistent output → add 3–4 few-shot examples, NOT more prose." Do not rely on temperature 0 alone for format normalization.
- Format-normalization pattern (Architect's Playbook): provide 2–3 complete input-output examples with the standardized format (e.g. "cotton blend" / "Cotton/Polyester mix" →
"Cotton Blend"). - You can ask Claude to evaluate your examples for relevance/diversity or generate more from a seed set.
Why it matters for the exam
- The "inconsistent output → few-shot examples not more prose" rule is a classic D4 distractor-killer.
- Few-shot is the Playbook's mitigation for the Accuracy constraint (Structured Intermediates & Few-Shot Prompts).
Common gotchas
- "Add more instructions / more prose" is the wrong fix for inconsistent formatting — add examples.
- Too-similar examples cause Claude to overfit an unintended pattern; diversity matters.
See also
Sources
Referenced by
Practice questions optional · AI
Generate fresh practice questions about this concept with AI. These are not vault-verified.