Few-Shot vs Zero-Shot vs One-Shot
| Type | Examples | Best For |
|---|---|---|
| Zero-Shot | 0 | Simple, well-known tasks |
| One-Shot | 1 | Basic format guidance |
| Few-Shot | 2-5 | Complex patterns, styles, edge cases |
Few-shot shines when outputs need specific structure (JSON, rhymes, sentiment with reasoning) or when zero-shot fails on domain-specific logic.
Real-World Few-Shot Examples
Sentiment Analysis
JSON Extraction
Product Categorization
Best Practices for Few-Shot Success
- β
2-5 examples max
More risks context overflow; fewer loses pattern clarity.
- β
Diverse examples
Cover edge cases, variations, common errors.
- β
Consistent formatting
Same delimiters, structure, output style across examples.
- β
Quality over quantity
Realistic, correct examples beat generic ones.