One-Shot Prompting
If zero-shot is "just ask," one-shot is "just ask — and show one example." One-shot prompting gives the model exactly one demonstration of the task before the real input. That single example is often enough to lock in the format, style, or pattern you want, without the length of a full few-shot prompt.
💡 In one line: One-shot prompting includes a single example before the task, showing the model exactly what a good answer looks like.
What is One-Shot Prompting?
You provide an instruction, one example (an input paired with its ideal output), and then the real input. The example acts as a template the model imitates. It sits between zero-shot (no examples) and few-shot (several).
Why It Helps
A single example removes ambiguity. Instead of guessing your desired format, the model sees it once and copies it — the label style, the length, the structure. This often fixes the inconsistency you'd get from zero-shot, at a minimal token cost.
When to Use One-Shot
- Zero-shot almost works, but the format is inconsistent.
- One clear example is enough to convey the pattern.
- You want to keep the prompt short (only one example).
- The task has a simple, consistent structure.
Limitations
- One example may not be enough for varied or tricky inputs.
- It can bias the model toward that single example's pattern.
- Edge cases often need several examples (few-shot).
Example
Classify the sentiment as POSITIVE or NEGATIVE.
Text: "The food arrived cold and late."
Sentiment: NEGATIVE
Text: "The battery lasts forever, I love it!"
Sentiment:The one example teaches the exact label format, so the model answers POSITIVE.
Code Example
The example turn shows the format; the model matches it for the real input.
Best Practices
- Make the example representative of the real task.
- Match the exact format you want in the output.
- Keep the example clear and unambiguous.
- If one example isn't enough, move to few-shot.
Summary
- One-shot prompting includes exactly one example before the task.
- The example removes ambiguity and shows the desired format at low cost.
- It's ideal when zero-shot almost works but needs a format nudge.
- Its limit: one example may not cover varied inputs or edge cases.
- When it's not enough, add more examples → few-shot. EOF echo "created"