01 — Types
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.
03 — Examples
Real-World Few-Shot Examples
Sentiment Analysis
Classify sentiment as positive, negative, or neutral:
Text: "This is awesome!" → Positive
Text: "This is bad!" → Negative
Text: "The movie was okay." → Neutral
Text: "Wow that was rad!" → Positive
Text: "Service was adequate." → ?
Expected Output: Neutral
JSON Extraction
Extract entities as JSON:
"Tim Cook leads Apple" → {"person": "Tim Cook", "company": "Apple"}
"Elon Musk tweets about Tesla" → {"person": "Elon Musk", "company": "Tesla", "action": "tweets"}
"Article mentions Google CEO" → ?
Product Categorization
Classify product type:
"iPhone 15 Pro" → Electronics → Smartphone
"Nike Air Max shoes" → Apparel → Footwear
"USB-C cable 2m" → ?
Expected: Electronics → Accessories
04 — Best
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.
FAQ