The transformer and the scale era: 2017–2022¶
In June 2017 eight Google researchers published an architecture built only from attention. Within five years the same block was reading, writing, coding, drawing and folding proteins, and the field had found something it never had before: a recipe whose returns could be forecast. Make the model bigger, feed it more text, spend more compute, and the loss falls along a straight line on a log-log plot. This page is the story of that discovery, its correction, and the alignment trick that turned a text predictor into ChatGPT.
10,000 ft
This is the second act of the third AI boom. The deep learning reset had shown that learned representations beat hand-made ones; this era found the one architecture, the transformer, and the one objective, next-token prediction on web-scale text, that kept improving as you scaled them. Its three intellectual products are self-attention, scaling laws and learning from human preferences. Its industrial product is the frontier lab: an organisation whose main input is compute and whose main bet is that the curve keeps going. Everything in the assistant era is built on what was settled here.
2,000 ft
Five steps, each a response to the limit of the one before:
- Architecture. Drop recurrence; let every token attend to every other token in parallel. Training becomes one big batch of matrix multiplications, which is what GPUs and TPUs do best.
- Pre-train, then adapt. Train once on unlabelled text, then fine-tune cheaply for each task. Labelled data stops being the bottleneck.
- Scale. Make the pre-trained model 1,000× bigger. At 175 billion parameters it does new tasks from a few examples in the prompt, with no fine-tuning at all.
- Predict and correct. Loss is a power law in parameters, data and compute, so labs can plan a USD 10 million run from USD 10,000 experiments. In 2022 Chinchilla corrected the first laws: most big models had been trained on too little data.
- Align. A raw model continues text; it does not follow instructions. Fine-tuning on human demonstrations and preferences makes a small model more useful than a big raw one, and puts a chat interface on top.
Ground level¶
2017: attention is all you need¶
By 2016 the best translation systems, Google's GNMT among them, were recurrent networks with attention bolted on (see the deep learning reset). Recurrence had a structural cost: an LSTM reads a sentence one token after another, so the computation for token 50 must wait for tokens 1 to 49. On hardware built for massive parallelism that is a terrible fit, and it limited how much data a model could see in a week.
On 12 June 2017 Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan Gomez, Łukasz Kaiser and Illia Polosukhin posted "Attention Is All You Need". It proposed a network "based solely on attention mechanisms, dispensing with recurrence and convolutions entirely". Each layer lets every position compute a query, compare it with a key from every other position, and take a softmax-weighted average of their values; several such heads run side by side; a small MLP follows; residual connections and layer normalisation wrap both. Position is injected with sinusoidal encodings, because attention by itself ignores order.
The paper's own Table 1 states the trade it made. A self-attention layer costs \(O(n^2 d)\) operations for a sequence of length \(n\) and width \(d\), against \(O(n d^2)\) for a recurrent layer, but it needs only \(O(1)\) sequential steps instead of \(O(n)\), and any two tokens are one hop apart instead of \(n\). For sentences, where \(n < d\), attention is cheaper and parallel. The quadratic cost in \(n\) would become the central engineering problem of long context five years later (KV cache and efficient attention).
The results were good rather than miraculous: 28.4 BLEU on WMT 2014 English-to-German, "improving over the existing best results, including ensembles, by over 2 BLEU", and 41.8 on English-to-French. What mattered was the cost. The big model trained in 3.5 days on eight NVIDIA P100 GPUs, a fraction of the compute of the systems it beat. An architecture that learned as well and trained several times faster would win any race decided by data and compute, and every later race was.
The authors listed themselves in random order with an asterisk for "equal contribution". Within a few years nearly all of them had left Google to found or join start-ups: Gomez co-founded Cohere, Shazeer Character.AI, Polosukhin NEAR, Uszkoreit Inceptive, Jones Sakana AI, and Vaswani and Parmar Adept and then Essential AI; Kaiser joined OpenAI. Google published the idea that powered its competitors, which is the clearest example of how open research spread this era.
The rest of 2017 planted every other seed. In January Shazeer and colleagues had shown sparsely-gated mixtures of experts with up to 137 billion parameters, the ancestor of today's MoE models. In June, Paul Christiano, Jan Leike, Tom Brown, Miljan Martic, Shane Legg and Dario Amodei (OpenAI and DeepMind together) trained agents from human preferences between pairs of behaviours, needing feedback on "less than one percent of our agent's interactions": the core of RLHF. In July OpenAI's John Schulman and colleagues published PPO, the RL algorithm that would do the optimising. In October DeepMind's AlphaGo Zero learned Go from self-play alone and beat the version that had defeated Lee Sedol 100 games to 0. The same year NVIDIA's V100 shipped with tensor cores, units specialised for small matrix multiplies, and Google described its second-generation TPU for training as well as inference.
2018: pre-train once, fine-tune everywhere¶
Computer vision had used ImageNet-pre-trained networks as a starting point since 2014. Language caught up in a burst during 2018, when three groups showed that a model pre-trained to predict words learns representations that transfer to almost any language task.
- ULMFiT (January; Howard and Ruder) fine-tuned an LSTM language model for text classification, "reducing the error by 18-24% on the majority of datasets".
- ELMo (February; Peters et al., AI2) used the hidden states of a bidirectional LSTM language model as contextual word vectors: bank got different vectors in river bank and bank loan, which word2vec could not do.
- GPT (June; Radford, Narasimhan, Salimans and Sutskever at OpenAI, "Improving Language Understanding by Generative Pre-Training") put the transformer's decoder half on the job: a 12-layer, 117-million-parameter model trained to predict the next token on about 7,000 unpublished books, then fine-tuned. It improved the state of the art on 9 of the 12 tasks it tried.
- BERT (October; Devlin, Chang, Lee and Toutanova at Google, arXiv) used the encoder half and a fill-in-the-blank objective, so each word could see both sides of its context. BERT-large (340 million parameters) pushed the GLUE benchmark to 80.5%, "7.7% point absolute improvement", and topped eleven tasks at once. Google put it into Search in 2019.
In 2018 BERT looked like the winner: it was better at the benchmarks people cared about, and "understanding" (classification, search, extraction) was where the money was. The decoder-only branch looked like a curiosity that generated plausible paragraphs. The reversal came from scale, and from noticing that generation is the more general interface: any task can be phrased as text in, text out.
2019: too dangerous to release, and the bitter lesson¶
On 14 February 2019 OpenAI announced GPT-2: the same architecture, 1.5 billion parameters, trained "simply to predict the next word in 40GB of Internet text" scraped from pages linked on Reddit. Without any fine-tuning it wrote coherent news-style paragraphs and did rough zero-shot translation, summarisation and question answering (paper). OpenAI withheld the full model, citing misuse risks, and released it in stages; the 1.5B weights came out in November. Critics called it a publicity stunt, defenders a responsible-disclosure experiment. Either way it was the first time a lab treated a language model's release as a policy decision, and it set the template for staged access that every frontier lab now uses.
The same year turned research into an industry:
- March. OpenAI created a "capped-profit" company, OpenAI LP, under its non-profit board, to raise the capital that compute now required. Rich Sutton posted The Bitter Lesson: "general methods that leverage computation are ultimately the most effective, and by a large margin". Hinton, LeCun and Bengio received the 2018 Turing Award.
- July. Microsoft invested USD 1 billion in OpenAI and became its exclusive cloud provider. Facebook's RoBERTa showed BERT had been undertrained: same model, more data and longer training, better results. (Hold that thought until 2022.)
- September–October. NVIDIA's Megatron-LM split an 8.3-billion-parameter model across 512 GPUs; Google's T5 cast every task as text-to-text, trained an 11-billion-parameter model on the 750 GB "C4" web corpus, and ran the most careful ablation study of the era. Model parallelism became routine (distributed training).
Games were the other showcase of scale: DeepMind's AlphaStar reached Grandmaster level in StarCraft II and OpenAI Five beat the world-champion Dota 2 team, both on enormous self-play budgets. They were the last major milestones in which reinforcement learning, not language, led the field.
2020: scaling laws and GPT-3¶
In January 2020 Jared Kaplan, Sam McCandlish and colleagues at OpenAI published Scaling Laws for Neural Language Models. Across hundreds of training runs, test loss fell as a power law in parameters \(N\), dataset size \(D\) and compute \(C\), "with some trends spanning more than seven orders of magnitude", while width, depth and other architectural details mattered little. A power law is a straight line on a log-log plot, and a straight line can be extrapolated. The paper also drew a strong conclusion about how to spend a budget: "training very large models on a relatively modest amount of data and stopping significantly before convergence". That advice shaped every big model of the next two years, and was partly wrong.
In May the same group published GPT-3: 175 billion parameters, 96 layers, a 2,048-token context, about 300 billion training tokens, roughly 3.14 × 10²³ FLOP. Its title stated the finding: Language Models are Few-Shot Learners. Put three worked examples of a new task in the prompt and the model continued the pattern, a behaviour the authors called in-context learning, with no weight updates at all. Arithmetic, unscrambling words, writing news articles that human readers identified as machine-written barely above chance: abilities that were weak at 1B parameters became usable at 175B.
OpenAI did not release the weights. In June it opened an API instead and began charging for tokens, and in September Microsoft licensed GPT-3 exclusively. A model had become a product delivered as a service; developers built the first copywriting and chatbot start-ups on it. Open replications followed from a grassroots collective, EleutherAI, which assembled The Pile (825 GB of text) and released GPT-Neo and GPT-J in 2021.
Three other 2020 papers became pillars of later eras: Lewis et al.'s retrieval-augmented generation (May), connecting a model to an external index (RAG); Ho, Jain and Abbeel's denoising diffusion probabilistic models (June), which revived the 2015 diffusion idea and soon overtook GANs (diffusion models); and Dosovitskiy et al.'s Vision Transformer (October), "an image is worth 16x16 words", which showed that the transformer, given enough data, needs no convolutions for vision either.
Science. On 30 November 2020 the CASP14 protein-structure assessment reported that DeepMind's AlphaFold 2 predicted structures with a median score of 92.4 GDT across all targets, around 90 being informally competitive with experiment (DeepMind). Its core, the Evoformer, is attention over residue pairs. A 50-year-old problem in biology fell to the same family of ideas as translation; Hassabis and John Jumper shared the 2024 Nobel Prize in Chemistry for it (AI for science).
NVIDIA's A100 (May 2020) and Google's TPU v4 pods became the machines the next generation of models trained on.
2021: images, code and foundation models¶
Images. In January OpenAI announced DALL·E, a 12-billion- parameter transformer generating images from captions, and CLIP, which learned a shared embedding of images and text from 400 million captioned web images and could classify ImageNet zero-shot. CLIP's text encoder became the steering wheel for most image generators that followed (vision transformers and CLIP). In December Rombach and colleagues' latent diffusion ran the diffusion process in a compressed latent space, cheap enough for a consumer GPU: the basis of Stable Diffusion.
Code. In June GitHub previewed Copilot, built on OpenAI's Codex, a GPT-3 fine-tuned on public code. The Codex paper (July) introduced the HumanEval benchmark of 164 hand-written programming problems: GPT-3 solved 0%, a 12B Codex 28.8% on the first try and 70.2% when allowed 100 samples. Programming became the first profession where language models were daily tools, a lead it kept.
Sparse and enormous. Google's Switch Transformer (January) reached 1.6 trillion parameters by routing each token to one of many expert MLPs, so compute per token stayed small. Microsoft and NVIDIA's dense Megatron-Turing NLG reached 530 billion in October. DeepMind's Gopher (280 billion, December) came with the most thorough evaluation of the period across 152 tasks, and RETRO matched GPT-3-class models with 25× fewer parameters by retrieving from a 2-trillion-token database.
A name and new labs. In August Stanford's Center for Research on Foundation Models published On the Opportunities and Risks of Foundation Models, naming the paradigm: one large pre-trained model adapted to many downstream uses, with all its flaws inherited downstream. The same year Dario and Daniela Amodei and several colleagues left OpenAI and founded Anthropic, a safety-focused lab; Shazeer and Daniel De Freitas left Google, frustrated that their chatbot LaMDA was not being launched, and founded Character.AI. Hu et al.'s LoRA made fine-tuning a large model cheap by training two thin matrices per layer instead of all the weights (PEFT and LoRA).
2022: the year everything converged¶
Nearly every ingredient of the assistant era was published in the eleven months before ChatGPT.
- January. Jason Wei and colleagues at Google showed that chain-of-thought prompting, giving a few worked examples with intermediate steps, made large models far better at maths word problems. OpenAI deployed InstructGPT in its API; the paper followed in March.
- March. InstructGPT's headline: "outputs from the 1.3B parameter InstructGPT model are preferred to outputs from the 175B GPT-3, despite having 100x fewer parameters". The recipe (supervised fine-tuning on demonstrations, a reward model trained on human rankings, PPO against that reward) is the RLHF pipeline that every assistant used. The same month DeepMind published Chinchilla, and NVIDIA announced the H100 with FP8 arithmetic designed for transformers.
- April–May. Google's PaLM (540 billion parameters, 6,144 TPU v4 chips) explained jokes and did multi-step reasoning with chain-of-thought. OpenAI's DALL·E 2 and Google's Imagen made photorealistic images from text. DeepMind's Flamingo read images and text together, and Gato played Atari, captioned images and stacked blocks with one set of weights. Tri Dao and colleagues' FlashAttention made exact attention several times faster by respecting the GPU's memory hierarchy.
- June. A Google engineer, Blake Lemoine, claimed publicly that LaMDA was sentient and was fired; the episode showed how persuasive dialogue models had become before most people had used one. Wei et al. catalogued emergent abilities that appear only above some scale.
- July–August. Midjourney opened its beta; on 22 August Stability AI released Stable Diffusion with open weights, and image generation went from lab demo to millions of users in weeks. BigScience, a 1,000-researcher open collaboration, released the 176B multilingual BLOOM.
- September–October. OpenAI's Whisper transcribed speech in many languages after training on 680,000 hours of weakly labelled audio. Yao et al.'s ReAct interleaved reasoning with tool calls, the template for agents. On 7 October the US restricted exports of advanced AI chips and chipmaking tools to China, making compute a matter of national policy.
- November. Meta's science model Galactica was withdrawn three days after launch, when users showed it confidently writing fake papers. Two weeks later, on 30 November, OpenAI released a "research preview" chat interface on an RLHF-tuned GPT-3.5. The story continues in the assistant era.
The Chinchilla correction¶
Chinchilla deserves its own section, because it changed what "scale" meant. Jordan Hoffmann and colleagues at DeepMind trained more than 400 models, from 70 million to 16 billion parameters on 5 to 500 billion tokens, and asked: for a fixed compute budget, how should you split it between a bigger model and more data? Three independent methods agreed: "the model size and the number of training tokens should be scaled equally". Kaplan's analysis had said model size should grow as \(C^{0.73}\); Chinchilla found about \(C^{0.5}\). Their verdict on the field: "current large language models are significantly undertrained".
They tested it with the compute that had trained Gopher (280B parameters, 300B tokens). Chinchilla, with 70B parameters and 1.4 trillion tokens, "uniformly and significantly outperforms Gopher (280B), GPT-3 (175B), Jurassic-1 (178B), and Megatron-Turing NLG (530B)", reaching 67.5% on the MMLU benchmark, more than 7 points above Gopher. Because it is 4× smaller, it is also 4× cheaper to run for every user, forever. The rule of thumb that came out of it, about 20 training tokens per parameter, ended the parameter race of 2019–2021 and started a data race; the figure below shows the turn. The Build it section reproduces the calculation.
First principles: the forces behind the scale era¶
1. The architecture matched the hardware. A transformer layer on a batch of sequences is a handful of large matrix multiplications with no step-by-step dependency along the sequence. That is the workload GPUs, tensor cores and TPU pods were built for. An LSTM wasted most of the same hardware waiting. The winning architecture was not the most brain-like or the most elegant; it was the one that converted FLOPs into learning most efficiently (how a GPU works).
2. Self-supervision removed the labelling bottleneck. ImageNet had needed crowds of human labellers. Next-token prediction gets a training signal from every token of every document; the web supplies trillions. Data stopped being something you paid people to make and became something you crawled, filtered and deduplicated (pre-training data).
3. One objective, many skills. Predicting the next token of a physics textbook rewards knowing physics; of a Python file, knowing Python; of a dialogue, modelling the speakers. The objective is narrow but the cheapest way to satisfy it at low loss is broad competence. That is why a single model could be prompted into translation, coding and arithmetic (the language-modelling objective).
4. Predictable returns turned research into capital allocation. Before 2020 a lab could not promise investors what a 10× bigger model would do. Scaling laws let it fit a curve on small runs and forecast the loss of a big one. That forecastability is what justified billion-dollar commitments, and the money bought the compute that confirmed the curve: a flywheel.
5. Behaviour is a thin layer on top of capability. Pre-training buys knowledge and skills; post-training decides how they are presented. InstructGPT showed the thin layer could be worth more than a 100× larger model to a user. That made alignment research and product design the same job, and it is why the assistant era began with a fine-tuning run rather than a bigger model.
6. Openness declined as the stakes rose. The Transformer and BERT were published with code; GPT-2 was staged; GPT-3 was an API; by 2022 frontier labs published less about their largest systems. Open-weight efforts (EleutherAI, BigScience, Stability, and from 2023 Meta) grew in response. The tension between the two shapes the next era.
The numbers¶
| Model | Date | Parameters | Training tokens | Training compute (FLOP) | Source |
|---|---|---|---|---|---|
| Transformer (big) | Jun 2017 | 213 M | — | 2.3 × 10¹⁹ | paper, Table 2 |
| GPT-1 | Jun 2018 | 117 M | BooksCorpus | — | paper |
| BERT-large | Oct 2018 | 340 M | 3.3 B words | — | paper |
| GPT-2 | Feb 2019 | 1.5 B | 40 GB of text | — | paper |
| T5-11B | Oct 2019 | 11 B | C4 | — | paper |
| GPT-3 | May 2020 | 175 B | 300 B | 3.14 × 10²³ | paper, Table D.1 |
| Gopher | Dec 2021 | 280 B | 300 B | 5.76 × 10²³ | Chinchilla paper |
| Chinchilla | Mar 2022 | 70 B | 1.4 T | 5.76 × 10²³ | Chinchilla paper |
| PaLM | Apr 2022 | 540 B | 780 B | ≈ 2.5 × 10²⁴ (6ND) | paper |
From the Transformer to PaLM, training compute grew about 100,000-fold in five years, faster than the 4× a year that Epoch AI measured for the deep learning era as a whole (Sevilla et al.). Epoch's analysis also identifies a separate "large-scale" trend starting around 2015–2016, with runs 2–3 orders of magnitude above the rest: the frontier labs had pulled away from academia.
Translated into hardware: GPT-3's 3.14 × 10²³ FLOP is about 355 years of one V100 GPU at a sustained 28 TFLOP/s, or roughly USD 4.7 million at USD 1.50 per GPU-hour (computed in Build it; real costs, including failed runs and experiments, were several times higher). The Transformer paper's big model, by contrast, used 2.3 × 10¹⁹ FLOP: less than a ten-thousandth of GPT-3.
Build it: the Chinchilla calculation¶
Two facts carry the scale era. First, training compute for a dense transformer is about \(C \approx 6ND\) FLOP: each parameter does a multiply and an add (2 FLOP) per token in the forward pass, and the backward pass costs about twice the forward. Second, Chinchilla's fitted loss,
splits the loss into an irreducible part \(E\) (the entropy of text itself), a penalty for a model that is too small, and a penalty for too little data. Minimise it under \(6ND = C\) and you get the compute-optimal split (scaling laws derives it).
import numpy as np
# (name, year, parameters N, training tokens D, reported training FLOP or None)
models = [
("GPT-3", 2020, 175e9, 300e9, 3.14e23),
("Gopher", 2021, 280e9, 300e9, 5.76e23),
("Chinchilla", 2022, 70e9, 1.4e12, 5.76e23),
("PaLM", 2022, 540e9, 780e9, None),
]
def loss(N, D, E=1.6934, A=406.4, B=410.7, a=0.3392, b=0.2849):
"""Hoffmann et al. (2022) Approach-3 fit (unrounded constants from Besiroglu et al. 2024)."""
return E + A / N**a + B / D**b
print(f"{'model':11s} {'6ND (FLOP)':>11s} {'reported':>10s} {'tok/param':>9s} {'L(N,D)':>7s}")
for name, yr, N, D, rep in models:
C = 6 * N * D
r = f"{rep:.2e}" if rep else "—"
print(f"{name:11s} {C:11.2e} {r:>10s} {D/N:9.1f} {loss(N, D):7.3f}")
# For Gopher's budget, sweep model size and find the loss-minimising N.
C = 5.76e23
Ns = np.logspace(9, 12, 2001) # 1B .. 1T parameters
Ds = C / (6 * Ns) # tokens affordable at that size
L = loss(Ns, Ds)
i = L.argmin()
print(f"\nbudget {C:.2e} FLOP: best N = {Ns[i]/1e9:.0f}B, D = {Ds[i]/1e12:.2f}T tokens, "
f"D/N = {Ds[i]/Ns[i]:.0f}, loss {L[i]:.3f}")
print(f"rule of thumb D = 20N gives N = sqrt(C/120) = {np.sqrt(C/120)/1e9:.0f}B")
# What did GPT-3's 3.14e23 FLOP mean in 2020 hardware?
v100 = 28e12 # sustained FLOP/s assumed for one V100
years = 3.14e23 / v100 / 3.156e7
print(f"\nGPT-3 on one V100: {years:.0f} GPU-years; at USD 1.50/GPU-hour: "
f"USD {years * 8766 * 1.5 / 1e6:.1f}M")
Output:
model 6ND (FLOP) reported tok/param L(N,D)
GPT-3 3.15e+23 3.14e+23 1.7 1.976
Gopher 5.04e+23 5.76e+23 1.1 1.967
Chinchilla 5.88e+23 5.76e+23 20.0 1.921
PaLM 2.53e+24 — 1.4 1.904
budget 5.76e+23 FLOP: best N = 40B, D = 2.38T tokens, D/N = 59, loss 1.918
rule of thumb D = 20N gives N = sqrt(C/120) = 69B
GPT-3 on one V100: 355 GPU-years; at USD 1.50/GPU-hour: USD 4.7M
Read it closely:
- \(6ND\) reproduces GPT-3's reported compute almost exactly. It is the most useful single formula in the economics of AI (compute maths).
- GPT-3 and Gopher were trained on 1–2 tokens per parameter. Chinchilla used 20, and the fit gives it a lower loss than Gopher on the same budget. PaLM's lower predicted loss comes from 4× more compute, not a better split; its 1.4 tokens per parameter were, by this analysis, wasteful.
- The parametric fit itself puts the optimum at 40B parameters for Gopher's budget, exactly what the paper reports for this method (its Figure 4). The paper's other two methods gave 67B and 63B, and DeepMind trained 70B. Besiroglu et al. later could not replicate the parametric fit and found that a corrected fit agrees with the ~20 tokens-per-parameter rule. Scaling laws are measurements, not laws of nature: fit them with care, and expect the constants to move.
Things to try
- Round the constants to two decimals (
E=1.69, a=0.34, b=0.28) and rerun. How far does the optimum move? What does that say about extrapolating a fit by four orders of magnitude? - Compute the Chinchilla-optimal model for 10²⁵ and 10²⁶ FLOP with the 20:1 rule. Compare with the "1 trillion parameters needs 10²⁶ FLOP" remark in the paper.
- Add an inference term: if the model will serve 10¹³ tokens in its life at 2N FLOP each, what split of training compute minimises total cost? (This is why 2023–2026 open models are trained far past 20 tokens per parameter.)
- Use the scaling-law widget to see the same trade-off as curves.
Common misconceptions¶
Myths about the scale era
- "The transformer invented attention." Bahdanau, Cho and Bengio introduced attention for translation in 2014. The transformer's contribution was to remove everything else and show that attention alone, in parallel, was enough.
- "GPT-3 was an assistant." It was a raw text predictor. Asked a question, it might answer, continue with more questions, or write a forum thread. The assistant behaviour came from InstructGPT-style post-training (post-training at 2,000 ft).
- "Scaling laws say bigger models are always better." They say loss falls predictably with compute when model and data grow in the right proportion. A big model on too little data is worse than a smaller model on more, for the same money.
- "Emergent abilities appear suddenly at a magic size." Some apparent jumps are artefacts of all-or-nothing metrics: measured with a continuous score, the improvement is often smooth (Schaeffer et al., 2023). Others remain debated.
- "OpenAI won because it had a secret architecture." GPT-3 is architecturally close to GPT-2, which is close to the 2017 decoder. The edge was the bet on scale, the engineering to execute it, and post-training.
Check yourself¶
What structural property of the transformer made it win, and what did it cost?
Every token attends to every other in one parallel step, so training is a few large matrix multiplications with no sequential dependency, which suits GPUs and TPUs. The cost is \(O(n^2)\) compute and memory in sequence length \(n\) for the attention scores, which became the long-context problem.
BERT and GPT both appeared in 2018. Why did the GPT branch become the basis of assistants?
BERT's encoder and masked objective made it excellent at understanding tasks, but it cannot naturally generate long text. GPT's next-token objective makes generation the native interface, and text-in, text-out can express any task. With scale, in-context learning appeared, so one model could do new tasks from a prompt, which is what a general assistant needs.
State the Chinchilla result in one sentence, with the numbers.
For a fixed compute budget, parameters and training tokens should grow in equal proportion (about 20 tokens per parameter), so a 70B model trained on 1.4T tokens beat the 280B Gopher trained on 300B tokens with the same 5.76 × 10²³ FLOP, scoring 67.5% on MMLU.
Use C ≈ 6ND to estimate the compute of a 7B model trained on 2T tokens. How long on 1,000 GPUs at 400 TFLOP/s sustained?
\(C = 6 \times 7\times10^{9} \times 2\times10^{12} = 8.4\times10^{22}\) FLOP. The cluster does \(4\times10^{17}\) FLOP/s, so \(2.1\times10^{5}\) s, about 2.4 days.
What did InstructGPT show, and why did it matter more for products than GPT-3's size?
Human raters preferred a 1.3B model fine-tuned with demonstrations and RLHF over the 175B raw GPT-3. Following instructions, staying on task and refusing harmful requests are learned in a cheap post-training stage. That made a usable assistant possible without a bigger model, and it is exactly what ChatGPT shipped.
Hard: Kaplan et al. said to train very large models and stop early; Chinchilla said to scale data equally. Both fitted real data. How can both be 'right'?
They fitted different experiments. Kaplan used a fixed learning-rate schedule length across runs, so smaller models trained on more tokens were not given a schedule tuned to their length and looked worse than they were; their runs were also smaller in scale. Chinchilla matched the cosine schedule to each run's token count and covered larger models. Both are empirical fits within their regimes; the lesson is that methodology details change the extrapolated optimum.
Hard: if Chinchilla is optimal, why did 2023–2026 open models train 8B models on 15T tokens (almost 2,000 tokens per parameter)?
Chinchilla minimises training compute for a given loss. A model that will serve billions of requests should minimise training plus inference cost, and inference cost scales with parameters. Over-training a smaller model costs more to train but far less to serve, and fits on cheaper hardware.
Go deeper¶
Papers
- Attention Is All You Need — Vaswani et al., 2017. Read section 3 and Table 1 (cost per layer); the architecture diagram is the most reproduced figure in AI.
- BERT — Devlin et al., 2018. The encoder branch and the pre-train/fine-tune paradigm at its peak.
- Language Models are Unsupervised Multitask Learners — Radford et al., 2019 (GPT-2). Zero-shot task transfer from next-token prediction; short and readable.
- Scaling Laws for Neural Language Models — Kaplan et al., 2020. Figure 1 is the scale era's manifesto.
- Language Models are Few-Shot Learners — Brown et al., 2020 (GPT-3). Section 1 and Figure 1.2 on in-context learning; Appendix D for compute.
- Training Compute-Optimal Large Language Models — Hoffmann et al., 2022 (Chinchilla). Section 3: three methods, one answer.
- Training language models to follow instructions with human feedback — Ouyang et al., 2022 (InstructGPT). Figure 2 is the RLHF pipeline that made ChatGPT.
- Chinchilla Scaling: A replication attempt — Besiroglu et al., 2024. How fragile a famous fit can be.
- Compute Trends Across Three Eras of Machine Learning — Sevilla et al., 2022. The data behind "compute doubles every six months".
Articles and essays
- The Bitter Lesson — Rich Sutton, 2019. One page; the philosophy of the whole era.
- The Illustrated Transformer — Jay Alammar, 2018. The clearest pictures of the architecture ever drawn.
- The Annotated Transformer — Harvard NLP. The paper, line by line, as runnable PyTorch.
- The Scaling Hypothesis — Gwern Branwen, 2020. The contemporary case, written right after GPT-3, for why scale might be enough.
Videos
- Let's build GPT: from scratch, in code, spelled out — Andrej Karpathy, 2023. Two hours from bigrams to a working transformer.
- Attention in transformers, step-by-step — 3Blue1Brown, 2024. The geometry of queries, keys and values.
Where this leads¶
- The assistant era: 2022–2026 — what happened when the aligned model got a chat box, and then tools.
- Attention from first principles and the transformer block — the architecture of this page, derived equation by equation.
- Scaling laws: Kaplan to Chinchilla and beyond — the maths of the correction, and what changed after 2022.
- RLHF with PPO — the InstructGPT pipeline in full.
- Companies that shaped the boom — how OpenAI, Google, DeepMind, Anthropic and NVIDIA positioned themselves during these five years.