Few-shot prompting is a way of prompting in which you first give a language model a few worked examples and only then the actual task. The term comes from the research behind GPT-3 and differs from zero-shot and one-shot prompting only in the number of examples.
The model itself doesn’t change, but it recognises the pattern in your examples and continues it with new input. A good few-shot prompt consists of a short instruction, two to five examples in the same form and then the new input.
Examples have more influence than you might expect. A model copies length, tone and even mistakes, and the technique falls short on reasoning tasks with several steps.
At work, few-shot prompting pays off mainly for tasks that keep coming back, such as sorting emails or putting notes into a fixed format.
What does few-shot prompting mean?
Few-shot prompting means giving a language model a few examples of input and desired output before you set the actual task. Here, “shot” stands for example, so “few-shot” literally means “a few examples”.
The term became well known through the research paper “Language Models are Few-Shot Learners” by researchers at OpenAI (Brown et al., 2020). In it, they showed that GPT-3 could pick up a new task from a handful of examples in the prompt, without extra training. Until then, you had to fine-tune a model separately for each task.
It is one of the basic techniques in prompting, alongside a clear instruction and enough context.
What is the difference between zero-shot and few-shot prompting?
Zero-shot, one-shot and few-shot prompting differ only in the number of examples you provide: none, one or several. The table below compares the three and shows when to choose each technique.
| Technique | Number of examples | When to choose this technique |
|---|---|---|
| Zero-shot | None | For tasks a model does well with just an instruction, such as summarising a text |
| One-shot | One | When you want to show one form, such as the structure of a report |
| Few-shot | Two or more | When the output must always have the same form, style or layout |
In most cases, start without examples and only add them when the output doesn’t take the form you want.
How does few-shot prompting work?
Few-shot prompting works because a language model recognises the pattern in your examples and continues it with the new input. Nothing changes in the model itself: the examples only apply within that one prompt or that one conversation. Researchers call this in-context learning.
The form of the examples matters more than whether their answers are correct.
In 2022, Min et al. studied what exactly a model picks up from examples. They found that the form of the examples matters more than whether the answers in them are correct. Even examples with randomly chosen answers gave better results than no examples at all, as long as the format was right.
For your own prompts, the main lesson is this: give most of your attention to a consistent structure in your examples.
How do you write a few-shot prompt?
You write a few-shot prompt in three parts: a short instruction, a few examples in exactly the same form and then the new input. Separate the examples clearly with fixed labels, so the model can see where an example begins and ends.
An example from office work is sorting incoming emails into fixed categories:
Assign each email to one category: Question, Documents, Appointment or Complaint. Give only the category.
Email: Attached are the bank statements for the second quarter.
Category: Documents
Email: Can we call next Tuesday about the annual accounts?
Category: Appointment
Email: I still haven’t had a reply to my question from last month.
Category: Complaint
Email: Do I need to declare the sale of my car in my tax return?
Category:
You leave the last line open. A model fills in the category there according to the pattern, in this case Question. Examples work best combined with clear background information about your situation.
How many examples should you give in few-shot prompting?
For most tasks, two to five examples are enough. Start with two and add one each time the output differs from what you want. More examples make a prompt longer, and a long prompt costs more tokens and leaves less room for the actual input.
Which examples you choose matters more than how many. Good examples differ in content and are the same in form. Three emails on the same topic teach a model little. Three emails on different topics, each with the same structure, show what is fixed and what varies.
What does a model copy from few-shot examples?
A model copies more from few-shot examples than you intend, because it can’t tell which features are incidental. These five things come back in the output most often:
- Length: short examples produce short answers, even when the new question needs more explanation.
- Tone: formal examples give formal output, even in an email to a long-standing contact.
- Mistakes: a spelling mistake or wrong amount in an example can come back without warning.
- Specific details: names, amounts and dates from an example sometimes turn up in an answer where they don’t belong, a form of AI hallucination.
- Proportions: if your examples contain three complaints and one question, a model leans towards “Complaint”.
So don’t use real client data as an example. An example is part of every prompt you use it in and is therefore sent to the tool’s provider every time. Anonymise examples or make them up yourself.
When doesn’t few-shot prompting work?
Few-shot prompting works poorly in three situations: reasoning tasks with several steps, contradictory examples and simple tasks. With a calculation or a tax judgement, a model sees only the outcome in your examples, not the intermediate steps. It learns the form of an answer without the reasoning behind it.
For such tasks, chain-of-thought prompting works better: you have the model write out the steps, possibly with examples that include those steps.
Contradictory examples, such as two similar emails with different categories, make the output unpredictable. And for a simple question that a model already answers well with just an instruction, examples mainly add length.
How do you use few-shot prompting at work?
Few-shot prompting works best at work for tasks that keep coming back and have a fixed form: sorting emails, turning notes into a standard report, writing texts in one house style or putting data from documents into a table.
In that case, don’t paste the examples into a chat every time; store them once in the instructions of your own assistant. I work with one project per client myself, with the client context in separate files, and for almost every task that comes up more than a few times I now build a skill.
If you want to learn how to set up prompts, examples and fixed ways of working for your own work, LearnLLM’s AI courses, such as the ChatGPT Course, cover this step by step. A few good examples often make the difference between an answer you rewrite and an answer you can use straight away.
Frequently asked questions about few-shot prompting
With the arrival of reasoning models and large context windows, few-shot prompting has developed further on two points.
Does few-shot prompting work with reasoning models?
Yes, few-shot prompting also works with reasoning models, provided each example shows the approach and not just the outcome. For Claude with extended thinking, Anthropic recommends including the method used in each example, alongside the problem and the answer. According to Anthropic, a general instruction such as “think thoroughly” often produces better reasoning than a step-by-step plan you write out yourself.
What is many-shot prompting?
Many-shot prompting is a variant of few-shot prompting in which you put hundreds or even thousands of examples in the prompt, which became possible thanks to the larger context windows of newer models. Researchers (Agarwal et al., 2024) found clearly better performance on many tasks than with a few examples. The cost of a request does grow with every example you add.



