Language Models are Few-Shot Learners
TL;DR. GPT-3 is a 175B-parameter decoder-only Transformer trained on 300B tokens. Its main finding is in-context learning: given a task description and a few solved examples in the prompt, it performs the task with no gradient updates. Few-shot GPT-3 is competitive with fine-tuned models on some benchmarks (TriviaQA, LAMBADA), but weak on others (natural language inference, some reading comprehension). The gap between zero-, one- and few-shot performance tends to grow with model size.
Why it matters now. Prompting, few-shot examples, LLM judges and synthetic data generation all rest on in-context learning. GPT-3 also set the template for later scale-up reports: a family of model sizes, a curated web mixture, contamination checks, and a frank limitations section.
Key idea
Section titled “Key idea”Model (§2.1, Table 2.1). A GPT-2-style Transformer with alternating dense and locally banded sparse attention. Eight sizes from 125M to 175B parameters. The largest has 96 layers, , 96 heads and a 2048-token context. All sizes are trained on 300B tokens.
Data (§2.2, Table 2.2). Filtered Common Crawl (45TB compressed before filtering, 570GB after), plus WebText2, two book corpora and Wikipedia. Sampling is weighted by quality, not size:
| dataset | tokens | weight | epochs in 300B |
|---|---|---|---|
| Common Crawl | 410B | 60% | 0.44 |
| WebText2 | 19B | 22% | 2.9 |
| Books1 | 12B | 8% | 1.9 |
| Books2 | 55B | 8% | 0.43 |
| Wikipedia | 3B | 3% | 3.4 |
Evaluation settings (§2). All use the same frozen weights:
- Zero-shot: a task description and the query.
- One-shot: plus one solved example.
- Few-shot: plus solved examples, typically 10–100, as many as fit in the context.
Multiple-choice tasks are scored by comparing per-token-normalised likelihoods of the options.
Compute. About FLOPs, which the appendix reports as .
Key results
Section titled “Key results”- LAMBADA (Table 3.2). Accuracy 76.2 zero-shot, 72.5 one-shot and 86.4 few-shot, against a previous best of 68.0. Few-shot perplexity is 1.92. The few-shot fill-in-the-blank format shows the model that a single word is wanted.
- Closed-book QA (Table 3.3). Few-shot: Natural Questions 29.9, WebQuestions 41.5, TriviaQA 71.2. A fine-tuned retrieval-augmented model (RAG) gets 44.5, 45.5 and 68.0. So GPT-3 beats it on TriviaQA but not on Natural Questions.
- Arithmetic (Table 3.9). Few-shot: 100% on 2-digit addition, 98.9% on 2-digit subtraction, 80.4% and 94.2% for 3 digits, about 25–27% for 4 digits and about 9–10% for 5 digits. Only 0.8% of 3-digit addition test problems appeared in the training data.
- Weak spots. Performance is close to chance on WiC and weak on ANLI and some reading comprehension tasks, which the authors link to the lack of a bidirectional objective.
- Contamination (§4). About a quarter of benchmarks have more than 50% of items flagged, but most scores barely change on clean subsets. PIQA and Winograd are marked as possibly affected. Some Wikipedia language-modelling benchmarks and the Children’s Book Test were dropped.
Limitations & open questions
Section titled “Limitations & open questions”The paper’s §5 is unusually candid:
- Text quality. Long generations repeat, lose coherence and sometimes contradict themselves. The model struggles with common-sense physics.
- Objective. No bidirectional or denoising objectives, and every token is weighted equally regardless of importance.
- Sample efficiency. Pretraining sees far more text than a human does in a lifetime.
- Learning or recognising? It is unclear whether few-shot examples teach a new task or only identify one learned in pretraining.
- Cost. Inference is expensive; the authors suggest distillation.
- Bias and misuse. §6 studies gender, race and religion biases and misuse risks.
Connections
Section titled “Connections”- Architecture: Attention Is All You Need. Contrast the encoder-only BERT and the encoder-decoder T5.
- Scaling: Kaplan scaling laws guided the model sizes; Chinchilla later showed models like GPT-3 were under-trained on data. Emergent abilities builds on its scaling curves.
- Prompting: Chain-of-Thought adds reasoning steps to few-shot examples.
- Data and contamination: FineWeb and DCLM for modern web filtering; contamination.
- Build it: Karpathy’s Let’s build GPT codes a small version of this architecture.
Questions to think through
These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.
- Derive / compute
GPT-3 175B was trained on 300B tokens. Estimate its training compute with the 6·N·D rule, convert it to petaflop/s-days (1 pf-day = 8.64 × 10^19 FLOPs), and compare with the 3.14 × 10^23 FLOPs the paper reports. Then compute how many times Common Crawl was seen, given 410B tokens and a 60% sampling weight.
What a strong answer covers
- 6 × 175 × 10^9 × 300 × 10^9 ≈ 3.15 × 10^23 FLOPs, matching the reported 3.14 × 10^23.
- 3.14 × 10^23 / 8.64 × 10^19 ≈ 3,640 pf-days, consistent with "several thousand petaflop/s-days".
- Common Crawl: 0.60 × 300B / 410B ≈ 0.44 epochs, as in Table 2.2. Smaller, higher-quality sets were repeated (Wikipedia 3.4 epochs).
- By the later Chinchilla rule of thumb (about 20 tokens per parameter) a 175B model would want about 3.5T tokens, so GPT-3 was heavily under-trained on data.
- Mechanism
On LAMBADA, GPT-3 175B scores 76.2 zero-shot, 72.5 one-shot and 86.4 few-shot. Explain what changes between the three settings, why one example can hurt while many help, and what the paper's fill-in-the-blank format has to do with it.
What a strong answer covers
- All three use the same frozen weights; only the context changes: a task description plus 0, 1 or K (10–100) solved examples.
- LAMBADA asks for the last word of a passage. Without guidance the model may continue with several words; the few-shot fill-in-the-blank format shows that exactly one word is wanted.
- The paper notes one-shot does worse than zero-shot here, plausibly because a single example is not enough for the model to recognise the pattern and may add noise.
- This illustrates the paper's own ambiguity: in-context examples may teach a new task or only help the model recognise one it already knows and the right output format.
- Critique
Section 4 studies training-data contamination. Describe the method, what it found for PIQA, Winograd, reading comprehension and LAMBADA, and why its conclusions are weaker than they first appear.
What a strong answer covers
- A filtering bug left some test overlap in the training data, and retraining was too costly. For each benchmark the authors built a "clean" subset with no 13-gram overlap and compared scores.
- PIQA (29% flagged) dropped 3 points and Winograd (45% flagged) 2.6 points on clean subsets; both are marked with an asterisk. Reading-comprehension sets were over 90% flagged, but mostly because source passages, not QA pairs, appeared in training. LAMBADA had real contamination but the clean score was within 0.5%.
- Clean subsets are not random samples: removing overlapping items can shift difficulty, so a small change does not prove contamination did not help.
- 13-gram overlap misses paraphrases and translations, so false negatives are likely.
- What if…
For few-shot arithmetic GPT-3 175B scores 100% on 2-digit addition, 80.4% on 3-digit addition and 25.5% on 4-digit addition. How did the authors check that this is not memorisation, and what does the drop with digit count suggest?
What a strong answer covers
- They searched the training data for 3-digit test problems in forms like "<NUM1> + <NUM2> =" and "<NUM1> plus <NUM2>" and found 17 of 2,000 addition (0.8%) and 2 of 2,000 subtraction (0.1%) problems.
- So most correct answers were not copied, which suggests the model computes something addition-like.
- Accuracy falls sharply with digit count and the 13B model solves only about half of 2-digit problems, so the skill is brittle and depends on scale.
- A string search does not rule out memorised partial patterns, and the BPE tokenisation of numbers makes digit-level carrying harder; both are confounds.
- Design
Design an experiment that separates "learning a new task from the examples" from "recognising a known task" in few-shot prompting, using GPT-3-style models of several sizes.
What a strong answer covers
- Use tasks whose input-output mapping cannot be in pretraining: random symbol substitutions, invented label words, or flipped labels on a known task.
- Compare accuracy with correct, flipped and random labels in the examples. If labels barely matter, the model is mostly recognising format and task.
- Vary K and model size; the paper's claim that bigger models are better meta-learners predicts steeper gains with K at larger sizes.
- Control for format by including a condition with the right format but no input-output pairing.
- Connect
Closed-book GPT-3 few-shot beats a fine-tuned retrieval-augmented model on TriviaQA (71.2 vs 68.0) but loses badly on Natural Questions (29.9 vs 44.5). Explain the difference and what it implies for retrieval-augmented systems.
What a strong answer covers
- Closed-book means answers must come from the weights. TriviaQA questions are about widely repeated trivia, which large models memorise well.
- Natural Questions are real search queries that often need specific, long-tail facts that a model sees rarely in pretraining.
- So parametric knowledge covers frequent facts but not the long tail, which is where retrieval adds the most.
- The same trade-off drives modern RAG design, including how much to trust retrieved text versus the model's memory.