# 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.

Canonical: https://promptlyfound.com/glossary/few-shot-prompting
Updated: 2026-11-20

## Short answer

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.

## Key findings

- 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]
- 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]
- Anthropic recommends 3 to 5 examples for best results, wrapped in example tags so that Claude can tell them apart from instructions. [2]
- 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]

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](https://arxiv.org/abs/2005.14165), 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?](https://promptlyfound.com/llms/how-llms-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](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-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](https://ai.google.dev/gemini-api/docs/prompting-strategies) 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](https://developers.openai.com/api/docs/guides/prompt-engineering) 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?](https://promptlyfound.com/llms/context-windows) covers the limits. [Fine-tuning](https://promptlyfound.com/glossary/fine-tuning) trains the examples into the model instead, which changes its weights. [What is a prompt in AI?](https://promptlyfound.com/glossary/prompt) covers the other parts of a prompt, such as instructions, context and the system prompt.

## Sources

1. Language Models are Few-Shot Learners. arXiv, 2020-05-28. https://arxiv.org/abs/2005.14165
2. Prompting best practices. Claude API documentation. https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices
3. Prompt design strategies. Gemini API documentation. https://ai.google.dev/gemini-api/docs/prompting-strategies
4. Prompt engineering. OpenAI API documentation. https://developers.openai.com/api/docs/guides/prompt-engineering

---

This is a plain-text copy of https://promptlyfound.com/glossary/few-shot-prompting from Promptly Found. The web page is the canonical version and includes the charts.
