Zero-shot uses instructions alone. One-shot adds a single worked example so the model can imitate format, tone, or a decision boundary that is hard to describe in words.
One-shot sits between zero-shot and few-shot: enough to show the pattern, cheap enough to keep prompts short. Use it when one crystal-clear demo unlocks compliance that paragraphs of rules failed to achieve.
Learning Objectives
By the end of this lesson, students should be able to:
- Define one-shot prompting and explain what the single example is meant to teach.
- Choose a demonstration that matches the true task distribution (not a toy edge case).
- Format input–output pairs so the model can continue the pattern on a new input.
- Compare one-shot vs zero-shot on format adherence and accuracy.
- Recognize when one example under-covers the label space and few-shot is needed.
- Avoid leaking the test answer or biased cues inside the demonstration.
One-shot prompting includes exactly one input–output demonstration in the prompt, then asks the model to produce the corresponding output for a new input, typically under the same instructions.
Why One Example Helps
Instructions describe intent; examples demonstrate instantiation. A single demo often fixes JSON shape, heading style, abbreviation policy, or how to handle empty fields—details that are tedious to encode as rules.
| Need | Prefer |
|---|---|
| Common task, clear labels | Zero-shot first |
| One tricky format or tone | One-shot |
| Multiple classes / edge cases | Few-shot |
| Multi-step reasoning | CoT (+ optional demos) |
One-Shot Pattern
Picking the Demonstration
Good demo
- Typical length and difficulty.
- Shows the exact output schema.
- Uses the same label vocabulary.
Bad demo
- Extreme outlier the model overfits.
- Wrong format relative to the ask.
- Contains the test instance’s answer.
Check
- Would a human infer the rule?
- Does zero-shot already pass?
- Is the demo shorter than many rules?
Classification One-Shot
Strengths and Tradeoffs
Strengths
- Strong format anchoring at low cost.
- Easy for reviewers to audit one example.
- Often enough for style transfer tasks.
Tradeoffs
- One demo cannot cover many classes.
- Model may over-copy idiosyncratic phrasing.
- Still may need few-shot for boundaries.
“Any example is fine.” A mismatched demo teaches the wrong pattern. If your production inputs are short, angry tickets, do not demonstrate on a long polished essay—the model will imitate the wrong register.
Knowledge Check
- Short Answer: How many demonstrations does one-shot use? Answer: Exactly one.
- True/False: One-shot always beats carefully written zero-shot. Answer: False.
- Multiple Choice: One-shot is especially useful to teach: (a) CUDA kernels, (b) output format/style, (c) GPU drivers. Answer: (b).
- Short Answer: What makes a good demonstration? Answer: Typical of the task, correct schema, clear pattern a human could continue.
- True/False: Putting the test answer inside the demo is acceptable. Answer: False—that is leakage.
- Multiple Choice: If you have five subtle classes, prefer: (a) one-shot only, (b) few-shot covering classes, (c) empty prompt. Answer: (b).
- Short Answer: Name a risk of one-shot. Answer: Over-copying the demo’s quirks / under-covering edge cases.
- True/False: One-shot still includes a task instruction in most production prompts. Answer: True.
- Multiple Choice: Compared with few-shot, one-shot usually: (a) uses fewer tokens, (b) always higher accuracy, (c) needs gradient descent. Answer: (a).
- Short Answer: When should you stay on zero-shot? Answer: When format and accuracy already meet the bar without demos.
Key Takeaways
- One-shot adds a single worked example to anchor format and behavior.
- Demo quality matters more than demo count at n = 1.
- Escalate to few-shot when one example cannot cover the decision space.
- Next: Few Shot.
Hands-on idea: Same task, three demos of different quality (outlier, typical, wrong format). Show how one-shot quality tracks demo quality.
Discussion prompt: Would you rather spend tokens on a better instruction or a better single example?
Recap: One-shot teaches by imitation with a single demonstration. Continue with Few Shot.