skip to content

Search

← The Language Machines

Part II — The Transformer Era (2017–2020)

The GPT Lineage

Decoder-only scaling from GPT-1 to GPT-3, and in-context learning as an emergent phenomenon.

2018–2020 12 min read 4 papers

It is June 2018, one year after the Transformer. OpenAI takes only the decoder half of the architecture, trains it to predict the next token, and over the following twenty-three months publishes three papers whose main variable is size: 117 million parameters, then 1.5 billion, then 175 billion. Along the way, the interface to a language model changes from fine-tuning weights to simply writing a prompt — and this chapter is the story of that shift.

Where We Were

The Transformer (The Transformer) arrived in June 2017 as an encoder-decoder architecture for machine translation. It solved the training-speed and long-range-dependency problems of recurrent networks, but it did not by itself change how NLP systems were built. In 2017, the field still operated one task at a time: a bespoke architecture and a labeled dataset for sentiment analysis, another pair for question answering, another for entailment. Labeled data was the bottleneck, and nothing learned on one task transferred cheaply to the next.

The pretrain-then-finetune paradigm — the subject of Pretrain, Then Finetune, which teaches this era in full — broke that bottleneck during 2018. Within it, GPT-1 (Radford et al., 2018), released in June 2018, matters to this chapter for one specific decision: it was a 12-layer, decoder-only Transformer of roughly 117 million parameters, pretrained left-to-right on BooksCorpus and then fine-tuned per task. The architecture — masked self-attention so each token sees only its predecessors, a stack of identical blocks, a next-token softmax on top — is the template every subsequent GPT scales without structural change. Fine-tuned on twelve downstream tasks, this single task-agnostic architecture improved the state of the art on nine of them, including an 8.9-point absolute gain on commonsense-reasoning story completion and 5.7 points on the RACE reading-comprehension benchmark — evidence that a generic decoder pretrained on raw text could out-compete architectures purpose-built per task.

Then, in October 2018, BERT appeared with bidirectional masked pretraining and outperformed GPT-1 across the standard benchmarks. To most of the field, the causal, left-to-right objective looked like the losing branch of the family tree: why let the model see only leftward context when a masked objective could use both directions? The trade-off between the two objectives is taught in Pretrain, Then Finetune; what matters here is that the causal objective had one property the masked objective lacked. A causal model is a generator, and a generator can be asked to continue any text — including text that describes a task. That property was worth little at 117 million parameters. The next two papers in the lineage were experiments in what it was worth at 13 times, and then 1,500 times, that size.

Three papers, one architecture, a thousand-fold in size GPT-1 to GPT-3 change almost nothing structurally. What moves is scale, and with it, how the model is asked to do a task. Grey monospace text is the parameter count and date. 2017 Transformer encoder-decoder, translation June 2017, Vaswani et al. 2018 GPT-1 decoder-only pretraining 117M params, June 2018 2018 BERT masked bidirectional encoder beats GPT-1, October 2018 2019 GPT-2 zero-shot task transfer 1.5B params, February 2019 2020 Kaplan scaling laws loss follows power laws January 2020, OpenAI 2020 GPT-3 few-shot in-context learning 175B params, May 2020 the causal, decoder-only lineage a competing model or a theory paper BERT briefly looked like the winning branch in 2018. Its lead held only until scale made the causal objective's generality decisive.
Three GPT papers in twenty-three months change almost nothing about the architecture. What moves is scale: 117 million parameters, then 1.5 billion, then 175 billion. PNG ↓

The Breakthrough

GPT-2 (Radford et al., 2019), announced in February 2019, reframed the question. Instead of asking how well a pretrained model could be fine-tuned, it asked whether a language model trained on enough diverse text would begin to perform tasks without any fine-tuning at all. The paper’s framing was that a general system should model not a single conditional distribution per task but one distribution conditioned on the task itself — and that natural language can express the task inside the input. A translation demand can be written as text; so can a summarization demand; the string “TL;DR:” is a task specification.

The bet required a dataset broad enough to contain implicit demonstrations of many tasks. The team built WebText by scraping the 45 million outbound links posted on Reddit that had received at least 3 karma — a cheap human-curation signal — yielding just over 8 million documents and 40 GB of text after deduplication and cleaning, with Wikipedia removed to avoid contaminating evaluation sets. The architecture stayed a GPT-1-style decoder with modest changes: layer normalization moved to the input of each sub-block (the now-standard pre-norm arrangement), the context window doubled from 512 to 1024 tokens, and the vocabulary grew to 50,257 tokens of byte-level BPE — a tokenizer choice whose mechanics are the subject of Tokenization. Four sizes were trained: 117M parameters (12 layers — equivalent to the original GPT), 345M (24 layers), 762M (36 layers), and 1,542M (48 layers, 1600-dimensional states).

The result: the 1.5B model set state-of-the-art perplexity on 7 of 8 language-modeling datasets in a zero-shot setting — no gradient step taken on any of them — and reached 63.24% accuracy on the LAMBADA long-range completion task and 70.70% on the Winograd Schema Challenge, a commonsense-reasoning benchmark, a 7-point improvement over the prior state of the art. On every summarization, translation, and question-answering probe, performance improved log-linearly with model size, and the largest model still underfit WebText. That last observation was the loaded gun: capability was climbing with scale and had not yet saturated. OpenAI judged the generation quality concerning enough to withhold the full model at announcement, releasing it in stages — a 774M checkpoint in August 2019 and the full 1.5B model on November 5, 2019.

GPT-3 (Brown et al., 2020), submitted in May 2020, changed almost nothing about the method and everything about the magnitude. The design was informed by the power-law scaling results published by the same broader group four months earlier (Kaplan et al., 2020) — the subject of Scaling Laws. GPT-3 was a 175-billion-parameter decoder: 96 layers, 12,288-dimensional states, 96 attention heads of dimension 128, a 2,048-token context window, trained with a 3.2M-token batch size at a learning rate of 0.6×10⁻⁴. The paper describes it as ten times larger than any previous non-sparse language model. Its training mix drew from a filtered Common Crawl (410B tokens), WebText2 (19B), two book corpora (12B and 55B), and English Wikipedia (3B), sampled non-uniformly for a total of about 300 billion training tokens — the curation questions this raised are taken up in The Data Question.

The headline finding was not a benchmark number but a behavior. Place a few examples of a task inside the prompt — English phrase, French translation, English phrase, French translation, English phrase — and the model completes the pattern, performing the task on the new input with no gradient updates whatsoever. The paper named the settings by the number of demonstrations: zero-shot (a natural-language instruction only), one-shot (one demonstration), and few-shot (typically 10 to 100 demonstrations, as many as fit in the context window). This is in-context learning: task adaptation that happens entirely in the forward pass, in the model’s activations, while the weights stay frozen.

The few-shot numbers made the behavior impossible to dismiss: 86.4% on LAMBADA, 71.2% on TriviaQA open-domain question answering, 100% on two-digit addition and 80.4% on three-digit addition — arithmetic no one trained it to do. On SuperGLUE, few-shot GPT-3 outperformed a fine-tuned BERT-Large on four of eight tasks (while remaining weak on others, such as 49.4% on the WiC word-sense task). And human evaluators asked to distinguish GPT-3-written news articles from human-written ones scored around 52% — barely above chance.

Generation is the same loop, run once per token Every completion, from one word to an essay, is this five-step loop executed repeatedly, each time on a prompt one token longer. Grey monospace text is a concrete number from the GPT lineage. Prompt tokens the text typed so far e.g. Translate to French: Embeddings token plus position vectors 50,257 token vocabulary Decoder block, xN self-attention, then MLP 96 layers in GPT-3 Softmax over vocab a probability per token 50,257-way distribution Next token sampled one token chosen and appended the model's own output fed back in as the new prompt, one token longer the growing prompt a fixed computation step the part that repeats N times The architecture in this loop is unchanged from GPT-1 to GPT-3; only N, the width, and the context length grow.
Every completion is this loop executed once per output token; only the width, depth and context length changed between GPT-1 and GPT-3. PNG ↓

The architecture in this loop is essentially unchanged from GPT-1 to GPT-3 — only NN, the widths, and the context length grow. The lineage is a controlled experiment in scale.

GPT-1 (Jun 2018)GPT-2 (Feb 2019)GPT-3 (May 2020)
Parameters~117M1,542M175,000M
Layers124896
Model width7681,60012,288
Context window5121,0242,048
Training dataBooksCorpusWebText, 40 GB~300B tokens, filtered web + books + Wikipedia
Task adaptationFine-tune weights per taskZero-shot promptingFew-shot in-context learning
ReleasePaper + weightsStaged over 9 monthsAPI only, no weights

The Mathematics

All three models optimize the same pretraining objective — the causal language-modeling loss, whose chain-rule roots go back to From Shannon to N-grams. In GPT-1’s notation, given an unsupervised corpus of tokens U={u1,…,un}\mathcal{U} = \{u_1, \ldots, u_n\}:

L1(U)=∑ilog⁡P(ui∣ui−k,…,ui−1;Θ)L_1(\mathcal{U}) = \sum_{i} \log P\left(u_i \mid u_{i-k}, \ldots, u_{i-1}; \Theta\right)
SymbolMeaning
U\mathcal{U}The unlabeled corpus, a sequence of tokens u1,…,unu_1, \ldots, u_n
uiu_iThe token at position ii
kkThe context window — how many previous tokens the model may condition on
Θ\ThetaThe neural network parameters being trained
P(⋅∣⋅ ;Θ)P(\cdot \mid \cdot\,; \Theta)The model’s predicted probability of the next token given its context

GPT-1 followed this with a supervised fine-tuning stage per task (mechanics in Pretrain, Then Finetune). GPT-2’s conceptual move was to delete that second stage. A task-specific system estimates p(output∣input)p(\text{output} \mid \text{input}); a general one must condition on the task too:

p(output∣input)  ⟶  p(output∣input,task)p(\text{output} \mid \text{input}) \;\longrightarrow\; p(\text{output} \mid \text{input}, \text{task})

GPT-3 made the conditioning concrete. In the few-shot setting, KK demonstration pairs are concatenated with the query into a single context, and the model’s ordinary next-token machinery produces the answer:

y^=arg⁡max⁡y  pθ(y∣x1,y1,x2,y2,…,xK,yK,x)\hat{y} = \arg\max_{y}\; p_\theta\left(y \mid x_1, y_1, x_2, y_2, \ldots, x_K, y_K, x\right)
SymbolMeaning
xj,yjx_j, y_jThe jj-th demonstration: an example input and its correct output, written as text
KKNumber of demonstrations in the prompt (GPT-3 used 10–100, bounded by the context window)
xxThe new query input to be solved
y^\hat{y}The predicted output — the highest-probability continuation
pθp_\thetaThe frozen pretrained language model with parameters θ\theta

Two empirical regularities gave the equation its force. First, few-shot performance improves smoothly as parameters grow — the GPT-3 paper’s aggregate curves show the gap between zero-shot and few-shot widening with scale, which the authors read as larger models being better in-context learners, not just better memorizers. Second, none of this was targeted by the training objective: in-context learning is an emergent phenomenon of scaling the loss in the first equation. Whether such emergence is sharp or an artifact of how we measure it became a live debate later, covered in Scaling Laws.

What It Enabled

The practical consequence of the lineage is a change in who can adapt a language model. In the fine-tuning regime, adapting a model to a task meant a labeled dataset, a training pipeline, GPU time, and a new copy of the weights to serve. In the prompting regime, it means writing text. The cost of trying a new task fell from an ML-engineering project to a few minutes of typing.

Fine-tuning era (2018–2019)Prompting era (2020–)
Task specificationLabeled dataset, thousands of examplesInstruction plus 0–100 examples in the prompt
Who adapts the modelML engineers with training infrastructureAnyone who can write
Artifacts producedOne checkpoint per taskOne shared model, many prompts
Iteration cycleHours to days per experimentSeconds per experiment
ServingDeploy and version each fine-tuned copyOne deployment serves every task
Failure modeOverfits small task dataSensitive to prompt wording and example choice
The interface moves from weights to words Same base model, three different ways of pointing it at a task: update the weights, or just change what you type. Grey monospace text is the parameter count and what changes at inference. Pretrained decoder LM one base model, three eras GPT-1 through GPT-3 GPT-1, 2018 add a head, update weights per task full fine-tune per task GPT-2, 2019 zero-shot: task written into the prompt itself 1.5B params, no gradients GPT-3, 2020 few-shot: demonstrations placed in the prompt 175B params, no gradients One checkpoint per task a new copy of the weights expensive, per task, per team One model, every task adapted by the prompt alone no training run required Prompting, the interface anyone who can write, adapts it prompt engineering, a new job the shared base model fine-tuning: cost grows per task prompting: one model, every task GPT-2 and GPT-3 differ only in how much of the task is shown in the prompt; both leave the weights untouched.
GPT-1's branch gets more expensive with every new task; GPT-2 and GPT-3's branch gets cheaper, which is why the industry settled on prompting. PNG ↓

The distribution model changed with the interface. OpenAI never released GPT-3’s weights; access opened through a commercial API announced on June 11, 2020, and in September 2020 Microsoft took an exclusive license to the underlying model while everyone else consumed it through the API. The language model became a metered utility, and “prompt engineering” became a job description.

The lineage also set the agenda for the rest of this book. The observation that GPT-2 underfit WebText and that GPT-3’s gains tracked smooth power laws made scaling a quantitative discipline — Scaling Laws covers Kaplan and the Chinchilla correction. Raw in-context learning proved awkward to steer, which motivated Instruction Tuning and RLHF — the pipeline that turned GPT-3’s base capability into the ChatGPT product of November 2022 (ChatGPT and the Open Explosion). And the discovery that what you put in the context changes what the model can do is the seed of chain-of-thought prompting and everything in Prompting Becomes Reasoning.

Key Papers

PaperAuthorsYearLinkWhy it matters
Improving Language Understanding by Generative Pre-TrainingRadford et al.2018PDFGPT-1: fixed the decoder-only architecture and the generative-pretraining recipe the whole lineage scales
Language Models are Unsupervised Multitask LearnersRadford et al.2019PDFGPT-2: zero-shot task transfer from web-scale pretraining; showed capability still climbing at 1.5B
Language Models are Few-Shot LearnersBrown et al.2020arXivGPT-3: 175B parameters; named and demonstrated in-context learning as an emergent ability of scale
Scaling Laws for Neural Language ModelsKaplan et al.2020arXivThe power-law results that justified betting a 100x scale-up on the same recipe

PM Lens

Papers referenced