Research

Language Models are Few-Shot Learners

GPT-3 showed that scaling an autoregressive language model to 175B parameters can produce strong task performance from instructions and examples in the prompt, without gradient updates.

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 AmodeiMay 28, 2020NeurIPS 202018 min readOpenAI
FOUNDATIONALLarge Language ModelsAdvanced

Key takeaway

A 175B-parameter autoregressive Transformer trained on 300B tokens. At inference, tasks are specified in the prompt using zero, one, or a few examples; model weights are not updated.

Updated on Nov 23, 2026

01

Abstract

Overview

GPT-3 is a large autoregressive Transformer language model introduced by OpenAI in 2020. Its central claim is that increasing model and data scale can substantially improve task-agnostic performance. Rather than fine-tuning separately for each benchmark, GPT-3 is given a task description and optional demonstrations directly in the prompt. The paper evaluates three settings: zero-shot (instruction only), one-shot (one example), and few-shot (a small set of examples).

02

Background

Related work

GPT-3 builds directly on the GPT-2 autoregressive language-model approach and the Transformer architecture. It connects to work on neural language-model scaling laws, sparse attention, and large-scale unsupervised pretraining. Its few-shot prompting results helped motivate later work on instruction tuning, preference optimization, retrieval augmentation, and systematic prompt-based evaluation.

03

Methodology

Core idea

The model learns broad statistical structure by predicting the next token over a large text mixture. At inference, the prompt acts as temporary task context: examples demonstrate the desired input-output pattern, and the model continues it. This is called in-context learning. Crucially, the demonstrations do not cause gradient updates; the parameters remain fixed during task execution.

Method

Training uses causal next-token prediction: given preceding tokens, predict the next token. The paper compares zero-shot, one-shot, and few-shot prompting across language, reasoning, translation, question-answering, and other tasks. In few-shot evaluation, examples are placed in the context window, followed by the test input; the model generates the completion without task-specific fine-tuning.

Figure 1

In-context learning as meta-learning

Figure 1.1 frames the paper's central idea. The outer loop is ordinary pre-training: stochastic gradient descent on next-token prediction over a huge text corpus, during which the model acquires a broad set of skills and pattern-recognition abilities. The inner loop is in-context learning: within a single forward pass, the model recognizes the pattern in the examples earlier in its context (arithmetic, fixing misspelled words, English-to-French translation) and continues it. No weights change in the inner loop. The authors stress that these sequences are illustrative, not real training data; the point is that natural text sometimes contains repeated sub-tasks inside one sequence, which is one way such an ability could be learned.

Figure 1.1 from Brown et al. (2020), supplied by the user. Paper: NeurIPS 2020.

Figure 2

Zero-, one- and few-shot prompting versus fine-tuning

This is the evaluation protocol used throughout the paper (Section 2). In all three in-context settings the model only runs forward passes at test time. Zero-shot gives a natural-language task description and the prompt; one-shot adds a single solved example; few-shot adds as many examples as fit in the 2,048-token context window, typically 10 to 100. Traditional fine-tuning, on the right, updates the weights with gradient steps over a labeled dataset and is deliberately not used for GPT-3. The trade-off the paper weighs: fine-tuning usually scores higher on a given benchmark, but it needs a new labeled dataset per task and can exploit spurious features of a narrow training distribution, while few-shot learning needs only a handful of examples.

Figure 2.1 from Brown et al. (2020), supplied by the user. Paper: NeurIPS 2020.

04

Architecture

GPT-3 follows the GPT-2-style decoder-only, autoregressive Transformer design, with modified initialization and pre-normalization. The largest model has 175 billion parameters, 96 layers, width 12,288, and 96 attention heads. The architecture uses alternating dense and locally banded sparse attention patterns. The context window is 2,048 tokens. The study trained eight model sizes, from 125M through 175B parameters.

Figure 3

Eight model sizes, one architecture

All eight models share GPT-2's architecture with one change: dense and locally banded sparse attention layers alternate, as in the Sparse Transformer. n_params is the trainable parameter count, n_layers the number of layers, d_model the hidden size, n_heads the number of attention heads and d_head the size of each head; the feed-forward layer is always 4 x d_model and the context window is 2,048 tokens. The largest model, "GPT-3", has 96 layers, 96 heads of 128 dimensions and d_model = 12,288. Larger models use larger batches and smaller learning rates. Every model is trained on the same 300 billion tokens, so size is the main variable, which is what lets the paper draw clean scaling curves. (40 heads x 128 = 5,120, so the 5,140 printed for the 13B model is likely a typo.)

Table 2.1 from Brown et al. (2020), supplied by the user. Paper: NeurIPS 2020.

05

Training

Regularization and training stability

The paper largely retains GPT-2 training design choices, including pre-normalization and modified initialization. It does not introduce a new task-specific regularizer as its main contribution. Generalization is studied empirically through held-out validation loss and downstream task performance across model scales. The authors also analyze possible benchmark contamination arising from web-scale pretraining data.

Data and compute

All eight models were trained on 300 billion tokens. The training mixture combines filtered Common Crawl with WebText2, Books1, Books2, and Wikipedia, with sampling weights chosen to improve quality and avoid over-reliance on the largest raw source. The 175B model required substantial distributed training across GPUs and model-parallel dimensions. The 300B figure is the number of training tokens, not the raw size of the source datasets.

Implementation notes

A conceptual reproduction requires a decoder-only Transformer, causal attention, large-scale next-token pretraining, and an inference interface that serializes task instructions and demonstrations into a prompt. The original 175B training run is not realistically reproducible for most teams. Smaller open models can demonstrate the prompting protocol, but they are not equivalent replications of GPT-3 or its scale-dependent results.

Figure 4

Training compute compared with BERT, RoBERTa and T5

Training compute is shown in petaflop/s-days (one petaflop per second sustained for a day) on a log scale. Following the scaling-laws analysis of Kaplan et al. (2020), GPT-3 trains much larger models on comparatively fewer tokens than is typical. As a result, the roughly 3B-parameter GPT-3 model, almost 10x larger than RoBERTa-Large (355M parameters), used about the same ~50 petaflop/s-days. GPT-3 175B used several thousand petaflop/s-days (Appendix D gives the method), roughly ten times more than T5-11B. The 300B training tokens come from a weighted mix: filtered Common Crawl (60%), WebText2 (22%), Books1 and Books2 (8% each) and Wikipedia (3%). Higher-quality sources are sampled more often than their size alone would suggest, accepting a little overfitting in exchange for better data.

Figure 2.2 from Brown et al. (2020), supplied by the user. Paper: NeurIPS 2020.

06

Results

Performance generally improves with model scale and with more examples in the prompt. GPT-3 is competitive with or exceeds fine-tuned systems on selected tasks, while remaining behind strong task-specific systems on others. The paper demonstrates useful few-shot behavior in translation, question answering, cloze completion, arithmetic, word manipulation, and text generation. Results are uneven: strong aggregate progress does not mean reliable reasoning or state-of-the-art performance on every benchmark.

Evaluation protocol

The paper evaluates tasks under zero-shot, one-shot, and few-shot conditions, generally varying the number of demonstrations within the context window. It compares results with prior task-specific systems and examines scaling trends across eight model sizes. For modern evaluation, add contamination checks, held-out private test sets, prompt sensitivity tests, calibration, factuality, robustness, and cost/latency measurements.

Figure 5

Validation loss follows a power law in compute

Each curve is one training run, coloured by model size (non-embedding parameters, from 10^5 to 10^11). Plotted against training compute, the lowest loss reachable at each compute budget falls on a straight line in log-log space, L = 2.57 * C^-0.048. This is the power law reported by Kaplan et al. (2020), and GPT-3 extends it by two more orders of magnitude with only small deviations: the yellow 175B curve keeps tracking the frontier. Lower cross-entropy matters because the paper finds it leads to consistent gains across a broad range of downstream tasks. Section 3.1 gives a concrete case: on Penn Treebank, GPT-3 zero-shot reaches 20.5 perplexity against a previous zero-shot best of 35.8. PTB was the only classic language-modeling benchmark kept, because the Wikipedia-based ones and most of One Billion Word overlap with GPT-3's training data.

Figure 3.1 from Brown et al. (2020), supplied by the user. Paper: NeurIPS 2020.

Figure 6

Aggregate performance across 42 benchmarks

The faint lines are individual benchmarks; the bold lines are the average over all 42 accuracy-based benchmarks in the paper, for each of the eight model sizes. Zero-shot accuracy improves steadily with size, but few-shot accuracy improves faster, so the gap between the settings widens, from almost nothing at 0.1B to roughly 15 points at 175B. That widening gap is the paper's headline claim: larger models are better in-context learners. The spread of faint lines is a reminder that the average hides large variation; some tasks barely move, and the paper itself notes few-shot GPT-3 still struggles on natural language inference (such as ANLI) and some reading comprehension datasets (such as RACE and QuAC).

Figure 1.3 from Brown et al. (2020), supplied by the user. Paper: NeurIPS 2020.

Figure 7

Larger models learn more from examples in context

The task is to remove random symbols inserted into a word (for example, "s.u!c/c!e.s s i/o/n" becomes "succession"), a skill unlikely to appear verbatim in training data. The x-axis is the number of solved examples K placed in the context; solid lines include a natural-language task description and dashed lines do not. The 1.3B model barely improves with more examples, 13B improves slowly, and 175B climbs steeply to about 67% with a few dozen examples. The task description helps most when there are few examples (at one-shot, about 46% with it versus about 26% without for 175B), and its effect fades as examples accumulate. These steeper in-context learning curves for larger models are the evidence behind the paper's title; the authors report qualitatively similar behaviour across many tasks (Section 3.9.2).

Figure 1.2 from Brown et al. (2020), supplied by the user. Paper: NeurIPS 2020.

07

Limitations

GPT-3 can produce fluent but false or nonsensical answers, struggles with some tasks requiring precise multi-step reasoning, and is sensitive to prompt wording and example selection. Training on web corpora introduces potential benchmark contamination, bias, toxic content, and privacy concerns. The compute and energy costs are high, and the paper does not establish that scaling alone solves reliability or factuality.

08

Conclusion

Contributions

The paper provides a large-scale empirical study of task-agnostic language-model scaling; popularizes zero-, one-, and few-shot evaluation as a unified comparison; documents in-context learning across diverse tasks; and highlights the relationship between model size, prompt demonstrations, and downstream performance. It also includes analyses of limitations, data contamination, and societal risks.

Key takeaways

In-context learning lets a pretrained model adapt its behavior from examples in the prompt without changing its weights. Model scale and demonstration count both matter, but performance remains task-dependent. GPT-3 was a milestone in prompting and large language models—not proof of general intelligence or universally reliable reasoning.

FAQ

Is GPT-3 fine-tuned for each task? No. The paper evaluates it without gradient updates; task examples are supplied in the prompt.

What is in-context learning? Conditioning the model on instructions or examples in its input context so it can perform a task without updating parameters.

How large was GPT-3? The largest model had 175 billion parameters; the paper also trained seven smaller sizes.

How much data was used? Each model was trained for 300 billion tokens from a mixture of filtered web text, books, and Wikipedia.

Does few-shot mean the model learns new weights? No. It adapts its output based on context, not through gradient-based parameter updates.

Continue reading

Related research

Browse all research