Day 6 — Examples and few-shot prompting
Showing beats telling. One worked example does more than three paragraphs of instruction.
Zero-shot, one-shot, few-shot
| Name | What it means | Use when |
|---|---|---|
| Zero-shot | Instructions only, no examples | Common tasks with an obvious answer |
| One-shot | One worked example | You need a specific format or tone |
| Few-shot | Three to five examples | Classification, or rules hard to write down |
When describing the format is hard
Some formats take longer to describe than to demonstrate. Product codes are a good example - try writing the rule in words, then just show it:
Three examples define the rule precisely: three-letter stem, uppercase, hyphenated, most distinctive attribute last. Writing that as prose would take a paragraph and still be ambiguous.
Few-shot for classification
This is where it earns its keep. Categorising support tickets, tagging expenses, bucketing customer feedback - all far more consistent with examples than with rules.
Examples set tone too
"Professional tone" means nothing in particular. Two examples of your actual house style mean everything.
How many examples
The trap
Models follow your examples closely - including your mistakes. If one example has a typo, an inconsistent format or a wrong classification, expect the output to reproduce it faithfully.
Try these yourself
- Write a one-shot prompt that converts dates into "05-Jan-2025" format.
- Build a few-shot prompt classifying five support tickets.
- Include one deliberate edge case in your examples and say why.
- Explain when few-shot beats writing out the rule.
- Give one reason few-shot output can come back consistently wrong.
