Few-shot prompting explained, with simple examples
Few-shot prompting means showing an AI two to five examples of what you want, right inside your prompt, before you make your request. The model copies the pattern in your examples, so tone, format and style follow without any retraining.
Zero-shot, one-shot and few-shot
Zero-shot means you give an instruction and no examples. One-shot means one example. Few-shot means a handful, usually two to five. The more your task depends on a particular style or format, the more examples help.
A simple few-shot example
Say you want short, warm customer messages. Instead of describing the tone, show it:
Rewrite each line in our brand voice: short, warm, no jargon.
Input: Your order has been dispatched.
Output: Your order is on its way.
Input: Please remit payment by Friday.
Output: Could you pay by Friday? Thanks!
Input: [your line]
Output:
The AI sees the pattern and continues it for your new line.
Where the idea comes from
The 2020 paper "Language Models are Few-Shot Learners" from OpenAI, which introduced GPT-3, showed that a large language model could pick up many tasks from a few examples placed in the prompt, with no retraining. That finding is why example-based prompting works in chat tools today.
Tips for better examples
- Keep the format identical in every example, including labels and punctuation.
- Make examples varied so the AI learns the rule, not one case.
- Use good ones. The AI copies mistakes too.
- Start with two or three. Add more only if results are inconsistent.
- End with the open slot, like "Output:", so the AI knows what to produce.
When not to use it
For a simple factual question or a short task, a clear instruction is enough. Use examples when style, structure or a tricky rule is hard to describe in words. For reasoning problems, also see step-by-step prompting.
New to prompts in general? Start with the 5-part prompt formula.
Frequently asked questions
How many examples should I give?
Two to five is a good range. Start with two or three and add more only if the output is inconsistent.
Does few-shot prompting retrain the AI?
No. The examples only guide that one conversation. The model itself does not change.
Can I use few-shot prompting in ChatGPT, Claude and Gemini?
Yes. It is just a way of writing your prompt, so it works in any chat tool.