# Language Models are Few-Shot Learners

Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal and 25 more · arXiv · 2020-5-28

- **Problem** Fine-tuned language models need thousands or more labeled examples per task, so the study asks whether a very large model can learn new language tasks from a few text demonstrations alone.
- **Method** Trains GPT-3, a 175B-parameter autoregressive transformer, and evaluates it in zero-, one- and few-shot settings, with demonstrations placed in the context and no weight updates.
- **Results** Reached 77.7% Winogrande accuracy few-shot, up from 70.2% zero-shot, and 86.4 LAMBADA accuracy few-shot.

## Why task-specific fine-tuning is a bottleneck

Pre-training a language model on a large text corpus and then fine-tuning it on a specific task has become the standard route to strong NLP benchmark results. The study asks whether a very large autoregressive model can learn a new task from a handful of text demonstrations or a plain instruction, with no gradient updates.

Three practical concerns motivate this. Collecting labeled data for every new task is costly, especially when the task changes often. Fine-tuned models can also exploit spurious correlations in narrow training distributions, so benchmark scores may overstate performance on the underlying task. Humans, by contrast, can often learn a new task from a short instruction or from a few examples.

## Four ways to specify a task

The study does not fine-tune GPT-3, because its focus is task-agnostic performance, though the authors note that fine-tuning remains a promising direction.

In the few-shot setting, the model receives K demonstrations, each a context and a desired completion, followed by one final context, and no weight updates occur. K is usually set between 10 and 100, because that is how many examples fit into the context window of 2048 tokens. Figure 2.1 places these settings beside traditional fine-tuning, with each setting using forward passes only at test time.

The one-shot setting keeps one demonstration together with a natural language description of the task, which resembles how a worker on a crowdsourcing service is usually briefed. The zero-shot setting removes the demonstrations and keeps only a natural language instruction, which is the most convenient and robust of the three but also the hardest.

The authors argue that one-shot and zero-shot are the fairest comparisons with human performance, while few-shot results are the ones that often come close to fine-tuned models.

## Model size and training budget

The architecture follows GPT-2, including its modified initialization, pre-normalization and reversible tokenization. The one departure is alternating dense and locally banded sparse attention patterns across the transformer layers, in the style of the Sparse Transformer. Eight model sizes are trained, from 125 million to 175 billion parameters, so that the effect of scale can be studied over three orders of magnitude.

Training sequences always span the full context window of 2048 tokens, with several short documents packed into one sequence. Documents within a packed sequence are separated by an end-of-text token, so no special masking is needed.

## How completions are chosen and scored

For each evaluation example, K demonstrations are drawn at random from that task's training set and separated by one or two newlines. Datasets without a supervised training split, such as LAMBADA and Storycloze, take demonstrations from the development set and are scored on the test set. The Winograd set has only one split, so its demonstrations are drawn from itself.

For multiple-choice tasks, the model is given K examples of context plus correct completion, then one context alone, and each candidate completion is compared by its likelihood. Most tasks use per-token likelihood to normalize for length, while ARC, OpenBookQA and RACE divide the conditional probability by the probability of the completion given a generic answer prompt, written as \\(P(\\text{completion}\\mid\\text{context}) / P(\\text{completion}\\mid\\text{answer context})\\).

Binary tasks use semantically meaningful option names, such as True or False, and are then handled as multiple choice.

Reported results come from the test set when it is public and otherwise from the development set, and submissions to test servers were made only for a few datasets.

## How loss changes with scale

Six extra-small models with as few as 100,000 parameters are added to the eight main sizes when the training curves are plotted. The authors argue that these loss gains carry over to a broad range of downstream tasks, which the later sections test.

## Language modeling, LAMBADA and StoryCloze

On Penn Tree Bank, the largest model reaches a zero-shot perplexity of 20.50, against the prior zero-shot result of 35.8. The study omits Wikipedia-based datasets and the one-billion word benchmark, because much of their content appears in the training data, and the PTB dataset predates the modern internet.

On LAMBADA, GPT-3 reaches 76.2 accuracy zero-shot, 72.5 one-shot and 86.4 few-shot, against a prior state of the art of 68.0. Perplexity on LAMBADA falls from 3.00 zero-shot to 1.92 few-shot, while one-shot sits at 3.35 and is worse than zero-shot on both measures. On StoryCloze, accuracy rises from 83.2 zero-shot to 87.7 few-shot, and HellaSwag accuracy moves from 78.9 zero-shot to 79.3 few-shot.

## Winograd and Winogrande pronoun resolution

On the original set of 273 Winograd schemas, using partial evaluation, GPT-3 reaches 88.3% zero-shot, 89.7% one-shot and 88.6% few-shot.

On the adversarially mined Winogrande dataset, in-context learning helps more, with GPT-3 at 70.2% zero-shot, 73.2% one-shot and 77.7% few-shot. A fine-tuned RoBERTa model reaches 79%, the state of the art of 84.6% comes from a fine-tuned high-capacity T5 model, and human performance is 94.0%. Figure 3.5 shows that the gains from few-shot learning grow with model size, and that the few-shot 175B model is competitive with a fine-tuned RoBERTa-large.

## Commonsense reasoning results

On PhysicalQA, GPT-3 reaches 82.8% accuracy few-shot on the PIQA test server, against a prior state of the art of 79.4%. Overlap analysis flagged PIQA for possible contamination even though test labels are hidden, so the study conservatively marks the result with an asterisk.

On the Challenge set of ARC, GPT-3 reaches 51.4% zero-shot, 53.2% one-shot and 51.5% few-shot, which approaches a fine-tuned RoBERTa baseline of 55.9%. On the Easy set, GPT-3 reaches 68.8%, 71.2% and 70.1%, which slightly exceeds a fine-tuned RoBERTa baseline, though UnifiedQA stays well ahead. On OpenBookQA, GPT-3 improves markedly from zero-shot to few-shot but remains more than 20 points short of the overall state of the art.

## Reading comprehension results

The study describes its performance as on par with early baselines trained on contextual representations, and states that it is 13 F1 below an ELMo baseline on QuAC.

On DROP, few-shot GPT-3 beats the fine-tuned BERT baseline but stays far below human performance and systems that combine neural networks with symbolic reasoning. On RACE, GPT-3 is still 45% behind the state of the art, which the authors describe as weak relative to the other reading comprehension results.

## SuperGLUE with 32 demonstrations

Few-shot GPT-3 uses 32 examples per task, sampled from the training set, and performs no gradient updates. Its SuperGLUE test-set average is 71.8, above the fine-tuned BERT-Large average of 69.0 and below the fine-tuned state-of-the-art average of 89.0. Performance varies widely by task: WiC reaches 49.4, close to chance, while WSC reaches 80.1 and ReCoRD reaches 90.2 accuracy.

On COPA and ReCoRD, GPT-3 is near state of the art in the one-shot and few-shot settings, with COPA a couple of points short of a fine-tuned 11B T5 model. The dev-set figure for SuperGLUE shows that accuracy grows with model size and with the number of examples in context, and the authors compare the gain from one to eight examples with the difference between two BERT variants.

## Checking benchmark contamination

A clean subset of each benchmark is built by removing examples that share a 13-gram overlap with the pretraining data, and GPT-3 is scored on that subset and compared with the full score.

For the reading comprehension sets QuAC, SQuAD2 and DROP, more than 90% of examples were flagged, but in manual inspection the source text was in training while the question and answer pairs were not. For WMT16 German-English, 25% of examples were flagged with an associated effect of 1-2 BLEU, and the flagged matches were mostly monolingual overlaps about news events.

For PIQA, 29% of examples were flagged and the clean subset showed a 3 percentage point drop in accuracy. The authors note that the overlap analysis is designed to be very conservative and so is expected to produce some false positives.

## Human judgement of synthetic news

The authors generated news articles with GPT-3 and asked human evaluators to judge them, and the evaluators found it difficult to distinguish them from human-written articles.

## Limitations

GPT-3 samples can repeat themselves semantically at the document level, lose coherence over long passages, and contradict themselves. The authors also observe informally that GPT-3 has difficulty with common sense physics questions, despite doing well on PIQA. In one-shot or few-shot settings it does little better than chance on some comparison tasks, such as WiC and ANLI, and on a subset of reading comprehension tasks.

The study uses only autoregressive models, without bidirectional architectures or denoising objectives, so it may underperform on tasks that benefit from looking at both sides of a context.

The uniform token weighting of the pretraining objective and the large amount of text needed in pre-training are further constraints that the authors flag as directions for future work.

## Paper info

- **Authors**: Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, Dario Amodei
- **Venue**: arXiv · Preprint
- **First published**: 2020-5-28
- **Added**: 2026-10-20
- **Updated**: 2020-7-22
- **Version**: v4
- **arXiv**: 2005.14165
- **Category**: cs.CL
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/2005.14165v4) · [PDF ↗](https://arxiv.org/pdf/2005.14165v4)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse et al. (2020). Language Models are Few-Shot Learners. arXiv:2005.14165v4. https://arxiv.org/abs/2005.14165v4

**BibTeX**

```
@misc{brown2020language,
  title = {{Language Models are Few-Shot Learners}},
  author = {Tom B. Brown and Benjamin Mann and Nick Ryder and Melanie Subbiah and Jared Kaplan and Prafulla Dhariwal and Arvind Neelakantan and Pranav Shyam and Girish Sastry and Amanda Askell and Sandhini Agarwal and Ariel Herbert-Voss and Gretchen Krueger and Tom Henighan and Rewon Child and Aditya Ramesh and Daniel M. Ziegler and Jeffrey Wu and Clemens Winter and Christopher Hesse and Mark Chen and Eric Sigler and Mateusz Litwin and Scott Gray and Benjamin Chess and Jack Clark and Christopher Berner and Sam McCandlish and Alec Radford and Ilya Sutskever and Dario Amodei},
  year = {2020},
  eprint = {2005.14165},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2005.14165v4}
}
```

## Other paper commentary

- [RoBERTa: A Robustly Optimized BERT Pretraining Approach](https://refivu.com/en/papers/3dc17b50-5c0f-4503-a368-4b0d9e86745c-roberta-a-robustly-optimized-bert-pretraining-approach.md)
- [LoRA: Low-Rank Adaptation of Large Language Models](https://refivu.com/en/papers/fec4f8e4-2771-4948-a986-0295db47b321-lora-low-rank-adaptation-of-large-language-models.md)
- [To Believe or Not to Believe Your LLM: Iterative Prompting for Estimating Epistemic Uncertainty](https://refivu.com/en/papers/b71ecca0-59f2-4260-b74f-1c35839640b8-to-believe-or-not-to-believe-your-llm.md)
- [Representation Drift Compensation: A Near-Zero Inference Cost Enhancement for LLM Decomposition](https://refivu.com/en/papers/b9ad989e-7c06-4f6f-8008-335a945d3a5d-representation-drift-compensation-a-near-zero-inference-cost.md)
- [Random Selection Reveals Implicit Knowledge Consensus in Code Generation](https://refivu.com/en/papers/3824968b-20fc-4c3a-89c4-30ce0f08c74f-random-selection-reveals-implicit-knowledge-consensus-in.md)
- [Evaluating Ukrainian Grammatical Competence in Language Models: Probability Versus Prompting](https://refivu.com/en/papers/b9da328b-a55a-404e-8dab-7573f504b062-evaluating-ukrainian-grammatical-competence-in-language.md)
- [Generative Adversarial Networks](https://refivu.com/en/papers/b0edf89c-f6c4-4cce-9c25-eccaea8dcfc9-generative-adversarial-networks.md)
- [Trust Region Policy Optimization](https://refivu.com/en/papers/30e842a2-bb44-47ff-9ad7-d25925260b2c-trust-region-policy-optimization.md)
- [Learning Transferable Visual Models From Natural Language Supervision](https://refivu.com/en/papers/c2ad57ff-fd96-4ad1-af27-4195a16c557d-learning-transferable-visual-models-from-natural-language.md)
- [Efficient Estimation of Word Representations in Vector Space](https://refivu.com/en/papers/d295cb4b-dace-4ef1-9199-b860d9b1f123-efficient-estimation-of-word-representations-in-vector-space.md)
- [Sequence to Sequence Learning with Neural Networks](https://refivu.com/en/papers/2ac7aa06-39ab-48fb-868d-81dbac5767e6-sequence-to-sequence-learning-with-neural-networks.md)
- [Proximal Policy Optimization Algorithms](https://refivu.com/en/papers/831b67ec-e2f9-4c8f-914d-dc9387e23e27-proximal-policy-optimization-algorithms.md)

## Terms in this paper

- [Accuracy](https://refivu.com/en/terms/1995c0cd6282-accuracy)
- [perplexity](https://refivu.com/en/terms/2b204e513801-perplexity)
- [BLEU](https://refivu.com/en/terms/42cd9b97719e-bleu)
- [beam search](https://refivu.com/en/terms/3e449f8f713b-beam-search)
- [in-context learning](https://refivu.com/en/terms/d53d2af6b551-in-context-learning)
- [GPT-2](https://refivu.com/en/terms/3c130f2029b4-gpt-2)
- [SuperGLUE](https://refivu.com/en/terms/e4683d9c222e-superglue)
- [RACE](https://refivu.com/en/terms/0dc449cd7f20-race)
- [Sparse Transformer](https://refivu.com/en/terms/f87fc7b2ecf4-sparse-transformer)
- [13-gram overlap](https://refivu.com/en/terms/ec3165f23fd1-13-gram-overlap)
- [Common Sense Reasoning](https://refivu.com/en/terms/5c7ebea09fb2-common-sense-reasoning)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/82602214-e941-40a1-bc42-5b92c1268a53-language-models-are-few-shot-learners)
