Zero-Shot & Few-Shot Prompting
Part of the AI Engineer Roadmap
In short
Sometimes just asking works. Sometimes the model needs to see two or three examples first. Knowing when to add examples saves you from fine-tuning for simple jobs.
Zero-shot asks a model to perform a task with no examples; few-shot includes a handful of examples in the prompt to steer format and style — a cheap alternative to fine-tuning.

Think of it like this
Showing the mehendi artist samples
Tell a mehendi artist 'something nice' and she'll draw her usual design. Show her three sample cards of the exact style you want, and she copies that pattern on your palm. Zero-shot is just asking. Few-shot is showing samples first.
Watch it happen
No examples vs a few examples
Zero-shot
- Just the instruction
- Short and cheap
- Format may vary
Few-shot
- Instruction plus 2 to 5 examples
- Locks in format and tone
- Costs more tokens
Start zero-shot. If answers drift in format, labels or tone, add a few short, varied examples that show exactly what you want.
The big ideas
What you need to know
Zero-shot for common tasks
Summarise, translate, classify into obvious groups. Strong models handle these with no examples.
Few-shot teaches the pattern
Examples show the exact labels, length and style. The model copies the pattern closely.
Vary your examples
If all examples are positive, the model leans positive. Mix classes and include an edge case.
Examples leak
Models sometimes copy example details into answers. Use clearly different examples from the real input.
See it in code
Walk through the code
1Classify each customer message as ORDER, REFUND or OTHER.2 3Message: "Where is my parcel? It said delivered today."4Label: ORDER5 6Message: "I got the wrong size, I want my money back."7Label: REFUND8 9Message: "Do you have a store in Pune?"10Label: OTHER11 12Message: "Paid twice by UPI for the same order, please return one."13Label:1/3The instruction alone would be zero-shot.
Three examples fix the label names and the one-word answer format. The last line leaves a blank for the model to fill.
Save yourself the pain
Common mistakes
Oops
Adding 30 examples when 3 would do.
Do this instead
More examples cost tokens and slow responses. Add examples only until the output is consistent.
Oops
Using examples that are all the same class.
Do this instead
Balance the classes. Otherwise the model learns 'the answer is usually X'.
Your mission
Label 10 messages
Quick check
Your zero-shot classifier sometimes answers 'Refund request' and sometimes 'REFUND'. What's the simplest fix?
Go deeper
- 1Compare zero-shot vs. few-shot output quality on the same task.
- 2Practice picking diverse, representative few-shot examples.
- 3Learn when few-shot stops helping and fine-tuning becomes worth the investment.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.