Few-Shot Prompting Techniques
CoreApply few-shot prompting to improve output consistency and quality · Difficulty 2/5
Few-Shot Prompting provides concrete examples of desired input-output behavior to guide the model. It is the most effective technique when instructions alone produce inconsistent output.
When to Use Few-Shot Examples
Best Practices
Generalization, Not Matching
Few-shot examples enable the model to generalize judgment to novel patterns. They teach the decision-making approach, not just a lookup table of pre-specified cases. This is why showing reasoning in examples is critical.
Reducing Hallucination in Extraction
For extraction tasks with varied document structures, few-shot examples showing correct handling of informal measurements, missing fields, and varied formats significantly reduce fabricated data.
Key Takeaways
- ✓Few-shot examples are more reliable than instructions for consistent formatting
- ✓Target examples at ambiguous cases, not obvious ones
- ✓Include reasoning in examples so the model generalizes judgment, not just pattern-matches
- ✓2-4 well-chosen examples outperform 10+ unfocused ones
Related Concepts
Test Yourself1 of 3
Your agent achieves 55% first-contact resolution, well below the 80% target. Logs show it escalates straightforward cases (standard damage replacements with photo evidence) while attempting to autonomously handle complex situations requiring policy exceptions. What's the most effective way to improve escalation calibration?