Examples: Zero-, One-, and Few-Shot
Use demonstrations to steer behavior, balancing exemplar quality, order effects, and when to skip examples entirely.
Content
When to Use Zero-Shot
Versions:
Watch & Learn
AI-discovered learning video
Sign in to watch the learning video for this topic.
When to Use Zero-Shot — The Lazy Genius of Prompting
"Zero-shot is not doing nothing — it's doing the most with the least." — Your slightly smug TA
You're coming off the "Supplying Context and Grounding" lecture, so you already know how to feed the model the right facts at the right time (delimiters, source pinning, avoid context leakage, session memory strategies). Good. Now let's decide: when do you hand the model nothing but the task description (zero-shot), versus feeding it examples (one-shot/few-shot)? This guide helps you pick the right moment to be delightfully minimal.
TL;DR (the bit for skimming like a pro)
- Use zero-shot when the task is well-specified, generic, or when examples could hurt (bias, context leakage, stale data).
- Avoid zero-shot for highly idiosyncratic tasks, new formats, or when you need consistent structure — then prefer few-shot.
- Zero-shot is fast, lightweight, and memory-friendly. It's also more brittle on edge cases.
What's zero-shot, again? (Flash refresher)
Zero-shot prompting means: you give the model a description of what to do and no exemplar inputs/outputs. No demo, no priming with examples. Just the prompt and expectations.
Contrast quick table:
| Mode | What you give the model | Best for |
|---|---|---|
| Zero-shot | Task description only | Generic tasks, speed, privacy |
| One-shot | Task + 1 example | Slightly custom style or format |
| Few-shot | Task + several examples | Complex formatting, strict outputs |
When zero-shot is your friend (use cases + why)
1) Quick experiments & exploratory prompts
You're prototyping. You want to know if the model even understands the task. Zero-shot gives answers fast without you committing to a few-shot setup.
- Use case: "Summarize this article in three sentences." — run zero-shot to see capability.
2) Generic, well-known tasks
Tasks like translation, summarization, sentiment analysis, or writing grammar fixes are often in-model knowledge already. The model has seen tons of examples during training; you probably don't need to teach it.
- Use case: Translating English to Spanish, or turning passive voice into active.
3) When examples can introduce bias or leak sensitive data
Remember "Preventing Context Leakage"? If your examples contain private info or create unwanted style bias, zero-shot avoids that.
- Use case: You have confidential data formats — don't paste examples that reveal structure to attackers or leak tokens across sessions.
4) Memory-limited environments or low-latency systems
Few-shot eats up tokens and memory. If you have tight token budgets (API cost, latency, or device memory), zero-shot is a lean, cheap alternative.
5) When you want the model to be creative or generalize
Examples can anchor the model. If you want it to surprise you, innovate, or generalize beyond your sample, give it space.
- Use case: Prompting for brainstorming ideas or multiple approaches to a problem.
6) When model behavior is robust for the task
If you know the model performs well zero-shot for a particular task (through testing), use it. Don’t invent extra work.
When zero-shot is the wrong move (and why)
- You need precise output format (CSV, JSON schema) — few-shot or structured instructions + pinned templates help.
- The task is highly domain-specific or uses unusual conventions (medical coding, legal citations).
- You observe inconsistent or hallucinated outputs — examples can stabilize behavior.
Ask yourself: "Does the model already understand this without teaching?" If not, don't go zero-shot.
Decision flow: a tiny prompt-engineering flowchart (but textual, because drama)
- Is the task standard (translate, summarize, fix grammar)? → Try zero-shot.
- Does it need strict formatting or exact tokens? → Use few-shot with examples + template.
- Is privacy or context leakage a concern with examples? → Prefer zero-shot or use sanitized examples.
- Budget/latency constraints? → Lean zero-shot, test for quality.
- Still getting flaky results? → Add 1–3 examples (one-shot → few-shot) and use the grounding tricks we covered earlier.
Mini examples — what zero-shot looks like in practice
Zero-shot prompt for summarization:
Task: Summarize the following article in three clear bullet points focusing on outcomes and recommendations.
[ARTICLE]
Output: Bullet list, max 3 items.
One-shot vs few-shot contrast (why you'd switch):
- Zero-shot might produce varied bullet counts or miss "recommendations".
- Add one example showing desired bullet phrasing → one-shot stabilizes style.
- Add 3 examples with edge cases (long, technical, vague) → few-shot yields consistent shape.
Practical tie-ins to "Supplying Context and Grounding"
When you choose zero-shot, you're choosing minimal grounding. That's fine — but still: be explicit about formats and constraints in the instruction. Use delimiters to isolate the task description and the input to avoid context leakage.
If your session memory is tracking user preferences (tone, formality), you might not need examples — you can rely on a pinned preference instead. This reduces token use and avoids repeating examples that go stale.
If you fear stale context, zero-shot is a good periodic reset: issue a fresh task prompt without relying on previous session memory that might be outdated.
Quick cheatsheet (copy-paste in your brain)
- Try zero-shot first for common tasks.
- If output is inconsistent, add a single example (one-shot).
- If you need strict structure or edge-case handling, go few-shot + templates.
- If privacy/budget/latency matters, prefer zero-shot + crisp instructions.
Closing: The power move
Use zero-shot like a scalpel, not a hammer. It's elegant when the problem is already in the model's wheelhouse — but it won't replace careful priming when you need precision.
Key takeaways:
- Zero-shot = fast, cheap, minimally anchored. Great for generic and exploratory tasks.
- Examples aren't always helpful. They can bias outputs, leak info, or waste tokens.
- Test iteratively. Start zero-shot, then escalate to one-shot/few-shot if the model stumbles.
Now go forth: try a zero-shot prompt, see what comes back, and then either crown it or teach it a single example like the wise, efficient prompt engineer you are.
Version note: This builds on our grounding strategies. Remember to use delimiters and source pinning when you do include context — and keep an eye on session memory so your zero-shot experiments don't accidentally inherit someone else's weird preferences.
Comments (0)
Please sign in to leave a comment.
No comments yet. Be the first to comment!