What is few-shot prompting?
Few-shot prompting puts a few input and output examples in a prompt. The GPT-3 paper used 10 to 100, and Anthropic recommends 3 to 5 for Claude.
In short. Few-shot prompting is putting a few examples of a task, each with an input and the expected output, in a prompt. The model follows the pattern of the examples, and its weights do not change. The 2020 GPT-3 paper tested it against prompts with one example or none. Anthropic recommends 3 to 5 examples, and Google recommends always including examples in Gemini prompts.
On this page 7 sections
The evidence
The GPT-3 paper defines few-shot as giving the model a few demonstrations of a task at inference time, with no weight updates. The authors typically used 10 to 100 examples, as many as fit in a 2,048-token context window.1
1arXivarXiv, May 28, 2020.On the TriviaQA benchmark, GPT-3 scored 64.3% with no examples, 68.0% with one example and 71.2% with few-shot prompts.1
1arXivarXiv, May 28, 2020. Closed-book question answering.Anthropic recommends 3 to 5 examples for best results, wrapped in example tags so that Claude can tell them apart from instructions.2
2Claude API documentationClaude API documentation. Checked Nov 20, 2026.Google recommends always including few-shot examples in Gemini prompts. It warns that too many examples can make the model overfit its responses to them.3
3Gemini API documentationGemini API documentation. Checked Nov 20, 2026.Anthropic calls examples one of the most reliable ways to steer a model's format, tone and structure, and their cost is extra tokens on every request. In the GPT-3 paper, a few examples lifted TriviaQA scores from 64.3% with none to 71.2%.
Few-shot prompting is a way to show a language model what a task looks like. The prompt includes a few worked examples, each an input with the output that the user wants. Then it gives a new input, and the model writes an output in the same pattern.
#How few-shot prompting works
The method was described and tested at scale in Language Models are Few-Shot Learners, the 2020 paper that introduced GPT-3. The paper gives the model K examples of a context and its completion, then one final context, and the model is expected to write the completion. No gradient updates or fine-tuning take place.1
The paper compares three settings by the number of examples:1
- A zero-shot prompt has only a natural language instruction, with no examples.
- A one-shot prompt has an instruction and one example.
- A few-shot prompt has as many examples as fit in the context window, typically 10 to 100 for GPT-3.
The paper also calls this in-context learning, because the model picks up the task from the text in its context. How do large language models work? explains why a prompt does not change a model's weights.
#Results in the GPT-3 paper
Examples raised GPT-3's scores on tasks such as TriviaQA, where it scored 64.3% zero-shot, 68.0% one-shot and 71.2% few-shot. The authors found that the gap between zero-shot and few-shot results often grew with model size.1
The paper also lists limits. It says few-shot results had so far been much worse than state-of-the-art fine-tuned models, and that a small amount of task data is still needed. The authors say it is unclear whether the model learns a new task at inference time or recognizes a task it learned in training.1
#Guidance from model providers
OpenAI, Anthropic and Google each recommend examples in prompts.
Anthropic's prompting best practices call examples one of the most reliable ways to steer Claude's format, tone and structure. Anthropic asks for examples that are relevant to the use case and diverse enough to cover edge cases. It recommends 3 to 5 examples, each in <example> tags.2
Google's prompt design guide for the Gemini API recommends always including few-shot examples. It says clear examples can replace some instructions, because they show the model the response format. All examples need the same structure and formatting, including tags, white space and line breaks.3
OpenAI's prompt engineering guide describes few-shot learning as a way to steer a model toward a new task without fine-tuning. It suggests showing a diverse range of inputs with the desired outputs, usually in the developer message.4
#Few-shot prompting and other methods
Examples take up tokens in the context window on every request. What is a context window? covers the limits. Fine-tuning trains the examples into the model instead, which changes its weights. What is a prompt in AI? covers the other parts of a prompt, such as instructions, context and the system prompt.
Read next
LLMs
How do large language models work?
LLMs predict text one token at a time from what fits in their context window. Tokens, context window sizes and the lost-in-the-middle effect.
LLMs
What is a context window?
A context window is the number of tokens a model can read and write in one request. Sizes from Anthropic, OpenAI and Google, and what happens at the limit.
LLMs
What are tokens in AI?
A token is the unit of text a language model reads and writes. OpenAI estimates that 100 tokens are about 75 English words. Counts and limits by provider.
LLMs
What are reasoning models, and how do they change AI search?
Reasoning models think before answering and can search several times per response. What OpenAI, Google and Anthropic document, and what it means for citations.
Questions
What is the difference between zero-shot, one-shot and few-shot prompting?
The GPT-3 paper separates them by the number of examples. A zero-shot prompt gives only a natural language instruction. A one-shot prompt adds one example, and a few-shot prompt adds several.
How many examples should a few-shot prompt have?
Anthropic recommends 3 to 5 for Claude. Google says the right number takes some experiment, and that too many examples can cause overfitting. The GPT-3 paper used 10 to 100 and found that more examples were usually, but not always, better.
Is few-shot prompting the same as fine-tuning?
No. Fine-tuning trains the model further and changes its weights. Few-shot prompting adds examples to one request, and the model stays unchanged. OpenAI presents few-shot learning as a way to steer a model toward a new task without fine-tuning.
Notes
- 1
- 2
- 3
- 4
About this page
Researched and reviewed by Promptly Found. Reviewed Nov 20, 2026. Next review due Feb 2027.
Cite this page
Promptly Found. (2026, November 20). What is few-shot prompting? https://promptlyfound.com/glossary/few-shot-prompting
Revisions 1
- First published.