Back to full roadmap
topicfoundation
Few-shot Prompting
Show 2-5 examples so the model picks up the format / style / classification rule.
3 hours2 resources1 prereqs
When the task is complex or output format is critical, examples act like a "cookbook". Typical count: 3-5. Too many = overload, too few = misleading.
Best practice:
- Cover diverse cases (include edge cases)
- Order matters — put the strongest example last (recency bias)
- "Wrong → right" pairs are pedagogical
- Wrap with XML tags for readability