Few-shot prompting: how examples make AI answers better
Updated:
You could spend a paragraph describing the tone you want: “friendly but professional, a little witty, never salesy.” Or you could paste one email that sounds exactly right. The second approach wins almost every time, and it takes ten seconds.
Adding examples to a prompt is called few-shot prompting. The idea is simple: show instead of tell.
Why examples beat adjectives
Adjectives are slippery. “Professional” means one thing to a law firm and another to a skate shop. An example pins it down: a specific length, rhythm, vocabulary and structure. The model picks up on all of it.
How many to use
- One is enough to show a tone or a format.
- Two or three are better when you want the AI to learn a pattern rather than copy one case.
- More than five is rarely needed and just makes the prompt longer.
If you use several, make them different from each other. If every example is about sneakers, the AI may decide sneakers are the point.
Say what the example is for
Unlabeled examples get copied too closely. Tell the model what to take from them:
Here's an example of the voice I want. Match the voice and length,
not the subject:
<example>
Rainy Saturday? Perfect. Our reading nook has blankets, and the
chai is on us until noon.
</example>
Tags like <example> help the model separate your sample from your instructions. They’re especially effective with Claude, but they work with any assistant.
Show what you don’t want (sparingly)
Sometimes a counterexample is the fastest way to explain:
Not like this:
"🚨 HUGE SALE 🚨 You WON'T believe these prices!!!"
Always pair it with a positive example. If you only show what to avoid, the AI knows what not to do but not where to go.
Examples by task
- Writing: an email, post or paragraph you like.
- Code: a snippet in your project’s style, or a site you’d like to resemble.
- Bots: a typical customer question and the ideal answer.
- Analysis: one well-written finding with the number that supports it.
- Classification: two or three items already labeled correctly.
No examples? Two options
- Ask for variety: “I don’t have examples. Give me two very different versions so I can choose.” Then use your favorite as the example next time.
- Ask for questions: “Before you start, ask me about the style I’m going for.”
The coach offers both options when it reaches the examples layer. To see examples working inside real prompts, check out before and after: 5 real prompts, rewritten.