Few-shot vs Zero-shot
A comparison of In-Context Learning prompting strategies: instructing an LLM with no examples (Zero-shot) versus supplying a few input–output demonstrations (Few-shot) without updating weights
Table of Contents
Structure Diagram
0 examples · Direct instruction only
- Token CostLowest (short, fast prompts)
- Best ForSummarization, translation, reasoning models
- LimitationAmbiguous edge cases & custom formats
2–5 demos · Shows exact pattern & edge cases
- Token CostModerate (offset with Prompt Caching)
- Best ForDomain classification, edge cases, exact style
- CaveatWatch class balance & example bias
What is Few-shot vs Zero-shot?
A comparison of In-Context Learning prompting strategies: instructing an LLM with no examples (Zero-shot) versus supplying a few input–output demonstrations (Few-shot) without updating weights. It is a core concept in Training & Tuning within AI / ML.
Core Principles
In-Context Learning (ICL) lets an LLM adapt to tasks purely through prompt examples without changing weights. Zero-shot relies solely on task instructions, whereas Few-shot supplies 2–5 (input → expected output) demonstrations so the model mirrors the exact schema, tone, and decision boundary.
Practical Takeaways
- Benchmark Zero-shot first, then add targeted edge-case demos: Start minimal and only add 3–5 examples that specifically clarify recurring ambiguities.
- Use Dynamic Few-shot Retrieval: When you have a large library of examples, retrieve the top-3 semantically closest examples per query via embeddings instead of stuffing fixed examples.
- Beware over-prompting reasoning models: Dedicated reasoning models often perform better with crisp Zero-shot specs and constraints than rigid Few-shot templates.
Notable Examples
- Nuanced Ticket Classification: Supplies 4 balanced examples covering sarcastic and borderline tickets to stabilize labels.
- Text-to-SQL: Dynamically injects 3 similar verified SQL examples matching the user's question.
- Brand Voice Copywriting: Mirrors tone and cadence from 3 curated brand samples without fine-tuning.