Use zero-shot when the task is simple, the output format is loose, or you have no representative examples; use few-shot (2-5 examples) when output format must be exact, edge cases are common, or a model keeps drifting from your intended structure. The deciding factors are task complexity, format strictness, and example availability — not preference.
Quick Answer: Add examples when format precision matters more than token cost and you have 2-5 genuinely representative cases. Skip them when the task is open-ended, examples would overfit to one template, or you don't have real labeled data yet.
Most prompt-design advice treats few-shot prompting as a free upgrade — "just add examples, it can't hurt." That's wrong twice over. Examples cost real tokens on every call, and they teach the model more than you intend: format, yes, but also incidental patterns like length, phrasing, and edge-case handling that don't generalize. Treating the choice as a design tradeoff, not a default, is the difference between a prompt that generalizes and one that memorizes your three sample cases.
This framework builds on the fundamentals in our complete guide to prompt design and assumes you already have a working system prompt — see why your system prompt is the new PRD if you haven't formalized one yet.
What Few-Shot Examples Actually Do to a Prompt
Few-shot examples work by demonstration rather than description: instead of telling the model "output valid JSON with these five fields," you show it two or three finished instances and let it infer the pattern. This is measurably more reliable for format compliance than instruction alone.
The mechanism traces back to Brown et al.'s 2020 GPT-3 paper ("Language Models are Few-Shot Learners"), which showed that in-context examples shift model behavior toward a demonstrated distribution without any weight updates. The model isn't "understanding" your format rule — it's pattern-matching against the closest examples in its context window.
That pattern-matching is exactly why examples are double-edged:
- What they teach well: exact output shape, field naming, delimiter conventions, tone, and how to handle a specific edge case you've shown.
- What they teach by accident: the length of your examples, the specific phrasing you used, assumptions baked into your sample data that don't hold for the full input distribution.
- What they cost: every example is tokens spent on every single call — not a one-time setup cost. At scale, that's a real, recurring line item.
A useful mental model: zero-shot asks the model to follow a rule; few-shot asks it to follow a pattern. Rules generalize better to novel inputs; patterns generalize better to a repeated structure. Pick based on which one your task actually needs.
The Three-Factor Decision Tree
Deciding between zero-shot and few-shot comes down to three questions: how complex is the task, how strict is the output format, and how many representative labeled examples do you actually have. Answer those three and the choice is usually obvious rather than a guess.
Factor 1: Task Complexity
Simple, well-bounded tasks (classify sentiment, extract a single named field, summarize in one sentence) rarely need examples — a clear instruction plus one constraint sentence usually gets you there. Complex, multi-step, or judgment-heavy tasks (triage a support ticket into one of twelve categories with nuanced boundaries, extract structured data from messy free text, apply a scoring rubric) benefit from examples because they show the model where the boundaries are, not just what the categories are named.
Factor 2: Output-Format Strictness
This is the factor most PMs underweight. If your downstream system parses the output programmatically — feeding a database, an API call, or a UI component — format drift isn't cosmetic, it's a broken pipeline. Our piece on shipping structured outputs as reliable JSON covers schema enforcement in depth, but the short version: the stricter the format contract, the more few-shot examples pay for themselves, because they anchor the model to an exact shape instruction alone often can't pin down.
Factor 3: Available Labeled Examples
Few-shot only helps if your examples are genuinely representative of the input distribution you'll see in production. Three examples pulled from the easiest 10% of your cases will actively mislead the model on the harder 90%. If you don't yet have labeled examples that span your real edge cases, zero-shot with a clearer instruction is the more honest starting point — bad examples are worse than no examples.
| Factor | Favors Zero-Shot | Favors Few-Shot |
|---|---|---|
| Task complexity | Simple, single-step, well-known task type | Multi-step, judgment-heavy, or has non-obvious edge cases |
| Format strictness | Loose prose, human-read output | Strict schema, parsed downstream, feeds another system |
| Labeled examples available | None, or examples aren't representative | 2-5 representative examples covering real edge cases |
| Token budget | Tight, high call volume | Cost of drift exceeds token cost of examples |
| Edge-case density | Low — inputs are fairly homogeneous | High — inputs vary widely and format needs to hold anyway |
Run your task through all five rows before deciding. A task that's simple but feeds a strict downstream schema (row 2 says few-shot) still might not need examples if the schema is simple enough for instruction alone — the rows interact, they don't just add up.
Case One: Two Examples Fixed Format Drift
A recurring, concrete failure mode: a zero-shot prompt asked a model to extract action items from meeting notes into a fixed JSON shape (owner, task, due_date, priority). Instructions alone specified the schema clearly. In practice, the model would periodically nest fields differently, use assignee instead of owner, or emit due_date: "next Tuesday" instead of a normalized date — all technically reasonable interpretations of ambiguous instructions, all breaking the downstream parser.
Adding just two examples — one with a clean single action item, one with an ambiguous relative date ("by end of week") resolved to a normalized date — collapsed the drift almost entirely. The examples didn't add new information the instructions lacked; they resolved the ambiguity the instructions couldn't fully specify in prose. That's the signature case for few-shot: instructions can describe a rule, but examples resolve exactly how the rule applies at the boundary.
What made these two examples effective, specifically:
- They covered the two failure modes actually observed, not hypothetical ones — pick examples from real drift, not imagined edge cases.
- They stayed minimal — two examples, not ten, keeping the token cost proportional to the problem.
- They varied on the dimension that mattered (date ambiguity) while holding the schema constant, so the model couldn't confuse "this schema" with "this specific date phrasing."
Case Two: Examples That Caused Overfitting to a Template
The failure runs the other way just as often. A team building a customer-feedback summarizer added three few-shot examples, all drawn from product-related feedback with a similar three-paragraph structure: context, sentiment, suggested action. The model performed well on product feedback — and then started forcing every input into that same three-paragraph shape, including billing complaints and one-line praise that had no "suggested action" to extract.
The examples had taught a template, not a task. Because all three shared structure, length, and topic, the model over-indexed on the surface pattern rather than the underlying instruction to "summarize what matters in this feedback." Removing the examples and tightening the instruction — with an explicit note that output length and structure should match input complexity — outperformed the few-shot version on the full input distribution, even though it looked worse on the three curated examples used to build it.
The tell for this failure mode: your few-shot examples all share length, tone, or structure by coincidence of how you sourced them, not because the task genuinely calls for that uniformity.
How to Choose Examples That Don't Overfit
Bad example sets share one root cause: they were convenient to write, not representative to select. A better process:
- Sample from real production inputs, not hand-written hypotheticals — hand-written examples tend to be cleaner and more uniform than reality.
- Deliberately vary length and structure across your examples if the task's real inputs vary that way — uniform examples teach uniformity even when you didn't mean to.
- Include at least one edge case, not just the median case — the "easy" examples are the ones the model least needs help with.
- Cap at 3-5 examples for most tasks; beyond that, marginal format gains rarely justify the added token cost, and the risk of accidental templating rises.
Measuring the Tradeoff Instead of Guessing
You don't have to choose blind. The only reliable way to know whether few-shot examples help your task is to run both variants against the same held-out test cases and compare failure modes side by side — format compliance, factual accuracy, and whether outputs are collapsing toward your examples' template. This is also where prompt versioning discipline pays off: treat each variant as a numbered version you can roll back to, following the practice in version prompts like code, test like features.
A Lightweight Test-Case Set Is Enough to Start
You don't need hundreds of cases to get signal. Ten to fifteen well-chosen test cases — spanning your typical input, your known edge cases, and at least one adversarial or malformed input — will usually surface format drift or overfitting within the first pass. If you're building this test set from scratch, the same rigor used in mapping customer jobs to be done applies: know what job the output is actually supposed to do for the person or system consuming it before you decide what "correct" looks like.
When the Answer Is "Neither, Yet"
Sometimes the honest answer is that you don't have enough signal to choose either confidently. If you're at the very early stage of defining the task — before you've mapped how the output fits into the surrounding customer journey or workflow — spending time optimizing few-shot examples is premature. Get the instruction right first, ship zero-shot, and let real usage generate the labeled examples that would make few-shot worth adding later.
A rough maturity signal: if you can't yet describe three concrete edge cases your prompt needs to handle, you don't have enough understanding of the task to pick good examples — few-shot added at this stage is more likely to overfit to whatever you happen to have on hand than to genuinely help.
Key Takeaways
- Zero-shot is the default for simple, loosely-formatted tasks with no representative labeled examples on hand yet.
- Few-shot earns its token cost when output format is strict and parsed downstream, where drift breaks a pipeline rather than just reading oddly.
- Two well-chosen examples can fix real format drift — the fix works because examples resolve ambiguity instructions can't fully specify in prose, not because more examples are inherently better.
- Uniform-looking examples teach a template, not a task — vary length, structure, and edge cases deliberately or the model will overfit to incidental patterns.
- Cap most few-shot sets at 3-5 examples; beyond that, added token cost rarely buys proportional format gains.
- Test both variants against the same held-out cases rather than deciding from intuition — that's the only way to see overfitting or drift before it ships.
- If you can't name three edge cases your prompt must handle, you're not ready to pick good examples yet — fix the instruction first.
Frequently Asked Questions
Is few-shot prompting always better than zero-shot?
No. Few-shot only outperforms zero-shot when the task has real format strictness or edge-case complexity that instructions alone can't resolve, and when your examples are genuinely representative. Poorly chosen examples can make output worse than a clear zero-shot instruction.
How many examples should I use in a few-shot prompt?
Most tasks need only 2-5 examples; this range comes from balancing token cost against diminishing format-compliance gains, a pattern also discussed in Brown et al.'s original few-shot learning research. Beyond five, you're usually paying tokens for gains you could get with a tighter instruction instead.
Can few-shot examples make a prompt worse?
Yes — this is the overfitting failure mode. If your examples share incidental structure (similar length, tone, or template) rather than covering genuine task variation, the model learns to reproduce that structure even on inputs where it doesn't fit.
How do I know if my examples are causing overfitting?
Watch for outputs collapsing toward your examples' shape regardless of input — a short input producing a long, template-matching answer, or a category-mismatched input still being forced into your examples' structure. Testing zero-shot and few-shot variants against the same held-out cases, as in Prodinja's Evals tool, is the most reliable way to catch this before it ships.
Does few-shot prompting cost more than zero-shot?
Yes, directly — every example's tokens are sent on every single API call, not just once during setup. For high-volume workflows, that recurring per-call cost is a real factor to weigh against the format-reliability gains, not an afterthought.