← Master Index
Vol. 13 Module 13.1 Lecture

One Shot

Prompting Techniques

How This Lesson Fits the Module & Volume

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.
Definition

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.

NeedPrefer
Common task, clear labelsZero-shot first
One tricky format or toneOne-shot
Multiple classes / edge casesFew-shot
Multi-step reasoningCoT (+ optional demos)

One-Shot Pattern

Rewrite each product blurb as a 12-word max tagline in Title Case. Return only the tagline. Example Input: Our battery lasts all day and charges in under an hour for travelers. Output: All-Day Battery, Hour-Fast Charge For Travelers Now rewrite: Input: {{NEW_BLURB}} Output:

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

Label sentiment as positive | negative | mixed | neutral. Reply with the label only. Example Text: The UI is gorgeous but checkout crashed twice. Label: mixed Text: {{TEXT}} Label:

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.
Common Misconception

“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

  1. Short Answer: How many demonstrations does one-shot use? Answer: Exactly one.
  2. True/False: One-shot always beats carefully written zero-shot. Answer: False.
  3. Multiple Choice: One-shot is especially useful to teach: (a) CUDA kernels, (b) output format/style, (c) GPU drivers. Answer: (b).
  4. Short Answer: What makes a good demonstration? Answer: Typical of the task, correct schema, clear pattern a human could continue.
  5. True/False: Putting the test answer inside the demo is acceptable. Answer: False—that is leakage.
  6. Multiple Choice: If you have five subtle classes, prefer: (a) one-shot only, (b) few-shot covering classes, (c) empty prompt. Answer: (b).
  7. Short Answer: Name a risk of one-shot. Answer: Over-copying the demo’s quirks / under-covering edge cases.
  8. True/False: One-shot still includes a task instruction in most production prompts. Answer: True.
  9. Multiple Choice: Compared with few-shot, one-shot usually: (a) uses fewer tokens, (b) always higher accuracy, (c) needs gradient descent. Answer: (a).
  10. 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.
Trainer’s Guide

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.