Few-shot prompting: examples beat instructions
When you want a model to do something subtle, examples beat instructions every time. This is the secret weapon of pro prompt engineers.
If you ask a new chef to "make a Bangalorean-style dosa", you might get a dozen interpretations. Show them three photos of exactly what you want, and the next dosa will nail it.
Few-shot prompting is including 2 to 5 input-output examples in your prompt before the real input. The model uses the pattern to infer the rule.
Classify the sentiment.
Tweet: I love this phone, battery lasts all day.
Sentiment: positive
Tweet: Worst app ever. Crashes constantly.
Sentiment: negative
Tweet: It is fine, I guess.
Sentiment: neutral
Tweet: The camera is unreal. Worth every rupee.
Sentiment:
The model completes with positive. No "instruction" needed.
Choose examples that:
- Cover edge cases (positive, negative, neutral, ambiguous)
- Match the format exactly
- Are real-world realistic, not toy
5 well-chosen examples often outperform a long instruction. They also fit better with how the model was trained.
Quick recall
3 prompts · think before you flip
Prompt 1 of 3
What is few-shot prompting?
Quiz time
1 question · tap an answer to check it
1. Few-shot prompting is most useful when
Finished lesson 4.3?
Mark complete to update your module progress and unlock the streak.