In short
Examples shape an AI’s answer more reliably than descriptions. Including a few samples of the input you will give and the output you want, called few-shot prompting, shows the model length, tone and structure at once. Start with one good example and add more, up to three to five, only if results are still inconsistent.
Try describing your company’s house style in a paragraph, then compare that with handing someone two documents written in it. The second takes less effort and gets a closer result, because a good example carries dozens of small decisions about length, tone, structure and word choice that are tedious to spell out.
AI assistants respond to examples in much the same way. Including a few samples of the input you will give and the output you want is called few-shot prompting, and it is one of the most reliable ways to get consistent results from a model. This article explains how it works, how many examples to use and how to pick them.
Where the idea comes from
The term became widely known through a 2020 paper from OpenAI that introduced GPT-3, titled “Language Models are Few-Shot Learners” (arXiv). Before that, getting a model to do a new task usually meant retraining it on many labeled examples. The paper showed that a large enough model could pick up a task from a handful of examples placed directly in the prompt, without any retraining.
The vocabulary from that work is still in use. Zero-shot means asking with instructions only. One-shot means including a single example. Few-shot usually means two to about five.
When examples help most
Examples earn their place when the output has to follow a pattern that is easier to show than to explain.
Consistent formats. Weekly status updates, meeting notes, product descriptions or anything else where every instance should have the same sections in the same order.
Classification. Sorting support tickets, tagging feedback, labeling leads. Two or three examples of each category, with the reasoning for borderline cases, make the labels far more consistent.
Tone and voice. A sample of a newsletter you like, or a reply your best support agent wrote, conveys tone better than adjectives such as “friendly but professional”.
Data extraction. Pulling the same fields out of contracts, invoices or emails into a table. An example of the exact output structure prevents the model from improvising its own.
For one-off creative tasks, examples are less useful and can even narrow the result too much. If you want new ideas, describe the goal and let the model range more widely.
How many examples to use
Anthropic’s guidance for Claude recommends three to five examples for best results, and describes examples as one of the most reliable ways to steer format, tone and structure (Anthropic). For everyday work, a practical rule is to start with one and add more only if the results are still inconsistent.
There is a reason to start small. Each example takes space in the prompt and attention from the model, and with too many similar examples the model tends to copy them too closely. Newer reasoning models often do well with instructions alone, which is why OpenAI suggests trying zero-shot prompting with those models before adding examples.
How to choose good examples
Make them realistic. Use real past work, or examples that look like the inputs you will actually give. Invented examples that are cleaner than real data teach the model the wrong thing.
Make them varied. If every example is about the same product, or every ticket is a complaint, the model may assume that is always the case. Cover the range of situations you expect.
Include the awkward cases. If there is a tricky category or an input that should be handled differently, show it. Borderline examples teach more than obvious ones.
Keep them separate from your instructions. Label them clearly, for example with a heading such as “Example 1” or by wrapping them in tags, and say what they are for: “Here are two past updates in the format I want.”
Check for accidental patterns. If all your examples happen to be three paragraphs long, expect three paragraphs. If they all start with “Hi team”, so will the output. Make sure the features they share are the ones you want copied.
Download the example builder
A one-page template for setting up few-shot prompts: the task, the examples, the edge case and the new input.
Free. We will also send you our newsletter about new courses and guides. Unsubscribe in one click.
A worked example
Say you want to turn messy meeting notes into a short update for people who missed the meeting. Instead of describing the format, you include one earlier update you were happy with:
“Turn the notes below into an update for colleagues who missed the meeting. Follow the format of the example exactly.
Example notes: [last week’s notes] Example update: [last week’s update]
New notes: [this week’s notes]”
The model will match the headings, length and tone of last week’s update, and you will spend your time checking facts instead of reformatting.
Where this fits
Examples work best on top of a clear brief, as described in Brief AI Like a Colleague, Not a Search Box. They are one of the techniques in our guide to getting real work done with AI assistants, and the free Prompt Engineering course has a lesson on them with exercises. Start the course here.
Frequently asked questions
What is few-shot prompting?
Few-shot prompting means including a small number of examples in a prompt, each showing an input and the output you want, so the AI model follows the same pattern for a new input.
What is the difference between zero-shot, one-shot and few-shot prompting?
Zero-shot gives instructions with no examples. One-shot adds a single example. Few-shot adds several, usually between two and five.
Can examples make the results worse?
Yes. Examples that are too similar make the model copy surface features such as length or opening phrases. Examples with errors teach the errors. And for open creative tasks, examples can narrow the ideas the model produces.
Should my examples be perfect?
They should be good enough that you would be happy to receive output like them. The model will reproduce their weaknesses as faithfully as their strengths, so fix any mistakes before you use a past document as an example.
Can I ask the AI to write the examples for me?
You can, and it is a quick way to get started, but review them carefully. Generated examples tend to be cleaner and more uniform than real work, which can make the final output less suited to the messy inputs you actually have.
Sources
- Brown, T. et al. (2020). Language Models are Few-Shot Learners. arXiv. arxiv.org
- Anthropic, “Be clear and direct”, Claude documentation. platform.claude.com
