Book a demo →

Few-Shot Prompting

Definition

Few-shot prompting in the sources: how Brown et al. define it, how many examples they use, what changes the result, and where vendors differ.

In short

Few-shot prompting puts worked examples of a task into a prompt so that a model follows their pattern without a weight update. Brown et al. (28 May 2020) separate zero-shot, one-shot and few-shot by the number of demonstrations. Sources differ on how many examples to use.

What is few-shot prompting?

Few-shot prompting puts worked examples of a task into the prompt, and the model answers a new case in the same pattern. The model's weights stay as they are. Five definitions, the paper at the top and the vendor pages below it (retrieved on 5 December 2026):

Source and dateWording
Brown et al., arXiv 2005.14165, version 1 (28 May 2020)“Few-Shot (FS) is the term we will use in this work to refer to the setting where the model is given a few demonstrations of the task at inference time as conditioning [RWC+19], but no weight updates are allowed.”
OpenAI, “Prompt engineering” (no date on the page)“Few-shot learning lets you steer a large language model toward a new task by including a handful of input/output examples in the prompt, rather than fine-tuning the model.”
Anthropic, “Prompting best practices” (no date on the page)“A few well-crafted examples (known as few-shot or multishot prompting) improve accuracy and consistency.”
Google, Gemini API, “Prompt design strategies” (no date on the page)“Prompts that contain a few examples are called few-shot prompts, while prompts that provide no examples are called zero-shot prompts.”
Google Cloud, “Include few-shot examples” (last updated 4 December 2026)“Prompts that contain examples are called few-shot prompts, while prompts that provide no examples are called zero-shot prompts.”

The five sources use four names for one practice: few-shot learning (Brown et al., OpenAI), few-shot or multishot prompting (Anthropic) and few-shot prompts (Google). The exact phrase “few-shot prompting” does not appear in the papers by Brown, Zhao, Min or Lu quoted below. This entry does not say who used it before whom.

Zero-shot, one-shot and few-shot in the GPT-3 paper

Brown et al. posted “Language Models are Few-Shot Learners” in four versions: 28 May, 1 June, 5 June and 22 July 2020. The definitions quoted here read the same in version 1 and version 4. Next to few-shot, the paper defines two settings with fewer demonstrations:

“One-Shot (1S) is the same as few-shot except that only one demonstration is allowed, in addition to a natural language description of the task, as shown in Figure 1.” And: “Zero-Shot (0S) is the same as one-shot except that no demonstrations are allowed, and the model is only given a natural language instruction describing the task.”

The paper describes the form of a few-shot prompt: “few-shot works by giving K examples of context and completion, and then one final example of context, with the model expected to provide the completion”. It sets this against changing the model: “Fine-Tuning (FT) has been the most common approach in recent years, and involves updating the weights of a pre-trained model by training on a supervised dataset specific to the desired task.” The entry on fine-tuning covers that route.

Two results from version 1 show how far the settings lie apart, for GPT-3 in the closed-book setting: “GPT-3 achieves 64.3% accuracy on TriviaQA in the zero-shot setting, 68.0% in the one-shot setting, and 71.2% in the few-shot setting”. And: “On WebQuestions (WebQs), GPT-3 achieves 14.4% in the zero-shot setting, 25.3% in the one-shot setting, and 41.5% in the few-shot setting.” The gap from zero-shot to few-shot is 6.9 points on TriviaQA and 27.1 points on WebQuestions, by this entry's subtraction.

A footnote on “meta-learning” in the introduction says: “In the context of language models this has sometimes been called “zero-shot transfer”, but this term is potentially ambiguous”.

The three settings as Brown et al. define them (arXiv 2005.14165, version 1, Section 2). For GPT-3 the paper says “We typically set K in the range of 10 to 100”.

How many examples the sources use

The sources give numbers of a different kind: a range that fits a model’s context window, a test setting, a recommendation and a warning in both directions.

Source and dateWording
Brown et al., version 1 (28 May 2020), GPT-3“We typically set K in the range of 10 to 100 as this is how many examples can fit in the model’s context window (nctx = 2048).” Caption of Figure 2.1: “We typically present the model with a few dozen examples in the few shot setting.”
Zhao et al., arXiv 2102.09690, version 1 (19 February 2021)“For each set of training examples, we evaluate the accuracy for all possible permutations. Figure 2 shows the results for SST-2 (4-shot, GPT-3 2.7B).”
Anthropic, “Prompting best practices” (no date on the page)“Include 3–5 examples for best results.”
Google Cloud, “Include few-shot examples” (last updated 4 December 2026)“Depending on the model, too few examples are ineffective at changing model behavior. Too many examples can cause the model to overfit.”
Agarwal et al., arXiv 2404.11018, version 1 (17 April 2024)“Newly expanded context windows allow us to investigate ICL with hundreds or thousands of examples -- the many-shot regime”

Brown's “10 to 100” is tied by the sentence itself to the context window of GPT-3, which the paper gives as 2,048 tokens. Anthropic's 3 to 5 come with the words “for best results”. The Google Cloud page tells readers to “Experiment with the number of prompts to include.” Google's AI Overview for the query “what is few shot prompting” (5 December 2026) wrote “usually 2 to 5 input-output pairs”. Agarwal et al. abbreviate “in-context learning” as ICL. This entry does not pick one number.

What changes the result: order, choice and labels of the examples

Four papers varied properties of the examples and measured the effect:

Paper and versionWording
Liu et al., arXiv 2101.06804, version 1 (17 January 2021), on GPT-3The empirical results “depend heavily on the choice of in-context examples”
Zhao et al., “Calibrate Before Use”, versions 1 and 2 (19 February and 10 June 2021); SST-2, 4-shot, GPT-3 2.7B“the choice of prompt format, training examples, and even the order of the training examples can cause accuracy to vary from near chance to near state-of-the-art” and, in the paper, from “near chance (54.3%) to near state-of-the-art (93.4%)”
Lu et al., “Fantastically Ordered Prompts”, version 2 (3 March 2022)“the order in which the samples are provided can make the difference between near state-of-the-art and random guess performance”. In version 1 (18 April 2021) the sentence has “can be the difference” instead of “can make the difference”.
Min et al., “Rethinking the Role of Demonstrations”, version 2 (20 October 2022)“randomly replacing labels in the demonstrations barely hurts performance on a range of classification and multi-choce tasks, consistently over 12 different models including GPT-3”

Min et al. count their models in the paper: “We experiment with 12 models in total. We include 6 language models (Table 1)”, each used with two inference methods, direct and channel. In the paper the drop from random labels is “in the range of 0–5% absolute”, and the trend is “consistent over nearly all models”. Version 1 (25 February 2022) of the abstract does not contain the words “on a range of classification and multi-choce tasks”; the spelling “multi-choce” is the abstract's own.

The results measure different things. Liu et al. look at the choice of examples, Zhao et al. at format, choice and order, Lu et al. at order, Min et al. at the correctness of the labels. Min et al. write that other aspects of the demonstrations “are the key drivers of end task performance, including the fact that they provide a few examples of (1) the label space, (2) the distribution of the input text, and (3) the overall format of the sequence”. The papers also use different words for the examples: “demonstrations” (Brown et al., Min et al.), “training examples” (Zhao et al.) and “samples” (Lu et al.).

Where the sources disagree on when to use it

Where a source names a model or model type for its statement, the row says so:

Source and dateWording
Google, Gemini API page (no date on the page)“We recommend to always include few-shot examples in your prompts.”
Google Cloud page (last updated 4 December 2026)“you should always accompany few-shot examples with clear instructions.”
OpenAI, “Reasoning best practices” (no date on the page), on reasoning models“Try zero shot first, then few shot if needed” and “Reasoning models often don’t need few-shot examples to produce good results, so try to write prompts without examples first.”
DeepSeek-AI, DeepSeek-R1 report, arXiv 2501.12948, versions 1 and 2 (22 January 2025, 4 January 2026), on DeepSeek-R1“When evaluating DeepSeek-R1, we observe that it is sensitive to” prompts. “Few-shot prompting consistently degrades its performance.”
Agarwal et al., version 3 (17 October 2024), on frontier models“frontier LLMs benefit from many-shot ICL to varying degrees”

The three statements on defaults come from the Gemini API page, OpenAI's page on reasoning models and the DeepSeek-R1 report, which writes about DeepSeek-R1. The DeepSeek-R1 report follows its sentence with a recommendation for that model: “we recommend users directly describe the problem and specify the output format using a zero-shot setting for optimal results.” The Agarwal sentence appears in the abstract of version 3, not of version 1. The entry on reasoning models describes the model type in the OpenAI and DeepSeek rows.

Names and dates in the sources

Brown et al. write that meta-learning, in the context of language models, means the model develops skills “at training time” and uses them “at inference time to rapidly adapt to or recognize the desired task”. They continue: “Recent work [RWC+19] attempts to do this via what we call “in-context learning”, using the text input of a pretrained language model as a form of task specification”. In their reference list, [RWC+19] is Radford et al., “Language models are unsupervised multitask learners, 2019”.

The same footnote separates its terms: “we use the term “meta-learning” to capture the inner-loop / outer-loop structure of the general method, and the term “in context-learning” to refer to the inner loop of meta-learning”. It also leaves a question open: “A limitation, or at least uncertainty, associated with few-shot learning in GPT-3 is ambiguity about whether few-shot learning actually learns new tasks “from scratch” at inference time, or if it simply recognizes and identifies tasks that it has learned during training.” The label results of Min et al. in the section on order, choice and labels bear on that question; neither paper settles it. The entry on in-context learning sets out the explanations that other papers give for this behavior.

Version 1 dates of the seven papers on language models quoted in this entry, evenly spaced. Wang et al. and Vinyals et al. (Section 7) are not shown. The figure shows dates, not an order of credit.

Other meanings of few-shot

In machine learning, “few-shot learning” also names generalizing to new tasks from a few samples. Wang et al. (arXiv 1904.05046, version 3, 29 March 2020) write: “Machine learning has been highly successful in data-intensive applications but is often hampered when the data set is small. Recently, Few-Shot Learning (FSL) is proposed to tackle this problem. Using prior knowledge, FSL can rapidly generalize to new tasks containing only a few samples with supervised information.” Vinyals et al. (arXiv 1606.04080, version 1, 13 June 2016) begin: “Learning from a few examples remains a key challenge in machine learning.” In the GPT-3 setting of Brown et al., the examples sit in the prompt and “no weight updates are allowed”.

Large language model. The model that reads the prompt and its examples; the entry on large language models explains that model.

Context window. How much text fits into one request; the entry on the context window covers it.

Fine-tuning. Training a model on examples, the other route to a new task; the fine-tuning entry covers it.

Reasoning model. A paper by Jason Wei and co-authors pairs chain of thought with examples in the prompt; the reasoning model entry covers it.

Context engineering. Few-shot examples appear there among the parts of the context; the entry on context engineering lists them.

Source

Frequently asked questions

What is one-shot, few-shot, and zero-shot prompting?

Brown et al. (version 1, 28 May 2020) separate the three by the number of demonstrations placed next to the task description. For one-shot, “only one demonstration is allowed”. For zero-shot, “no demonstrations are allowed”. For few-shot, the model “is given a few demonstrations of the task at inference time”. In all three settings the paper allows no weight update.

When using few-shot prompting, how many examples are typically involved?

The sources give different numbers. Brown et al. write “We typically set K in the range of 10 to 100” for GPT-3, which has a context window of 2,048 tokens. Anthropic writes “Include 3–5 examples for best results.” The Google Cloud page asks readers to experiment and warns: “Too many examples can cause the model to overfit.”

When should you use few-shot prompting instead of zero-shot?

The sources set different starting points. The Gemini API page says “We recommend to always include few-shot examples in your prompts.” OpenAI writes for reasoning models “Try zero shot first, then few shot if needed”. The DeepSeek-R1 report says of DeepSeek-R1: “Few-shot prompting consistently degrades its performance.”

What is few-shot learning in LLM?

Brown et al. use the words few-shot learning for GPT-3 given demonstrations in the prompt with no weight update. Wang et al. use them for the ability to “rapidly generalize to new tasks containing only a few samples with supervised information”. The abstract of Wang et al. mentions neither a prompt nor weight updates.

What is the difference between zero-shot prompting and few-shot prompting?

Zero-shot gives the task without examples, few-shot adds worked examples. Brown et al. report in version 1 for GPT-3 on closed-book TriviaQA 64.3% zero-shot and 71.2% few-shot, and on WebQuestions 14.4% and 41.5%. Zhao et al. report in versions 1 and 2 for SST-2 with GPT-3 2.7B, 4-shot, a range from 54.3% to 93.4% from the order of the examples.