Few-Shot Examples: Show, Don't Just Tell
Instead of describing exactly what you want, you show the model two or three examples - and it picks up the pattern on its own.
What few-shot prompting is
You give the model a couple of example inputs and outputs right inside the prompt, then ask for one more. No fine-tuning, no extra tool - just examples sitting in your prompt, showing the pattern you want repeated.
Why it works
Explaining a format in words is often vaguer than showing it. "Write a short, punchy product description" leaves a lot open. Three examples of exactly the tone, length, and structure you want leave much less room for the model to guess wrong.
Zero-shot vs. few-shot
Zero-shot means no examples at all - just an instruction. That's fine for simple, common tasks a model has seen a million times, like summarizing a paragraph. Few-shot earns its keep once you need a specific format, a house style, or a slightly unusual pattern the model wouldn't default to on its own.
Quality beats quantity
Two or three sharp, representative examples usually beat ten mediocre ones. A bad example teaches a bad habit just as reliably as a good one teaches a good one - the model has no way of knowing which examples you actually meant as the rule.
EXAMPLE
Without examples: "Turn this feature into a changelog entry." With few-shot: Example 1: Feature: Added dark mode toggle in settings Changelog: Dark mode - switch it on under Settings -> Appearance. Example 2: Feature: Fixed crash when uploading files over 50MB Changelog: Fixed a crash when uploading large files (50MB+). Now: Feature: Added CSV export for reports Changelog: (model completes it in the same style)
๐ ๏ธ EXERCISE โ TRY IT YOURSELF
Turn a vague formatting instruction into a working few-shot prompt.
- Pick a small formatting task you do often, like turning a feature note into a changelog line.
- Write the zero-shot version: just the instruction, no examples. Run it once and note the output.
- Write 2-3 examples in the exact format you want, each wrapped clearly (e.g. "Example 1: ... Example 2: ...").
- Add your real input after the examples and run the few-shot version.
- Compare both outputs - check if the few-shot version matches your intended format more consistently.
โ SELF-CHECK
- โ Did the few-shot output match your intended format more closely than the zero-shot one?
- โ If you run the few-shot prompt again with a different input, does it still follow the same pattern?
QUICK QUIZ
What's the main benefit of few-shot examples over a purely zero-shot instruction?
SOURCES
- Claude Platform Docs: Multishot Prompting โ platform.claude.com
- OpenAI Platform Docs: Prompt Engineering โ developers.openai.com