Few-shot prompting: show, don't just tell
Few-shot prompting means placing a few complete examples of what you want inside your prompt, so the model copies their format and style. It is one of the simplest and most effective ways to get consistent answers.
Data as of October 22, 2026
Key figures
| Level | Intermediate |
|---|---|
| Origin | 2020 |
| Introduced by | Brown et al. (OpenAI) |
Show rather than describe
Describing an output format precisely is hard; showing it is easy. Few-shot prompting builds on that. Inside your prompt, you add two, three or four “input → expected answer” pairs, followed by the new input. The model spots the pattern and follows it.
A concrete example
Say you are sorting customer support emails into three buckets. Your prompt might look like this:
- “My parcel never arrived” → Delivery
- “I want to change my email address” → Account
- “The item was broken when I opened it” → Complaint
- “I can’t log in anymore” → ?
With no examples, the model might reply with a full sentence, invent a fourth bucket or spell the labels differently. With them, it nearly always returns a single word from the right list. For structured output such as JSON, one example of the exact format often works better than a paragraph of explanation.
Where the term comes from
The phrase was popularised by the GPT-3 paper, “Language Models are Few-Shot Learners” (Brown et al., OpenAI, May 2020). The authors showed that a large model could take on a new task from a few demonstrations supplied purely as text, with no retraining. This ability is often called in-context learning.
Why it matters
Few-shot prompting is the most approachable technique in prompt engineering: no code, no training data, and usually an immediate gain in consistency. For an agent or an automated workflow it is a cheap way to make output predictable before moving on to fine-tuning, which takes far more effort.
Common pitfalls
- Examples that are too alike. If every example is short and upbeat, the model will struggle with a long or ambiguous case. Mix them up.
- Accidental bias. If two out of three examples share a label, the model may lean towards it. Keep them balanced.
- Sloppy examples. A formatting slip in one example will be copied faithfully.
- Assuming the model has “learned”. The examples only count for the current request.
Related terms
Few-shot prompting pairs well with chain of thought: your examples can show not just the answer but the reasoning that leads to it. The site’s prompt generator can help you add an examples section to your prompt.
Related terms
- Prompt · The text, question or instruction you give an AI to get a response; how clear it is directly shapes the result.
- Prompt engineering · The practice of writing, testing and refining instructions to an AI model so its answers become more reliable and useful.
- Fine-tuning · Continuing the training of an already trained model on a small, targeted set of examples to adapt it to a task, style or output format.
- Chain of thought · Getting a model to write out intermediate reasoning steps before its final answer, which helps on multi-step problems.
- Structured output · An AI model's answer produced in an enforced format, usually JSON that matches a schema, so that a program can read it reliably.
Try it
Full glossary
Frequently asked questions
How many examples should I include?
There is no official number. In practice a few well-chosen examples are often enough; add more if the model still gets typical cases wrong. Every example takes up room in the context window, which means more tokens.
What do zero-shot, one-shot and few-shot mean?
Zero-shot: you describe the task with no example. One-shot: you give a single example. Few-shot: you give several. The terms were popularised by the GPT-3 paper in 2020.
Does the model learn permanently from my examples?
No. The examples only apply to the current request and the model itself is not changed. In a new conversation you need to provide them again, or put them in custom instructions.
Can few-shot prompting replace fine-tuning?
Often, for simple needs. When a task involves hundreds of varied cases or a very specific style, fine-tuning on your own data may become the better fit.
Data sources
Data as of October 22, 2026
Report an error
Does a figure, a date or a fact look wrong? Tell us: every report is checked.