Foundation model training: a field guide
How a language model gets made: the arithmetic that sizes the run, the data and objectives that shape what it learns, and the systems that turn a cluster into a trained model and a working service.
A training run turns a budget into a model through a long chain of choices. The data decides what the model sees. The architecture and optimizer decide how it learns. The cluster decides how quickly it can learn, and evaluation decides which apparent improvements deserve to survive.
Those choices are coupled. A longer context changes the memory budget and the communication pattern. A smaller model can cost more to train and less to serve. A reward that is cheap to compute can become expensive once a policy learns how to exploit it. The useful question is what each choice buys, what it costs, and how to tell whether it worked.
This guide follows published language-model runs from raw text to deployment. It is written for an engineer who wants to work through the numbers: count the parameters, budget the memory, choose an experiment, read the loss curve and account for the time the GPUs spend waiting. Reported results, computed examples and toy simulations are labelled throughout; the assumptions matter as much as the answer.
Key ideas
- Start with the arithmetic. Parameters, tokens, FLOPs and bytes put bounds on a plan before a cluster is booked. Keep the attention term, activated parameters and optimizer states in the right account. Compute and memory →
- Data choices are training choices. Filtering, deduplication, tokenization and mixture weights change the distribution the optimizer sees. Test those choices at a scale where a mistake is still cheap. Data →
- Choose a model for its whole life. A compute-optimal pretraining run solves one budgeting problem. Repeated data, long context, post-training and serving demand change the one you actually need to solve. Scaling laws →
- Every objective pays for a behavior. Demonstrations, preference pairs and verifiable rewards provide different learning signals. Follow each signal into the update, including the biases and shortcuts it rewards. Post-training →
- A score needs a measurement procedure. Sampling, the harness, contamination, the grader and statistical uncertainty all belong beside the result. Decide what evidence would change a training decision before collecting it. Evaluation →
- Account for useful work. Parallelism moves bytes; failures lose progress; serving spends the memory bandwidth again. Measure the complete system, including recovery, queueing and the time outside the fast kernel. Systems at scale →
For a deeper treatment of the tasks and rewards used in agent training, see RL environments: a field guide. RL environments as a business follows the economics of the measurement. The orientation below maps the 17 chapters; the research engineer's playbook brings them together into a run plan.
0. Orientation: how a foundation model gets made
A model like Llama 3 or DeepSeek-R1 comes out of a pipeline whose stages cost very different amounts. Start by separating the stages, the costs each report counts, and the work its headline total leaves out.
What does it take to make a model like Llama 3 or DeepSeek-R1, and where does the effort go? A foundation model is a large model pretrained on broad data and then adapted to many tasks. It is the output of a pipeline. You collect and filter text, pretrain on it, midtrain on a curated mix, post-train for behavior, evaluate at every step and then serve. This guide follows a few published runs through every stage.
DeepSeek's own accounting shows the shape of the effort. DeepSeek-V3 took 2,788K H800 GPU-hours. The H800 is a Hopper GPU like the H100 with NVLink cut from 900 to 400 GB/s [1], and a GPU-hour is one accelerator busy for one hour. Of those, 2,664K went to pretraining, 119K to extending the context window and 5K to post-training (reported) [2]. DeepSeek-R1 then built on V3 and added 147K GPU-hours of reasoning training (reported) [3]. Pretraining alone was 2,664 / 2,788 = 95.6% of V3's budget (computed).
The small later budget is not small in effect. During the reinforcement learning (RL) that produced R1-Zero, a model trained with RL alone from the V3 base, the model's average pass@1 on the AIME 2024 math competition, the share of problems solved with a single sample, rose from 15.6% to 77.9% (reported) [3].1 That RL run cost 101K GPU-hours, or 101 / 2,788 = 3.6% of V3's total (computed).
Pretraining buys most of the compute and most of what the model knows. The stages after it cost a few percent and decide much of how the model behaves. Evaluation runs beside every stage, not only at the end.
The chapter has four parts. Section 0.1 draws the pipeline and links each stage to its chapter. Section 0.2 prices the stages in compute, time and people. Section 0.3 introduces the running examples and the notation, and Section 0.4 suggests where to start.
0.1 The pipeline in one picture
What are the stages, in what order, and which chapter covers each? Figure 1 draws them from left to right, from web text to a served model. Every box links to its chapter, so the figure doubles as a visual table of contents. Switch between the Llama 3 and DeepSeek presets to read one or two reported numbers per stage, and follow the dashed arrows: they are the loops that make the pipeline less linear than it looks.
Method and sources
Every box links to its chapter. Solid arrows are the main flow and dashed arrows are feedback loops: evaluation steers every stage, reinforcement learning shares its decoding with inference and gets its rewards from code run in sandboxes, and the use of the served model shapes the next one. The numbers are the labs' reported values except two computed ones, the decode floor of Llama 3 70B (its BF16 weights read once per token over eight H100s' memory bandwidth) and the planning example (2,048 H100s for 30 days at 40% MFU and 0.90 effective training time). The cost note divides DeepSeek-V3's reported GPU-hours by stage, and under the Llama 3 preset it points there, since the Llama 3.1 model card gives no split. Sources: the Llama 3 report (Grattafiori et al., 2024) and the Llama 3.1 model card (Meta, 2024), the DeepSeek-V3 and DeepSeek-R1 reports and DeepSeek's inference system overview (DeepSeek-AI, 2024 and 2025), Zhao et al. (2025), the NVIDIA H100 datasheet, Penedo et al. (2024), Hoffmann et al. (2022), Team OLMo (2024), Ouyang et al. (2022), Luo et al. (2025), Huang et al. (2026) and the released DeepSeek-V3 and Llama 3 configuration files.The base layer: compute, memory and hardware
Every stage is paid for in FLOPs (floating-point operations), bytes and bandwidth, and Chapter 1 and Chapter 2 teach that arithmetic and the machines behind it. The reference accelerator in this guide, the H100 SXM, does 989.5 TFLOP/s of dense math in BF16, a 16-bit floating-point format (Section 2.3), and reads its high-bandwidth memory (HBM) at 3.35 TB/s [4]. Its datasheet prints 1,979 TFLOP/s, a figure that assumes structured sparsity, so the dense rate is half of it (computed).
Data and the tokenizer
Chapter 3 turns the raw web into training tokens. FineWeb, an open dataset, filters 96 Common Crawl snapshots down to 15T tokens [5]. That is about the size of one frontier run, though the two counts use different tokenizers: Llama 3 405B trained on 15.6T text tokens [6]. A tokenizer maps text to integers (Section 3.7). Llama 3's averages 3.94 characters per token on English, up from 3.17 for Llama 2 [6].
Architecture and pretraining
Chapter 4 covers the network. Dense decoders such as Llama 3 use every parameter on every token. Mixtures of experts such as DeepSeek-V3 store 671B parameters and activate only 37B per token [2]. Pretraining teaches the network to predict the next token (Section 4.1), with the optimizer and schedules of Chapter 5, at a size chosen in advance with scaling laws (Chapter 6). Llama 3 405B used FLOPs on up to 16,384 H100s at 38–43% model FLOPs utilization (MFU), the share of the dense BF16 peak spent on the model's own math [6]. Meta's fitted scaling law had suggested 402B parameters on 16.55T tokens for that budget [6], close to the 405B on 15.6T it trained.
Systems: spreading the run and keeping it alive
In BF16 the 405B model's weights alone take GB (computed), ten times an H100's 80 GB [4]. So Chapter 11 splits each step across devices. The 405B run combined 8-way tensor, 16-way pipeline and 128-way data parallelism on 16,384 GPUs [6]. Chapter 12 keeps such a run alive. In a 54-day snapshot of pretraining it had 466 job interruptions and still achieved more than 90% effective training time [6].
Midtraining
Midtraining (Chapter 7) sits between bulk pretraining and post-training. It lowers (anneals) the learning rate toward zero while training on curated data, and extends the context window. Llama 3 405B's long-context stage used about 800B tokens [6], and OLMo 2 7B's score on the GSM8K math benchmark rose from 24.1 to 67.5 through midtraining [7].
Post-training and reinforcement learning
Post-training (Chapter 8) teaches format and behavior. Its tools are supervised fine-tuning (SFT), reward models, RL from human feedback (RLHF) and direct preference optimization (DPO). Its leverage showed early: labelers preferred the outputs of a 1.3B InstructGPT model to those of the 175B GPT-3 [8]. Llama 3 used SFT, rejection sampling (keeping the best of several sampled answers) and DPO, repeated over six rounds [6]. Chapter 9 covers RL with rewards a program can check, the route to reasoning models that write a long chain of thought before they answer. R1-Zero's AIME jump took 101K GPU-hours [3].
Evaluation, serving and sandboxes
Evaluation (Chapter 10) is not a final exam. It runs at every stage, and every score needs an error bar (Section 10.4). Llama 3 reports its 8B base model's HumanEval coding score as 37.2 ± 7.4, a 95% interval [6]. Serving (Chapter 13) is paid every day, and Section 0.2 compares a day of it with training. Sandboxes (Chapter 14) are isolated environments where model-written code runs. DeepSWE, an open coding agent trained with RL, spawned 512 containers per RL iteration [9], and DSec, DeepSeek's sandbox platform, supports over 380,000 concurrent sandboxes [10]. Chapter 15 then plans a whole run.
The loops
The dashed arrows matter as much as the solid ones. Evaluation steers every stage: small-scale ablations choose the data (Section 3.9), benchmark scores pick anneals and checkpoints (Section 7.3), and each post-training round is judged before the next one starts (Section 8.8). RL rewards are themselves automatic evaluations (Section 9.1). RL also ties post-training to inference, because generating rollouts is decoding (Section 9.8 and Section 13.2), and to sandboxes, because the rewards come from running code (Section 14.6 and Section 14.7). Finally, usage and failures in serving shape the data and the goals of the next model.
Midtraining is also called annealing, the cooldown or the decay phase. Llama 3 counts its long-context stage as part of pretraining [6], while DeepSeek-V3 reports context extension as its own line [2]. This guide uses one name per stage and says when a source differs.
With the stages named, Section 0.2 asks what each one costs.
0.2 What each stage costs: compute, time and people
How much compute and wall-clock time does each stage take, and how many people, by the labs' own numbers? We count in three currencies: GPU-hours or FLOPs, calendar time, and people. Figure 2 plots compute by stage on a log scale, so that the small stages stay visible next to pretraining. Its presets switch between DeepSeek-V3 and R1, Llama 3.1, InstructGPT, SmolLM3 and OLMo 2. In the presets that split compute by stage (DeepSeek, InstructGPT and OLMo 2), pretraining sits 20 to 750 times above every later stage (computed). The SmolLM3 preset shows what such totals leave out.
Method and sources
Llama 3.1 gives totals per model (39.3M H100 GPU-hours, not split by stage), InstructGPT gives PF/s-days (SFT and PPO-ptx together are 1.78% of GPT-3's pretraining), SmolLM3 shows the research compute that most totals leave out (ablations and debugging equal 58.3% of the main run), and OLMo 2 7B splits its 4.05T tokens into 3.90T of pretraining and 150B of midtraining (tokens stand in for compute because both stages train the same model). Values are as reported, shares are computed here from them, and the linear-axis toggle shows how the small stages vanish without a log scale. Sources: DeepSeek-AI (2024) for V3, DeepSeek-AI (2025) for R1 and for one day of serving, Meta (2024) for the Llama 3.1 model card, Ouyang et al. (2022), Allal et al. (2025) and Team OLMo (2024).Compute
DeepSeek gives the cleanest split by stage. At an assumed rental price of $2 per H800 GPU-hour, V3's 2,788K GPU-hours come to $5.576M (reported) [2], and R1's 147K come to $294K (reported) [3].
V3: 2,664K + 119K + 5K = 2,788K H800 GPU-hours (reported). The shares are 2,664 / 2,788 = 95.6% for pretraining, 119 / 2,788 = 4.3% for context extension and 5 / 2,788 = 0.18% for post-training (computed) [2].
R1: 101K for R1-Zero's RL, 5K to create SFT data and 41K to train R1 itself, 101K + 5K + 41K = 147K GPU-hours (reported), and 147 / 2,788 = 5.3% of V3 (computed) [3]. Together the two runs used 2,935K GPU-hours, and pretraining is 2,664 / 2,935 = 90.8% of them (computed). At DeepSeek's assumed $2 per GPU-hour the total is $5.576M + $0.294M = $5.87M (computed).
Cross-check against wall-clock time. R1-Zero's RL ran on 64 × 8 = 512 H800s for about 198 hours, and R1 on the same GPUs for roughly 80 hours (reported) [3]. 512 × 198 = 101,376 and 512 × 80 = 40,960 GPU-hours, which match the table's 101K and 41K (computed).
Llama 3.1 used 39.3M H100 GPU-hours in all: 1.46M for the 8B model, 7.0M for the 70B and 30.84M for the 405B (reported) [11]. The 405B took 30.84 / 39.3 = 78.5% (computed). At DeepSeek's $2 per GPU-hour, used here only as an illustration, its hours alone would rent for 30.84M × $2 = $61.7M (computed). The model card gives one total per model and does not split pretraining from post-training, so it cannot show stage shares.
InstructGPT reports its costs in PF/s-days, one petaFLOP/s sustained for a day, or FLOPs. Its 175B SFT model needed 4.9 PF/s-days and its PPO-ptx model (RLHF with PPO, with pretraining gradients mixed in) 60, against 3,640 for pretraining GPT-3 [8]. That is 4.9 / 3,640 = 0.13% and 60 / 3,640 = 1.65%, or 1.78% together (computed).
What the totals leave out
These totals cover the official training runs. DeepSeek's figure excludes "the costs associated with prior research and ablation experiments on architectures, algorithms, or data" [2]. R1 was prepared with experiments on a smaller 30B model on A100 GPUs, which its table does not count [3]. The Olmo 3 report makes the same point about post-training and evaluation: "These additional costs are not captured when reporting pretraining hours alone" [12]. Section 12.8 accounts for every GPU-hour, and Section 15.1 shows how to spend a research budget.
SmolLM3, a 3B model, trained on 384 H100s for nearly a month on 11T tokens (reported) [13]. Its playbook reports the research budget as well. Ablations and debugging consumed 161,280 GPU-hours, "more than half the cost of our main training run (276,480 GPU hours)" (reported), and evaluation took slightly under 10,000 more (reported) [13].
The ratio is 161,280 / 276,480 = 58.3% (computed). A report that gave only the main run would leave out 161,280 / (161,280 + 276,480) = 161,280 / 437,760 = 36.8% of the project's training compute (computed). When you read a headline GPU-hour figure, ask what it excludes.
Serving catches up
Training is paid once, and serving is paid every day. DeepSeek's V3 and R1 service averaged 226.75 nodes over 24 hours [14]. At eight GPUs per node that is 226.75 × 8 × 24 = 43,536 H800 GPU-hours a day (computed), and at $2 per GPU-hour it gives the $87,072 daily cost that DeepSeek reports [14]. A day of serving is 43,536 / 2,788,000 = 1.56% of V3's training, so 2,788,000 / 43,536 = 64 days of serving use as many GPU-hours as the whole training run (computed). The service read 608B input tokens that day, 56.3% of them from an on-disk cache, and wrote 168B [14]. Section 13.3 turns such numbers into the price of a token.
Time
Time to train is compute divided by delivered FLOP/s, , derived in Section 1.3. For Llama 3 405B at 41% MFU on 16,384 H100s [6], the computed time is
The model card's 30.84M GPU-hours spread over 16,384 GPUs give hours, or 78 days (computed). The report gives neither figure as the wall-clock time. Read 66 days as the time the FLOPs need at the reported pace, and 78 days as everything the card charges to the model, in days of the full 16,384-GPU cluster. Part of the run used 8,192 GPUs [6], so neither is the calendar time.
DeepSeek-V3's pretraining finished in "less than two months" [2]. Each trillion tokens took 3.7 days on a cluster of 2,048 H800 GPUs [2], and 3.7 × 14.8 ≈ 55 days for the 14.8T-token run (computed). Olmo 3 took about 56 days from the start of training to the evaluation of its 32B Think checkpoint on 1,024 H100s, a span that includes post-training [12]. DeepSWE trained for six days on 64 H100s [9]. At the small end, llm.c reproduces GPT-2 small in 90 minutes for about $20 [15].
People
Llama 3's report says the model is "the result of the work of a large number of people at Meta" [6]. Its lists hold 236 core contributors, who worked on the project for at least two thirds of its runtime, and 323 contributors, who worked at least one fifth of it (computed: counted from the author lists). DeepSeek-V3 lists 150 people in research and engineering, 31 in data annotation and 18 in business and compliance (computed: counted from the author list) [2]. These are author lists, not team sizes or full-time equivalents. Much human work sits outside them. InstructGPT hired a team of about 40 contractors to label data [8], and 93 software developers screened the samples of SWE-bench Verified [16]. Automation stretches people: Llama 3 needed significant manual intervention only three times in its 54-day snapshot [6].
In every report that splits compute by stage, pretraining comes first by a factor of 20 or more (computed: 2,664 / 119 = 22 for DeepSeek-V3, 3,640 / 60 = 61 for InstructGPT). Effort in people, data and research is spread far more evenly. That is why the chapters on data, post-training, evaluation and practice (Chapter 3, Chapters 8 to 10 and Chapter 15) matter as much as Chapter 5. Section 9.4 tells the R1 story in full.
0.3 The running examples and the notation
Which models will you meet in every chapter, and what do the symbols mean? A small set of published models, the running examples, carries through the guide. When every chapter uses the same configurations, its arithmetic can be checked against the others: the FLOPs of Chapter 1, the parallel layout of Chapter 11 and the KV cache of Chapter 13 all describe the same Llama 3 70B. Parameter counts are computed from the released configuration files, so they match the checkpoints. Section 1.1 derives them, and Section 4.7 explains why a mixture of experts has two counts.
Table 0.1. The running examples. Shapes are from the papers and released configuration files. Parameter counts are computed from those shapes.
| Model | Shape | Parameters | Training tokens | Reported compute |
|---|---|---|---|---|
| Llama 3 8B | 32 layers, 4,096, 14,336, 32 query and 8 KV heads of 128, 128,256, untied embeddings [6, 17] | 8,030,261,248 (computed) | about 15T (reported) [11] | 1.46M H100 GPU-hours (reported) [11] |
| Llama 3 70B | 80 layers, 8,192, 28,672, 64 query and 8 KV heads [6] | 70,553,706,496 (computed) | about 15T (reported) [11] | 7.0M H100 GPU-hours (reported) [11] |
| Llama 3 405B | 126 layers, 16,384, 53,248, 128 query and 8 KV heads [6] | 405,853,388,800 (computed) | 15.6T (reported) | FLOPs and 30.84M H100 GPU-hours (reported) [6, 11] |
| DeepSeek-V3 | 61 layers, 7,168, multi-head latent attention (KV latent of 512 plus a 64-wide RoPE key), 3 dense layers, then MoE layers with 1 shared and 256 routed experts, 8 active, 129,280 [2, 18] | 671B total, 37B activated (reported), about 37.6B by our count | 14.8T (reported) [2] | 2.788M H800 GPU-hours (reported) |
| DeepSeek-R1 | DeepSeek-V3-Base plus reasoning RL and SFT [3] | as V3 | not a pretraining run | 147K H800 GPU-hours (reported) |
| GPT-2 small | 12 layers, 768, 12 heads, 50,257, tied embeddings, learned positions [19, 20] | 124,439,808 (computed), 117M in the paper | 10B in the llm.c reproduction [15] | about 90 minutes on 8 A100s (reported) |
| OLMo 2 7B | 32 layers, 4,096, 11,008, 32 heads (full multi-head attention), 100,352 [21] | 7,298,617,344 (computed) | 4.05T, of which 3.90T pretraining (reported) [7] | FLOPs (reported) |
| OLMo 2 13B | 40 layers, 5,120, 13,824, 40 heads, 100,352 [7] | 13,716,198,400 (computed) | 5.6T (reported) | FLOPs (reported) |
Each example has a job. Llama 3 8B, 70B and 405B are the dense workhorses for FLOPs, memory, parallelism, failures and inference. DeepSeek-V3 is the mixture-of-experts example, trained in FP8 [2], and R1 the reasoning model built on it [3]. GPT-2 small is the scale you can train and ablate on one node, and OLMo 2 is the run whose data and recipe are fully open [7].
Counts in this guide come from the released configuration files, so they match the checkpoints to the parameter. The model names round them. GPT-2 small's paper says 117M [19], and the released checkpoint has 124,439,808 (computed) [20]. DeepSeek-V3 reports 37B activated parameters [2], and our count is 37.55B including both embedding matrices, or 36.63B without the input embedding (computed). One exact count keeps results consistent across chapters. Mixed-precision AdamW keeps about 16 bytes of model state per parameter [22] (Section 1.4), so Llama 3 8B needs 16 × 8,030,261,248 bytes = 128.5 GB of model states (computed).
One accelerator serves as the hardware reference throughout: the H100 SXM, with 989.5 TFLOP/s of dense BF16 compute (1,979 with sparsity) and 80 GB of HBM at 3.35 TB/s [4]. The price of $2 per GPU-hour is DeepSeek's assumption [2] and serves only as an illustration. Table 0.2 fixes the symbols. Each has one meaning on the whole page.
Table 0.2. The notation used in every chapter.
| Symbol | Meaning |
|---|---|
| , | Parameters, and parameters activated per token in a mixture of experts. Say "non-embedding" when you mean it. |
| Training tokens | |
| Training compute in FLOPs, about | |
| or | Number of layers. Chapters whose formulas also need the loss write . |
| (or ), | Model width and MLP width |
| , , | Query heads, key and value heads, head dimension |
| Vocabulary size | |
| , , | Sequence length, micro-batch size in sequences, global batch in tokens |
| , | Number of accelerators, and FLOP/s of one accelerator (say peak or achieved) |
| Bandwidth per direction. Chapter 13 writes BW and keeps for weight bytes. | |
| MFU | Model FLOPs utilization: achieved model FLOP/s over the dense peak. State the convention with every value. |
| , , , , | Data, tensor, pipeline, context and expert parallel degrees |
| , | Micro-batches per pipeline flush, virtual stages per device |
| Loss, in nats per token | |
| , , | Learning rate and Adam's two decay rates |
| , , | Policy, reference policy, and the KL coefficient (named in words, since also names Adam's rates) |
| Samples in pass@k | |
| , , , and others | Chapter-local, defined where they appear (for example for weight decay in Chapter 5) |
Two unit rules hold everywhere. FLOPs is a count and FLOP/s a rate. GB is bytes and GiB is bytes, and one comparison never mixes them. In token counts, 8K means 8,192 and 128K means 131,072. Every number carries a label: (reported) for a source's own number, (computed) for arithmetic done here from cited inputs, and (illustrative) for an assumed value. Section 16.1 collects the formulas and Section 16.2 defines the terms.
0.4 How to read this guide
Where should you start, and what can you skip on a first pass? The guide is written for engineers and scientists who know calculus, linear algebra, probability and Python and want the arithmetic and practice of training and serving models at scale. Each formula is derived once, in its home section, and collected in Section 16.1. Section 16.2 defines every term. Each number has a source and a label. Section 16.3 lists fifty sources worth reading in full.
The figures are meant to be used. Hover over or focus any mark to read its value and source. Every figure has a table view with the numbers it plots, and the calculators take your own inputs, so you can put your model where the running examples sit.
A first pass covers about a fifth of the guide. After this chapter, read:
- Foundations, first if you have never written out a transformer layer: Sections 4.1–4.2 (the objective and one Llama 3 8B block).
- Compute: Sections 1.1–1.3, 1.7 and 2.1.
- Pretraining: Sections 3.2, 5.1–5.2, 6.1–6.2 and 7.1.
- Post-training and evaluation: Sections 8.1–8.2, 8.5, 8.7, 9.1–9.4 and 10.4.
- Systems and serving: Sections 11.1–11.2, 12.1, 13.1–13.2 and 15.4.
Safe to skip the first time: the probability in Section 3.3, the derivations in Section 7.4, and Sections 2.3, 2.6, 4.8, 5.4, 6.3–6.4, 9.5–9.6, 10.6–10.8, 11.5–11.6, 11.8–11.9, 12.7–12.9 and 13.5–13.9, and Chapter 14 unless you train or evaluate agents.
By role, if you plan runs, read Chapters 1, 6, 11, 12 and 15 closely. If you post-train, read Chapters 8, 9, 10 and 14. If you serve models, read Chapters 1, 2 and 13.
DeepSeek-V3's post-training used 5K of its 2,788K H800 GPU-hours. What share is that, and does a small share mean post-training matters little?
5 / 2,788 = 0.18% (computed). A small share does not mean a small effect. R1-Zero's RL used 101K GPU-hours, 101 / 2,788 = 3.6% of V3's total (computed), and took AIME 2024 pass@1 from 15.6% to 77.9% (reported). A compute share measures cost, not effect, and the cheap stages are where much of a model's behavior is decided.
At $2 per GPU-hour, what would Llama 3.1 405B's 30.84M GPU-hours cost to rent, and what does that number leave out?
30.84M × $2 = $61.7M (computed, illustrative price). It leaves out the research and ablation runs before the final run, data collection and human labeling, much of the evaluation, the people, and the cost of owning a cluster rather than renting one. Those omissions can be large: SmolLM3's ablations and debugging alone came to 161,280 / 276,480 = 58.3% of its main run (computed from reported GPU-hours).
Why does the pipeline figure draw evaluation as a band over every stage rather than as a last step?
Because measurements steer each stage. Small-model ablations choose the data, benchmark scores choose anneals and checkpoints, each post-training round is judged before the next, and RL rewards are themselves automatic evaluations. Evaluating only at the end would find problems after the compute is spent, and without error bars it could not tell a real gain from noise.
Llama 3 405B's training time comes out as 66 days from its FLOPs and 78 days from its GPU-hours. Why do two honest calculations disagree?
They measure different things. 66 days divides FLOPs by 16,384 GPUs running at 41% MFU, which is the steady-state pace of the main configuration with no time lost. 78 days divides the model card's 30.84M GPU-hours, every hour charged to the model, by the same 16,384 GPUs (computed). The report does not give the full wall-clock time or split the gap, so use 66 days as the pace at full speed and 78 days as the all-in charge in cluster-days.
Why does this guide write Llama 3 8B's size as 8,030,261,248 parameters?
The count is computed from the released configuration, so every later formula uses the same exact number and results agree across chapters. "8B" is the rounded name. For example, at 16 bytes of model state per parameter under mixed-precision AdamW, 16 × 8,030,261,248 = 128.5 GB (computed). Rounding to 8B would give 128.0 GB. The 0.5 GB (0.4%) gap is small, but exact counts let every chapter's numbers be checked against each other to the digit.
- A foundation model comes from one pipeline: data, pretraining, midtraining, post-training and reinforcement learning, with evaluation steering every stage and serving at the end.
- Pretraining dominates compute: 95.6% of DeepSeek-V3's 2.788M H800 GPU-hours (computed). Post-training and all of R1's reasoning training together cost (5 + 147) / 2,788 = 5.5% of V3's total (computed) and decide much of how the model behaves.
- Reported totals cover the final run. Research, ablations and debugging can add more than half again, as SmolLM3's 161,280 GPU-hours against a 276,480 GPU-hour main run show (reported).
- Serving catches up quickly: at DeepSeek's reported rate, 64 days of serving use as many GPU-hours as V3's whole training run (computed).
- The running examples (Llama 3 8B, 70B and 405B, DeepSeek-V3 and R1, GPT-2 small, OLMo 2) and one notation carry through every chapter. Section 16.1 collects the formulas and Section 16.2 the terms.
1. FLOPs and memory: the arithmetic of training
A training plan begins with parameters, tokens, FLOPs and bytes. Count them before booking the hardware, then turn the compute into time at a stated utilization. Memory and bandwidth decide whether that arithmetic describes a run the machine can actually execute.
Why should a research engineer be able to do the arithmetic of training by hand? A wrong guess costs months. Llama 3 405B has 405B trainable parameters and was pretrained on 15.6T text tokens with FLOPs, on up to 16K H100 GPUs, each running at 700 W with 80 GB of HBM3 (high-bandwidth memory, the GPU's main memory) [6]. At the 41% model FLOPs utilization the paper reports on 16,384 GPUs, that is 66 days of uninterrupted compute (computed in Section 1.3). The Llama 3.1 model card reports 30.84M H100 GPU-hours for 405B and 39.3M for all three sizes [11]. DeepSeek-V3 reports 2.788M H800 GPU-hours for its full training [2].
Memory decides what fits. A 1.5B-parameter GPT-2 needs 3 GB for its 16-bit weights, "yet, it cannot be trained on a single GPU with 32GB memory using Tensorflow or PyTorch" [22]. EleutherAI is blunter: "Modern GPUs are typically bottlenecked by memory, not FLOPs, for LLM training." [23] The same guide warns that whitepaper peak FLOP/s are never reached in practice [23].
The order: parameters (Section 1.1), FLOPs (1.2), days (1.3), training bytes (1.4, 1.5), inference bytes (1.6), a chip's speed limit (1.7), and energy and dollars (1.8). The running examples and the notation are introduced in Section 0.3. Architecture is Chapter 4, parallelism Chapter 11, serving Chapter 13.
Parameters, FLOPs, bytes and the rate at which a chip turns bytes into FLOPs decide almost every plan. This chapter derives each one and checks it on Llama 3 and DeepSeek-V3.
1.1 Counting parameters
Exactly how many parameters does a model have, and which of them do work in a matmul? A decoder-only transformer is an embedding table that turns each token into a vector of width , identical blocks, a final norm, and an output head that turns the last vector into vocabulary scores. A Llama-style block uses grouped-query attention (GQA, below), a SwiGLU MLP (three matrices, one of them a gate) and RMSNorm (normalization with one learned gain vector). If these are new, read Section 4.2 first: it walks one Llama 3 8B block operation by operation, and this section only counts its weights. Nearly all parameters sit in the blocks' attention and MLP weight matrices (Table 1.1). In Llama 3 8B the MLP holds 80.8% of each block (computed) [6, 17].
Table 1.1. Parameters in one Llama-style block, with Llama 3 8B's values (, , , , , computed).
| Component | Shape | Parameters | Llama 3 8B |
|---|---|---|---|
| Query projection | 16,777,216 | ||
| Key and value projections (GQA) | , twice | 8,388,608 | |
| Output projection | 16,777,216 | ||
| SwiGLU MLP (gate, up, down) | twice, | 176,160,768 | |
| Two RMSNorm gains | each | 8,192 | |
| Block total | 218,112,000 |
Outside the blocks sit the input table (), a final norm () and, for an untied head (its own matrix, not the input table reused), another . With equal to 1 or 0:
The released Llama 3.1 8B configuration has 32 layers, width 4,096, MLP width 14,336, 32 query heads, 8 key/value heads, head dimension 128, a 128,256-token vocabulary and an untied head [6, 17]. Thirty-two blocks of 218,112,000 are 6,979,584,000. The input table and head add , the final norm 4,096. The total is 8,030,261,248 (computed), the released 8.03B [11]. The paper's Table 3 lists the vocabulary as 128,000, and the extra 256 entries are reserved special tokens [24]. With 128,000 the count would be 8,028,164,096 (computed). Everything except the input table takes part in matmuls: 7,504,924,672 parameters.
Kaplan et al.'s rule of thumb, , counts only the blocks, "where we have excluded biases and other sub-leading terms" [25]. It assumes full multi-head attention () and a two-matrix MLP (). Llama 3 8B's block is , so the rule gives 6.44B against 6.98B actual non-embedding parameters (computed). SwiGLU's three matrices would normally shrink the hidden width to about [26], which OLMo 2 rounds up "to the closest multiple of 128" [7], but Llama 3 uses (8B, 70B) and (405B). Grouped-query attention (GQA) lets query heads share key and value heads, and Llama 3 uses 8 KV heads "to improve inference speed and to reduce the size of key-value caches during decoding" [6]. That also cuts attention to 41.9M parameters per layer from 67.1M (computed).
Not every parameter does a matmul: "embedding layers have a negligible contribution to the model FLOP counts, since they do not require matrix-vector products" (Porian et al. [27]), while the output head is a real matmul. gpt-oss agrees: "Unembedding parameters are counted towards active, but not embeddings." [28]. The two vocabulary matrices are 13.1% of Llama 3 8B but 1.0% of 405B (computed), so total and non-embedding counts diverge most for small models, which matters for scaling laws (Chapter 6). Shapes also serve the hardware: a vocabulary divisible by 64 is recommended [29], and 128,256 is 64 × 2,004 (Section 1.7).
Table 1.2. The running examples counted from their released configs (computed) against reported sizes [6, 17, 20, 19, 21, 7, 18, 2].
| Model | Reported | Counted from config | What the count includes |
|---|---|---|---|
| Llama 3 8B | 8.03B | 8,030,261,248 | untied head, |
| Llama 3 70B | 70B | 70,553,706,496 | , , , , |
| Llama 3 405B | 405B | 405,853,388,800 | , , , , |
| GPT-2 small | 117M | 124,439,808 | tied head, learned positions, biases |
| OLMo 2 7B and 13B | 7B and 13B | 7,298,617,344 and 13,716,198,400 | QK-norm (RMSNorm on queries and keys), |
| DeepSeek-V3, total | 671B | 671,026,419,200 | 61 layers (3 dense, 58 mixture-of-experts), main model only |
| DeepSeek-V3, activated | 37B | 37,552,297,472 | both embedding tables, 36,625,618,432 without the input table |
The GPT-2 paper lists its smallest model at 117M parameters [19]. Its released configuration, with a tied head, 1,024 learned position embeddings and biases, counts to 124,439,808 (computed) [20], which is why reproductions call it GPT-2 (124M) [15]. No source we found explains the gap. Llama 3's 128K-token vocabulary in the paper against 128,256 in the config is the same trap in miniature [6, 17]. Count from the config.
In a mixture of experts (MoE), each token visits only a few expert MLPs. DeepSeek-V3 has 671B total parameters, "of which 37B are activated for each token" [2], about 37.6B by our count. Each MoE layer holds 1 shared and 256 routed experts [2], and a token uses the shared one plus 8 routed ones [18]. Memory follows total parameters, since all 671B must be stored. FLOPs follow activated parameters. Switch Transformers made FLOP-matched comparison standard: "when keeping the FLOPS per token fixed, having more parameters (experts) speeds up training" [30].
Common mistakes: from the paper, a tied head treated as untied (GPT-2 ties it, Llama 3 and OLMo 2 do not [20, 17, 21]), missed extras such as OLMo 2's QK-norm [7], MoE totals used for FLOPs, and extra modules: DeepSeek-V3's 685B release adds a 14B multi-token prediction module to the 671B model [31]. Apply the formula to config.json, then sum numel() over the checkpoint. They should agree exactly.
1.2 FLOPs per token: the 6N rule and the attention term
Why does training cost about FLOPs per token, and when does attention break that rule? A FLOP is one floating-point add or multiply. FLOPs is a count and FLOP/s a rate: a chip delivers TFLOP/s ( per second), a run consumes FLOPs. Older papers use the PF/s-day (written PF-day by Kaplan et al.), one PFLOP/s sustained for a day, FLOPs [25].
From one matmul to one training token
Multiplying an matrix by a matrix gives outputs, each a length- dot product of multiplies and adds [32, 25]:
Llama 3 8B's query projection on 8,192 tokens costs
Through the whole network each weight does one multiply and one add per token, so the forward pass costs [33]. Backward needs two products per forward one. For , the input gradient keeps backpropagation going and the weight gradient feeds the optimizer. Each matches the forward matmul, so backward costs [34, 35], and GPT-3 adds "a multiplier of 3x to account for the backwards pass" [36]. Training costs about FLOPs per token [25].
The attention term
Attention also has two matmuls with no weights, the scores and the weighted sum of values. For a query attending to keys each costs per layer, so the pair costs forward and three times that in training. Dropping the input table from , since it does no matmul, gives
with the sequence length (keep whole for a tied head). The full count, used by PaLM [34] and nanoGPT [37], charges every query for every key. Under a causal mask token sees only keys, so FlashAttention-2 halves its count [38], and Porian et al. fault full counts for ignoring causality [27]. Kaplan et al. left the context-dependent term out of as "a relatively small fraction of the total compute" for models with [25], and GPT-3 ignored attention as under 10% [36]. For Llama 3 8B at 8K, causal attention per token is
Per training token at 8,192 tokens of context, causal counting, from the paper's Table 3 shapes [6]:
Table 1.3. Llama 3 8B training FLOPs per token by component at 8K context, causal counting (computed).
| Component | GFLOPs per token | Share |
|---|---|---|
| MLP (three matrices) | 33.82 | 65.7% |
| Query and output projections | 6.44 | 12.5% |
| Key and value projections | 1.61 | 3.1% |
| Attention scores | 3.22 | 6.3% |
| Attention over values | 3.22 | 6.3% |
| Output head | 3.15 | 6.1% |
| Total | 51.47 | 100% |
is 48.18 GFLOPs with all 8.03B parameters and 45.03 with the matmul ones. At 131,072 tokens the attention rows grow 16 times, to 51.5 GFLOPs each, and the total is 148.1 GFLOPs, 2.88 times the 8K cost (computed).
Table 1.4 repeats this for all three sizes. Attention matters more for small models, since its cost per layer grows with and the weights' with . At 128K, underestimates the work 1.7 times (405B, causal) to 5.2 times (8B, full). With causal counting, attention equals all other FLOPs at about 57K tokens for 8B, 106K for 70B and 196K for 405B (computed). How to Scale Your Model's rule (Austin et al., called the scaling book below) that attention dominates once the context exceeds eight times the width [39] assumes other shapes, so compute the crossover for yours. Figure 19 lets you slide the context and watch attention's share grow.
Table 1.4. Llama 3 training FLOPs per token at 8K and 128K context and attention's share (causal / full), from the paper's shapes [6] (computed).
| Model | , GFLOPs | 8K causal, GFLOPs | 128K causal, GFLOPs | 128K over 8K | Attention share at 8K | Attention share at 128K |
|---|---|---|---|---|---|---|
| Llama 3 8B | 48.2 | 51.5 | 148.1 | 2.88× | 12.5% / 22.2% | 69.6% / 82.1% |
| Llama 3 70B | 423.3 | 449.2 | 932.4 | 2.08× | 7.2% / 13.4% | 55.3% / 71.2% |
| Llama 3 405B | 2,435.1 | 2,524.0 | 4,046.0 | 1.60× | 4.0% / 7.7% | 40.1% / 57.3% |
So Llama 3 trains long sequences last: "We do not train on long sequences earlier because the compute in self-attention layers grows quadratically in the sequence length." [6] Its long-context stage used about 800B tokens [6] (Chapter 7).
Total compute: does 6ND match the papers?
Multiplying by tokens gives the budget that Chinchilla's scaling analysis uses as its constraint [40]:
Table 1.5's matches look perfect, but many reported totals are themselves 6ND. GPT-3's appendix multiplies parameters by tokens and ignores attention [36], and OLMo 2 computes training FLOPs "using the approximation from Kaplan et al. (2020)" [7]. Others count more: PaLM's total adds attention, 3.28 TFLOPs per token against 3.24 for [34], and Chinchilla's detailed count differs from 6ND by 0.99 to 1.10 times across model sizes [40]. A match with 6ND checks the inputs, not the method.
Table 1.5. 6ND (computed) against reported training compute [36, 40, 34, 6, 7].
| Model | Tokens | 6ND, FLOPs | Reported, FLOPs | How the report counted |
|---|---|---|---|---|
| GPT-3 175B | 300B | 6ND, attention ignored | ||
| Chinchilla 70B | 1.4T | the Gopher budget it was matched to | ||
| PaLM 540B | 780B | plus full attention | ||
| Llama 3 405B | 15.6T | not stated | ||
| OLMo 2 7B | 4.05T | Kaplan's approximation | ||
| OLMo 2 13B | 5.6T | Kaplan's approximation |
FLOPs (computed), the budget the paper reports [6], which does not say how it counted. With causal attention at 8K a token costs 1.036 times , with a full count 1.078 times (computed), and the 800B long-context tokens cost more. So true model FLOPs exceed by several percent, by an amount the paper's data cannot pin down.
Kaplan et al. drop embeddings from [25], Chinchilla counts "all training FLOPs, including those contributed to by the embedding matrices" [40]. Megatron counts recomputation's extra forward pass [41]. DeepSeek's counts attention but not the vocabulary [42]. Gopher's budget reads , in Chinchilla's recount [40], or as plain 6ND (computed). Pearce and Song trace "much of this discrepancy" between Kaplan's and Chinchilla's optimal sizes to non-embedding counting [43] (Chapter 6). State your convention.
Common mistakes: a multiply-add counted as one FLOP, the input table kept in (7.0% too high for 8B, computed), MoE totals instead of activated parameters, attention ignored at long context, causal and full counts mixed, recomputation counted as model FLOPs. To plan, use plus causal attention, with the weights that do matmuls (activated for an MoE, head in, input table out). To compare with papers, use plain 6ND, as most reports do.
1.3 From FLOPs to days: utilization, time to train and GPU-hours
How long will a run take on a given cluster, and what does MFU really measure? Time is work over rate. With accelerators of peak FLOP/s running at model FLOPs utilization (MFU, the fraction of peak spent on the model's own FLOPs),
GPU-hours do not depend on while MFU holds. EleutherAI writes , with the cluster's throughput [23]. Megatron's GPT-3 175B estimate checks out: 300B tokens on 1,024 A100s at 140 TFLOP/s each, with per token under full recomputation, take
against the paper's "34 days" [41].
MFU, HFU and recomputation
PaLM defined MFU as "the ratio of the observed throughput (tokens-per-second) relative to the theoretical maximum throughput of a system operating at peak FLOPs" [34], with the maximum counting only the model's forward and backward FLOPs:
Hardware FLOPs utilization (HFU) also counts recomputation, which MFU leaves out [44]. Recomputation (Section 1.5) reruns the forward pass in backward to save memory, so the full version executes per token [39] and HFU is 1.33 times MFU. With a fraction of the forward pass recomputed,
It costs time: Korthikanti et al. saw 30–40% longer steps with full recomputation, and selective recomputation with sequence parallelism lifted a 530B model from 42.1% to 54.2% MFU [45]. PaLM rejects HFU as "not a consistent and meaningful metric" [34]: recomputing more raises it without training faster.
PaLM 540B on 6,144 TPU v4 chips reported "46.2% in model FLOPs utilization (observed throughput relative to theoretical max throughput) and 57.8% in hardware FLOPs utilization" [34]. Its policy explains the ratio: "75% of non-attention forward pass FLOPs are recomputed" [34]. Ignoring attention, the hardware runs per token, so HFU over MFU should be 1.25, and 57.8/46.2 = 1.251 (computed). Throughput agrees: , the paper's "45.7% without self-attention" [34]. Rather than publish only the larger number, the authors introduced MFU and re-scored GPT-3 (21.3%) and MT-NLG (29.7%) on the same basis. When two utilizations disagree, first ask whether they count the same FLOPs.
Table 1.6. Reported utilization of large training runs. Conventions differ, so read the notes before comparing rows.
| System | Hardware | MFU | Convention and notes | Source |
|---|---|---|---|---|
| GPT-3 175B | V100 | 21.3% | re-scored by PaLM | [34] |
| Gopher 280B | 4,096 TPU v3 | 32.5% | re-scored by PaLM from training speed | [34] |
| PaLM 540B | 6,144 TPU v4 | 46.2% | HFU 57.8% | [34] |
| Megatron 530B | 2,240 A100 | 54.2% | selective recomputation, sequence parallelism | [45] |
| LLaMA 65B | 2,048 A100 | 47.6% | computed from 380 tokens/s per GPU | [46] |
| MegaScale 175B | 12,288 GPUs | 55.2% | 59.1% at 3,072 GPUs, same batch | [47] |
| Llama 3 405B | 8,192, 16,384, 16,384 H100 | 43%, 41%, 38% | BF16, last row at 131K context, rounded | [6] |
| TorchTitan Llama 3.1 8B | 8 to 128 H100 | 33–42% | BF16, no FP8 | [48] |
| DeepSeek-V3 | 2,048 H800 | 38.94%, 43.73% | causal, full attention, BF16 peak | [1] |
| Mixtral 8x22B, Qwen2-57B-A14B | H100 | 49.3%, 39.0% | MoE, Megatron-Core | [49] |
| MegaScale-MoE | Hopper GPUs | 32.48% to 27.89% | falls as GPUs are added | [50] |
| Olmo 3 7B, 32B | H100 | about 43%, 41% | 8,192-token sequences | [12] |
| llm.c GPT-2 124M | 1 A100 40GB PCIe | 49.0% | author: up to about 60% on A100 80GB SXM | [15] |
Why do the best runs stop near 40–60%? Losses stack, and no source splits them the same way. Norms, softmax and routing take time but add no counted FLOPs, and MoE adds "many memory-intensive operations like routing, local scatter, and gather" [50]. DeepSeek-V3 gives 20 of the H800's 132 streaming multiprocessors (SMs, Section 2.1) to communication [2] and loses 2.06 s of a 19.9 s step to a pipeline bubble, idle time while pipeline stages wait on each other (Section 11.4) [1]. Long context, awkward shapes (Section 1.7) and memory pressure (Section 1.5) add more. Plan dense BF16 runs on H100s at 35–45% MFU [6, 48, 12, 1].
Which peak? Dense BF16. Section 2.1 explains why the datasheet's 1,979 TFLOP/s assumes sparsity and the dense BF16 peak is 989.5. DeepSeek-V3 ran most GEMMs in FP8 [2] but computes MFU "based on BF16 peak performance" [1]. TorchTitan calls MFU for mixed BF16 and FP8 runs "not well-defined" [48]. Causal or full attention? One DeepSeek-V3 run is 38.94% causal and 43.73% full, 385 against 432 TFLOP/s per GPU [1]. Steady state or all GPU-hours? Llama 3.1 405B is 41% against 34.6%, as worked out below.
To compare reported hours with an MFU, use the same FLOP count:
with the matmul parameters of Section 1.2 (keep whole for a tied head).
At a constant 41% MFU on 16,384 H100s, s, or 66 days and 26.0M GPU-hours (computed). That is a hypothetical, since stages ran at 43% and 38% too [6]. The model card lists 30.84M H100 GPU-hours for 405B [11], 78 days on 16,384 GPUs. With the 989.5 TFLOP/s dense BF16 peak [4],
so 34.6% with 6ND, or 35.8% counting causal attention at 8K (computed), against 38–43% steady state. Restarts, checkpoints and slower stages plausibly fill the gap. Meta reports "higher than 90% effective training time" [6] without a breakdown. The card's 1.46M hours for 8B and 7.0M for 70B imply 13.9% and 25.5% (computed). Neither source explains that, and the card counts "the total GPU time required for training each model", which may include more than pretraining [11].
Failure rates, the 1/N law and Llama 3's 466 interruptions are in Section 12.1. Goodput and ETTR (effective training time ratio) are defined in Section 12.8. In Figure 3, pick a running example and compare the bar for hours at your MFU with the reported hours. The calculator counts causal attention by default, so Llama 3 405B shows 69 days. Set Counting to None (6N) to recover the 66 days above: part of every gap is the counting convention.
Method and sources
The left panel compares the GPU-hours computed at your settings with the hours the preset's run reports. The right panel divides each run's compute by its reported GPU-hours and the dense BF16 peak of the hardware it used, under the attention counting you choose, and sets the result beside its headline MFU: with causal counting DeepSeek-V3's pretraining hours imply 39.1%, matching its 38.94% MFU, while Llama 3.1 405B implies 35.8% against 41%. Configurations, token counts and reported GPU-hours come from Grattafiori et al. (2024), the Llama 3.1 model card (Meta 2024), DeepSeek-AI (2024), Zhao et al. (2025), Team OLMo (2024) and Karpathy (2024), chip peaks from NVIDIA, AMD and Google Cloud specification pages and Epoch AI's hardware data, and prices from DeepSeek-AI (2024) and Lambda's list prices (accessed November 2026).DeepSeek-V3's numbers agree with each other. Parameters: 671.03B and 37.55B from the config (Table 1.2) against 671B and 37B reported [18, 2]. FLOPs: six times the 36.63B activated matmul parameters is 219.8 GFLOPs, and causal attention at 4,096 tokens adds GFLOPs (128 heads, query-key dimension 192, value dimension 128, 61 layers). The 250.5 GFLOPs per token (computed) matches the 250 reported [1]. Time: at the measured 272.8B tokens per day on 2,048 GPUs [1], that is 385 TFLOP/s per GPU and 54.3 days for 14.8T tokens, 2.667M GPU-hours (computed), against 2.664M H800 GPU-hours reported for pretraining [2].
DeepSeek reports 38.94% causal and 43.73% full on the BF16 peak [1], which implies an H800 peak equal to the H100's. Plain 6ND, FLOPs, over the 2.664M pretraining hours is 343 TFLOP/s per GPU: 34.6% of the BF16 peak, 33.1% over all 2.788M hours. With causal attention it is 39.1% (all computed), close to the reported MFU, so these hours lose little beyond steady state.
The formulas work at every scale. GPT-2 124M on 10B tokens is FLOPs (nanoGPT's count), 95 minutes on 8 A100s at 60% MFU (computed), near the 90 minutes llm.c's author reports at up to about 60% [15]. An 8B model on 15T tokens on 1,024 H100s at 40% needs FLOPs, 20.6 days and 507K GPU-hours (illustrative cluster, computed), a third of the 1.46M hours reported for Llama 3.1 8B.
Two cautions. Reported GPU-hours cover the final run only (Section 0.2). And MFU falls as GPUs are added at a fixed global batch. MegaScale went from 59.1% on 3,072 GPUs to 55.2% on 12,288 [47], and Llama 3 from 43% to 41% on twice the GPUs "due to the lower batch size per DP group needed to keep the global tokens per batch constant during training" [6]. Optimization fixes the batch (Chapter 5), so each GPU gets less work while communication stays fixed. Twice the cluster does not halve the time.
1.4 Training memory I: weights, gradients and optimizer states
How many bytes per parameter does training need, and how does sharding divide them? Training keeps 16-bit weights, their gradients and the optimizer's private state for every parameter. ZeRO calls these the model states and everything else (activations, temporary buffers, fragmented memory) the residual states [22]. This section counts model states. Section 1.5 counts the rest.
Sixteen bytes per parameter
Take mixed-precision Adam, the default for large models. Mixed precision means the matmuls run in a 16-bit format (BF16 or FP16) while the optimizer works in FP32. Each parameter costs 2 bytes of 16-bit weight, 2 bytes of 16-bit gradient and three FP32 optimizer numbers: a master copy of the weight, Adam's momentum and its variance, 4 bytes each [22]. With ZeRO's , and for weight, gradient and optimizer bytes per parameter,
The master copy exists because updates are tiny next to the weights. FP16’s smallest positive subnormal is ; with round-to-nearest-even, magnitudes at or below half that value (2−25) round to zero. Micikevicius et al. keep an FP32 master copy so that small updates can accumulate [51]. BF16 has FP32's range but far fewer mantissa bits [52], so small updates round away (Chapter 5).
Accumulating gradients over micro-batches in FP32 adds 4 bytes, making 20 per parameter [44]. Llama 3 does this [6]. Do the sources disagree? Micikevicius et al. found mixed precision roughly halved training memory [51], while the Ultra-Scale Playbook says it saves none and only redistributes it [44]. Both are right. FP32 Adam also needs 16 bytes per parameter, so model states do not shrink. The 2017 saving came from activations.
- Mixed-precision AdamW: 2 + 2 + 12 = 16 [22]. With FP32 gradient accumulation: 20 [44].
- DeepSeek-V3: BF16 Adam moments, FP32 master weights and gradients, so 2 + 2 + 4 + 4 = 12 plus a low-precision working copy the report does not itemize [2].
- 8-bit Adam: 2 + 2 + 6 = 10 [23, 53]. SGD with momentum: 2 + 2 + 8 = 12 [23].
- Adafactor: about 8, because it keeps the second moment of an matrix in numbers [54]. For one 4,096 × 14,336 Llama 3 8B matrix that is 18,432 numbers instead of 58.7 million (computed).
Newer work goes lower (as of November 2026): 4-bit states [55], GaLore's low-rank gradients [56], FP8 training [57, 58] and no FP32 master weights at all [59]. Quantized states can go stale, though [60], and Chapter 5 judges whether they converge as well as Adam.
Table 1.7. Model states of the running examples before sharding, in GB (109 bytes), computed from the parameter counts of Section 1.1.
| Model | BF16 weights () | Mixed-precision AdamW () | With FP32 accumulation () |
|---|---|---|---|
| Llama 3 8B | 16.06 | 128.5 | 160.6 |
| Llama 3 70B | 141.1 | 1,128.9 | 1,411.1 |
| Llama 3 405B | 811.7 | 6,493.7 | 8,117.1 |
The Playbook rounds the 70B row to 1,120 and 1,400 GB [44]. The rule of thumb: an 80 GB GPU holds the model states of at most 80 / 16 = 5B parameters, with nothing left for activations (computed). Llama 3 8B cannot train with plain Adam on one H100.
Dividing model states across GPUs
Plain data parallelism copies all bytes to every GPU. ZeRO removes copies across the data-parallel GPUs in three stages: stage 1 shards optimizer states, stage 2 also gradients, stage 3 also weights [22]. Per GPU,
These reproduce the paper's 7.5B model on 64 GPUs: 120, 31.4, 16.6 and 1.9 GB [22]. ZeRO's three stages and FSDP are in Section 11.2. Here we only need the bytes.
With and (all computed):
- Plain data parallelism: GB per GPU.
- ZeRO-1: GB.
- ZeRO-2: GB.
- ZeRO-3: GB.
Only stage 3 leaves room for activations in 80 GB, because stages 1 and 2 still keep all 141 GB of BF16 weights on every GPU.
Llama 3's FSDP shards optimizer states and gradients but keeps gathered weights after the forward pass, to save an all-gather in the backward pass [6]. Offloading to CPU memory and NVMe goes further [61, 62], and DeepSeek-V3 keeps its moving average of the weights in CPU memory [2]. LoRA and QLoRA memory and FLOPs are in Section 8.3.
In Figure 4, pick Llama 3 70B, set to 64 and step ZeRO from 0 to 3: optimizer states collapse at stage 1, gradients at 2, weights only at 3. Then raise the sequence length and watch activations decide whether the bar crosses the HBM line.
Method and sources
With pipeline parallelism a second bar shows the last stage, which holds the logits, while the first stage holds the most activations. Model states follow the ZeRO accounting of Rajbhandari et al. (2019) with recipe bytes from Tazi et al. (2025), DeepSeek-AI (2024), Dettmers et al. (2021) and Shazeer and Stern (2018). Activations use the GPT-layer count and pipeline factor of Korthikanti et al. (2022), a Llama-style count derived in this chapter (a computed estimate), FlashAttention after Dao et al. (2022) and fused losses after Wijmans et al. (2024). The Llama 3 405B preset uses the Table 4 layout of Grattafiori et al. (2024), and the dashed line is the 80% rule of thumb of Fujii et al. (2024), stated for their own estimator. Parameter counts come from the released configurations, and context overhead and the gathered-layer window are illustrative.The usual mistakes: forgetting the FP32 gradient buffer, counting the master copy twice (it is inside ), and testing only step one. Runs can pass step one and fail on step two, because the optimizer state builds up after the first step [44].
1.5 Training memory II: activations, recomputation and the real peak
How much memory do activations take, what does recomputation buy, and why does a run that fits on paper still run out of memory? The activations are the tensors the forward pass saves for the backward pass. They grow with the tokens on the GPU, the layers and the width. They pile up through the forward pass, peak at the loss and are freed layer by layer on the way back. ZeRO does not shrink them.
Counting saved tensors
Korthikanti et al. did the bookkeeping for a GPT layer with 16-bit activations, multi-head attention, a 4d GeLU MLP and dropout. In our notation (their is our width , their our head count ), sequences of tokens store bytes in attention, in the MLP and in the two layer norms [45]:
The term holds the attention scores, softmax and dropout mask, the only tensors that grow with . For GPT-3 (, , ) it equals 80, as the paper states [45], so one sequence needs 2.67 GiB per layer (computed). That quadratic part is cheap to recompute, and recomputing only it saves 70% and 65% of activation memory for GPT-3 and MT-NLG at 2.7% and 1.6% extra FLOPs [45]. FlashAttention never stores the matrix and recomputes it in the backward pass, so it runs faster and uses less memory [63], linear in sequence length. FlashAttention's tiling and online softmax are explained in Section 2.4.
A Llama layer
No published count covers a Llama layer (GQA, SwiGLU, RMSNorm, no dropout), so we do our own. With FlashAttention, an unfused SwiGLU and BF16, each token in each layer saves the input and output of both RMSNorms ( elements), the query and attention output (), the key and value (), and four MLP tensors of width (gate output, its SiLU, up output and their product):
For Llama 3 8B that is bytes, or , per token per layer. One 8,192-token sequence through 32 layers holds 41.0 GiB (44.0 GB). Llama 3 70B holds 202.5 GiB and 405B 602.4 GiB per 8K sequence (all computed). Treat these as estimates: on a scaled-down Llama-shaped layer, the tensors PyTorch autograd saved came to 8% more (measured for this guide), from K and V expanded to every query head, the softmax log-sum-exp and the norm statistics. Without FlashAttention the stored softmax adds bytes per layer, 128 GiB more for 8B at 8K (computed).
Recomputation
Activation recomputation (or checkpointing) trades FLOPs for bytes: store less in the forward pass and recompute the rest in the backward pass. Full recomputation stores only each layer's input, bytes [45], and reruns the forward pass: about hardware FLOPs per token instead of , which is why HFU exceeds MFU (Section 1.3). Chen et al. (2016) made it practical for deep networks: checkpointing an -layer network every layers needs memory that grows as , for one extra forward computation [64].
Recomputing both RMSNorms removes elements per token per layer. Fusing SwiGLU (keep the gate and up outputs, recompute the rest) removes .
Table 1.8. Activations for one Llama 3 8B sequence of 8,192 tokens, BF16, FlashAttention (GiB, computed).
| Strategy | Stored per token per layer | Activations | Extra compute |
|---|---|---|---|
| Store everything | 41.0 d | 41.0 | none |
| Recompute both RMSNorms | 37.0 d | 37.0 | small |
| Fused SwiGLU | 27.0 d | 27.0 | small |
| Both (DeepSeek-V3 style) | 23.0 d | 23.0 | small |
| Full recomputation | 2 d | 2.0 plus a 1.3 working set | one forward pass ( instead of ) |
DeepSeek-V3 recomputes its RMSNorms, the up-projections of its multi-head latent attention (MLA, Section 4.5) and SwiGLU outputs, which with other memory work let it train without tensor parallelism [2].
Korthikanti et al. measured a per-layer overhead of 7% for selective against 39% for full recomputation, and 30–40% more execution time in full-recomputation runs [45]. Llama 3 pretrained on 8K sequences without activation checkpointing [6]. Section 11.4 settles whether Llama 3 405B fits at 8K without checkpointing (about 42–75 GiB per GPU, depending on assumptions).
What parallelism divides
Tensor parallelism with sequence parallelism (Section 11.3) splits activations across GPUs: Llama 3 70B at 8K drops from 202.5 to 25.3 GiB per GPU at (computed). Pipeline parallelism does not help the first stage: under 1F1B (the one-forward-one-backward schedule of Section 11.4) it holds micro-batches of layers, layers' worth, and more with interleaved chunks [45]:
which is at , (computed). Llama 3's first stage used more memory [6]. Chapter 11 divides these numbers for each layout.
The logits
The loss needs logits, in BF16 and again in FP32 [45], so bytes. With Llama 3's 128,256-token vocabulary that is 1.96 + 3.91 = 5.9 GiB (6.3 GB) at 8K and 94 GiB at 128K (computed). Fused loss kernels remove most of it: Cut Cross-Entropy cuts Gemma 2 2B's loss memory from 24 GB to 1 MB [65], and the Liger kernels report 60% less GPU memory [66].
ZeRO-3 over , one 8,192-token sequence per GPU, FlashAttention, no recomputation, unfused loss. At the loss, from step 2 on (computed):
- Model states: GB (weights 2.0, master 4.0, moments 8.0, gradients 2.0).
- Activations 44.0 GB, logits 6.3 GB.
- Gathered weights of the current and prefetched layer: 0.87 GB (an illustrative two-layer window).
- CUDA context: 1.5 GB (illustrative, inside the Playbook's 1–2 GB [44]).
The total is about 68.8 GB, or 66.8 GB if gradient buffers are freed between steps. Step 1 peaks near 58.7 GB, because the Adam moments and gradients do not exist yet [44]. That fits in 80 GB but exceeds 64 GB, 80% of HBM. In Fujii et al.'s 454 experiments, every configuration their estimator put at or below 80% of GPU memory trained without running out of memory [67]. Recomputing norms and SwiGLU gives 49.4 GB, and full recomputation about 27–28 GB.
Figure 5 walks through that step. Watch activations climb about 1.4 GB per layer, the logits spike at the loss, and the backward pass free them. Switch to step 1 to see the 8 GB of Adam moments appear at the first optimizer step.
Method and sources
The toggles show what recomputing the norms and SwiGLU output (49.4 GB) or whole layers (26.9 GB) removes, what a fused loss removes, and what FP32 gradient accumulation adds. Every band is computed from formulas with cited constants (model states from Rajbhandari et al. 2019, activations and logits after Korthikanti et al. 2022 with FlashAttention from Dao et al. 2022, recomputation choices from DeepSeek-AI 2024, fused loss from Wijmans et al. 2024, model shapes from Grattafiori et al. 2024) following the step anatomy in the Ultra-Scale Playbook (Tazi et al. 2025). The progress axis and the 1.5 GB CUDA context are illustrative, gradient buffers are assumed to be kept between steps, and the dashed line marks 80% of HBM, Fujii et al.'s (2024) rule of thumb for their own memory estimator (454 runs on A100 40GB and H100 94GB GPUs).- CUDA kernels take 1–2 GB before the first tensor [44].
- PyTorch's caching allocator keeps freed blocks, which nvidia-smi still shows as used [68].
- Fragmentation: ZeRO hit out-of-memory errors with over 30% of memory free in extreme cases [22]. The allocator option
max_split_size_mbcan help [68]. - Buffers: a flattened FP32 gradient buffer for a 1.5B model is 6 GB [22], and communication and gradient-accumulation buffers persist through the step [44].
Keep the estimate under about 80% of HBM [67] and check it against PyTorch memory snapshots of the first two steps [69]. Chapter 12 covers out-of-memory debugging.
1.6 The arithmetic of inference: FLOPs per token, weights and the KV cache
What does generating one token cost in FLOPs and bytes, and how big is the KV cache? With no backward pass and no optimizer, the FLOPs per training token become per inference token [70, 33], and model states shrink to the weights. A new memory takes their place: the KV cache, the keys and values of every earlier token, kept so they are not recomputed for each new one.
FLOPs per token
Prefill processes the prompt in one forward pass, at per prompt token plus causal attention. Decode then generates one token at a time. Each new token passes through every weight once, and each of the query heads in each layer takes a dot product with cached keys and a weighted sum of values, FLOPs each:
We subtract the input-embedding parameters because a lookup is not a matmul. Snell et al. use the same per token to compare test-time with pretraining compute [71]. With the Llama 3 shapes [6]:
Table 1.9. Decode FLOPs per generated token for Llama 3 (GFLOPs, computed), attention share in parentheses.
| Model | Weights, 2(N - Vd) | Attention at 8K | Attention at 128K |
|---|---|---|---|
| Llama 3 8B | 15.0 | 4.3 (22%) | 68.7 (82%) |
| Llama 3 70B | 139.0 | 21.5 (13%) | 343.6 (71%) |
| Llama 3 405B | 807.5 | 67.6 (8%) | 1,082.3 (57%) |
At 128K a decoded token costs 2.3 times (405B) to 5.6 times (8B) its weight FLOPs (computed), so fails worst for small models with long contexts.
Grouped-query attention (GQA) lets several query heads share one key and value head. Every query head still takes its own dot products, so decode attention FLOPs scale with , not . Only the cache shrinks, by : 4 times for Llama 3 8B, 8 for 70B, 16 for 405B. Head count is therefore a FLOP decision. Kimi K2 kept 64 heads rather than 128 because at 128K doubling them would add 83% to inference FLOPs [72].
The KV cache
Each layer caches one key and one value vector per KV head per token. With bytes per element,
Check it on OPT-13B, with 40 layers, width 5,120 and multi-head attention (): bytes, which the vLLM paper rounds to 800 KB [73].
With , , and BF16 [6]: bytes, 128 KiB per token. One 8K sequence needs 1.0 GiB, and one 128K sequence 16 GiB (17.2 GB), more than the 16.06 GB of weights. With multi-head attention it would be 64 GiB. The same formula gives 320 KiB per token for 70B and 504 KiB for 405B, 40 and 63 GiB per 128K sequence (all computed).
Section 4.5 compares KV bytes per token across attention designs: 327,680 B for Llama 3 70B with GQA-8 against 70,272 B for DeepSeek-V3 with MLA. Both descend from multi-query attention, which shares one key and value head across all heads to cut the memory bandwidth of decoding [74, 75].
The cache matters more than its FLOPs suggest because, unlike the weights, it is unique to each sequence [33]. Weight loading dominates at small batches and short sequences, KV loading at 2,048+ tokens with batch 512+, where a 500B+ multi-head model needs a 3 TB cache [33].
Weights and what fits
Llama 3 70B in BF16 is 141.1 GB, more than one H100. Llama 3 405B in BF16 is 811.7 GB (computed) and does not fit one 8-GPU H100 machine [6]. FP8 halves weight memory [1], to 405.9 GB (computed). Section 13.2 owns the KV-cache arithmetic, the decode floor and what fits in HBM. Other inference overhead is usually 20% or less [23], but the cache used to waste space: before paging, only 20.4–38.2% of KV memory held token states, and vLLM's paged cache raised throughput 2–4 times [73]. Section 13.4 works out how many sequences fit: on 8 H100s a 402.9 GB pool holds 1.23M tokens, about 150 sequences that each reserve 8K.
Table 1.10. Rules of thumb for one 80 GB GPU (computed from bytes per parameter, before activations or KV cache). The 4-bit row uses QLoRA's NF4 with double quantization, 4.127 bits per parameter [76].
| Job | Bytes per parameter | Largest model whose states fit |
|---|---|---|
| Full training, mixed-precision AdamW | 16 | 5B (about 3-4B with activations) |
| BF16 inference | 2 | 40B (about 30-35B with KV room) |
| FP8 or INT8 inference | 1 | 80B (70B fits with little KV room) |
| 4-bit inference | about 0.52 | about 155B |
Decode does about 2 FLOPs per weight per sequence and a few per cached byte. With so few FLOPs per byte, memory bandwidth rather than peak FLOP/s sets decode speed. Section 1.7 makes that precise with the roofline.
1.7 Rooflines: when bytes, not FLOPs, set the time
Given an operation's FLOPs and bytes, how fast can it run on a given chip? Think of the chip as a factory with a loading dock [77]. The floor (the tensor cores) does FLOPs per second. Material arrives through the dock (HBM) at bytes per second. If each byte feeds few operations, the floor idles.
The roofline and the ridge point
An operation that does FLOPs and moves bytes needs at least seconds of math and seconds of traffic. With perfect overlap the time is the larger one, so
This is the roofline of Williams, Waterman and Patterson [78, 79]. is the arithmetic intensity in FLOPs per byte of HBM traffic (the paper says operational intensity). The ridge point is "the minimum operational intensity required to achieve maximum performance" [79], which NVIDIA calls the ops:byte ratio [80]. Below it an operation is memory-bound, above it compute-bound. The roof is a best case: microbenchmarks reach 90–92% of rated bandwidth [81], and an H100 does 989 TFLOP/s of FP16 matmul but only 3.9 TFLOP/s of exponentials [82].
Table 1.11. Dense peaks, HBM bandwidth and ridge points. Sparse datasheet figures are halved. Ridges are computed as dense peak over bandwidth.
| Chip | BF16 TFLOP/s | FP8 TFLOP/s | HBM | TB/s | Ridge BF16 (FLOP/B) | Ridge FP8 (FLOP/B) | Source |
|---|---|---|---|---|---|---|---|
| A100 SXM 80GB | 312 | n/a | 80 GB | 2.039 | 153 | n/a | [83] |
| H100 SXM | 989.5 | 1,979 | 80 GB | 3.35 | 295 | 591 | [4] |
| H200 SXM | 989.5 | 1,979 | 141 GB | 4.8 | 206 | 412 | [84] |
| B200 (per GPU, from 8-GPU totals) | 2,250 | 4,500 | 180 GB | 8.0 | 281 | 563 | [85, 86] |
| MI300X | 1,307.4 | 2,614.9 | 192 GB | 5.3 | 247 | 493 | [87] |
| TPU v5p | 459 | 459 (as listed) | 102 GB (95 GiB) | 2.765 | 166 | 166 | [88] |
Ridges cluster at 150–300 FLOP per byte in BF16 and double in FP8, because compute outruns bandwidth: over 20 years peak server FLOP/s grew 60,000x against 100x for DRAM bandwidth [89].
Where transformer operations sit
An matmul (GEMM) costs FLOPs, the rule of Section 1.2 (here is the output width, not the parameter count). With each operand crossing HBM once at bytes per element [32],
where is the tokens in the product. In BF16 a weight GEMM's intensity is about the tokens in flight, and a matrix-vector product is always memory-bound [32].
Llama 3 8B's fused gate and up projection has and [6]. In BF16 its intensity is 1.0 at , 62.9 at 64 and 238.9 at 256, all below the H100's 295. At 512 tokens it reaches 448, compute-bound. One 8,192-token training sequence gives 2,493, near the limit (all computed). Training sits on the flat roof, small-batch decode low on the slope.
Decode attention cannot be batched up the slope. Each sequence reads its own cache, and the query heads sharing a KV head do FLOPs per cached position:
4 FLOP per byte for Llama 3 8B and 8 for 70B at any batch or context (computed). Only fewer KV bytes help (Section 1.6). A roofline study of Llama-2–7B found that "in the decode stage, all computations are memory-bound" [90]. Elementwise operations do about one FLOP per two-byte element [80]. In a Llama 3 8B layer at 8K tokens they take about 10% of ideal H100 time for 0.03% of the FLOPs (computed). Fusion, which keeps intermediates on chip, is the fix [77].
Table 1.12. Arithmetic intensity of Llama 3 operations in BF16 and their regime on an H100 (ridge 295). All values computed from the Table 3 shapes of the Llama 3 paper.
| Operation | FLOP per byte | H100 regime |
|---|---|---|
| 8B gate and up GEMM, T = 1 (decode, batch 1) | 1.0 | memory-bound |
| 8B gate and up GEMM, T = 256 | 238.9 | memory-bound |
| 8B gate and up GEMM, T = 8,192 (one training sequence) | 2,493 | compute-bound |
| Decode attention, 8B (g = 4) and 70B (g = 8) | 4 and 8 | memory-bound at any batch |
| FlashAttention prefill at 8K, ideal traffic (upper bound) | about 4,096 | compute-bound |
| RMSNorm, residual add | about 1 and 1/6 | memory-bound |
Figure 6 places these operations on real chips. Drag the token count: the four weight GEMMs climb the slope and cross the H100 ridge at –345 (computed), a little above 295 because activations add traffic, while decode attention stays pinned at 4 or 8. Compare the H200's line: the same roof, with the ridge moved left to 206.
Method and sources
Points are the operations of one Llama 3 8B or 70B layer placed on the chosen chip's roof: the four weight GEMMs, whose intensity 2TKN / (e(TK + KN + TN)) is computed live from the model shapes as the tokens per GEMM T change, decode attention at 2K, 8K and 128K context, FlashAttention prefill per head with ideal traffic (an upper bound on its intensity), and three elementwise operations. On the H100 in BF16 the weight GEMMs cross the ridge at T ≈ 308–345 (computed), so decode below a few hundred sequences is memory-bound, and decode attention stays at h/h_kv FLOP per byte whatever the batch. The roofline model is from Williams, Waterman and Patterson (2009), GEMM and elementwise intensities follow NVIDIA's performance guides (2023) and He (2022), model shapes are from Grattafiori et al. (2024), attention traffic follows Dao et al. (2022) and Pope et al. (2022), and chip figures come from NVIDIA, AMD and Google Cloud product pages.Decode against the memory wall
A decode step with batch reads every weight once for FLOPs, so , about with BF16 weights.
Dense BF16 is 1,979 / 2 = 989.5 TFLOP/s over 3.35 TB/s, a ridge of 295 (computed from [4]). BF16 weight GEMMs turn compute-bound near , about 148 with 8-bit weights and BF16 math, and still about 295 with FP8 weights and math, since the ridge doubles too (computed). The scaling book gives about 280 for an H100 and the same 2x rules [91].
Section 13.2 turns this into the decode floor: Llama 3 70B on 8 H100s needs at least 5.27 ms per token at batch 1 (computed).
PaLM 540B showed both regimes on 64 TPU v4 chips: 29 ms per token in low-batch generation with int8 weights and 76% MFU on large batches of input tokens [33]. Serving systems now split the two phases [92], as Chapter 13 shows. Mixture-of-experts decode is harder: DeepSeek-V3 routes each token to 8 of 256 experts, so feeding every expert near the ridge takes about 9,450 tokens per step (computed), and its smallest decoding deployment is 320 GPUs [2].
The H200 keeps the H100's compute with 141 GB at 4.8 TB/s [84], so the ridge falls from 295 to 206. The roofline predicts nothing for compute-bound training kernels and up to 1.43x for memory-bound decode, plus larger batches (computed). NVIDIA's headline claims are inference ones, such as Llama 2 70B inference 1.9x faster (reported) [84]. Read a new chip by asking which roof moved.
Overhead and shapes
Horace He adds a third regime, overhead: Python, dispatch and kernel launches [77]. His test: "if you double your batch size but your runtime only increases by 10%, you're likely overhead bound" [77].
OLMo 2's team removed host-device syncs, which stop new work from being queued until the GPU drains, used torch.compile to cut Python dispatch, and disabled automatic garbage collection, under which throughput was "slower and less stable, often becoming worse as the run progresses" [7]. Measure tokens per second per device over a long window.
Shapes matter too: on a 108-SM A100, a matmul needing 117 tiles instead of 108 adds a tail wave and roughly halves throughput [32]. The exponential unit is a ceiling of its own: FlashAttention-3 lifted attention from 35% to 75% of H100 peak by overlapping exponentials with matmuls [82], and Section 2.4 explains its tiling and online softmax. To diagnose a kernel, count and , compute both time bounds, and if the measured time is far above the larger one, look for overhead, bad shapes or a lower ceiling.
1.8 Energy, dollars and the compute trend
What does a training run cost in energy and money, and how fast is training compute growing? Both costs start from the GPU-hours of Section 1.3:
Power usage effectiveness (PUE) is facility energy over IT energy: 1.58 for the 2018 US average [93] and 1.09 across Google's fleet [94]. is energy per model FLOP.
The model card reports 30.84M H100-hours for 405B at 700 W, a power it defines as peak capacity "adjusted for power usage efficiency", and 8,930 t CO2eq [11]. So PUE is already in. Hours times power is 21.6 GWh, about 0.414 t per MWh, and J over FLOPs is 2.05 pJ per model FLOP (computed). An H100 at dense peak spends 0.71 pJ per FLOP, so 2.05 pJ is the 34.6% end-to-end utilization of Section 1.3 seen from the power side (computed).
The card assumes full rated power throughout [95]. OLMo 2's measured power swung between about 15% and 85% of maximum, just over 100 W per GPU during checkpoints [95], so TDP-based estimates "are nearly always an overestimation" [96]. GPU-only boundaries err the other way: one median Gemini prompt is 0.24 Wh with host and facility counted and 0.10 Wh with accelerators only [94]. Always state the boundary.
Table 1.13. Training energy of public runs. Energy and emissions are reported, except Llama 3.1 405B's energy, which is GPU-hours × 700 W (computed). Energy per FLOP is computed.
| Run | Energy (MWh) | Method | CO2eq (t) | pJ per model FLOP | Source |
|---|---|---|---|---|---|
| Llama 3.1 405B (H100) | 21,588 | GPU-hours × 700 W, PUE included | 8,930 | 2.05 | [11, 6] |
| OLMo 2 7B (H100) | 157 | measured GPU power | 52 | 3.1 | [95, 7] |
| BLOOM 176B (A100) | 433 | reported, Jean Zay cluster | 24.7 dynamic, 50.5 all processes | 4.3 | [97, 98] |
| GPT-3 175B | 1,287 | estimate by Patterson et al. | 552 | n/a | [93] |
Facility power and the grid swings of synchronous jobs are covered in Section 2.7.
Dollars: the method decides the number
DeepSeek-V3's famous figure is 2.788M H800-hours at an assumed 2 dollars per GPU-hour, 5.576 million dollars, final run only, excluding prior research and ablations [2]. The same model can carry very different prices.
Table 1.14. One model, many prices: Llama 3.1 405B (30.84M H100-hours). Rental rows are computed. Epoch rows are dataset values, accessed November 3, 2026.
| Method | Cost (USD) | Source |
|---|---|---|
| Rental at 2.00 per GPU-hour (illustrative, DeepSeek's assumption) | 61.7M | [11, 2] |
| Rental at 3.99, a listed on-demand 8-GPU price | 123M | [99] |
| Rental at 5.54, a listed 256-GPU cluster price | 171M | [99] |
| Epoch, amortized hardware and energy (2023 USD) | 52.9M | [98] |
| Epoch, cloud | 176.0M | [98] |
| Epoch, hardware acquisition | 582.3M | [98] |
| Epoch, training compute cost (upfront) | 928.4M | [98] |
| Electricity, 21.6 GWh at 0.08 per kWh (illustrative) | 1.7M | computed |
Amortized frontier training costs grew 2.4x per year since 2016. Accelerator chips are 44% of amortized hardware and energy cost and energy about 9%, and energy falls to 2–6% of the full development cost once staff are counted [100].
Setting DeepSeek-V3's 5.6 million dollars beside Epoch's 176 million for Llama 3.1 405B compares a final-run rental with a cloud estimate. Normalize first. DeepSeek-V3 used 11x fewer GPU-hours and 11.6x fewer FLOPs ( against ). At one price of 2 dollars per GPU-hour both cost about 1.6–1.7 dollars per FLOPs (computed). The gap is run size and method, not efficiency.
The compute trend
Epoch AI estimates that training compute grew 4.1x per year for notable models from 2010 to May 2024 and 5.3x for frontier models, slowing to 4.2x after 2018, and summarizes the trend as 4–5x per year [101]. Our least-squares fit of on Epoch's November 2026 data gives x per year (90% interval 4.9–6.1x) for 302 language models since 2010, a doubling every 4.9 months, and 4.75x (4.3–5.2x) for 45 frontier models since 2018 (computed from [98]).
Figure 7 plots that dataset. Find the running examples on the trend, then note the hollow points above FLOPs: Epoch's estimates for closed models, labeled Likely or Speculative, not lab-reported numbers.
Method and sources
The dotted line grows at the slider's rate through the selected model. The two lines are unweighted least-squares fits of log compute on date, computed for this guide over the ranges drawn: 5.47x per year for 302 language models since 2010 and 4.75x per year for the 45 models Epoch flags as frontier since 2018, close to the 4–5x per year that Sevilla and Roldán (2024) recommend as a summary. Llama 3.1 405B sits on the frontier fit, DeepSeek-V3, five months later, used about 11.6x less compute by 6ND (computed), and the GPT-2 124M point is a 6ND estimate for Karpathy's (2024) llm.c reproduction, not part of Epoch's data. The four models above 10²⁶ FLOPs are Epoch estimates labeled Likely or Speculative, not numbers their developers reported. Sources: Epoch AI (2026), Sevilla and Roldán (2024), Karpathy (2024), Grattafiori et al. (2024), DeepSeek-AI (2024) and Chowdhery et al. (2022).Algorithms add more. The compute needed for a fixed language-model loss has halved about every 8 months (95% interval 5–14) [102], so effective compute grows roughly 10–15x per year (illustrative: 4–5x times about 2.8x). Epoch judges FLOP runs likely feasible by 2030 [103]. Chapter 6 asks what that compute buys.
Llama 3 8B trains at 8K tokens, then at 128K. How much more does a training token cost at 128K, and why?
About 2.9x: 148 against 51 GFLOPs per token, causal counting (computed from [6]). Weight FLOPs stay near 45 GFLOPs. The attention matmuls grow linearly with context and become about 70% of the work.
PaLM reports 46.2% MFU and 57.8% HFU. What recomputation does the ratio imply?
57.8 / 46.2 = 1.25 = : extra FLOPs per token, 75% of the forward pass. PaLM recomputed 75% of its non-attention forward FLOPs [34]. Full recomputation would give 1.33.
Llama 3 70B, mixed-precision AdamW, 64 GPUs: per-GPU model states without sharding and with ZeRO stages 1, 2 and 3?
About 1,129, 295, 157 and 17.6 GB (computed with the ZeRO formulas [22]). Only stage 3 fits an 80 GB GPU, because stages 1 and 2 keep all 141 GB of BF16 weights everywhere.
GQA with 8 KV heads cuts Llama 3 70B's KV cache 8x. Does it cut decode attention FLOPs 8x?
No. All 64 query heads still score every cached key, so FLOPs follow , not [75]. GQA cuts bytes 8x, which is why decode attention runs at 8 FLOP per byte.
An H100 sheet lists 1,979 TFLOP/s BF16 and 3.35 TB/s. What is the dense ridge, and what decode batch makes weight GEMMs compute-bound?
1,979 includes sparsity [4], so dense is 989.5 and the ridge 295 FLOP per byte. BF16 decode does 2b FLOPs per 2 bytes of weights, so the crossover is near b = 295. The sparse figure gives 591, a 2x error.
- Count parameters from the config: Llama 3 8B has 8,030,261,248 with its 128,256-token vocabulary.
- Training costs about FLOPs per token plus attention, times the context, halved when causal. With causal counting attention is 4–13% of Llama 3's FLOPs at 8K and 40–70% at 128K (up to 22% and 82% counted in full).
- Time is . Plan H100 runs at 35–45% MFU. GPU-hours imply less (34.6% for Llama 3.1 405B), so state peak, attention convention and time base.
- Mixed-precision AdamW costs 16 bytes per parameter (20 with FP32 accumulation). ZeRO-3 takes Llama 3 70B from 1,129 GB to 17.6 GB per GPU on 64 GPUs.
- One 8K sequence of Llama 3 8B holds about 41 GiB of activations, about 2 GiB with full recomputation. Stay under about 80% of HBM.
- The KV cache is bytes per token: 128, 320 and 504 KiB for Llama 3 8B, 70B and 405B, about 69 KiB for DeepSeek-V3. GQA saves bytes, not FLOPs. MLA saves more bytes, and its FLOPs depend on how it is computed (Section 4.5).
- An operation runs at . The H100's BF16 ridge is about 295 FLOP per byte. Decode weight GEMMs are memory-bound below about 300 sequences, and decode attention and KV reads are memory-bound at any batch.
- Energy is GPU-hours × power × PUE and cost is GPU-hours × price: state the power, boundary and price method. Frontier compute grows about 4–5x per year.
2. Hardware: accelerators, interconnects and clusters
A chip's peak is only one part of its performance. Follow the bytes from registers and high-bandwidth memory through the node and across the cluster: the slowest necessary transfer can set the pace for everything else.
Llama 3 405B trained on up to 16,384 H100 GPUs at 380 to 430 TFLOP/s per GPU, a BF16 MFU of 38% to 43% [6] (MFU is defined in Section 1.3). So the tensor cores, with a dense peak of 989.5 TFLOP/s, delivered less than half of it as useful model FLOPs (computed, 380/989.5 and 430/989.5). Hardware also shapes models: DeepSeek-V3 trained on 2,048 H800 GPUs [2], whose NVLink "is reduced from 900 GB/s to 400 GB/s", and so "Tensor Parallelism is avoided during training" [1].
On an H100, bandwidth falls roughly tenfold at each step out from the tensor cores: about 31 TB/s from shared memory, 3.35 TB/s from HBM, 450 GB/s per direction over NVLink, 50 GB/s through a 400 Gb/s network card and about 7 GB/s per GPU across the top of Llama 3's network [82, 4, 104, 6]. Kernels, formats, parallelism and networks all keep traffic on the fastest level that can hold it.
Sections 2.1 to 2.4 stay inside one chip. Section 2.5 to Section 2.8 move out to the node, network, cluster and chip landscape. The H100 SXM (the socketed server module, not the PCIe card) is the reference chip, with specs as of November 2026. The running examples and the notation are introduced in Section 0.3.
2.1 Inside a GPU: SMs, warps and tensor cores
When PyTorch multiplies two matrices, which hardware does the work, and where does the peak FLOP/s on the spec sheet come from? The tensor cores. "An H100 GPU has 989 TFLOPs of half-precision matrix multiply compute, and ~60 TFLOPs of 'everything else'" [105], so tensor cores supply about 94% of the arithmetic (computed).
A GPU is many copies of one processor, the streaming multiprocessor (SM) [106]. The H100 SXM has 132 SMs with 4 tensor cores each, cut down from 144 SMs on the full die [104]. A kernel launches thread blocks, each on one SM, whose threads form "groups of 32 threads called warps" [106] that execute one instruction together. Hopper adds warpgroups of four warps that issue matrix instructions together [82, 81].
Loads take hundreds of cycles, so an SM keeps up to 64 warps resident and switches among them. Occupancy, resident warps over 64, is capped by the first resource to run out: 64K 32-bit registers, 255 per thread, 32 blocks or 228 KB of shared memory per SM [107]. With registers per thread,
so 32 registers allow 100%, 128 allow 25% and 255 allow 12.5% (computed). Fast kernels accept low occupancy, because "registers are generally the key resource" [105]. In FlashAttention-3, producer warps only move data and consumer warpgroups only compute, with registers shifted between them [82]: two consumers at 240 registers per thread and a producer at 24 fill 64,512 of 65,536 registers at 19% occupancy (illustrative, computed).
Peak FLOP/s is a product of three numbers, with one fused multiply-add (FMA) counted as 2 FLOPs:
Dense 16-bit matmul work per SM per clock has doubled each generation, from 1,024 on V100 (FP16, since Volta has no BF16) to 2,048 on A100, 4,096 on H100 and 8,192 on B200 (BF16) [108, 109, 110]. Other chips follow the same formula. A TPU's matrix unit (MXU) is a systolic array that passes operands from cell to cell, 16K multiply-accumulates per cycle on a 128 × 128 array, accumulated in FP32 [111]. Table 2.1 multiplies it out.
Table 2.1. Peak dense 16-bit matmul FLOP/s from first principles matches the spec sheets within 1% (FP16 on V100, BF16 elsewhere).
| Chip | Units | FLOP per clock per unit | Boost clock | Computed (TFLOP/s) | Reported (TFLOP/s) | Source |
|---|---|---|---|---|---|---|
| V100 SXM2 (FP16) | 80 SMs | 1,024 | 1.53 GHz | 125.3 | 125 | [108] |
| A100 SXM | 108 SMs | 2,048 | 1.41 GHz | 311.9 | 312 | [109] |
| H100 SXM | 132 SMs | 4,096 | 1.83 GHz | 989.4 | 989.5 (1,979 sparse) | [4, 82] |
| B200 | 148 SMs | 8,192 | 1.85 GHz | 2,243 | 2,250 | [110] |
| TPU v4 | 8 MXUs | 32,768 | 1.05 GHz | 275.3 | 275 | [112] |
| MI300X | 304 CUs | 2,048 | 2.1 GHz | 1,307.4 | 1,307.4 | [113, 87] |
| MI355X | 256 CUs | 4,096 | 2.4 GHz | 2,516.6 | about 2,500 | [114] |
132 SMs × 4 tensor cores × 512 BF16 FMAs per clock per core × 2 FLOPs per FMA × 1.83 GHz = 989.4 TFLOP/s (computed), half of the 1,979 the product page lists with sparsity [4]. Halving that datasheet figure gives 989.5, the value this guide uses. FP8 doubles the per-clock rate, to 1,979 dense. A B200 gives 148 × 8,192 × 1.85 GHz = 2.24 PFLOP/s, quoted as 2.25 [110].
Since Ampere, tensor cores can skip the zeros of 2:4 structured sparsity, "two non-zero values in every four-entry vector" [109], for twice the throughput. NVIDIA prints that figure: the H100 page lists BF16 at 1,979 TFLOP/s, footnoted "With sparsity" [4], and the HGX page says "Dense is ½ sparse spec shown" [85]. MFU and its conventions (6N or with attention, which peak, which time base) are defined in Section 1.3. Say which one a number uses.
Non-matmul work is slower. An A100 has "312 TFLOPs/s of FP16/BF16 matmul, but only 19.5 TFLOPs/s of non-matmul FP32" [38]. Exponentials go to the multi-function unit (MUFU) at 16 per clock per SM on H100 and B200 [110]: 16 × 132 × 1.83 GHz = 3.9 trillion per second, 256 times below the H100's BF16 matmul rate (computed). This unit shapes attention kernels (Section 2.4).
2.2 The memory hierarchy: why moving bytes sets the pace
Where do the operands of a matrix multiply come from, how fast can each level deliver them, and why does data movement, not arithmetic, usually set the speed? Memory gets smaller and faster closer to the tensor cores, from HBM (high-bandwidth memory) beside the die to an L2 cache, per-SM shared memory and registers. For two decades peak server FLOP/s grew about 3.0 times every two years while DRAM and interconnect bandwidth "have only scaled at 1.6 and 1.4 times every 2 years, respectively" [89].
Table 2.2 gives the H100's ladder. Latency grows downward, from 29 cycles for shared memory to 479 for HBM, measured by Luo et al. on an H800 PCIe [81], about 17 and 273 ns (computed at 1,755 MHz).
The roofline and the ridge point are derived in Section 1.7. Apply them here without re-deriving. The new point is that every level has its own ridge, [79]. For an H100 in BF16 it is 295 FLOPs per byte against HBM, 82 against L2 and 32 against shared memory, and FP8 doubles all three (computed). A kernel must reuse each HBM byte about 295 times to keep the tensor cores busy.
Table 2.2. The H100 SXM memory ladder: each level down is faster and smaller.
| Level | Capacity | Bandwidth | Latency (cycles, H800 PCIe) | Ridge, BF16 (FLOP/byte) | Source |
|---|---|---|---|---|---|
| Registers | 256 KB per SM | not published | n/a | n/a | [107, 104] |
| Shared memory / L1 | 256 KB per SM, up to 228 KB shared | about 31 TB/s | 29.0 (shared), 40.7 (L1) | 32 | [104, 107, 82, 81] |
| Distributed shared memory | other SMs in the cluster | up to 3.27 TB/s (measured) | 180 | n/a | [81] |
| L2 | 50 MB | about 12 TB/s | 263.0 | 82 | [104, 82, 81] |
| HBM3 | 80 GB | 3.35 TB/s | 478.8 | 295 | [4, 81] |
Figure 8 draws the chip beside this ladder. Switch chip and format to move each level's ridge point, and pick a kernel to see where it is compute-bound.
Method and sources
Right: the capacity, bandwidth (a dot on a log scale, hollow when measured) and latency of each memory level, with its ridge point, the dense peak FLOP/s divided by that level's bandwidth. A tick marks the bandwidth that the chosen kernel (against HBM) or matmul tile (against shared memory) would need to run at peak. Sizes and bandwidths are vendor-reported (NVIDIA, AMD and Google documents and Jouppi et al. 2023) or taken from the FlashAttention papers (Dao et al. 2022, Shah et al. 2024, Zadouri et al. 2026). The latencies and the distributed-shared-memory bandwidth are microbenchmarks on an H800 PCIe and an A100 PCIe by Luo et al. (2024). Ridge points, kernel intensities (from the Llama 3 8B and GPT-2 small shapes) and tile intensities are computed.Blackwell shows the pressure. B200 doubled the tensor rate, but for shared memory "the read throughput is 128 bytes / clock / SM, the same as Hopper", so that ridge doubles to 64. In attention, shared-memory traffic and exponentials now exceed matmul time "by 25–60%" [110]. Blackwell's answer is a new level, tensor memory (TMEM), 256 KB per SM for tensor-core results [110].
Latency matters too. By Little's law, sustaining bandwidth at latency needs bytes in flight: 3.35 TB/s × 273 ns = 0.91 MB, about 6.8 KiB per SM (illustrative, latency from another card). So Hopper added the Tensor Memory Accelerator (TMA), a copy engine driven by a descriptor of "tensor dimensions and block coordinates instead of per-element addressing" [104], which kernel authors call "completely indispensable" [105].
Take , and 8,192 tokens in BF16. The MLP up-projection does FLOPs on 419 MB of operands, an intensity of 2,294, far above 295: 0.97 ms of compute against 0.13 ms of HBM time. An unfused SwiGLU (the gated activation of Llama's MLP, Section 4.2) [26] then reads two tensors and writes one, 705 MB in about 0.21 ms, 7% of the three MLP matmuls' 2.9 ms for almost no FLOPs. Decoding one token drops the matmul's intensity to 1.0, and a batch of 64 only reaches 63 (Section 13.2). All computed from the model's shapes and the H100 spec [6, 4].
Rivals bet differently. TPU v4 replaces caches with software-managed scratchpads, 16 MiB per TensorCore plus a shared 128 MiB [112]. AMD's MI300X puts a 256 MB Infinity Cache in front of 192 GB of HBM3 at 5.3 TB/s [115, 113]. Common failures are uncoalesced loads, where a warp's threads touch scattered addresses, and bank conflicts, since shared memory is "banked" into 32 stores that serialize clashing accesses [105].
2.3 Number formats: from FP32 to FP4
What exactly is in the bits of each training format, and why do training recipes use the ones they do? Fewer bits buy bandwidth and throughput: "FP8 halves data storage requirements and doubles throughput compared to FP16 or BF16" [104], so an H100's 989.5 dense TFLOP/s in BF16 become 1,979 in FP8 [4]. The price is range and precision. A normal float with exponent field and mantissa bits stores
When the value is subnormal, [116, 117]. Precision is the spacing in , and range is counted in powers of two, called binades (Table 2.3).
Table 2.3. Training formats trade range for precision bit by bit.
| Format | Sign/exp/mantissa | Max finite | Min normal | Min subnormal | Spacing | Typical use |
|---|---|---|---|---|---|---|
| FP32 | 1/8/23 | master weights, optimizer states, accumulation | ||||
| TF32 | 1/8/10 | tensor-core math mode for FP32 matmuls | ||||
| BF16 | 1/8/7 | default training format | ||||
| FP16 | 1/5/10 | 65,504 | V100-era training with loss scaling | |||
| FP8 E5M2 | 1/5/2 | 57,344 | 0.25 | gradients in per-tensor recipes | ||
| FP8 E4M3 | 1/4/3 | 448 | 0.0156 | 0.00195 | 0.125 | weights and activations, all tensors in fine-grained recipes |
| FP6 E3M2 | 1/3/2 | 28 | 0.25 | 0.0625 | 0.25 | MXFP6 elements |
| FP6 E2M3 | 1/2/3 | 7.5 | 1 | 0.125 | 0.125 | MXFP6 elements |
| FP4 E2M1 | 1/2/1 | 6 | 1 | 0.5 | 0.5 | MXFP4 and NVFP4 elements |
Limits are computed from the bit layouts [117, 116]. Figure 9 encodes any value in every format: type pi, 1,000 and , see which rows round, saturate or flush to zero, then rescue the small value with the scale control.
Method and sources
The scale control multiplies the value by 2 to the power k before encoding and divides it back afterwards, so at k = 10 the value 3 × 10⁻⁵ survives in E4M3 instead of flushing to zero, which is why low-precision tensors carry scaling factors. The stepper walks one format through sign, binade, biased exponent, mantissa rounding, range check and decoding. The lower chart gives bits per element for block-scaled formats with the shared scale included (computed as element bits plus scale bits divided by block size). Encodings are computed in the browser with round-to-nearest-even and saturating conversion, as training libraries do, and they reproduce every reference value in the text. Layouts and limits follow Micikevicius et al. (2022) for FP8, the OCP Microscaling specification by Rouhani et al. (2023) for FP6, FP4 and the E8M0 scale, Alvarez et al. (2025) and NVIDIA (2025) for NVFP4, Kalamkar et al. (2019) for BF16, NVIDIA (2020) for TF32 and Micikevicius et al. (2017) for FP16.BF16 came from the TPU, where "for the first time the exponent (8 bits) is larger than its fraction (7 bits)" [118]. Keeping FP32's range "is important to ensure that no hyper-parameter tuning is required for convergence" [52]. FP16 tops out at 65,504 and needs FP32 master weights, loss scaling and FP32 accumulation [51]. TF32 is a math mode, not a storage format [109].
FP8 has two encodings. E5M2 follows IEEE conventions and reaches 57,344 over 32 binades. E4M3 gives up infinities and keeps one NaN pattern to reach 448 over 18 binades, where "The maximum representable magnitude without this modification would be 240". The original recommendation was "E4M3 for weight and activation tensors, and E5M2 for gradient tensors" [117].
Near pi, E4M3 values are apart, so pi becomes 3.25, a 3.5% error. E5M2 gives 3.0 and BF16 3.140625. The value 1,000 saturates to 448 in E4M3 but becomes 1,024 in E5M2. flushes to zero in E4M3, whose smallest subnormal is 0.00195, but survives in E5M2 as . Multiply it by first and it survives in E4M3 too, which is all a scaling factor does (computed, round-to-nearest-even).
So each FP8 tensor carries a higher-precision scale that maps its largest value near the format's maximum [117]. The question is how many values share one. Hopper's transformer engine scales per tensor [104], Llama 3's FP8 inference per row [6], and DeepSeek-V3 per 1 × 128 activation tile and 128 × 128 weight block. With scales that fine, range stops binding and precision wins: DeepSeek-V3 writes "we adopt the E4M3 format on all tensors for higher precision", and NVIDIA's MXFP8 recipe does the same [2, 119]. FP8 training recipes (scaling granularity, accumulation precision) are in Section 5.6.
Microscaling builds the block scale into the format. An MX block is 32 elements sharing one 8-bit E8M0 scale, a bare power of two [116]. A block format costs
so MXFP8 costs 8.25 bits and MXFP4 4.25 (computed). NVFP4 uses 16-element blocks with an E4M3 scale plus an FP32 scale per tensor, 4.5 bits per value [120], while MXFP4 "can potentially lose up to one binade of dynamic range" to power-of-two scales [121]. Blackwell's tensor cores read these block scales directly and run FP4 two times faster than FP8 on GB200 and three times on GB300 [121]. Which FP4 variant trains best is open as of November 2026: one study finds NVFP4 "provides optimal results" [122], others use MXFP4 [123, 124], and AMD's MI355X advertises MXFP4 [114].
Narrow inputs need wide accumulators. DeepSeek found that FP8 matmuls on H800 keep "around 14 bits" of accumulation precision, so its kernels promote partial sums to FP32 every 128 elements, and it asked for tensor cores that apply group scales themselves [2], as Blackwell's now do.
In 2026 FP32 holds master weights, BF16 most training, FP8 some frontier matmuls and inference, and NVFP4 has reached pretraining: a 12B model on 10T tokens scored 62.58% on MMLU-Pro (a harder ten-option version of the MMLU knowledge exam [125], Section 10.1) against 62.62% for FP8 [121]. Section 13.8 sizes Llama 3 405B's weights by format and covers FP8 serving. How training and serving precision enter the scaling law is in Section 6.6.
Failures are numerical: underflow under per-tensor scales, saturation hiding overflows, and power-of-two scales rounded down that clip block maxima, which the MXFP8 recipe avoids by rounding up [119]. Outliers can arrive late: FP8 training of Llama 2 7B diverged "after processing 220B tokens" [126].
2.4 Kernels: fusion, FlashAttention and the per-generation rewrite
Most of a transformer's FLOPs are in matrix multiplies, so why does so much engineering go into the other operations, and into attention? In BERT training, "While tensor contractions account for over 99% of the arithmetic operations performed, they constitute only 61% of the runtime" [127]. Normalizations, activations and softmax took the rest.
The cure is fusion: if several operations apply to one input, "the input can be loaded once from HBM, instead of multiple times for each operation" [63]. Horace He calls it "the most important optimization in deep learning compilers": unfused, x.cos().cos() needs "4 global reads and writes" [77], and fused it needs two. Attention is the extreme case, because standard implementations "materialize the matrices and to HBM" [63], the scores and their softmax , at memory.
One head's score matrix at in BF16 is bytes = 134 MB, and one layer's 32 heads need 4.3 GB. At 131,072 tokens one head needs 34 GB and one layer 1.1 TB, more than any GPU holds. Even at 8K, writing and reading and takes about 160 µs per head and layer against 35 µs of matmul at peak, so attention is about 4.6 to 4.7 times memory-bound (computed, depending on whether Q, K, V and O reads count) [6, 4].
FlashAttention keeps tiles of , and in shared memory and never writes or to HBM [63] (its and are our and ). Softmax needs a whole row, which one tile does not see, so it uses the online softmax [128]: each block keeps its row maximum and sum of exponentials , and two blocks combine exactly,
rescaling partial outputs by the same factors. The backward pass recomputes and tile by tile, trading cheap FLOPs for HBM traffic. Theorem 2 counts HBM accesses with elements of on-chip memory [63]:
With 228 KiB of BF16 shared memory and , (computed), the same order as the up to 9 times fewer accesses the paper measured. It made GPT-2 training up to 3 times faster [63].
Each GPU generation then needed a new kernel. FlashAttention reached "only 25–40% of the theoretical maximum FLOPs/s" of an A100. FlashAttention-2 cut non-matmul work and parallelized over the sequence, reaching 230 TFLOP/s, 73% of peak, in the forward pass [38]. On an H100 the same kernel managed 35%, against 80–90% for optimized matmuls [82], because Hopper reaches full speed only through its asynchronous warpgroup matrix instruction (WGMMA) [81]. FlashAttention-3 adopted WGMMA, TMA and warp specialization, then went after the exponential. Per score, two matmuls cost tensor-core FLOPs and softmax one MUFU exponential, so
At on an H100 that is 4,096/(512 × 16) = 0.5 (computed): exponentials take half the matmul time, as the paper states. Overlapping them with matmuls took the forward pass "from 570 to 661 TFLOPs". For FP8 it rotates and with a random Hadamard matrix to spread outliers. The kernel reached 740 TFLOP/s in FP16, 75% of the dense FP16 peak (the same as BF16's), and close to 1.2 PFLOP/s in FP8 [82], about 61% of the FP8 peak (computed).
Blackwell broke the balance again: B200 doubled the matmul rate but kept the MUFU at "16 ops / clock / SM, the same as Hopper", so the ratio rises to 1.0 (computed) and exponentials can no longer hide. FlashAttention-4 computes some exponentials with polynomials on the FMA units, skips needless rescaling and uses tensor memory, reaching 1,613 TFLOP/s, 71% of a B200, with a deterministic mode for reinforcement learning [110]. B300 doubles the MUFU rate [110], which restores 0.5 if its per-SM matmul rate matches B200's (computed, assumed rate).
Figure 10 plots these results. Note FlashAttention-2's drop on the H100, and which chips' exponentials reach matmul time.
Method and sources
Panel B plots the time spent on softmax exponentials divided by the time spent on matrix multiplies for one attention score in the forward pass, for a head dimension you choose. Panel B is computed per SM per clock as tensor-core FLOPs over the matmul FLOPs per score times the exponential unit's rate. At 1.0 or above the exponentials cannot hide behind the matmuls, which is why FlashAttention-4 computes some of them with polynomials. The step buttons walk the generations. The FP8 share and the FlashAttention-2 throughput on H100 are computed from the reported 1.2 PFLOP/s and 35%, and the B300 bar assumes B200's per-SM matmul rate. Measurements come from Dao (2023), Shah et al. (2024) and Zadouri et al. (2026), the original kernel from Dao et al. (2022), and dense peaks from NVIDIA's A100, H100 and HGX specifications.FlashAttention-2 "suffered a 47% performance degradation when translated to the H100 GPU", and "it took over two years from the release of the H100 to develop FlashAttention-3" [129]. Going from 35% to 75% needed TMA, WGMMA, warp specialization and pingpong scheduling, none of which existed on Ampere [82]. FlashAttention-4 repeated the cycle on Blackwell, driven by units the headline spec omits, the MUFU and shared-memory bandwidth [110]. Plan on a new chip's headline FLOP/s only after its kernels are rewritten.
Table 2.4 maps the tools. Small matmuls cannot fill a chip: on an MI300X "a problem size of approximately 200 GFLOPs is required to reach peak throughput" [130], while a GPT-2 small MLP matmul at 16K tokens is 77 GFLOPs (computed). At that scale launch overhead also shows, so fusion, larger micro-batches and CUDA graphs pay off.
Table 2.4. The kernel toolbox: what each tool is for.
| Tool | What it is | Use it for | Reported result |
|---|---|---|---|
| cuBLAS, cuDNN, hipBLASLt | vendor libraries | matmuls and standard operations | the usual baseline |
| FlashAttention 2, 3, 4 | hand-written fused attention | attention on A100, H100, B200 | 73%, 75%, 71% of peak [38, 82, 110] |
| FlexAttention | compiler-generated fused attention | attention variants and masks | most variants "in a few lines of idiomatic PyTorch" [131] |
| Triton | Python-embedded tile language | custom fused kernels | vendor-level matmuls [132], Liger Kernel +20% throughput, −60% memory [66] |
| torch.compile (TorchInductor) | graph capture and fusion, emits Triton | fusing everything else | 1.41× training, 2.27× inference (A100) [133] |
| CUDA graphs | record and replay kernel launches | launch-bound small steps | a 2.9 µs kernel: 9.6 µs per synchronized launch, 3.4 µs in a graph [134] |
| CUTLASS, CuTe | C++ templates and Python DSLs | new hardware features (WGMMA, TMA, Blackwell's tcgen05 tensor-core instructions) | basis of FlashAttention-3 and 4 [135, 110] |
| ThunderKittens, TileLang | tile libraries and DSLs | research kernels | 10-40% faster attention backward [129, 136] |
To do it yourself, profile first, then use vendor libraries for matmuls with shapes that tile well, FlashAttention or FlexAttention for attention, torch.compile for the rest, CUDA graphs for small steps and Triton for custom fused operations. Watch for graph breaks that silently disable compilation, nondeterministic atomics, Hopper kernels ported to Blackwell unchanged, and swizzled layouts, one of whose diagrams "cost us three weeks of life that we will not get back" [105].
2.5 Inside the node: NVLink, NVSwitch and PCIe
Why do eight GPUs in one server behave almost like one large GPU for communication, and why does the edge of that group matter so much? Inside the server every GPU reaches every other over a switched fabric about nine times faster than the network card that leads outside, so the chattiest traffic must stay inside.
Units first
NVLink is full duplex. Each of an H100's 18 links carries "25 GB/sec effective bandwidth in each direction", which NVIDIA sums to "900 GB/sec total bandwidth" [104], so the GPU sends 450 GB/s while it receives 450 (computed). PCIe Gen5 x16 is 128 GB/s in total, 64 each way [104]. Network cards are quoted in bits: 400 Gb/s is 50 GB/s [137]. This guide uses one unit, : GB/s, per direction, per accelerator.
Table 2.5. The bandwidth ladder of one H100 in Llama 3's cluster: HBM, NVLink, the NIC and the cross-pod share each drop 7 to 9 times, and PCIe sits just above the NIC.
| Rung | Vendor figure | Conversion | GB/s per direction |
|---|---|---|---|
| HBM3 [4] | 3.35 TB/s | reads and writes share it | 3,350 |
| NVLink 4, specification [104] | 900 GB/s total | ÷ 2 directions | 450 |
| NVLink 4, measured all-reduce [138] | about 370 GB/s | large messages only | 370 |
| PCIe Gen5 x16 [104] | 128 GB/s total | ÷ 2 directions | 64 |
| Cluster NIC [137] | 400 Gb/s | ÷ 8 bits | 50 |
| Across Llama 3's 1:7 layer [6] | 1:7 oversubscription | 50 ÷ 7, worst case | 7.1 |
Section 11.1 times real collectives on each rung with Figure 58.
NVSwitch and the NVLink domain
A DGX H100 joins its eight GPUs through four NVSwitches [137] of 64 NVLink ports each [104]. They offer GB/s per direction against the the GPUs can inject, so the switches never block (computed). Per-GPU NVLink totals roughly double each generation: 600 GB/s on A100, 900 on H100 [104], 1,800 on Blackwell [139] and a preliminary 3,600 for Rubin [140] (bidirectional, as of November 2026). A GB200 NVL72 rack puts 72 GPUs on one fabric, whose quoted 130 TB/s is TB/s summed both ways [139] (computed). "The term node is overloaded" [138], so this guide says NVLink domain (or scale-up domain) for the accelerators fully connected by the fast fabric: 8 on an HGX board (NVIDIA's eight-GPU baseboard), 72 on an NVL72 rack, a whole pod on a TPU.
NICs and drives hang off PCIe, and one x16 slot feeds one 400 Gb/s NIC, so each GPU gets its own. Meta writes "There is a 1:1 mapping between GPUs and NICs" [141]. GPUDirect RDMA lets the NIC read GPU memory directly, but the two "must share the same upstream PCI Express root complex" [142]. Wired wrong, traffic detours through the CPU and bandwidth drops without an error.
What you actually get
On eight H100s an all-reduce reaches about 370 GB/s only with messages near 10 GB per GPU, and a 58 MB array gets about 150 GB/s [138] (measured). Benchmarks report bus bandwidth, rescaled by so that it compares with the link speed [143]: compare it with 450, never with 900. The cost of ring and tree collectives and bus bandwidth are derived in Section 11.1. The bandwidth term for bytes over ranks is
8.03B parameters in BF16 give GB, and eight GPUs give . The all-reduce takes ms on NVLink, 76 ms at the measured 370 GB/s and 562 ms through one 50 GB/s NIC (computed, bandwidth term only).
That ninefold gap keeps tensor parallelism inside the domain [41, 6]. Section 11.3 works out TP's communication share at TP 8 over NVLink at H100 peak: 0.42 for a standard layer and 0.36 for Llama 3 70B's layer (computed).
When NVLink is cut. H800 nodes cut NVLink from 900 GB/s to 400 GB/s [1]. DeepSeek counts that as 200 GB/s (per direction, our reading), about 160 achievable, against 50 GB/s per InfiniBand NIC, about 4:1 [1]. The V3 report's 3.2 divides the achievable 160 by the nominal 50 [2]. DeepSeek-V3 dropped tensor parallelism for 16-way pipeline and 64-way expert parallelism [2]. NVLink faults "often manifest as stalled load/store operations within CUDA kernels without returning a clear error code" [6].
2.6 Across the cluster: fabrics, traffic and collectives
How do thousands of GPUs get close to full NIC bandwidth to one another, and why does that take more than enough cables? Give every GPU its own NIC, wire NIC number of every server to the same leaf switches (a rail), and stack switches in a fat tree with as much bandwidth going up as coming in. The hard part is load balancing, because training traffic is the worst case for how switches spread flows.
InfiniBand and RoCE
Both carry RDMA (remote direct memory access), NIC-driven memory-to-memory transfers. RoCE v2 carries it in UDP/IP over Ethernet [141], made lossless like InfiniBand with priority flow control [144]. InfiniBand is faster (2.8 µs against 3.6 µs for 64 bytes within a leaf) but its switches have 64 ports to RoCE's 128 [1]. Meta built a 24,576-GPU cluster of each [145], trained Llama 3 405B on RoCE, and says "we tune both of them to provide equivalent performance" [6]. Dense training is bandwidth-bound and hides the latency gap that expert all-to-all exposes.
Fat trees, planes and oversubscription
With -port switches, a non-blocking tree of two tiers has leaves of hosts, and one of three tiers reaches [146]. In hosts :
For that is 2,048 endpoints from 96 switches and 65,536 from 5,120 (computed), exactly the fat-tree columns of DeepSeek's comparison [1]. Independent planes avoid a third tier: DeepSeek's eight two-tier planes reach 16,384 GPUs at 4.39 thousand dollars per endpoint against 7.5 thousand for three tiers [1], and eight 100 Gb/s planes per 800 Gb/s NIC let 512-port switches reach 131,072 GPUs in two tiers [147].
At the upper layer carries of what the layer below injects, so if every GPU sends across at once each gets
Llama 3 joins eight 3,072-GPU pods, each at full bisection, through a 1:7 layer [6]: 7.1 GB/s per GPU in the worst case (computed). Meta's 100K+ fabric moved to 1:2.8 [148], and Alibaba runs 15:1 to its core with only pipeline traffic crossing pods [149]. The bet holds because placement minimizes cross-pod traffic and collectives stay at hundreds of GPUs [141]. Section 11.7 works out FSDP traffic across Llama 3's 1:7 layer: an FP32 reduce-scatter of 18.9 GB per GPU, 0.38 s at 50 GB/s, about 2.7 s if all of it crossed, 6–43% of a 6.2 s step.
Why AI traffic defeats ECMP
Training traffic is "very few, but periodically bursty flows" [149]. Switches spread load with ECMP (equal-cost multi-path), hashing each flow onto one uplink, and with few flows that is a lottery. Let equal flows hash onto uplinks, with flows on the busiest. A synchronous collective (Section 11.1) finishes when that link does:
When the throughput is just one over the max-mean ratio, the busiest link's load over the average.
With 16 flows on 16 uplinks, links sit idle and the busiest carries about 3.1 flows, so the collective runs at about a third of line rate (computed, Monte Carlo). At 1,000 flows the busiest link carries about 1.23 times the mean, consistent with Meta's "average MMR over 1.2 for 1,000 flows on 16 links" [141]. In Figure 11, raise the flows from 16 to 256 and watch the idle grey columns fill and the red busiest column fall to about 1.5 times the even share (about 68% of line rate), then try packet spraying.
Method and sources
The readouts compare this draw with the expected values, and the routing buttons switch to packet spraying or to idealized fixed paths. The lower chart plots expected throughput, max(f, u) / (u n_max), against the number of flows from a 4,000-draw Monte Carlo simulation computed for this guide, with the idle count from the formula u(1 - 1/u)^f. Throughput is lowest when flows roughly equal uplinks, and at 1,000 flows on 16 links our max-mean ratio of 1.23 matches the value above 1.2 that Gangidi et al. (2024) report for Meta's simulation. The 256-flow preset follows Llama 3's 16 flows per GPU pair (Grattafiori et al., 2024), which reach about 68% if hashed at random. The fixes come from Gangidi et al. (2024) for E-ECMP, Qian et al. (2024) for Alibaba's dual-plane design, Araujo et al. (2026) for MRC packet spraying and Khashab et al. (2026), a vendor report, for Spectrum-X.Llama 3's library "creates 16 network flows between two GPUs, instead of just one" [6] and hashes on the queue-pair (QP) number, which names an RDMA connection, for up to 40% faster AllReduce [141], though 256 randomly hashed flows still reach only about 68% of line rate (computed). Alibaba fixes each flow's path inside a pod [149]. MRC (Multipath Reliable Connection, a transport) sprays packets over many paths, "eliminating the issue of flow collisions" [147]. Congestion control is contested: Meta runs RoCE without DCQCN (ECN-based congestion control) [141], ByteDance mixes Swift (delay-based) and DCQCN [47], and DeepSeek wants round-trip-time-based or programmable control [1].
ECMP collisions came first: under fragmented job placement, pinned paths degraded training by up to more than 30%, a 2× uplink overbuild worked at twice the cost, and 16 queue pairs per GPU pair replaced it [141]. Untuned large clusters showed "very poor utilization, ranging from 10% to 90%" [145], and co-tuning raised out-of-the-box RoCE performance "by more than 2x in many cases" [141]. The cables were the easy part.
Table 2.6. Production AI fabrics: each oversubscribes only above the block its jobs fill, and each found its own answer to load balancing.
| Fabric (year) | Scale | Topology | Oversubscription | Load balancing |
|---|---|---|---|---|
| Meta, Llama 3 (2024) [6, 141] | 24,576 H100, 400G RoCE | 3 tiers | 1:1 in a 3,072-GPU pod, 1:7 above | 16 flows per GPU pair, enhanced ECMP |
| Meta, 100K+ (2025) [148] | 100K+ GPUs, several buildings | RoCE | 1:2.8 across zones | not stated |
| Alibaba HPN (2024) [149] | 15K GPUs per pod, 2 × 200G | 2 tiers, dual-plane | 1.067:1 at the top-of-rack (ToR) switch, 15:1 to the core | fixed paths inside a pod |
| ByteDance MegaScale (2024) [47] | 12,288 GPUs | 3 tiers | 1:1 at every layer | ports split to add paths |
| DeepSeek-V3 (2024) [1] | 2,048 H800, 400G InfiniBand | 8 planes, 2 tiers | 1:1 | NVLink forwarding across planes |
| Google TPU v4 (2023) [112] | 4,096 chips | 3D torus plus 48 optical switches | none (direct torus links through optical circuit switches, no packet switches) | per-job topology |
| OpenAI and Microsoft MRC (2026) [147] | 131,072 GPUs (design) | 8 × 100G planes, 2 tiers | 1:1 | per-packet spraying |
TPU pods: a torus instead of switches
Each TPU v4 chip has six 50 GB/s links in a 3D torus, and 48 optical circuit switches join 64 cubes of 4 × 4 × 4 chips into 4,096 [112]. The optics buy availability: "Without OCSes, host availability must be 99.9% to offer reasonable slice goodput", and they cost under 5% of the system [112]. A v5p pod has 8,960 chips, and per chip and direction its scale-up beats scale-out by 96×: 1,200 GB/s of bidirectional ICI (inter-chip interconnect) is 600 each way, against 50 Gb/s (6.25 GB/s) of data-center network [88], compared with 9× on an H100 (computed).
Mapping parallelism onto the ladder
Put the parallelism that talks most often on the fastest rung. Llama 3 orders its groups [TP, CP, PP, DP] and keeps FSDP outermost because it "can tolerate longer network latency" [6]. Mixture-of-experts breaks the pattern: all-to-all across two nodes is more than four times slower [138], so DeepSeek-V3 sends each token to at most 4 nodes [2], a limit Section 11.6 derives.
2.7 Clusters at scale: power, storage and failures
What does a training cluster draw from the grid, what must its storage absorb, and how often does a synchronous job on it break? About twice its chips' power times the building's overhead, checkpoint bursts, and every few hours. Meta built two 24,576-GPU clusters [145], of which Llama 3 405B used up to 16K [6], and xAI says Colossus reached 200,000 GPUs [150] (company claim). A cluster is not a job.
Table 2.7. From chip to grid: power per GPU roughly doubles between the chip and the facility.
| Level | Item | Power | Per GPU or chip |
|---|---|---|---|
| Chip | H100 SXM, TDP (thermal design power, the rated maximum draw) [4] | up to 700 W | 0.70 kW |
| Node | DGX H100, 8 GPUs, maximum [137] | 10.2 kW | 1.28 kW |
| Node | DGX B200, 8 GPUs, maximum [86] | about 14.3 kW | 1.79 kW |
| Rack | GB200 NVL72, 72 GPUs [151] | about 120 kW | 1.67 kW |
| Pod | Ironwood, 9,216 chips [152] | nearly 10 MW | 1.09 kW |
| Job | Llama 3 405B, 16,384 H100, formula below | 26 MW (computed) | 1.59 kW |
| Cluster | Colossus, 200,000 chips [153] | about 300 MW (estimate) | 1.5 kW |
Pilz et al. estimate peak facility power from chip TDP [153]:
Here covers CPUs, switches and storage (calibrated on DGX H100). PUE (power usage effectiveness), facility over IT power, was 1.14 for AI data centers in 2023 [153], 1.09 for Google's 2025 fleet and 1.54 in a survey [154]. Llama 3's 16,384 GPUs at 700 W [6] and Pilz et al.'s 2024 PUE of 1.12 [153] give MW, of which the GPUs draw 11.5 MW (computed). Colossus at PUE 1.10 gives 313 MW against the roughly 300 MW Pilz et al. report (computed). The multiplier is debatable: the DGX H100 nameplate, 10.2 kW for eight 700 W GPUs, implies 1.82 (computed), so treat 2.03 as an upper estimate for air-cooled servers and use rack nameplates for rack-scale systems. The cluster panel of Figure 12 applies either mode to any chip.
H100s by DGX nameplate: 12,500 nodes × 10.2 kW = 127.5 MW, 140 MW at PUE 1.10. GB200s: 1,389 NVL72 racks × 120 kW = 167 MW, 183 MW at PUE 1.10. The GB200 fleet delivers 250 EFLOP/s of dense BF16 against the H100 fleet's 99, so about 1,360 TFLOP/s per facility kilowatt against 705 (all computed).
At 120 kW a rack, air runs out, and NVL72 trays are liquid-cooled through cold plates [151]. Llama 3 405B's throughput varied by 1–2% over the day, because higher mid-day temperatures affected the GPUs' dynamic voltage and frequency scaling [6]. Thousands of GPUs computing and then waiting together swing the load. For Llama 3 that "can result in instant fluctuations of power consumption across the data center on the order of tens of megawatts, stretching the limits of the power grid" [6]. The swings sit at 0.2–3 Hz, near grid resonances, and smoothing costs energy: holding GB200 power at a floor of 90% of TDP added 10.5% on one trace [155].
Llama 3's storage holds 240 PB and sustains 2 TB/s, with 7 TB/s peaks [6]. That is not for the text: at 16,777,216 tokens per 6.2 s step the job reads about 2.7M tokens per second, about 11 MB/s of 4-byte token IDs (computed). It is for "highly bursty checkpoint writes that saturate the storage fabric for short durations" [6]. Checkpoint size, write bandwidth and the Young interval are in Section 12.3, and data-loader throughput is in Section 12.9. Failures grow with node count, and Llama 3 saw one unexpected interruption every 3.1 hours [6] (computed, 419 in 54 days). Failure rates, the 1/N law and Llama 3's 466 interruptions are in Section 12.1.
2.8 The accelerator landscape and how to read a spec sheet
How do you compare accelerators from different vendors without being fooled, and which numbers decide the choice for training? Normalize first, then compare ratios. The roofline and the ridge point are derived in Section 1.7. Apply them here without re-deriving.
- Dense, not sparse. H100's BF16 1,979 carries "With sparsity" [4].
- Same format. TPU v5p and v6e list FP8 equal to BF16 [156], because FP8 was "emulated for v4 and v5p, but natively supported for Ironwood" [152].
- Per chip, not per board or rack. HGX B200's 36 sparse PFLOP/s for eight GPUs is 2.25 dense each [85].
- Peak is units × FLOP per clock × clock. MI355X: GHz TFLOP/s [114] (computed).
- Per direction, and GB or GiB. NVLink's 900 GB/s is both ways, and Ironwood's 192 GiB is 206 GB (computed).
- Shipping, not announced. Rubin's 4 PFLOP/s is an announcement [85].
- Same arithmetic. Ironwood's "for a total of 42.5 Exaflops" is FP8, set beside El Capitan's FP64 [152].
- TDP is not average draw. Idle power is about 20% of TDP on A100, H100 and MI300, 80% on Cerebras [157].
- Date it. The table was read in November 2026.
Table 2.8. The accelerator landscape, normalized to dense per-chip peaks, as of November 2026. Scale-up bandwidth is the vendor's bidirectional figure. "Epoch" marks power from Epoch AI's hardware dataset [158].
| Chip | BF16 TFLOP/s | FP8 TFLOP/s | HBM | HBM TB/s | Scale-up domain | Scale-up GB/s | Power | Ridge |
|---|---|---|---|---|---|---|---|---|
| NVIDIA H100 SXM [4] | 989.5 | 1,979 | 80 GB | 3.35 | 8 | 900 | 700 W | 295 |
| NVIDIA H200 SXM [84] | 989.5 | 1,979 | 141 GB | 4.8 | 8 | 900 | 700 W | 206 |
| NVIDIA B200 (HGX) [85, 86] | 2,250 | 4,500 | 180 GB | 8.0 | 8 | 1,800 | 1,000 W (Epoch) | 281 |
| NVIDIA GB200 (NVL72) [139] | 2,500 | 5,000 | 186 GB | 8.0 | 72 | 1,800 | 1,200 W (Epoch) | 312 |
| NVIDIA Rubin (announced) [85] | 4,000 | 17,500 | 288 GB | 22 | 8 | 3,600 | not stated | 182 |
| AMD MI300X [87] | 1,307 | 2,615 | 192 GB | 5.3 | 8 | 7 × 128 (assumed) | 750 W peak | 247 |
| AMD MI325X [159] | 1,307 | 2,615 | 256 GB | 6.0 | 8 | 7 × 128 (assumed) | 1,000 W | 218 |
| AMD MI355X [114] | 2,517 | 5,033 | 288 GB | 8.0 | 8 | 7 × 144 (assumed) | 1,400 W | 315 |
| Google TPU v5e [160] | 197 | not stated | 16 GB | 0.86 | 256 | 400 | 225 W (Epoch) | 229 |
| Google TPU v5p [88] | 459 | 459 (no speedup) | 95 GiB | 2.77 | 8,960 | 1,200 | 540 W (Epoch) | 166 |
| Google TPU v6e [161, 156] | 918 | 918 (no speedup) | 32 GiB | 1.64 | 256 | 800 | 380 W (Epoch) | 560 |
| Google TPU7x Ironwood [156] | 2,307 | 4,614 | 192 GiB | 7.38 | 9,216 | 1,200 | 960 W (Epoch) | 313 |
| AWS Trainium2 [162, 163] | 667 | 1,299 | 96 GiB | 2.9 | 64 | 1,280 | 500 W (Epoch) | 230 |
| Intel Gaudi 3 [164] | 1,678 | 1,678 (no speedup) | 128 GB | 3.7 | 8 | 1,200 (all 24 ports, 3 used for scale-out) | up to 900 W | 454 |
Three ratios carry most of the table (all computed). The ridge point puts 10 of the 14 chips between 200 and 320 FLOPs per byte. TPU v5p, Rubin, Gaudi 3 and TPU v6e are the outliers. A large training matmul clears every ridge (Llama 3 8B's MLP over 8,192 tokens does about 2,294 FLOPs per HBM byte), while decode sits far below, which is why H200 and MI325X add bandwidth without compute (Section 13.2). Compute per watt rose from 1,414 TFLOP/s per kW on H100 to 2,250 on B200. Memory per FLOP separates vendors: 81 GB per dense PFLOP/s on H100 against 147 on MI300X, so a model shards over fewer AMD chips. In Figure 12, find the diagonal ridge lines, then switch to FP8: hollow markers (no FP8 speedup) stay put.
Method and sources
Dashed diagonals mark constant ridge points (peak divided by bandwidth), and 10 of the 14 plotted chips fall in the shaded 200 to 320 band (computed). The workload buttons drop each chip to the smaller of its peak and the workload's arithmetic intensity times its bandwidth, using intensities computed from Llama 3 8B and GPT-2 small layer shapes. Specifications are normalized from vendor pages by NVIDIA, AMD, Google Cloud, AWS and Intel read on November 3, 2026: sparse figures halved, board figures divided by 8, rack figures by 72, and GiB converted to GB. Power for chips without a vendor figure comes from Epoch AI's hardware dataset (2026). The side panel applies the facility power estimate of Pilz et al. (2025), chips times TDP times 2.03 times PUE, next to node and rack nameplates where NVIDIA publishes them, with PUE values from Pilz et al. (2025), Google (2026) and Hu et al. (2024).Four design families share the market. Eight-chip boards with a NIC per chip: HGX, MI300X and MI355X, and Gaudi 3, whose Ethernet ports sit on the chip [164]. Rack-scale domains: NVL72 runs tensor and expert parallelism 72-way on NVLink [139], with one 400 Gb/s NIC per GPU outside, an 18:1 gap [151] (computed). Torus-connected chips: TPU pods, and Trainium2 with 64 chips per UltraServer at 1.28 TB/s of NeuronLink each [162]. SRAM-centric designs such as Cerebras' 44 GB wafer [165] trade capacity for bandwidth. Vendors lead with FLOP/s, but DeepSeek asks for scale-up and scale-out in "a unified framework" [1], and a 2026 comparison finds the best platform shifts with batch and model size [157]. For training, read bandwidth, memory and the scale-up domain before peak FLOP/s.
The rack lists 360 PFLOP/s of sparse BF16, 13.4 TB of HBM3E at 576 TB/s and 130 TB/s of NVLink for 72 GPUs [139]. Per GPU and dense: PFLOP/s, GB, TB/s, and TB/s of NVLink, 900 GB/s each way. Power: kW per GPU [151]. Ridge: FLOPs per byte (all computed). GB200 beats HGX B200's 2.25 PFLOP/s, likely because Epoch lists it at 1,200 W against 1,000 [158] (our inference).
An H100 spec page lists "1,979 teraFLOPS" for BF16. You measure 600 TFLOP/s on a large matmul. What share of peak is that?
About 61%, not 30%. The 1,979 assumes 2:4 sparsity ("With sparsity"), which dense training does not use [4]. The dense peak, 989.5, matches GHz. The sparse figure halves every MFU.
Why did early FP8 recipes put gradients in E5M2 (maximum 57,344), while DeepSeek-V3 uses E4M3 (maximum 448) everywhere?
It depends on how many values share a scale. With one scale per tensor, gradients span many binades, so E5M2's 32 binades win [117]. With one scale per 1 × 128 tile or 128 × 128 block, each group fits E4M3's range and its extra mantissa bit wins [2].
FlashAttention recomputes the score matrix in the backward pass, so it does more FLOPs. Why is it faster?
Standard attention is bound by HBM, not FLOPs. At 8,192 tokens one head's BF16 scores are 134 MB, and moving them costs about 4.6 times the matmul time on an H100 (computed). Tiling in shared memory cuts HBM accesses from to [63], about 7 times fewer on an H100.
A vendor page lists NVLink at "900 GB/s" and the NIC at "400G". How much faster is NVLink for one H100 sending data?
Nine times, not 18. 900 GB/s counts both directions, so 450 each way [104], and 400 Gb/s is 50 GB/s [137]. On an H800, whose NVLink totals 400 GB/s, the like-for-like ratio is 4 [1].
Llama 3's storage sustains 2 TB/s. Is that bandwidth for the training data?
No. The run read about 11 MB/s of token IDs, roughly 185,000 times less (computed). The bandwidth serves checkpoint bursts: a 405B checkpoint is about 5.7 TB at 14 bytes per parameter, 6.5 TB at 16 (Section 12.3), written by every GPU at once [6].
- Peak FLOP/s = units × FLOP per clock × clock: 989.5 TFLOP/s dense BF16 on an H100. Spec sheets often print the 2:4-sparse 1,979. MFU uses the dense one.
- Tensor cores do about 94% of the arithmetic, so speed means feeding them. H100 BF16 ridge points: 32 FLOPs per byte from shared memory, 82 from L2, 295 from HBM.
- Fewer bits cost range and precision (E4M3 stops at 448, E5M2 at 57,344, FP4 at 6). Scaling factors and FP32 accumulation make narrow formats trainable.
- Kernels decide achieved FLOP/s, and each GPU generation needs new ones: FlashAttention-2 got 35% of an H100, FlashAttention-3 75%.
- Per H100 and per direction: HBM 3,350 GB/s, NVLink 450, PCIe 64, NIC 50, Llama 3's cross-pod share 7. Tensor parallelism stays inside NVLink, FSDP goes outermost.
- Few synchronized flows defeat ECMP (16 flows on 16 links run at about a third of line rate). Fabrics fix it with more flows, fixed paths or packet spraying.
- A cluster draws about twice its chips' TDP times PUE (Llama 3's job, about 26 MW), swings by tens of megawatts, sizes storage for checkpoints, and fails in proportion to its node count.
- Normalize spec sheets: dense, same format, per chip, per direction, GB or GiB, shipping, dated.
3. Data: from the raw web to training tokens
The training distribution is built, one filtering and sampling decision at a time. Follow text from the web crawl to token ids, then test what cleaning, deduplication, tokenization and mixture weights do to the model you can afford to train.
Llama 3 was pretrained on about 15 trillion tokens, and every lab throws away most of the web it downloads. Llama 3 used "about 15T multilingual tokens, compared to 1.8T tokens for Llama 2", in a mix of roughly 50% general knowledge, 25% math and reasoning, 17% code and 8% multilingual text [6]. Section 3.5 returns to the mix. The running examples and the notation are introduced in Section 0.3.
The raw material is plentiful. Common Crawl, a nonprofit web archive, releases a crawl of 200 to 400 TiB of text every one or two months, and the April 2024 crawl held 2.7 billion pages [166]. The usable material is scarce. FineWeb, built from 96 snapshots and counted in GPT-2 tokens, had about 36T tokens after base filtering, 20T after deduplicating each snapshot and 15T after more heuristic filters [5]. Its educational subsets keep 5.4T and 1.3T [166], so FineWeb-Edu is of the base-filtered tokens (computed). The step from raw HTML to 36T is not reported. DCLM's pool of 200B documents and 240T tokens shrinks to 19.9% of documents after heuristics, 13.7% after deduplication and 1.4% after a quality classifier [167]. RefinedWeb keeps 11.67% of its Common Crawl documents [168].
Figure 13 draws the three funnels stage by stage. Switch presets and find the biggest cut: language identification in RefinedWeb, deduplication in FineWeb, the classifier in DCLM.
Method and sources
FineWeb (Penedo et al., 2024) is counted in GPT-2 tokens, from 36T after base filtering to the released 15T, and its educational subsets keep 5.4T and 1.3T. The dashed red row is the rejected alternative, MinHash deduplication across all 96 snapshots at once, which left 4T tokens and trained little better than no deduplication. RefinedWeb (Penedo et al., 2023) and DCLM-Baseline (Li et al., 2024) are shares of the crawl or pool, read from their pipeline figures. Stage values are reported by the sources and the percentages of the previous and first stage are computed here. Units differ between pipelines, so compare stages within one pipeline, and note that FineWeb does not report the token count of its raw snapshots.Every stage is a modeling decision, judged only by training a model on the result, so data work is an experimental science run with small proxy models. On long runs the binding constraint becomes unique tokens: how much you can repeat, synthesize and legally use.
A data ablation trains identical models that differ only in their training data and compares them on benchmarks. FineWeb used 1.71B-parameter models on about 28B tokens per filter test [5]. DCLM's 1B-1x scale is 1.4B parameters on 28.8B tokens, FLOPs (Chapter 1), 240 H100-hours per run. It scores data with Core, a centered accuracy over 22 low-variance tasks (0 is chance, 1 is perfect), and its 1B-1x rankings correlate with 7B-1x rankings at Pearson [167]. A small-scale ranking is evidence, not proof (Section 3.9).
Besides Llama 3, the chapter follows OLMo 2, whose 3.9T-token mix is over 95% web [7], and GPT-2 124M trained on FineWeb-Edu's 10B-token sample [169]. Sections 3.1 to 3.3 clean the text, 3.4 reads the open datasets, 3.5 and 3.6 mix and repeat it, 3.7 and 3.8 tokenize it, and 3.9 tests data decisions.
3.1 From Common Crawl to clean text
What exactly do you download from Common Crawl, and why does the step that turns HTML into text already change the model you get? Each crawl ships in three forms. WARC files hold the raw HTTP responses with full HTML, and WET files hold plain text that Common Crawl extracted itself [5]. WAT files hold computed metadata such as headers and links [170].
WET is the cheap option, and it is worse. FineWeb found that WET "retained too much boilerplate and menu text" [5], where boilerplate means the menus, footers, cookie notices and ads around a page's main content. On one snapshot WET gave about 254B tokens against about 200B from WARC with the trafilatura extractor: 25% more text and a much worse model [166]. DCLM measured the gap at 1B-1x with identical downstream filters: WET 20.7 Core, resiliparse 24.1, trafilatura 24.5, with resiliparse about eight times faster [167]. The first preset of Figure 14 plots these runs.
Extractors disagree
An extractor decides which HTML blocks are main content. Common choices are trafilatura [171], resiliparse [172] and jusText, which labels each block as boilerplate or content [173]. Llama 3 wrote its own parser, kept image alt text because math is often rendered as images, and stripped markdown because it hurt models trained mainly on web text [6].
Precision is not the only goal. On 13 snapshots, Nemotron-CC found that filtered jusText kept 104B high-quality tokens against 80B for filtered trafilatura, and unfiltered jusText kept 127B [174]. The extractor that looks dirtier can carry more of the text you want. A 2026 study ran the DCLM-Baseline pipeline on three extractors and found that 61% of surviving pages were kept by just one of them. Their union raised token yield by up to 71% at equal Core scores. On table-heavy pages the extractor moved WikiTableQuestions by up to 10.3 points, and on code pages HumanEval by up to 3.6 [173].
Language identification and URL filters
Language identification (LID) predicts each document's language. Most pipelines use fastText [175, 176], a linear classifier over character n-grams, and keep a document when the top language is the target and its probability clears a threshold.
Table 3.1. Language-identification rules in open pipelines.
| Pipeline | Classifier | Keep rule | Source |
|---|---|---|---|
| C4 | langdetect | English with probability at least 0.99 | [177] |
| RefinedWeb | CCNet fastText | top language score at least 0.65 | [168] |
| FineWeb | fastText | English score at least 0.65 | [5] |
| Dolma | CCNet fastText | English score at least 0.5 (removes 61.7% of bytes) | [178] |
| Nemotron-CC | pycld2 and fastText lid176 | threshold 0.3 | [174] |
| FineWeb2 | GlotLID | a threshold per language | [179, 180] |
LID is RefinedWeb's biggest single cut: it removes about half of the documents that reach it. It doubles as a junk filter, because a score below 0.65 "usually corresponds to pages without any natural text" [168]. It fails worst for low-resource languages, whose corpora can be more than 90% false positives from a related high-resource language [179]. URL filters run first because they need only the address. RefinedWeb's URL filter, a 4.6M-domain blocklist plus a score for flagged words in the URL, removes just 2.24% of documents [168], and Llama 3 drops domains likely to hold unsafe or adult content or a lot of personally identifiable information (PII) [6].
The default: extract from WARC with resiliparse or trafilatura, check tables, code and math separately, and take a union of extractors if data is short. FineWeb's blog calls WET a fair trade-off for small budgets, since extraction is among the costliest steps [166]. Extractors that drop <pre>, <table> or MathML silently delete code and math. None removes machine-generated pages: in C4, "the single-most represented website in the corpus is patents.google.com" [181].
3.2 Quality filtering: rules, classifiers and their side effects
After extraction and language identification, most of the text is still not something a model should imitate. How do you separate good from bad, and what does quality mean? Rules and models both answer it, and one test judges both: train on what they keep.
Heuristic rules
A heuristic filter is a threshold on a simple document statistic. C4 kept only lines ending in terminal punctuation, pages of at least 3 sentences and lines of at least 5 words, and dropped pages with a listed bad word, placeholder text or a curly bracket [177]. Gopher keeps documents of 50 to 100,000 words with a mean word length of 3 to 10 characters, caps the symbol-to-word ratio at 0.1 and limits repeated lines [182].
Thresholds chosen by eye are guesses, so FineWeb measured them [5]. It took a high- and a low-quality version of one snapshot (Section 3.3 explains where the low one came from), computed over 50 statistics per document, and set thresholds where the low-quality histogram dominates, then kept those that won 28B-token ablations. The three winners target lines without final punctuation, duplicated lines and very short lines. Together they removed about 22% of tokens and raised the aggregate score by about 1%, while C4's punctuation rule alone cost about 30% of tokens [5]. Rules also delete good text: Nemotron-CC's heuristic and perplexity filters removed 18.1% of the tokens the FineWeb-Edu classifier rates high quality [174].
Model-based filters
A model-based filter scores each document against a reference set, the text it learns to treat as good. GPT-3 trained a logistic-regression classifier to separate curated text from raw Common Crawl, then kept each document if np.random.pareto(9) exceeded one minus its score , so as to "still include some documents that were out of distribution" [36]. NumPy's pareto(9) draws a Lomax variable with , so (derived, and confirmed by simulation)
A document scored 0.9 survives with probability , one scored 0.5 with (1 in 38), and one scored 0 with (1 in 512). In an illustrative corpus where 10% of documents score 0.95 and 90% score 0.5, the rule keeps of documents, and of survivors come from the top 10% (computed). It acts like a top-decile filter that leaks a little of everything.
FineWeb-Edu distills an LLM's judgment into a cheap scorer [5]. A small regression head, trained on 410,000 educational-value ratings (0 to 5) from Llama-3–70B-Instruct, reached an F1 of 82% at threshold 3. Scoring all 15T FineWeb tokens took 6,000 H100-hours, 0.4% of the 1.46M H100-hours reported for training Llama 3.1 8B (computed) [11]. At 1.71B parameters and 350B tokens, MMLU rose from 33% to 37% and ARC from 46% to 57%, and the price was a skew toward education and history topics [5].
DCLM compared filter families at 1B-1x from a 27.5-Core baseline. PageRank scored 26.1, AskLLM (prompting a model to judge each document) 28.6, perplexity filtering (keeping documents a small reference language model finds likely) 29.0, and a fastText classifier whose positives were OpenHermes 2.5 instruction data and answers from the ELI5 forum 30.2 [167]. The reference set mattered more than the classifier. At 7B-1x those positives scored 41.0 Core against 37.5 for a GPT-3-style mix, 35.7 for Wikipedia and 34.7 for OpenWebText2, and keeping the top 10% beat the top 15% and 20% [167]. Why is open. One hypothesis is that their question-and-answer format resembles the benchmarks.
Figure 14 puts these results side by side. Look at the sizes: most filters move Core by -1.4 to +2.7 points, the positives by up to 6.3, and each mark is a single run without error bars.
Method and sources
Dashed lines mark each table's baseline. The educational preset shows MMLU and ARC before and after FineWeb-Edu's filter at 1.71B parameters and 350B tokens (Penedo et al., 2024), and the curated-sources preset shows how much mixing Wikipedia, books, Stack Exchange, arXiv and GitHub into each web set changes Core. The gray band is the gap that one run per arm must clear for 95% one-sided confidence, 1.645 × σ × √2 for an assumed seed noise σ (illustrative, computed), next to DataDecide's report of up to 2 accuracy points of seed noise (Magnusson et al., 2025). Values are single runs without error bars, MMLU at 7B-1x sits near its 25% chance level, and the OLMo 2 mix share comes from Team OLMo (2024).DCLM had 16 researchers label 499 documents. AskLLM agreed with them best, about 82% ROC-AUC (the probability of ranking a random human-approved document above a rejected one) against about 73% for the fastText filters, yet built the worse dataset, about 28.5 Core against more than 31 [167]. The authors conclude: "This suggests that human intuition may not reliably identify the most useful documents for language model training purposes." Validate every filter by training on what it keeps.
Strict filters also keep too little for long runs. Nemotron-CC notes that the FineWeb-Edu and DCLM classifiers label only 8% and 11% of tokens high quality, so it ensembles three classifiers into 20 score buckets and weights the buckets in the mix instead of discarding them [174] (Section 3.4). It left FineWeb-Edu's classifier out because Llama 3 annotations trained it [174]: the license of the model that wrote the labels can constrain a classifier trained on them.
Side effects
Filters remove more than junk. C4's bad-words list removed African American English and Hispanic-aligned English at 42% and 32%, against 6.2% for White-aligned English [181], which is why Gopher used SafeSearch instead of word lists [182]. Toxicity filtering raises loss most for marginalized groups [183], and quality filtering "substantially increases both toxic generation and downstream performance" [184].
"The OLMo-0424 training run was characterized by frequent loss spikes." The batches at the spikes held long repeated n-gram sequences, such as base64-like strings and runs of "255, 255, 255". The link was not deterministic, but removing such sequences cut the spike rate on average. The fix was a filter that "removes all documents with a sequence of 32 or more repeated n-grams, where an n-gram is any span of 1 to 13 tokens", plus masking such sequences from the loss [7]. Filters tuned for benchmarks do not target stability. Why loss spikes happen is explained in Section 5.5, and Chapter 12 handles them in operations.
As of November 2026 a sound default is Gopher-style rules with thresholds set by contrast, then a fastText or small-encoder classifier trained on LLM labels or instruction-style positives. Keep the top 10–20% for short runs, weight score buckets for long ones, and report tokens removed next to every score.
3.3 Deduplication
The web repeats itself. How do you find duplicates among billions of documents, how aggressive should you be, and does more deduplication always help? Duplicates waste compute and cause memorization. Over 1% of the unprompted output of a 1.5B model trained on C4 was copied verbatim from training data, and deduplication cut that tenfold [185]. A sequence seen 10 times is generated about 1,000 times more often than one seen once [186].
Exact duplicates and Bloom filters
Start cheap. In Dolma, exact URL deduplication removed 53.2% of documents [178]. Llama 3 removes lines that appear more than 6 times in each bucket of 30M documents, which strips boilerplate [6]. To ask "seen before?" over trillions of items, use a Bloom filter: bits and hash functions. Inserting an item sets its bits, and a query answers "seen" if all are set, so there are no false negatives. After insertions a bit is still zero with probability about , so the false-positive rate is
The optimum leaves half the bits set, which gives the last two formulas (derived). DCLM notes that 1T tokens at "would require 6.5TB of RAM" [167]. The formula gives 40 hashes and bytes, which is 6.54 TiB, so that TB is binary. At the corpus needs 1.20 TB (computed). Its Bloom-filter deduplication matched MinHash plus suffix arrays within 0.2 Core [167].
MinHash and banding
Near-duplicates differ by a date, a name or a menu. Represent each document by its shingles, the set of its word 5-grams, and measure overlap with Jaccard similarity . Comparing all pairs is impossible, so MinHash compresses each set into a short signature [187]. Apply a random permutation to all shingles and keep each set's minimum. Every element of is equally likely to come first, and the minima agree exactly when that element is shared:
With hash functions, the share of matching minima estimates with standard deviation , 0.046 at and (computed). Banding turns that into a cheap lookup [188]: split the values into bands of rows, and flag a pair if every row of some band matches. One band matches with probability , so
The curve is an S with its threshold near the steepest point. FineWeb's 112 hashes in 14 bands of 8 flag pairs at = 0.7, 0.75, 0.8 and 0.85 with probability 56%, 77%, 92% and 98.8% [5], exactly what the formula gives, with (computed). Flagged pairs form a graph, and pipelines keep one document per connected component. Normalizing text first (lowercase, strip punctuation and accents) raises recall [185, 168]. Lee et al. and RefinedWeb use 9,000 hashes in 450 bands of 20, flagging 76% at 0.75 and 99.4% at 0.8 [185, 168]. That sharper cut costs times the hashing and storage (computed), and FineWeb judged the savings worth "the higher uncertainty on documents near the threshold" [5].
In Figure 15, move the sliders. More rows per band push the threshold right and steepen the curve, more bands pull it left, and the readout shows the cost in hashes.
Method and sources
The thick curve is the setting chosen with the sliders, and the dashed curves are the published settings. FineWeb's 14 x 8 (Penedo et al., 2024) reproduces the 56%, 77%, 92% and 98.8% that paper reports at similarity 0.7, 0.75, 0.8 and 0.85 (diamonds). The 450 bands of 20 used by Lee et al. (2021) and RefinedWeb (Penedo et al., 2023) cut more sharply, at 76% for 0.75 and 99.4% for 0.8, but need 9,000 hashes per document, about 80 times FineWeb's 112. The hollow marker is the templated C4 flight-advertisement pair from Lee et al. (2021). Its word 5-gram Jaccard similarity is 0.30 (computed from the verbatim Table 1 texts), so a direct band match has about a 0.08% chance, yet NearDup still placed it in one cluster, most likely through other copies of the template.Lee et al. show two C4 flight ads filled in from one template [185]. Lowercased, without punctuation, their word 5-grams give (computed). FineWeb's bands flag the pair directly with probability (computed). Yet Lee et al. found it in one duplicate cluster, so other copies of the template likely linked the two through the graph (inference).
Exact-substring deduplication catches shared spans that document-level MinHash misses. It builds a suffix array over the concatenated corpus and removes repeated spans of 50 or more tokens. At 8 bytes per token it needs about 8 TB per trillion tokens (computed), and it removed 7.18% of C4's tokens [185]. Semantic deduplication, which drops near neighbors in an embedding space, scored 27.1 against 27.5 Core on DCLM's web text [167].
FineWeb first ran MinHash across all 96 snapshots at once. It left 4T tokens that trained barely better than no deduplication. In the old 2013–48 snapshot it kept about 31B of 490B tokens, 6.3% (computed), and the kept data trained a worse model than the removed data, with "more ads, incoherent lists of keywords and generally badly formatted text" [5, 166]. The authors suspect the gain comes from removing large duplicate clusters, while deduplicating clusters smaller than about 100 copies can hurt [5]. Our reading: good pages recur in every crawl, so global deduplication strips them from old snapshots and leaves pages found nowhere else, often junk. Deduplicating each snapshot on its own gave 20T tokens that matched RefinedWeb [5]. Deduplication changes the distribution, not only the size.
Others deduplicate globally and do fine. Llama 3 runs global MinHash [6], and FineWeb2 deduplicates each language globally, then repeats documents by cluster size with weights up to 10 [179]. Global deduplication is safe when quality filtering or duplicate-aware upsampling follows, and the copy count is itself a quality signal.
FineWeb simulated 100 identical snapshots: "for a 1 billion subset, almost all documents would be unique (#duplicates=1), despite each document being repeated 100 times in the full dataset" [5]. A 28B-token ablation cannot see what a 15T-token run repeats, so test deduplication at hundreds of billions of tokens.
The default: URL deduplication first, line or paragraph hashes for boilerplate, MinHash on word 5-grams near = 0.7–0.8 per snapshot (or global with upsampling), and exact substrings at 50 tokens if memory allows.
3.4 What the open datasets taught us
Read in order, what did each open web corpus teach, and how far should you trust the headline numbers? The open corpora read like a series of experiments, and Table 3.2 gives one lesson per row. Sizes are in each source's own unit and tokenizer, so compare rows only roughly.
Table 3.2. The open pretraining corpora and what each one taught. Sizes as reported, in each source's own tokenizer or bytes.
| Dataset (year) | Size | What it taught | Source |
|---|---|---|---|
| C4 (2019) | about 750 GB of English text | Simple line and page rules on one snapshot's extracted text give a usable corpus, and the rules have hidden costs | [177, 181] |
| GPT-3 Common Crawl (2020) | 570 GB after filtering (45 TB compressed before), about 400B BPE tokens | A quality classifier plus fuzzy deduplication, then up-weighting curated sources | [36] |
| The Pile (2020) | 825.18 GiB from 22 sources | Diversity of domains as a design goal | [189] |
| MassiveText (2021) | about 2.35T SentencePiece tokens (computed, sum of its subsets) | The quality and repetition rules that later pipelines reuse | [182] |
| RefinedWeb (2023) | 5T tokens, 600B released | Filtered and deduplicated web text alone is enough | [168] |
| RedPajama-V2 (2024) | 123.7T tokens raw, 30.4T deduplicated | Ship raw text with 46 quality signals per document and let users filter | [190] |
| Dolma (2024) | 3.06T LLaMA tokens | A fully open multi-source corpus with its tools. Its CCNet stage alone removed 84.2% of the content | [178] |
| FineWeb (2024) | 15T GPT-2 tokens from 96 snapshots | Ablate every step. Per-snapshot deduplication beat global | [5] |
| FineWeb-Edu (2024) | 1.3T (score 3 or more), 5.4T (score 2 or more) | Classifiers trained on LLM annotations lift knowledge benchmarks | [5, 166] |
| DCLM-Pool and DCLM-Baseline (2024) | 240T and 3.8T GPT-NeoX tokens | A benchmark for data itself, with rankings that transfer across scales | [167] |
| Nemotron-CC (2024) | 6.3T: 4.4T real, 1.9T synthetic | Strict filters starve long runs, so ensemble, bucket and rephrase | [174] |
| OLMo 2 Mix 1124 (2024) | 3.90T, of which 3.71T DCLM-Baseline | Open models now build directly on DCLM-Baseline | [7] |
| FineWeb2 (2025) | 20 TB, 5 billion documents, over 1,000 languages | One pipeline adapted automatically to each language | [179] |
| Essential-Web v1.0 (2025) | 24T tokens | Label every document with a twelve-category taxonomy instead of one score | [191] |
| Common Pile v0.1 (2025) | 8 TB from 30 openly licensed or public-domain sources | Openly licensed text can train a competitive 7B model (Section 3.6) | [192] |
| AICC (2025) | 7.3T tokens | Model-based HTML extraction | [193] |
Filtered web beats curated mixtures: RefinedWeb showed that "properly filtered and deduplicated web data alone can lead to powerful models" [168], and at 7B DCLM measured RefinedWeb at 36.9 on its Core average (Section 3.2) against 34.2 for C4, 35.0 for Dolma-V1 and 35.3 for RedPajama (reported) [167].
Reading the headline numbers
DCLM-Baseline trains a 7B model "from scratch to 64% 5-shot accuracy on MMLU with 2.6T training tokens" (reported), but that model also saw StarCoder code, ProofPile2 math and math-heavy cooldowns, so it is not filtered web alone [167]. MMLU is a four-way multiple-choice knowledge test (Chapter 10). DCLM's own head-to-head puts DCLM-Baseline at 50.8 MMLU against 37.3 for FineWeb-Edu (7B, 0.28T tokens) [167]. Nemotron-CC's 8B model scores 70.3 against 65.3 for Llama 3.1 8B, on the authors' own harness (reported) [174]. Removing detected MMLU overlaps from DCLM-Baseline did not lower its score (51.8 to 52.7) [167]. So ask of every number: base model, mostly multiple-choice English benchmark, whose harness? And could an educational filter raise MMLU partly by selecting text that reads like exam material? That is an open question.
The long-horizon problem
Strict filters shine at short token horizons and can starve a 15T-token run. Nemotron-CC was built for that problem: its 6.3T tokens match DCLM on MMLU with four times as many unique real tokens (reported) [174]. Its authors also state that "Both DCLM and FineWeb-Edu contain around 80% near-duplicates (1T and 0.2T unique tokens, respectively)" [174], a competing team's claim that this guide has not checked.
Llama 3 trained on about 15T tokens [6]. If the whole budget came from one corpus with unique tokens, the run makes passes, worth this much under the repetition law of Section 3.6 (computed):
| Corpus | Unique tokens | Epochs for 15T | Worth, % of fresh |
|---|---|---|---|
| FineWeb | 15T | 1.0 | 100% |
| FineWeb-Edu, score 2 or more | 5.4T | 2.8 | 96% |
| Nemotron-CC, real tokens | 4.4T | 3.4 | 95% |
| DCLM-Baseline | 3.8T | 3.9 | 93% |
| DCLM-Baseline, if 1T unique (disputed) | 1T | 15 | 68% |
| FineWeb-Edu | 1.3T | 11.5 | 75% |
Taken at face value, only FineWeb-Edu is starved. The case for Nemotron-CC is the near-duplicate claim: if DCLM-Baseline held 1T unique tokens, 15T would be 15 epochs worth 68% of fresh, and FineWeb-Edu's 0.2T would need 75 epochs (22% of fresh), both computed on a disputed input. At 20 tokens per parameter [40], each corpus alone would suit a model of B parameters for FineWeb, 190B for DCLM-Baseline and 65B for FineWeb-Edu (computed). Compute-optimal sizing is derived in Section 6.2.
A newer problem: the web is filling with model text, which is why DCLM-Pool omits crawls from 2023 on [167]. As of late 2026, after FineWeb filtering, the Pangram detector labels 27.5% of June 2026 web tokens as AI-generated and 31.1% by August, and such tokens raise loss almost immediately for models trained on large budgets of human text (reported, detector-dependent) [194]. Treat crawl date as a filter variable.
3.5 Mixtures: how much web, code and math
A pretraining corpus is a set of domains of very different sizes and qualities. Given a token budget, what fraction of training tokens should come from each? Not a share proportional to size. GPT-3 chose its weights so that "some datasets are seen up to 3.4 times during training while other datasets are seen less than once" [36]. A mixture is a sampling distribution over domain datasets , with weights that sum to 1 (the simplex over domains) [195]. Small, dense sources get upsampled and big, noisy ones downsampled.
A run of tokens draws tokens from domain , and one pass (one epoch) over the domain consumes its unique tokens, so the epochs over domain are
assuming token shares and no further filtering during training. phi-4 states this rule [196], and it reproduces phi-4's table: with T, synthetic data at 40% over 290B unique tokens is epochs and web at 15% over 1.3T is 1.15, against the printed 13.8 and 1.2 (computed). Check units first: GPT-3's weights count examples, so WebText2's 22% of 300B tokens over 19B unique gives 3.5 epochs where its table says 2.9 (computed).
Table 3.3. Published pretraining mixes. The basis column says what a share counts.
| Model (year) | Basis | Mix | Source |
|---|---|---|---|
| GPT-3 (2020) | fraction of examples, 300B tokens | Common Crawl 60%, WebText2 22%, Books1 8%, Books2 8%, Wikipedia 3% | [36] |
| LLaMA 1 (2023) | sampling proportion, 1.4T tokens | CommonCrawl 67%, C4 15%, GitHub 4.5%, Wikipedia 4.5%, Books 4.5%, ArXiv 2.5%, StackExchange 2% | [46] |
| Llama 3 (2024) | tokens, about 15T | general knowledge about 50%, math and reasoning 25%, code 17%, multilingual 8% | [6] |
| OLMo 2 Mix 1124 (2024) | tokens, 3.9T | DCLM-Baseline 95.1%, StarCoder code 2.1%, peS2o papers 1.5%, arXiv 0.5%, OpenWebMath 0.3%, Algebraic Stack 0.3%, Wikipedia 0.1% (computed from token counts) | [7] |
| phi-4 (2024) | tokens, about 10T | web 15%, web rewrites 15%, synthetic 40%, code 20%, acquired sources 10%. Epochs 1.2, 5.2, 13.8, 2.4, 1.7 | [196] |
| SmolLM2 (2025), stage 1 | tokens, 11T | code capped at 10% of the mix for about 4 epochs over its 250B tokens | [197] |
| DeepSeek-V3 (2024) | shares not published | more math and programming, broader multilingual coverage, 14.8T tokens, fill-in-the-middle at a rate of 0.1 | [2] |
| Qwen3 (2025) | instance-level labels | 36T tokens in 119 languages and dialects, mixed by ablations on small proxy models | [198] |
About 15T tokens at roughly 50/25/17/8 is about 7.5T general, 3.75T math and reasoning, 2.55T code and 1.2T multilingual (computed, rounded) [6]. Llama 3's code pool is not public. If it held as many unique tokens as StarCoder2–15B's 913B [199] (illustrative), the code would be epochs, worth fresh epochs, 96% of nominal (computed, law of Section 3.6).
Llama 3 chose its mix with a topic classifier that downsamples over-represented categories, small-model scaling-law experiments, and recent web data added late [6]. A production mix is a schedule.
Learning the weights
DoReMi trains a small reference model on default weights, then a small proxy with Group DRO (distributionally robust optimization, minimizing the worst-case loss over groups) on each domain's excess loss, proxy minus reference [195]:
Here is the proxy's loss on example and its length in tokens. In practice the per-token excess loss is clipped at 0 before averaging. Excess loss is high where a domain is learnable but not yet learned, so noise and already-easy domains both lose weight. Weights from a 280M proxy gave an 8B model 6.5 points more average one-shot accuracy than The Pile's defaults and reached the baseline's accuracy 2.6 times faster, for 8% of the large run's compute (reported) [195].
Regression methods fit loss as a function of the mix. Data mixing laws fit per validation domain , where a negative means domain helps domain , and find a mix the default needs 48% more steps to match [200]. RegMix fits 512 proxies of 1M parameters for nearly 2% of one 1B model's FLOPs and finds that web data, not Wikipedia, correlates best with downstream scores [201]. Olmix (2026) needs proxy runs linear in the number of domains [202]. But Aioli found that "no existing method consistently outperforms a simple stratified sampling baseline in terms of average test perplexity" (equal weight per domain) [203], and the best mix is scale-free only if the mixture enters the scaling law additively [204]. Confirm a learned mix at one larger scale.
With a 280M proxy, DoReMi raised Pile-CC's weight from 0.1121 to 0.6057 and cut ArXiv from 0.1052 to 0.0036. With a 1B proxy it upweighted OpenWebText2 instead, which the authors read as "multiple possible local minima in the domain weight space" [195]. Both beat the baseline. Learned weights are not unique, and a mix that works is no proof that it is optimal.
"High quality" is relative. Mixing Wikipedia, books, StackExchange, arXiv and GitHub raised DCLM's Core score for C4 (+2.2) and RefinedWeb (+1.4), but lowered it for DCLM-Baseline, from 31.1 to 29.9 [167]. A classifier that already selects reference-like text leaves curated sources little to add.
Code and math
Code gets its own pipeline. StarCoder2–15B trained on "913B+ unique tokens" after honoring opt-outs [199]. Fill-in-the-middle (FIM) reorders a document's prefix, middle and suffix with sentinel tokens so the model learns to infill. In a sweep of six 200B-token runs, reasoning peaks at 25% code (3.4% above the text-only model), while world knowledge falls 3.4% at 25% code and 31% at 75%, all relative changes [205]. Moderate shares help, and high shares displace the text that carries knowledge.
Math is rare on the web, and naive extraction destroys its notation, so OpenWebMath keeps LaTeX [206]. DeepSeekMath's iterative recall is the method to copy: train a fastText classifier on 500,000 seed math pages against 500,000 random ones, score the crawl, add pages from domains with many hits to the seeds, retrain and repeat. Four rounds gave 120B tokens [207]. Upsampling such data over the last 10–20% of training also pays [208] (Chapter 7).
How to do it yourself. Start from a published mix, compute for every domain before launch, cap small domains at about four epochs, keep 10–25% code, and make any learned mix beat the natural and stratified baselines. Watch for shares in mixed units, domains a filter silently exhausted, and mixes tuned on the reported benchmarks.
3.6 When unique data runs out: repetition, synthetic data and consent
When the clean, unique data runs out, how much is a repeated token worth, and can models write the rest? A 15T-token run on FineWeb-Edu alone is 11.5 epochs. Intuition says the first repeat is nearly as good as new data and the hundredth nearly worthless, and a simple model of that fits real runs.
The repetition law
Suppose each repetition of a token is worth a fraction of the pass before. With unique tokens seen for epochs, so repetitions, the effective data (the fresh tokens that would give the same loss) is a geometric sum:
Define . For small , , which gives the form Muennighoff et al. fit [209]:
For few repetitions , and for many it saturates at . A fit on 182 runs from 7M to 9B parameters and 1 to 500 epochs gives , so each pass is worth less than the last (computed). The constants come from C4 with the GPT-2 tokenizer, so do not transplant them blindly.
The numbers to remember (computed): 4 epochs are worth 3.73 times the unique data (93% of fresh), 16 epochs 10.58 times (66%), and no number of epochs beats 16.39 times. The 4th pass alone is worth 0.85 of a fresh one, the 16th 0.39, and FineWeb-Edu's 11.5 epochs are worth 8.6 fresh ones. Figure 16 plots the law: look for where the curve leaves the fresh-data diagonal (around 4 epochs) and flattens toward the ceiling (past 16), then switch the decay constant or check a real mixture in the planner.
Method and sources
The curve comes from the decay law that Muennighoff et al. (2023) fitted on C4, with a decay constant of 15.4, and the alternative constants come from Prabhudesai et al. (2025): 31.9 for autoregressive models and 513 for masked diffusion models in their setting (all values computed). Panel B computes each domain's epochs as its token share times the budget divided by its unique tokens, which reproduces the epochs in the phi-4 report (Abdin et al., 2024) and SmolLM2's code cap of about four epochs (Allal et al., 2025). The Llama 3 code row uses the reported 17% code share of about 15T tokens (Grattafiori et al., 2024) over an illustrative pool the size of StarCoder2's 913B-token training set (Lozhkov et al., 2024), and the 70B plan is illustrative. The law was fitted on runs where repetition did not hurt, so it cannot show the overfitting that heavy or concentrated repetition can cause, and phi-4 found that many epochs of its synthetic data did not overfit.The paper reports negligible loss changes up to 4 epochs and "Meaningful gains" up to about 16 [209]. Its 8.7B model trained for four epochs on 44B unique tokens ended with only 0.5% higher loss than one epoch over 178B (reported). The full law, which also decays parameters beyond the compute-optimal size for the data (), is
and with the paper's C4 constants it predicts about 0.7% when both runs see 178B tokens (0.75% if the four-epoch run gets only 4 x 44B = 176B), slightly more than measured (computed).
The law has edges, and its fit dropped runs where repetition hurt [209]. Repeating 0.1% of the data 100 times degraded an 800M model to the level of a 400M one [210], which is what surviving near-duplicates do (Section 3.3). Over many epochs larger models overfit more [211], and loss can rise with epochs unless weight decay is 30 times the standard value [212]. The constant also depends on the setting: 31.93 for autoregressive and 512.85 for masked diffusion models in another fit [213].
Illustrative inputs: a 70B model at 20 tokens per parameter wants T, but only B unique high-quality tokens exist. That is 3.5 epochs, worth T, 94.5% of nominal (computed). With it is 1.36T, 97.3%. At 14T tokens (35 epochs) only about 5.9T is effective. Past about 16 epochs, spend compute on new or synthetic data, regularization or a different model size (Chapter 6).
Synthetic data
When repetition is used up, a model can write more data. A strong generator can write new documents such as textbooks, or a model can rephrase real pages, which stay the source of knowledge. phi-1, a 1.3B code model trained with synthetic textbook-style data, "attains pass@1 accuracy 50.6% on HumanEval" [214]. phi-4 created about 400B unweighted synthetic tokens (290B unique in its mix table) and gave synthetic data 40% of training. At an equal token budget, 12 epochs of synthetic data beat 4 epochs plus more unique web tokens [196]. The authors argue synthetic text is easier to learn from because "each token generated by a language model is by definition predicted by the preceding tokens, making it easier for a model to follow the resulting reasoning patterns" [196]. For rephrasing, WRAP trains on real and rewritten C4 "in a 1:1 ratio" for more than 10% better perplexity [215], and Nemotron-CC adds 1.9T rephrased tokens [174].
For an ablation, the phi-4 team trained a 13B model on synthetic data only, so "the model sees over 20 repetitions of each data source". All benchmarks improved during training, but "knowledge-related benchmarks, like 1-shot triviaqa (TQA), show a large gap where synthetic models are subpar", and hallucinations rose [196]. The final mix kept 30% web and web rewrites. Synthetic data teaches reasoning and format, and web data carries long-tail knowledge.
Synthetic tokens cost real compute. WRAP generates "3M tokens per hour on a single A100", so its 85B tokens take , or 28,333 GPU-hours (computed) against the paper's "about 25K" [215]. Generating a token with a 7B model costs about FLOPs, more than the of training a 1.3B student on it, at lower utilization (computed, Chapter 13).
Model collapse
Train each model on its predecessor's output and "tails of the original content distribution disappear" [216]: a rare event of probability is absent from samples with probability , and once missed it cannot come back. But accumulating synthetic data alongside the real data, instead of replacing it, avoids collapse [217]. In linear regression with features, samples per generation and noise variance , the test error after generations, in units of one generation's error , is
because under accumulation generation 's new noise is only of the data. With , and , one generation's error is . By , replacing reaches 2.04 and accumulating 0.316, under the bound of 0.336 (computed). In another regression setting, though, even 1% synthetic data can cause collapse [218].
Replace real data with model output and error grows every generation. Keep the real data and add synthetic data, and error stays bounded, at most times one generation's error in the regression model [217]. That is why phi-4 and WRAP work: they generate once from a strong model, keep real data in the mix and ground generation in real documents.
Consent and licenses
The pool is also shrinking. From 2023 to 2024, new robots.txt restrictions (a site's machine-readable crawl permissions) fully restricted more than 5% of C4's tokens and more than 28% of its most critical sources [219], and dataset hosts omit licenses more than 70% of the time [220]. Yet the 8 TB openly licensed Common Pile v0.1 trains 7B models competitive with Llama 1 and 2 7B [192]. These are public findings, not legal advice.
3.7 Tokenization: from text to integers
A transformer reads integers from a fixed set of size . How does a string of Unicode become that integer sequence, and which choices in this step come back to bite you? Words leave an open vocabulary and bytes make sequences four times longer, so subwords are the middle ground [19]. A tokenizer is a compressor with a fixed codebook, about 4 bytes per token in tiktoken [221]. That ratio sets FLOPs per unit of text (Chapter 1) and how much text a context holds, and it is frozen for the model's life.
Byte-pair encoding
Byte-pair encoding (BPE), a compression method, was adapted by Sennrich et al. to text: write each word as characters plus an end-of-word marker, then repeatedly merge the most frequent adjacent pair, never across words. The merge count is the only hyperparameter, and encoding replays the merges in order [222], so the ordered merge list is the tokenizer.
vocab = all base symbols (bytes or characters)
words = {word: count} from the pre-tokenized corpus
repeat until len(vocab) == V:
pairs = count adjacent symbol pairs, weighted by word count
(a, b) = most frequent pair
replace every "a b" with "ab" in all words
vocab.add("ab"); merges.append((a, b))
encode(text): pre-tokenize, split chunks into base symbols,
apply merges in the order learned
Sennrich et al.'s toy dictionary is low 5 times, lower 2, newest 6, widest 3: 95 symbols over ten letters and _. The first three merges (9 occurrences each) build the suffix est_. After 12 merges the vocabulary has 23 symbols, the corpus is 22 tokens (4.32 times shorter), and the unseen lowest encodes as low + est_ (computed). In Figure 17, watch each merge's count fall from 9 to 3: compression flattens as grows.
Method and sources
Each step shows the merge, how often the pair occurred, the vocabulary size and the corpus length in tokens, which drops by exactly the pair count. The vocabulary grows from 11 to 23 symbols and the corpus gets 4.32 times shorter (computed). Ties go to the pair seen first. The GPT-2 style keeps the leading space with each word (shown as Ġ) instead of an end-of-word marker, as byte-level BPE does (Radford et al., 2019). It learns a different merge order and ends at 23 tokens from 94 symbols, 4.09 times shorter (computed). The encoder applies the merges learned so far, in rank order, to a word you type.Byte-level BPE and the pre-tokenizer
Unicode characters would need over 130,000 base symbols. Bytes need 256, so nothing is ever unknown. GPT-2 also forbids merges across character categories except spaces, so words never fuse with punctuation [19]. A regex pre-tokenizer cuts text into chunks (contractions, letters, digits, symbols, whitespace, with an optional leading space), and merges stay inside chunks [223]:
's|'t|'re|'ve|'m|'ll|'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+
GPT-2's 50,257 tokens are 256 bytes, 50,000 merges and an end-of-text token [19, 224]. Merges can stop inside a multi-byte character, so byte vocabularies can emit invalid UTF-8 [225, 226]. Table 3.4 compares other designs. Unigram matches or beats BPE for masked models [227], yet decoder LLMs almost all use BPE, for reasons no public study settles.
Table 3.4. Tokenizer designs in common use.
| Design | How it builds and applies the vocabulary | Digits and unknown input | Used by |
|---|---|---|---|
| Byte-level BPE [19, 223] | Merges over 256 bytes behind a regex pre-tokenizer, no normalization | cl100k: digit chunks of 1-3 from the left. Nothing unknown | GPT-2 (50,257), cl100k, o200k, Llama 3 (128,256), DeepSeek-V3 |
| SentencePiece BPE with byte fallback [228, 229, 230] | Trains on raw text, whitespace as a meta symbol, NFKC normalization by default | Single digits. Unknown characters fall back to bytes | Llama 2 (32K), Gemma |
| Unigram LM [231, 227] | Starts large, prunes the tokens whose removal costs the least likelihood | Depends on setup | Many SentencePiece models, PaLM's 256K vocabulary [34] |
| WordPiece [232, 233] | Merges the pair maximizing , encodes by greedy longest match | Unknown token | BERT-style encoders |
| BPE-dropout [234] | Randomly skips merges in training, up to 2.3 BLEU in translation | As BPE | Not standard in LLM pretraining |
Llama 3 adds 28K non-English tokens to 100K from tiktoken, improving compression and downstream results with no impact on English [6]. Its config's 128,256 includes 256 reserved special tokens [24, 17].
English compression rises from Llama 2's 3.17 to 3.94 characters per token [6]: fewer tokens. At GFLOPs per token, that is 12.2 instead of 15.2 GFLOPs per character, so 15T tokens cover 24% more text (computed, fixed). The launch blog says "up to 15%" [236] and BLT's bytes per token give 16% [237]: name the sample.
Special tokens and boundaries
Special tokens mark document ends and chat roles. Chat templates and loss masking are in Section 8.2. Never let user text become special tokens, which tiktoken refuses by default [238]. Serve the exact training template, without doubled BOS tokens [239]. Reserve ids up front, as Llama 3 did [24]. Boundaries bias models too: DeepSeek-V3 randomly splits merged punctuation-and-newline tokens in training [2], and exact byte-level scoring gains 18% on fill-in-the-middle coding [240]. Pre-tokenization is a hyperparameter: SuperBPE's merges across spaces cut tokens by up to 33% [241], and long fine-tuning can justify a tokenizer swap [242].
Languages and numbers
A language's tokenization premium is its token count over English for the same content, on parallel sentences [243]:
A window holds as much content, and attention-score cost grows as (Table 3.5). Their speakers pay more for worse results [244], English-centric tokenizers add up to 68% to multilingual training cost [245], and bytes are no cure: Burmese needs four times Chinese's bytes [243]. Train the tokenizer on the pretraining language mix.
Table 3.5. Tokenization premium over English on FLORES-200 (reported, Petrov et al. 2023), with what it means under cl100k_base (computed: 1/premium and premium squared).
| Language | GPT-2 (r50k) | cl100k_base | Content per window | Attention-score cost |
|---|---|---|---|---|
| Italian | 2.01 | 1.64 | 61% | 2.7x |
| Chinese (Simplified) | 3.21 | 1.91 | 52% | 3.6x |
| Bulgarian | 5.51 | 2.64 | 38% | 7.0x |
| Standard Arabic | 4.40 | 3.04 | 33% | 9.2x |
| Burmese | 16.89 | 11.70 | 8.5% | 137x |
| Shan | 18.76 | 15.05 | 6.6% | 227x |
Digits are the other trap. Left-to-right chunks split 1234567 as 123|456|7, but carries run from the right, where 1|234|567 aligns (computed). Right-to-left groups lifted GPT-3.5 and GPT-4 addition from 75.6% to 97.8% with 8 shots, and left-to-right fell to 8.25% when a final carry lengthened the answer [246].
Strings such as SolidGoldMagikarp sat closest to the centroid of GPT-2's 50,257 embeddings and produced bizarre completions [247]. Frequent in the tokenizer's scraped text but nearly absent from the model's curated text, they barely trained, and weight decay shrank their rows toward zero. Land and Bartolo detect such tokens from the weights: 556 of 2,540 candidates in Llama 3 8B and 3,161 of 5,117 in Gemma 2B. Their fix is "ensuring that input data pre-processing is identical across tokenizer training data, model training data, and model inference" [225].
3.8 Vocabulary size, byte-level models and bits per byte
How big should the vocabulary be, can we skip tokenization altogether, and how do you compare two models whose tokens are different? A bigger vocabulary buys shorter sequences with diminishing returns, and its costs matter most for small models.
Untied models have two such matrices. For Llama 3 8B that is B parameters (13.1%) and 6.5% of [17], and Table 3.6 shows the share falling roughly as . So Kaplan et al. drop embeddings from , which "produces significantly cleaner scaling laws" [25]. Logits take 3.91 GiB in FP32 per 8,192-token sequence (computed). Bigger vocabularies cut loss mostly on the 2,500 most frequent words while rare-tail loss rises [248].
Table 3.6. What the vocabulary costs (computed from the released configurations). Parameters count both matrices unless tied. Logits are FP32 for one 8,192-token sequence.
| Model | V | d | Tied | Vocabulary parameters | Share of N | Head share of 2N | Logits (GiB) |
|---|---|---|---|---|---|---|---|
| GPT-2 small [20] | 50,257 | 768 | yes | 38.6M | 31.0% | 31.0% | 1.53 |
| OLMo 2 7B [21] | 100,352 | 4,096 | no | 0.82B | 11.3% | 5.6% | 3.06 |
| Llama 3 8B [17] | 128,256 | 4,096 | no | 1.05B | 13.1% | 6.5% | 3.91 |
| Llama 3 70B [6] | 128,256 | 8,192 | no | 2.10B | 3.0% | 1.5% | 3.91 |
| Llama 3 405B [6] | 128,256 | 16,384 | no | 4.20B | 1.0% | 0.5% | 3.91 |
Vocabularies are padded for fast matmuls. OLMo 2's 100,352 and DeepSeek-V3's 129,280 are multiples of 128 [21, 18], and nanoGPT says so outright [37]:
vocab_size: int = 50304
# GPT-2 vocab_size of 50257, padded up to nearest multiple of 64 for efficiency
What buys is compression, with gains that shrink exponentially [242]. Tao et al. fit tokens per character [249]:
It gives 3.95 characters per token at 32K, 4.34 at 128K and 4.38 at 256K: 11% more for eight times the vocabulary (computed). The fit turns near 220K to 230K, and it predicts 9% fewer tokens from 32K to 128K against Llama 3's measured 19.5% on other data. In Figure 18, slide : the parameter share collapses as models grow while compression flattens.
Method and sources
The alternate view shows the characters per token predicted by the compression fit of Tao et al. (2024), drawn dashed where the quadratic turns, next to the two values the Llama 3 paper measured on English (Grattafiori et al. 2024). Ticks mark vocabularies in use, and the readouts give vocabulary parameters, output-layer FLOPs per token, logits memory per sequence and token counts relative to the preset. The converter turns a loss in nats per token into bits per byte, the measure that stays comparable across tokenizers (Gao et al. 2020), with bytes-per-token presets from the Pile paper, the Llama 3 paper and Pagnoni et al. (2024). Model shapes come from the published configurations of GPT-2, Llama 3 and OLMo 2, and every output is computed from these formulas.At inference size can pay. Llama 3 8B's 96,256 extra rows over 32K cost bytes = 1.47 GiB in BF16. At 128 KiB of KV cache per token ( bytes), 19.5% fewer tokens repays them once about 61,600 old-tokenizer tokens are cached (computed, after Dagan et al. [242]), routine in long-context serving (Chapter 13).
Scaling laws with vocabulary
Tao et al. split parameters into non-vocabulary and , count data in characters , and use a unigram-normalized loss, because a larger raises per-token loss by offering more choices [249]:
A bigger shrinks but grows . Fitting , they find optimal vocabulary parameters grow as , and that Llama 2 70B "should have been at least 216K, 7 times larger than its vocabulary of 32K". At 3B, 43K beat 32K on ARC-Challenge (32.0 against 29.1) at equal FLOPs, one task at one scale [249]. The fit reproduces their 35K, 60K and 218K optima (computed). See also Chapter 6.
B. Counting the vocabulary once, as Tao et al. do, 15T tokens cost FLOPs, far past compute-optimal. The fit gives about 60K at a compute-optimal budget and 206K at this one (computed), and 128K sits between. Tao et al. still recommend the compute-optimal size because larger vocabularies cost inference [249], while the memory trade favors 128K. This is reasoning from cited results, not Meta's rationale.
Compression alone is a weak predictor. PathPiece, which segments text into the fewest possible tokens, did not give better downstream models [250]. Yet an input vocabulary 128 times larger, decoupled from the output vocabulary, let a 400M model match a 1B baseline's training loss [251].
Byte-level models
Dropping the tokenizer removes premiums and glitch tokens but needs 3.4 to 4.4 times more positions (computed). Patch models run a large global network once per patch of bytes (Table 3.7). Subwords' edge may come from throughput and word boundaries [252]. As of November 2026 the leading open models still ship byte-level BPE tokenizers, including DeepSeek-V3 [2] and Qwen3 [198].
Table 3.7. Byte-level models (all results reported by their authors).
| Model | Idea | Result |
|---|---|---|
| ByT5 [253] | Plain byte transformer | +33% pretraining time, up to 10x slower inference |
| MEGABYTE [254] | Fixed patches, local and global models | Spends the large model's FLOPs once per patch |
| BLT [237] | Patches end where next-byte entropy is high | Matches Llama 3 at equal training FLOPs to 8B and 4T bytes, up to 50% fewer inference FLOPs |
| H-Net [255] | Learned chunking | Beats a BPE transformer at matched compute and data |
| MambaByte, AU-Net [256, 257] | State-space model, byte-to-word U-Net | Competitive with subword transformers |
Bits per byte
Per-token loss and perplexity are not comparable across tokenizers. Bits per byte (BPB) is: total code length nats, divided by for bits and by the text's UTF-8 bytes [189].
With GPT-2's tokenizer the Pile has 0.29335 tokens per byte [189], so 2.5 nats per token is 1.058 BPB (computed). DeepSeek-V3 reports Pile BPB [2]. Count bytes on the unnormalized text, give special tokens zero bytes, and compare only on identical text.
Model A (32K) reports 1.9 nats per token and model B (128K) 2.2 on the same text, at 3.6 and 4.4 bytes per token (illustrative). A scores BPB and B (computed): the higher-loss model compresses better.
3.9 Testing data decisions at small scale
A full run costs millions of dollars. How do you decide with small runs that dataset A beats dataset B, and how sure can you be? Train small models that differ only in data, and treat their scores as noisy measurements.
DCLM's rankings at 400M, 1B and 3B correlate with 7B at , 0.956 and 0.982, and a 1B run costs 240 H100-hours against 3,700 [167]. In DataDecide's 1,050 models (25 recipes, 14 sizes, 3 seeds), ranking at 150M picked the 1B winner in about 80% of pairs for of its compute (computed), no scaling-law method did better, and likelihood metrics made MMLU, ARC, HellaSwag, MBPP and HumanEval over 80% predictable [258]. High signal-to-noise benchmarks decide better [259].
Small from-scratch runs score at chance on MMLU [208], so value a small dataset by annealing a partly trained model on a mix containing it. Llama 3 anneals a 50%-trained 8B model on 40B tokens, 30% new data, for of the run (computed). In a separate test, annealing a pre-trained 8B model with the GSM8K and MATH training sets in the mix raised its validation scores by 24.0% and 6.4%, but the gain at 405B was negligible [6]: effects can shrink with scale (Chapter 7). Swarm regressions serve mixtures (Section 3.5).
Seed-to-seed noise in benchmark scores is measured in Section 10.9. DataDecide finds up to 2 points at 1B [258]. With noise per run and seeds per arm, a true gap and recipes whose true scores spread by give ( is the standard normal cumulative distribution function):
The last, the expected share of correctly ordered pairs, is derived in this guide (sign agreement of correlated Gaussians): 0.852 when the spread is twice the noise, 0.75 when equal (computed, matched by simulation). DataDecide's metric is this share, near Kendall's rescaled to 0–1 [258].
At and one seed per arm, : 95% one-sided confidence needs a -point gap, and a true 1-point gap has the right sign of the time. Three seeds: 2.69 points and 73%. Five: 2.08 and 79% (computed). Precision grows only as , so a lower-noise metric is often cheaper.
Table 3.8. What data decisions cost, as a share of the compute of the run they inform (6ND ratios, computed, unless marked reported).
| Method | Proxy | Target | Cost |
|---|---|---|---|
| DoReMi [195] | two 280M runs | one 8B run | 8% (reported) |
| RegMix [201] | 512 runs of 1M parameters on 1B tokens | 1B parameters on 25B tokens | 2.05% |
| DataDecide single scale [258] | 150M parameters on 15B tokens | 1B parameters on 100B tokens | 2.25% |
| Llama 3 anneal probe [6] | 8B, 40B tokens from a 50% checkpoint | 8B on about 15T tokens | 0.27% |
| FineWeb-Edu scoring [5, 11] | 6,000 H100-hours over 15T tokens | Llama 3.1 8B, 1.46M H100-hours | 0.4% |
| OLMo 2 microanneals [7] | 19 anneals, 130B tokens | three 50B-token anneals | 87% of that budget |
| FineWeb ablations [5] | over 70 models | dataset design | 80,000 H100-hours (reported) |
Defaults: likelihood metrics or bits per byte at small scale, averaged final checkpoints, two or three seeds when the gap is under 2 points, anneals for small sources, one confirmation at a larger scale, and data checks before launch. Contamination, including GPT-3's filtering bug, is in Section 10.5.
To try it, use FineWeb-Edu's 10B-token sample [169] and build-nanogpt, about an hour and $10 for GPT-2 124M [260]. FLOPs on 8 H100s at 989.5 TFLOP/s [4] and 40% MFU (illustrative) is 0.66 hours, so three seeds per arm for two arms take 3.9 hours (computed).
DCLM's AskLLM filter agreed with human annotators far better than its fastText filters (about 82% against 73% ROC-AUC). Which built the better training set?
The fastText filters: over 31 Core against about 28.5 at 1B-1x [167]. Human agreement does not predict usefulness: judge a filter by training on what it keeps.
FineWeb's MinHash uses 14 bands of 8 hashes. How often are documents at Jaccard similarity 0.8 flagged, and what do 450 bands of 20 change?
, against , while at 0.7 the chance falls from 0.56 to 0.30 (computed). More hashes sharpen the threshold at about 80 times the cost [5, 168].
A team plans 15T tokens for a 70B model using only FineWeb-Edu (score at least 3). What goes wrong, and what are two fixes?
FineWeb-Edu has 1.3T tokens, so that is 11.5 epochs, worth about 8.6 times the unique data under Muennighoff's law (computed). Lower the threshold (5.4T tokens at score 2), ensemble classifiers as Nemotron-CC did, or add rephrased synthetic data [5, 209, 174].
Model A (32K vocabulary) reaches 2.1 nats per token and model B (128K) 2.3 on the same text. Which is better?
Convert to bits per byte first. At 3.5 and 4.4 bytes per token (illustrative), A is at BPB and B at 0.754 (computed), so B is better despite its higher loss [249, 189].
A 150M ablation shows recipe A beating B by 0.8 points on HellaSwag, one seed each, with 1 point of seed noise. Ship A?
Not yet. The gap's standard deviation is , so with no true difference a gap of 0.8 either way happens of the time (computed). Use likelihood metrics or more seeds, since HellaSwag also needs a compute threshold before it predicts well [258].
- Most of the web never reaches training: FineWeb keeps 15T of 36T base-filtered tokens, FineWeb-Edu 1.3T, and DCLM-Baseline 1.4% of its pool's documents.
- Quality means what a trained model gains. The reference text matters most, and every filter has side effects.
- The banding curve sets a soft deduplication threshold, and global deduplication can leave the junk tail.
- Strict filters starve long runs. Up to about 4 epochs is nearly free, and value saturates near 16 times the unique data.
- A mixture is a sampling schedule. Learned mixing must beat natural and stratified baselines.
- Synthetic data helps with real data kept in the mix. Replacing real data collapses, accumulating does not.
- The tokenizer fixes compute per byte, context, embedding parameters and quirks, including multilingual premiums of 1.6 to 15 times under cl100k. Compare across tokenizers only in bits per byte.
- Single-scale rankings are about 80% right, and with 2 points of seed noise a true 1-point gap is ordered correctly only 64% of the time at one seed per arm.
4. Architecture and the pretraining objective
The objective gives the model a problem; the architecture gives it a way to compute an answer. Work through a Llama 3 layer with its actual shapes, and keep track of which operations consume parameters, FLOPs and memory.
The objective is one line: predict the next token, scored by cross-entropy, at every position of every training sequence (Section 4.1). The function is one family: the decoder-only Transformer, a stack of identical blocks that each read from and add to a running vector per token. Llama 3 "uses a standard, dense Transformer architecture", and its authors write that "our performance gains are primarily driven by improvements in data quality and diversity as well as by increased training scale." [6]
So the diff from 2017 is small in code but not in consequences. A few edits decide how fast the model trains, what each generated token costs in memory and whether a long run survives. We take one Llama 3 8B block apart (Section 4.2), then its stability guards (Section 4.3) and the evidence for each edit (Section 4.4). Sections 4.5 to 4.8 cover the big departures: attention and the key-value (KV) cache, positions, mixture of experts and recurrent layers. The running examples and the notation are introduced in Section 0.3. Full FLOP and memory accounting is in Chapter 1, tokenizers in Chapter 3, optimization in Chapter 5.
4.1 The objective: predicting the next token
What does pretraining minimize, how should you read the number in the training log, and why did the causal decoder-only model become the default? A language model assigns a probability to every possible next token. Training raises the probability of the token that actually came next, at every position at once.
A document becomes token ids from a vocabulary of entries. A causal mask lets position see only . The final hidden state times an output matrix gives logits , and a softmax with normalizer turns them into probabilities . GPT-1 stated the objective this way [261]. The loss is the mean negative log probability of the true next token:
One forward pass yields training signals. The second form shows that adding one constant to every logit changes nothing, which matters in Section 4.3.
Reading the number
Logs report in nats per token. Divide by for bits. Perplexity, , is the effective number of equally likely next tokens, and it is exponential: a 0.1-nat drop is a 9.5% drop in perplexity, since (computed).
Per-token losses depend on the tokenizer. Bits per byte, which compares losses across tokenizers, is defined in Section 3.8. The Pile authors prefer it "due to its invariance to different tokenization schemes" [189]. Llama 3's tokenizer improves English compression "from 3.17 to 3.94 characters per token" over Llama 2's [6]. Treating characters as bytes, 1.80 nats per token is bits per byte with the new tokenizer and 0.819 with the old, while perplexity reads 6.05 in both (computed).
At step 0 the model predicts roughly uniformly, so the loss should start near : 11.76 nats for Llama 3's 128,256 rows [17] (computed). The ln V check at step 0 is in Section 12.5. A first loss far above it means large, confidently wrong logits. PaLM, whose input and output embeddings are shared, scales its output logits by to avoid this [34].
Why the causal decoder-only model won
It was not obvious in 2019. T5 reported under fine-tuning that "For all tasks, the encoder-decoder architecture with the denoising objective performed best", with a GLUE average (a suite of language-understanding tasks) of 83.28 against 73.78 for a decoder-only language model (reported) [177]. Zero-shot use flipped the answer. At 5B parameters, Wang et al. found that "causal decoder-only models trained on an autoregressive language modeling objective exhibit the strongest zero-shot generalization after purely unsupervised pretraining" [262]. The economics agree. A full language-modeling loss uses every token, while their masked setup scored "only on the targets (18% of tokens on average)" [262]. GPT-3 kept "the same model and architecture as GPT-2" [36].
Dissent remains. UL2 finds that "the choice of the denoiser has significantly more impact" than the backbone [263], and T5Gemma turns pretrained decoders into encoder-decoders [264]. As of November 2026, pretraining still starts from a causal decoder. Whether next-token prediction alone is the right objective is open, and multi-token prediction is in Section 4.8.
Nats per token within one tokenizer, bits per byte across tokenizers, and at step 0: 11.76 for Llama 3, 12.48 for Gemma 3's 262,144 rows [265] (computed). Mask padding out of the loss. Llama 3 masks attention between packed documents, which mattered mainly for very long sequences [6] (Chapter 7).
4.2 Inside a modern block: Llama 3 8B, operation by operation
What exactly happens to a token inside one layer of Llama 3 8B, and where do its 8 billion parameters and its FLOPs go? Picture the residual stream: one vector of width per token that every block reads and adds back to. Attention mixes information across positions. The MLP transforms each position on its own.
The 2017 Transformer normalized after each residual add (post-norm) and used a ReLU MLP of width [266]. GPT-2 moved layer norm "to the input of each sub-block" [19], PaLM adopted SwiGLU and dropped biases [34], and LLaMA added RMSNorm and rotary positions (RoPE) [46]. Llama 3 adds grouped-query attention (GQA) with 8 KV heads and a RoPE base of 500,000, and otherwise "does not deviate significantly from Llama and Llama 2" [6].
The block in order
Llama 3 8B has , query heads, KV heads of dimension , and 32 layers [6, 17]. For tokens, one block does this:
- Normalize the stream : , with [17].
- Project without biases: to , and , to each [17].
- Rotate and , never , with RoPE (Section 4.6).
- Score per head, each KV head serving query heads, under a causal mask and a mask between packed documents [6].
- Softmax, take the weighted sum of and concatenate heads back to .
- Project with and add: .
- Normalize, , then gate and up , each to 14,336.
- Form , where and is the elementwise product, project down with and add: .
After 32 blocks come a final RMSNorm and an untied output matrix [17]. The 128,256 rows are the paper's 128,000 tokens plus 256 reserved special tokens [24]. Figure 19 walks these operations with their shapes, parameters and FLOPs. Drag the context slider and watch the attention-score segment of the FLOPs bar grow while the parameter bar stays still.
Method and sources
Select an operation to see its tensor shapes, parameters and FLOPs per token at the current context. The bars split the whole model's parameters and its FLOPs per token by component, and the chart traces the attention share against context for all three sizes, with open circles where attention FLOPs equal weight FLOPs (about 57K, 106K and 196K tokens under a causal mask). Every number is computed in this guide: 2 FLOPs per weight per token, plus 4 FLOPs per key, head dimension and layer for attention, with a causal token attending to about half the keys. The shapes come from Table 3 of the Llama 3 paper (Grattafiori et al., 2024) and the released Llama 3.1 configuration, and the block design from LLaMA (Touvron et al., 2023). Switch to 70B or 405B, to multi-head attention, to training FLOPs or full attention, or slide the context length.Where the parameters go
The parameter count is derived in Section 1.1 (Table 1.1). From the shapes in Table 3 of the Llama 3 paper and the released configuration, Llama 3 8B has 218,112,000 parameters per block and 8,030,261,248 in total, or 8,028,164,096 with 128,000 rows (computed) [6, 17]. The SwiGLU MLP is 80.8% of each block (computed). Attention takes only 19.2% because its 8 KV heads make K and V a quarter the width of Q. With multi-head attention (MHA, one KV head per query head) it would be 27.6% (computed). The same count gives 70,553,706,496 for 70B and 405,853,388,800 for 405B (computed).
Where the FLOPs go
A forward weight matmul costs 2 FLOPs per parameter per token, and the embedding lookup costs nothing. Scores and the weighted sum of values cost FLOPs per layer for each key attended, and under a causal mask the average token attends to about keys:
At Llama 3 8B's shapes, the attention scores and the weighted sum of values take 3.5% of forward FLOPs per token at 2,048 tokens, 12.5% at 8,192, 36% at 32,768 and about 70% at 131,072 (computed from the Llama 3 paper's Table 3 [6], counting a causal mask as an average of about keys per token and the weight matmuls, including the output layer, at 2 FLOPs per parameter). At 8,192 tokens that is for weights plus for attention, and the two terms meet near 57K tokens (computed). Training costs about three times the forward pass, FLOPs per token at 8K (computed). Section 1.2 owns the budget. Here the point is that "6N per token" hides a context term that dominates at 128K.
SwiGLU and the 2/3 correction
SwiGLU replaces the MLP's first matrix and nonlinearity with a gated product [26, 267]:
A gated linear unit (GLU) layer multiplies one projection by a gated copy of another, so it has three weight matrices instead of two, and Shazeer cut its hidden width by a factor of 2/3 to keep parameters and computation equal to the original [26]. Against a MLP, that parity width is
OLMo 2 uses about rounded up to the nearest multiple of 128, which is 11,008 for its 7B model [7]. Llama 3's widths of 14,336, 28,672 and 53,248 are , and , so they sit 31%, 31% and 22% above parity (computed from the Llama 3 paper's Table 3) [6]. Meta chose to spend more in the MLP than the 2/3 rule asks.
Gemma 2's Table 1 lists feedforward dimensions of 18,432, 28,672 and 73,728 [268]. Read as the width of each projection, they would give the 2B model 3.68B non-embedding parameters (computed). Half those widths per projection (9,216, 14,336 and 36,864), with an RMSNorm before and after each sublayer, reproduce Table 2's non-embedding counts of 2,024,517,888, 8,324,201,984 and 26,047,480,320 exactly (computed). Our reading is that Table 1 counts the gate and up projections together. For 2B (, 26 layers), attention 14,155,776 plus MLP plus four norms 9,216 make 77,865,984 per layer, and . Reconcile shape tables with parameter tables before you build on them.
Tying the input embedding to the output layer saves one matrix: 31% of GPT-2 small's 124,439,808 parameters [20] but 0.5% of Llama 3 405B (computed). Press and Wolf recommend tying [269]. In practice small models tie and large ones untie (Table 4.1 in Section 4.4).
4.3 Normalization and the stability guards
Where do the norms go, which parts of a transformer blow up in long runs, and which architectural guard addresses each failure? Picture the residual stream with two softmaxes in it: attention inside every block and the output at the top. Each fails in its own way [270, 271], and norm placement sets how fast the stream grows. Why loss spikes happen is explained in Section 5.5.
Pre-norm, post-norm and RMSNorm
Post-norm normalizes the stream after each residual add. Pre-norm normalizes only each sublayer's input, which leaves an identity path from output to input. At initialization, post-norm's gradients near the output are of order whatever the depth, and pre-norm's are much smaller. So post-norm needs warmup: without it, Xiong et al.'s Transformer reached a BLEU score (n-gram overlap with reference translations) of only 8.45, while pre-norm trained well with none [272].
Pre-norm has a cost. If each block adds a unit-variance update to a unit-variance stream, the stream norm grows like : 3.0 at 8 layers and 11.4 at 128 (illustrative). Deep blocks then nudge a long vector, so they matter less. That fits the claim that "nearly half of the layers are less effective than expected" [273], and that you "can eliminate up to roughly half of the layers" of Llama 2 70B [274].
RMSNorm drops LayerNorm's mean subtraction [275] and keeps a learned gain :
Its authors report "comparable performance against LayerNorm" with 7% to 64% less running time [276]. OLMo 2's ablations "show no difference between the two" [7]. It is a speed win, not a quality win.
Two softmaxes, three guards
Attention logits can grow until "the attention weights collapse to one-hot vectors" [270], called attention entropy collapse [277]. ViT-22B diverged this way [278]. Output logits fail differently. Cross-entropy ignores a shift shared by every logit, so nothing anchors and it can drift, a failure Wortsman et al. see "in models with no weight decay regardless of scale" [270].
QK-norm guards the attention softmax by normalizing and per head before the dot product [278, 279]. It "allows training a model with 1.2B parameters at learning rate 0.3" [270], and Qwen3 and Gemma 3 adopted it [198, 265]. But OLMoE kept it "despite it reducing throughput by almost 10%" [280], one study found it worst on long-context evaluations [281], and it "is not applicable to multi-head latent attention (MLA), because its Key matrices are not fully materialized during inference" [72]. DeepSeek normalizes the compressed latents instead [282], and Kimi K2 rescales a head's query and key weights when its maximum logit passes 100 [72] (QK-Clip, Chapter 5).
z-loss guards the output softmax by penalizing directly:
When it lowers every logit in proportion to its probability, the one direction cross-entropy cannot see. Published z-loss coefficients run from to . PaLM adds to its loss [34], as do Wortsman et al. [270]. Chameleon [271] and Olmo 3 [12] use . The OLMo 2 paper gives both values: in its Table 1 and in Section 3.3.3 [7]. In two 1B ablations it made no measurable difference to quality [283, 13].
Soft-capping bounds logits smoothly. Gemma 2 uses in attention and at the output [268]:
With QK-norm it let an 830M model take 1.5 times the learning rate of QK-norm alone [284]. Gemma 3 still dropped it for QK-norm [265]. One likely reason, which is our inference: a capped score is not the plain softmax that fused attention kernels assume.
Let 128,256 logits drawn from all drift up by 20 (illustrative). Cross-entropy gives zero gradient for the shift. Now , the z-loss at is , and its total downward push is per token, aimed straight at the drift (computed). Soft-capping at maps raw logits 5, 30 and 60 to 4.95, 22.85 and 28.92, with local gradients 0.97, 0.42 and 0.07 (computed). Small logits pass almost untouched, and large ones stop learning.
Chameleon trained mixed text and image tokens on a Llama 2 architecture, which "showed complex divergences due to slow norm growth in the mid-to-late stages of training." QK-norm was "essential in both cases" (7B and 34B), z-loss at held the output softmax, and the 34B model also needed reordered norms [271]. Lesson: find out which softmax is failing, and log norms early enough to tell.
Where the norms are moving
Llama 3 and Qwen3 use pre-norm, [6, 198]. OLMo 2 normalizes outputs, , and Gemma 2 and 3 normalize both, a pattern Kim et al. call Peri-LN [7, 268, 285]. OLMo 2's output norm and QK-norm "reduce the spike score of the gradients from 0.108 to 0.069 when applied together", and neither helped alone [7]. Peri-LN beat pre-norm on C4 loss, averaged over five seeds, at all three sizes: 3.11 against 3.20 at the largest (reported) [285]. That evidence stops at 3.2B parameters and 30B tokens.
PaLM dropped every bias and "found this to result in increased training stability for large models" [34]. Qwen2.5 kept a QKV bias [286] that Qwen3 removed [198]. Newer options such as gated attention [287] rest on one lab's evidence so far.
Turn QK-norm on (latent norms or QK-Clip with MLA) and leave out biases. Add z-loss between and , but check a fused loss kernel's backward pass against a plain reference first. OLMo 2's z-loss episode is told in Section 12.6. Log the maximum attention logit and the output-logit norm from step 0 (Section 12.5).
4.4 What survives ablation: evidence, shape and the recipes labs ship
Which of these choices are backed by evidence that transfers, how should depth and width be split, and what do current recipes actually use? Most single changes move their metric by a few percent at most, and many do not survive the move to another codebase. Narang et al. re-implemented dozens of Transformer modifications in one codebase: "Surprisingly, we find that most modifications do not meaningfully improve performance," and the ones that helped "were either developed in the same codebase that we used or are relatively minor changes" [288]. Across ten architectures, Tay et al. found that "the vanilla Transformer has the best scaling behaviour" [289]. Treat a gain measured once, at one scale, by its inventors, as a hypothesis.
SwiGLU is the best-supported tweak, and its gain is small. In Shazeer's T5-base runs, matched in parameters and FLOPs, held-out log-perplexity fell from 1.677 (ReLU) to 1.636 (SwiGLU), about 0.04 nats or 2.4% (computed), and the paper credits the result "to divine benevolence" [26]. Narang et al. reproduced it (final loss 1.838 to 1.789) [288]. Falcon's 1B ablation dissents: zero-shot accuracy stayed at 49.2, and its Pile score (labeled ppl-pile, but below 1, so a log-scale loss rather than a perplexity) moved from 0.895 to 0.891, "just at the threshold of being unlikely to characterize an actual improvement", and MLP activation memory rose 33%, so Falcon did not adopt it. Its authors add that "SwiGLU may require dedicated hyperparameters tuning" [283]. Nemotron-4 and Nemotron-H use squared ReLU instead [290, 291, 292].
Figure 20 puts 36 published comparisons on one scale, the relative change in each study's own metric, signed so that right is better (computed from reported values):
Count the dots inside the ±1% band, then find the long sticks. They come from single-lab tests, such as DeepSeek-V2's from-scratch attention ablation (MQA at -16.2% on MMLU, multiple-choice knowledge questions described in Section 10.1, computed) [282]. Changes in different metrics compare in magnitude only.
Method and sources
Rows are grouped by component, the gray band marks plus or minus 1%, the hollow marker is a knockout at evaluation rather than a training ablation, and the Kimi K2 row is a reported range. Changes on different metrics show magnitude only, so a loss row and a benchmark row are not interchangeable. Sources are Shazeer (2020), Narang et al. (2021), Liu et al. (2024, MobileLLM), Almazrouei et al. (2023, Falcon), Team OLMo (2024), Kim et al. (2025, Peri-LN), Ainslie et al. (2023), Gemma Team (2024), DeepSeek-AI (2024, DeepSeek-V2 and DeepSeek-V3), Kimi Team (2025), Wang et al. (2024), Dai et al. (2024, DeepSeekMoE), Fedus et al. (2021) and Zoph et al. (2022).Shape barely matters for upstream loss. Kaplan et al. found that "aspect ratio in particular can vary by a factor of 40 while only slightly impacting performance" [25]. It matters more downstream and in small models: Tay et al. find shape "highly important for downstream transfer" [293], MobileLLM's 30- and 42-layer models beat 12-layer ones at about 125M [294], and Gemma 2's deeper 9B beat a wider one 52.0 to 50.8 [268]. GLM-4.5 went deeper because "deeper models exhibited better reasoning capacity" [295]. Depth costs speed [288] and "increases LR sensitivity at a faster rate than scaling width" [270]. In practice the width-to-depth ratio is 64 for GPT-2 small [20], 128, 102 and 130 for Llama 3 8B, 70B and 405B [6], 118 for DeepSeek-V3 [2] and 19 for MobileLLM-125M [294] (computed). Above about 1B parameters, open models sit at 80 to 130.
Heads cost inference FLOPs. Kimi K2 found that doubling them lowered validation loss by only 0.5% to 1.2% but, at 128K context, "leads to an 83% increase in inference FLOPs", so K2 uses 64 heads where DeepSeek-V3 uses 128 [72].
Table 4.1 lines up six open families on the choices in Sections 4.2 to 4.6.
Table 4.1. What six 2024–2025 open model families ship. "None reported" means the cited sources do not describe one.
| Choice | Llama 3 (8B, 70B, 405B) | OLMo 2 7B | Qwen3 (8B dense, 235B MoE) | Gemma 2 and Gemma 3 | DeepSeek-V3 | gpt-oss-120b |
|---|---|---|---|---|---|---|
| Norm and placement | RMSNorm, pre-norm [46, 6] | RMSNorm on sublayer outputs [7] | RMSNorm, pre-norm [198] | RMSNorm before and after each sublayer [268, 265] | RMSNorm, plus RMSNorm on compressed latents [282] | RMSNorm before attention and MoE blocks [28] |
| MLP | SwiGLU, (405B: ), computed [6] | SwiGLU, 11,008 = [7] | SwiGLU. MoE: 128 experts, 8 active, no shared expert [198] | GeGLU [268] | SwiGLU, dense layers 18,432 = [18]. MoE: 1 shared and 256 routed experts, top-8 [2] | SwiGLU with clamping and a residual connection. MoE: 128 experts, top-4 [28] |
| Position | RoPE, [6] | RoPE, 500,000 [21] | RoPE, base raised from 10,000 to 1,000,000 for long context [198] | RoPE. Gemma 3: 10k on local layers, 1M on global [265] | Decoupled RoPE on 64 dimensions [282] | RoPE, YaRN to 131,072 on dense layers [28] |
| Attention | GQA, 8 KV heads [6] | MHA, 32 KV heads [21] | GQA: 32 query and 8 KV heads (8B), 64 and 4 (235B) [198] | GQA, local and global layers 1:1, window 4,096 [268]. Gemma 3: 5:1, window 1,024 [265] | MLA, [2] | GQA, 64 query heads of 64, 8 KV heads, 128-token bands alternating with dense layers, learned sink bias [28] |
| Vocabulary | 128,000 (128,256 rows) [6, 17] | 100,352 rows [21] | 151,669 [198] | 256,128. Gemma 3: 262,144 [268, 265] | 128K (129,280 rows) [2, 18] | 201,088 [28] |
| Tied embeddings | No [17] | No [21] | Yes up to 4B, no from 8B [198] | Yes [268]. Gemma 3: yes, from its parameter counts [265] | No [18] | No, embedding and unembedding counted apart [28] |
| QK-norm | None reported | Yes [7] | Yes [198] | Gemma 2 no, Gemma 3 yes [265] | Not applicable to MLA [72] | None reported |
| z-loss | None reported | in Table 1, in the text [7] | None reported | None reported | None reported | None reported |
| Logit soft-cap | None reported | None reported | None reported | Gemma 2: 50 in attention, 30 at the output [268]. Gemma 3 replaced it with QK-norm [265] | None reported | None reported |
| Biases | None [17] | None [7] | None, Qwen2's QKV bias removed [198] | None reported | None in attention [18] | None reported |
The consensus is plain: RMSNorm, a gated MLP and RoPE everywhere, shared or compressed keys and values (OLMo 2 7B's MHA is the exception), and, outside Gemma, untied embeddings from about 8B up. Labs differ on the stability guards.
Fix the data, tokenizer, token budget and compute. Retune the learning rate for each variant [283]. Run two or more scales and several seeds (Peri-LN used five) [285]. Compare at matched FLOPs, not matched steps. Report loss and downstream metrics, and reproduce in a second codebase. This guide's rule of thumb: treat a single-paper gain under about 1% in loss as unconfirmed.
4.5 Attention variants and the KV cache
Why did attention change at all, how many key and value heads does a model need, and what do MQA, GQA, MLA and sliding windows each buy and cost? The pressure came from generation. Each new token's query reads the stored keys and values of every earlier token, the KV cache, and each byte feeds only a few operations. Shazeer showed that incremental multi-head attention has a ratio of memory access to arithmetic of for context , width and batch , "causing memory bandwidth to be a major performance bottleneck" [74]. Batching shrinks , but is the cache itself. Each design below trades bytes against FLOPs and quality.
In multi-head attention (MHA) each of the query heads has its own keys and values. Multi-query attention (MQA) shares "a single set of keys and values" across heads, which cut an incremental decoder step for a batch of 1,024 sequences on TPUv2 from 47 ms to 3.9 ms (reported) [74]. Grouped-query attention (GQA) sits between, with KV heads that each serve query heads [75]. Each layer caches one key and one value vector per KV head [282]:
Llama 3 70B has 80 layers, 8 KV heads and , and chose GQA "to reduce the size of key-value caches during decoding" [6]. In BF16 it caches bytes per token, 320 KiB, or 40 GiB for one 131,072-token sequence (computed). MHA at the same shape would need 2.5 MiB per token and MQA 40 KiB (computed). DeepSeek-V3's MLA caches a 512-wide latent and a 64-wide rotary key in each of 61 layers, 70,272 bytes per token [282, 2], about 57 times less than MHA with 128 heads of 128 dimensions (computed).
Table 4.2. KV-cache bytes per token in BF16 and per 131,072-token sequence (computed from the published shapes).
| Model and design | Layers | Cached per layer | Bytes per token | One 128K sequence |
|---|---|---|---|---|
| Llama 3 70B shape, MHA (counterfactual) | 80 | 64 heads × 128, K and V | 2,621,440 (2.5 MiB) | 320 GiB |
| Llama 3 70B, GQA-8 (as built) | 80 | 8 heads × 128, K and V | 327,680 (320 KiB) | 40 GiB |
| Llama 3 70B shape, MQA (counterfactual) | 80 | 1 head × 128, K and V | 40,960 (40 KiB) | 5 GiB |
| Llama 3 70B shape, MLA (counterfactual) | 80 | latent 512 + rotary key 64 | 92,160 (90 KiB) | 11.25 GiB |
| Llama 3 8B, GQA-8 | 32 | 8 heads × 128, K and V | 131,072 (128 KiB) | 16 GiB |
| Llama 3 405B, GQA-8 | 126 | 8 heads × 128, K and V | 516,096 (504 KiB) | 63 GiB |
| DeepSeek-V3, MLA (as built) | 61 | latent 512 + rotary key 64 | 70,272 (68.6 KiB) | 8.58 GiB |
| DeepSeek-V3 shape, MHA (counterfactual) | 61 | 128 heads × 128, K and V | 3,997,696 (3.81 MiB) | 488 GiB |
Figure 21 computes these caches for any shape. Pick fewer KV heads and the cache falls in proportion. On the right, GQA and MLA caches grow with context while windowed and hybrid designs go nearly flat. Section 13.4 turns bytes into serving capacity.
Method and sources
Right, decode state per sequence against context on log-log axes for Llama 3 8B, DeepSeek-V3, Mistral 7B, the Gemma 3 local-to-global pattern applied to Llama 3 8B dimensions and the Nemotron-H-8B hybrid, with contexts past 131,072 tokens shaded as formula only. Every byte count is computed in this guide from published shapes with 2 x layers x KV heads x head dimension x bytes per element, the latent width formula for MLA, a rolling-buffer fraction for windowed layers and the Mamba-2 state size, using the configurations in Grattafiori et al. (2024), the DeepSeek-V2 and DeepSeek-V3 reports (2024), Jiang et al. (2023), the gpt-oss model card (2025), the Gemma 3 report (2025) and the Nemotron-H report (2025). Quality notes are as reported by Shazeer (2019), Ainslie et al. (2023), Jiang et al. (2023), the DeepSeek-V2 report and the Gemma 2 and Gemma 3 reports.GQA cuts bytes, not FLOPs. Each query head still scores keys and sums values, so decode attention's arithmetic intensity in BF16 rises from about 1 FLOP per KV byte (MHA) to : 8 for GQA-8, 64 for MQA at (computed). Decode attention FLOPs equal the weight FLOPs at
about 53,000 tokens for Llama 3 70B (, counting matmul parameters only, computed). Only fewer query heads, windows or sparse attention move that crossover.
What sharing costs in quality is contested, because the tests differ. DeepSeek trained three 7B dense models on 1.33T tokens, matched in parameters by depth, and measured 5-shot MMLU of 45.2 (MHA), 41.2 (GQA-8) and 37.9 (MQA) [282]. Ainslie et al. uptrained T5-XXL encoder-decoders for 5% of their pretraining compute and report seven-task averages of 47.2, 47.1 and 46.6, at 1.51 s, 0.28 s and 0.24 s per sample [75]. Gemma 2's 9B ablation gives a four-benchmark average of 50.3 with MHA and 50.8 with GQA [268]. The penalty looks small for uptraining or mild grouping and large from scratch on hard benchmarks. Shipped models accept GQA [6, 296, 198, 265, 28]. With fewer KV heads than tensor-parallel ranks, heads must be replicated (Section 11.3).
Ainslie et al. also trained T5-Large models with MQA from scratch. "In each case, pre-training suffered from frequent loss spikes and the final models diverged immediately when fine-tuning on long-input tasks," while uptrained GQA was stable [75]. KV sharing can change training dynamics, not only quality.
MLA: cache a latent, not the keys
Multi-head latent attention (MLA) compresses instead of sharing [282]:
- Down-project each hidden state to a latent of width [2].
- Up-project it to per-head keys and values .
- Cache only the latent. Since for hidden state , folds into and into , so "we even do not need to compute keys and values out for attention" [282].
- RoPE would put a position-dependent rotation between and , so "RoPE is incompatible with low-rank KV compression" [282].
- Decoupled RoPE adds one rotary key of width , shared by all heads and cached beside the latent [282].
That equals GQA "with only 2.25 groups" [282], or bytes per token for DeepSeek-V3 (computed). In absorbed form all 128 heads do FLOPs each per cached token on the same 1,152 bytes, about 242 FLOPs per byte (computed), against 8 for GQA-8 and close to an H100's dense BF16 ridge of 295 (Section 1.7). MLA decode attention sits near the compute-bound regime, not deep in the memory-bound one. The quality evidence is the authors' own: in DeepSeek-V2's MoE ablations MLA beat MHA on MMLU (50.0 against 48.7, 59.0 against 57.5) with 14% and 4% of its cache and slightly fewer activated parameters [282]. As of November 2026 we found no independent dense test.
Windows and sinks
Sliding-window attention lets each token see only the previous tokens, yet information still travels tokens per layer. Mistral 7B's 32 layers with give "a theoretical attention span of approximately 131K tokens", and a rolling buffer "reduces the cache memory usage by 8x" at 32K [296]. Gemma and gpt-oss interleave local and global layers (Table 4.1). With a fraction of global layers, the cache relative to all-global is
Gemma 3's pattern (, ) keeps 0.193 of the cache at 32K and 0.173 at 128K (computed), with "minimal" perplexity impact [265]. Retrieval tests may disagree (Chapter 10).
Windows hide a trap: "a surprisingly large amount of attention score is allocated to the initial tokens, irrespective of their relevance". Keeping four of these sink tokens beside the window lets a model stream stably [297], and gpt-oss builds a sink into each head as "a learned bias in the denominator of the softmax" [28]. If you serve with a window or evict cache entries, keep the first few tokens.
4.6 Position: RoPE and its alternatives
Attention is blind to order. How does position get in, why did RoPE win, and what does its base frequency control? Without a mask or positions, attention is permutation-equivariant: shuffle the tokens and each token's output is unchanged, only reordered. So position must be added. The 2017 Transformer added sinusoids, hoping they "may allow the model to extrapolate", and found learned embeddings "nearly identical" [266]. ALiBi subtracts a per-head linear distance penalty from the scores (slopes 1/2 to 1/256 for 8 heads), but its authors credit most of its edge to "improved avoidance of the early token curse" [298].
Rotary position embedding (RoPE) wants a score that depends only on content and relative offset [299]. Write one 2-D pair of a query as a complex number and rotate it by its position , multiplying by . For a key at ,
which depends on alone. A head of width has pairs, each at its own frequency with wavelength in tokens:
Rotations preserve norms and , so RoPE "encodes the absolute position with a rotation matrix and meanwhile incorporates the explicit relative position dependency" [299]. It touches queries and keys, never values. Code builds no matrix: , where swaps and negates each pair.
Take and radians per token, with the query at 3 and the key at 5. Then , , and their dot product is . Shift both by 100 and the score is again (computed). With Llama 3's base of 500,000 and , the frequencies run from 1 radian per token (a 6.28-token wavelength) to (2.56M tokens) (computed).
The RoPE figure in Section 7.4 starts from this step and shows the whole spectrum. Notice how little the slowest pairs turn within a training context.
The base sets those slow wavelengths. With , the slowest pair has a wavelength of 54,410 tokens at base 10,000 and about 2.56M tokens at Llama 3's base of 500,000, and 15 of the 64 pairs have wavelengths longer than 131,072 tokens (computed) [6]. These counts use the base alone. The released Llama 3.1 configuration also rescales RoPE by a factor of 8 for wavelengths beyond its original 8,192-token context [17], which stretches the slowest wavelength to about 20.5M tokens and puts 25 pairs above 131,072 (computed). Pairs that never complete a turn within the context can carry content nearly free of position, so long-context models raise the base: OLMo 2 to 500,000 [21], Qwen3 to 1,000,000 [198], Gemma 3 to 1M on global layers only [265]. Extending RoPE beyond the trained length is Section 7.4.
What the frequencies do is contested. Against RoFormer's story of scores decaying with distance [299], Barbero et al. found that trained Gemma 7B "greatly prefers to use the lowest frequencies of RoPE, which we suspect are used to carry semantic information", and dropping the lowest 25% slightly improved 2B-model perplexity (4.4414 against 4.4627) [300]. MiniMax-Text-01 rotates only half of each head [301], and MLA is partial RoPE by construction. Models with no positions (NoPE) still work, since the causal mask leaks order: they "acquire an implicit notion of absolute positions" [302]. Cohere uses NoPE on its full-attention layers [281], Llama 4 interleaves layers "without positional embeddings" [303], and recurrent hybrids drop positions entirely [304, 292] (Section 4.8). This guide's defaults as of late 2026: RoPE with a base of 500,000 to 1,000,000 for dense models, partial RoPE with MLA, and NoPE only in some global layers or in hybrids.
4.7 Mixture of experts: parameters without FLOPs
How can a model hold 671B parameters but spend the FLOPs of about 37B per token, what keeps its experts busy, and what does sparsity cost in memory and communication? A mixture of experts (MoE) keeps many copies of the MLP, called experts, and a small learned router that sends each token to a few of them. Parameters grow with the number of experts. FLOPs per token grow only with the experts each token visits. So DeepSeek-V3 stores 671B parameters and activates 37B per token (reported) [2].
Early mixtures ran every expert and weighted them softly [305, 306]. Shazeer et al. made the gate sparse and named the two problems every later paper fights: routing collapse, where favored experts train faster and get chosen more, and the shrinking batch each expert sees [307]. Table 4.3 follows the line to today.
Table 4.3. Mixture-of-experts language models, 2017 to 2025. Reported values, with our recomputation from published shapes in parentheses.
| Model (year) | Total | Active per token | Routed experts, chosen per token | Shared experts | Source |
|---|---|---|---|---|---|
| Sparsely gated MoE (2017) | 137B | not reported | 131,072 (hierarchical), between LSTM layers | 0 | [307] |
| GShard (2020) | 600B | not reported | 2,048, top-2 | 0 | [308] |
| Switch-C (2021) | 1.6T | not reported | 2,048, top-1 | 0 | [30] |
| GLaM (2021) | 1.2T | 96.6B | 64, top-2 | 0 | [309] |
| Mixtral 8x7B (2024) | 47B (46.70B) | 13B (12.88B) | 8, top-2 | 0 | [310] |
| OLMoE-1B-7B (2024) | 6.9B (6.92B) | 1.3B (1.28B) | 64, top-8 | 0 | [280] |
| DeepSeek-V3 (2024) | 671B (671.03B) | 37B (37.55B) | 256, top-8 | 1 | [2, 18] |
| Qwen3-235B-A22B (2025) | 235B | 22B | 128, top-8 | 0 | [198] |
| Kimi K2 (2025) | 1.04T | 32.6B | 384, top-8 | 1 | [72] |
| gpt-oss-120b (2025) | 116.83B | 5.13B | 128, top-4 | 0 | [28] |
| Llama 4 Maverick (2025) | 400B | 17B | 128, top-1 | 1 | [303] |
Anatomy and parameter count
The MoE replaces the MLP sublayer, and attention stays dense. A router scores each token against routed experts (0.016% of a DeepSeek-V3 MoE layer, computed). Scores come from a softmax (Mixtral's over its top- logits [310]) or, in DeepSeek-V3, from sigmoids normalized over the chosen experts [2]. Each token goes to its top experts, SwiGLU MLPs of width with parameters, whose outputs are gate-weighted and summed with any shared experts and the residual. With attention parameters per layer, sparse layers out of , untied embeddings and a final norm, the parameters every token uses regardless of routing are
and the experts add the rest:
DeepSeek-V3 (, 61 layers, 3 dense, 58 MoE layers of 1 shared plus 256 routed experts of width 2,048, top-8) gives 671.03B and 37.55B: 37B (reported), about 37.6B by our count [2, 18]. Its routed experts are 97.4% of stored parameters but 54% of active ones (computed). Conventions vary: gpt-oss counts the unembedding as active but not the embedding [28]. Expert-choice routing, where experts pick tokens, balances by construction but peeks at future tokens [311].
Training FLOPs use [312]: FLOPs, 18 times less than a dense 671B model (computed from [2]). DeepSeek-V3's utilization is worked out in Section 1.3: 385 TFLOP/s per GPU (38.94% causal MFU), or 343 counting only [1]. Memory follows : 1.34 TB of weights in BF16 (computed), hence V3's 16-way pipeline and 64-way expert parallelism [2].
FLOPs are not wall clock. OLMoE matched a dense model of equal active size on about 3x fewer tokens, but ran 23,600 tokens per second per GPU against 37,500, so it was about 2x faster in time (reported) [280], and (computed).
Keeping experts busy
Without balance, routing collapses and the busiest GPU sets the step time [2]. OLMoE without a balancing loss left most first-layer experts as "dead weights" [280]. Switch's auxiliary loss is [30]
with the fraction of tokens dispatched to expert (no gradient) and its mean router probability (differentiable). At uniform routing , so the loss is exactly for any (derived). Too large an adds interference gradients [313]. The hard limit is a capacity per expert of slots for tokens and capacity factor CF, with overflow tokens dropped to the residual [30].
With 4,096 tokens, 64 experts and top-1, each expert expects 64 tokens, but the load is binomial. At CF 1.0 (64 slots) chance overflow drops 4.94% of tokens. At CF 1.25 (80 slots) it drops 0.13%, and about 20% of slots sit idle as padding (computed from the binomial with the Switch formula). Smaller groups fare worse (Table 4.4).
Table 4.4. Balancing and stability tools, with the evidence for each.
| Tool | What it does | Evidence (reported unless marked) | Source |
|---|---|---|---|
| Capacity factor | caps slots per expert | chance drops at CF 1.0 and 1.25: 4.94% and 0.13% (4,096 tokens, 64 experts, top-1), 13.90% and 5.27% (1,024, 128, top-1), 1.22% and under 0.001% (32,768, 256, top-8, simulated) (computed). Switch drops under 1%. CF 2.0 instead of 1.25 costs +7% step time at 1B and +14% at 32B | [30, 314] |
| Dropless kernels | block-sparse or grouped matmuls, no drops | validation-loss gain over the dense base model: 0.26 dropless against 0.15 at CF 1. Up to 40% faster end to end than Tutel | [315] |
| Auxiliary loss | penalizes popular, favored experts | after a sweep. With 8 experts, one logit raised by 1 or 3 lifts the loss from 0.010 to about 0.013 or 0.047 (computed) | [30] |
| Bias balancing | per-expert bias for selection only | 1B: perplexity 9.56 to 9.50, MaxVio (busiest expert's load over the mean, minus 1) 0.72 to 0.04. DeepSeek-V3 228.7B ablation: Pile BPB 0.656 to 0.652, HumanEval 40.2 to 46.3, MMLU 68.3 to 67.2 | [313, 2] |
| Global-batch statistic | balances over all micro-batches | about 0.1 perplexity and 2 benchmark points | [316] |
| Router z-loss | penalizes large router logits, | 3 of 3 runs stable, quality -1.741 vs -1.755 baseline. About 2% throughput in OLMoE | [314, 280] |
| Float32 router, 0.1x init | tames router numerics | -2.72 vs -3.60 negative log perplexity after 3.5k steps | [30] |
Dropless kernels move imbalance from quality to time and memory, because the busiest expert sets the step [315]. DeepSeek-V3 balances with a bias that changes which experts are selected but not the gate values, so it adds no gradient [313, 2]:
where is expert 's load and the mean (DeepSeek writes and ). V3 used for 14.3T tokens and 0 for the last 500B, and dropped no tokens [2]. Yet its own 1B ablation gives validation losses of 2.258 with a sequence-wise auxiliary loss, 2.253 with the bias method and 2.253 with a batch-wise auxiliary loss, and the authors conclude that the key difference "lies in their balancing scope" [2]. Balance scope, more than dropping the loss, explains most of the gain.
Frameworks computed the balance statistic per micro-batch of a few sequences, so "the router is pushed to distribute the token evenly within each sequence" [316]. Averaging over the global batch, one small extra all-reduce, gained about 0.1 perplexity and 2 benchmark points and let domain specialization emerge [316]. Qwen3 adopted it [198]. Check what any balancing loss averages over.
Figure 22 walks one layer through routing, capacity, dropless execution, bias updates, scope and expert placement. Watch overflow appear at CF 1.0 under equal expected loads.
Method and sources
Drop rates at real scale are computed in this guide for uniform random routing with the capacity formula of the Switch Transformer (Fedus et al., 2021), exactly from the binomial distribution for top-1 groups and by simulation for the top-2 and top-8 groups of the research table. The balancing curves are an illustrative toy of the update rule of Wang et al. (2024), the scope results are reported by Qiu et al. (2025) and DeepSeek-AI (2024), and the byte counts are computed from the DeepSeek-V3 report and configuration and from Zhao et al. (2025).The router z-loss [314],
is added with coefficient . For 32 experts is about 0.016 at unit-scale logits and about 1.8 at scale 20 (computed), so it bites only when logits grow. Instability tracked compute per token: Switch-XXL, with about 7x the FLOPs per sequence of Switch-C (6.3T against 890B in its Table 9, "nearly 10x" in the text), was the unstable one [30].
The modern recipe and its costs
Fine-grained experts split each expert into smaller ones at equal parameters and FLOPs [317], so top-8 of 256 gives combinations (computed). V3's granularity [318] is (computed). Shared experts are contested. Disabling DeepSeekMoE's shared expert at evaluation, in a model trained with it, raised Pile loss from 1.808 to 2.414 [317], a knockout rather than a training ablation. OLMoE found a shared expert slightly worse [280] and Qwen3 dropped them [198]. Expert parallelism and DeepSeek-V3's node-limited routing are in Section 11.6.
Sparsity saves FLOPs, not bytes. If decode tokens each pick of experts independently, a step reads this share of the routed experts:
For V3 that is 3.1% at and 87% at 64, about 568 GB of FP8 expert weights per step (computed, an upper bound). So V3 decodes on 320-GPU units, still memory-bound [2], and gpt-oss quantizes its experts to MXFP4 to fit one 80 GB GPU [28]. Serving an MoE, including the 14.76 ms all-to-all floor for DeepSeek-V3, is in Section 13.6. Figure 23 computes them for any configuration: slide the decode tokens and watch the expert share climb while training FLOPs stay put.
Method and sources
The presets use the published configurations of DeepSeek-V3 (DeepSeek-AI, 2024), Mixtral 8x7B (Jiang et al., 2024) and OLMoE-1B-7B (Muennighoff et al., 2024), which give 671.03B and 37.55B, 46.70B and 12.88B, and 6.92B and 1.28B total and active parameters (computed). The coverage curves add Qwen3–235B-A22B (Yang et al., 2025), the network bound follows the arithmetic of Zhao et al. (2025), and gpt-oss-120b (OpenAI, 2025) and Kimi K2 (Kimi Team, 2025) appear as reported values only.Upcycling a dense checkpoint into an MoE pays off only when the additional training budget is small [319, 320]. MoE scaling laws are in Section 6.6.
4.8 Beyond softmax attention: recurrent layers, hybrids and new objectives
Can the KV cache be replaced by a fixed-size state, what does that cost, and are objectives beyond next-token prediction worth using? Yes, at a price in recall, which a few attention layers buy back. Multi-token prediction is the one new objective in production.
Replace softmax attention's weight by , and associativity turns attention into a recurrence [321]:
A 128 x 128 head state is 32 KiB in BF16 at any context, the KV of 64 tokens of one GQA head (computed). The price is capacity. Store random unit key-value pairs additively and read one back: every other pair adds noise of variance about , so
0.90 at 16 pairs and 0.24 at 1,024 for , matched by Monte Carlo (computed). Softmax attention keeps every key instead [322]. The fixes are decay and the delta rule, which overwrites the value stored for ( is a write strength, not an Adam moment) [322, 323]:
Table 4.5. Recurrent layers as state updates. is and is read as . The gates , , and are each paper's own symbols.
| Model | State update | Reported | Source |
|---|---|---|---|
| Linear transformer | linear-time training | [321] | |
| RetNet | 8.4x faster decoding at 7B and 8K, 70% less memory | [324] | |
| GLA | input-dependent decay | [325] | |
| Mamba-2 (SSM) | kernels 6x faster than FlashAttention-2 at 16K | [326, 327] | |
| DeltaNet | beat Mamba and GLA in perplexity at 1.3B | [323] | |
| Gated DeltaNet | erasure plus targeted updates | [328] |
The losses are about recall. Recall explained 82% of the gap between attention and gated convolutions [329], and transformers learn copying with 100x fewer samples than SSMs [330]. In a matched 8B study Mamba-2 trailed by 17 five-shot MMLU points at 1.1T tokens and 1.37 at 3.5T, and Phonebook stayed hard at any token count [331].
On few-shot IMDB, where the answer is Positive or Negative, "the pure Mamba model often does not follow the correct format" and wrote answers such as "Funny" or "3/10" [304]. Jamba, with attention in one layer of eight, followed it. Perplexity hides this, so test copying and retrieval explicitly (Chapter 10).
So hybrids won (Table 4.6). About 8% attention layers minimized loss in one study [331], and another recommends 3:1 to 6:1 linear to full layers [332].
Table 4.6. Hybrid models (reported).
| Model | Attention share | Reported result | Source |
|---|---|---|---|
| Jamba | 1 attention : 7 Mamba | KV cache 8x smaller than a vanilla Transformer | [304] |
| Mamba-2-Hybrid 8B | 7% of layers | +2.65 points over an 8B Transformer on 12 tasks | [331] |
| Nemotron-H-8B | 4 of 52 layers | up to 3x faster inference | [292] |
| MiniMax-Text-01 | 1 softmax block per 7 linear | 456B total, 45.9B active | [301] |
| Kimi Linear | layerwise mix with MLA | up to 75% less KV cache, up to 6x decode throughput at 1M | [333] |
| Samba | Mamba with sliding-window attention | 3.73x throughput over a GQA Transformer at 128K | [334] |
Nemotron-H-8B () has 4 attention layers with 8 KV heads and 24 Mamba-2 layers with expansion , state dimension , groups and convolution window [292]. One Mamba-2 layer holds
2.06 MiB in BF16, so 49.4 MiB for 24 layers at any context. Attention adds bytes per token, against Llama 3 8B's 131,072 [6]. The hybrid is smaller beyond about 450 tokens and 7.8x smaller at 128K, 2.05 GiB against 16 GiB (computed). See the decode-state panel of Figure 21.
Multi-token prediction (MTP) trains each position to predict several future tokens. With parallel heads, 13B models solved 12% more HumanEval problems, but small models got worse [335]. DeepSeek-V3 adds one sequential module (depth , since means tokens) that shares the embedding and output head [2]:
with weight for 10T tokens, then 0.1 (not the RoPE wavelength ). It lifted HumanEval from 44.5 to 53.7 but cut MMLU from 67.5 to 66.6 [2], for about 4% more training FLOPs (computed, approximate: the module adds about 1.6B active parameters per token, one MoE block, a projection and the shared 0.93B output head, against 37.6B). Using MTP heads as a speculative draft is in Section 13.7. Diffusion models such as LLaDA drop the causal mask and the KV cache [336], a research direction, not a default, as of November 2026.
A model with a 262,144-token vocabulary prints a loss of 14.9 nats at step 0. Is that fine?
No. Uniform prediction gives nats (computed), so the logits start confidently wrong. A usual cause is a tied output layer initialized at without the logit scale PaLM applies [34].
Why is Llama 3 8B's MLP width 14,336 rather than ?
SwiGLU has three matrices, so parameter parity with a MLP is [26]. Llama 3's 14,336 is , 31% above parity and a multiple of 1,024 (computed from [6]): a choice to put more parameters in the MLP.
Llama 3 70B has 64 query heads and 8 KV heads. By what factor does GQA cut decode attention FLOPs relative to MHA?
None. Every query head still scores keys. GQA cuts KV bytes 8x (2.5 MiB to 320 KiB per token) and so lifts decode arithmetic intensity from about 1 to 8 FLOPs per byte (computed from [6, 75]).
A Switch-style layer has 64 experts, top-1, 4,096 tokens per group and capacity factor 1.0. The router is perfectly balanced in expectation. Do you drop tokens?
Yes, about 4.9% (computed from the binomial with the Switch formula [30]), because loads fluctuate around 64 and every expert above it overflows. CF 1.25 drops 0.13% at the price of 20% padding. Balance in expectation is not balance in every step, one reason dropless kernels won [315].
An 8B pure Mamba-2 model matches a Transformer on average zero-shot accuracy. Which two evaluations do you run before switching, and what does the evidence predict?
Five-shot MMLU and a retrieval test such as Phonebook. The matched 8B study above predicts a 17-point MMLU gap at 1.1T tokens and Phonebook failures at any scale [331]. Prefer a hybrid with a few attention layers.
- Pretraining minimizes next-token cross-entropy. Compare bits per byte across tokenizers, and expect a step-0 loss near .
- A modern dense block is the 2017 Transformer plus pre-norm RMSNorm, SwiGLU, RoPE, grouped KV heads and no biases. In Llama 3 8B the MLP holds 81% of block parameters, and attention reaches about 70% of forward FLOPs at 128K.
- Attention logits grow (QK-norm, soft-capping, QK-Clip) and output logits drift (z-loss at to ).
- Adopt an architecture tweak only after it reproduces at two scales, with retuned learning rates, at matched FLOPs.
- KV bytes per token are times bytes per element. GQA-8 cuts Llama 3 70B's cache 8x, and MLA caches 68.6 KiB per token for DeepSeek-V3.
- RoPE makes scores depend only on relative offset, and long-context models raise its base (500,000 for Llama 3).
- DeepSeek-V3 stores 671B parameters but trains on about 37B per token, FLOPs, while memory and large-batch decode traffic follow total parameters. Balancing and its scope decide drops, stragglers and specialization.
- Linear attention and SSMs swap the KV cache for a fixed state but lose recall, so production hybrids keep roughly 8% to 25% attention layers.
5. Optimization and training dynamics
An optimizer turns prediction errors into parameter updates. The learning rate, batch size, initialization and number format determine whether those updates improve the model, waste the budget or end the run. A useful loss curve has to be read alongside those choices.
You have an architecture (Chapter 4) and a budget of about FLOPs (Section 1.2). Which optimizer settings spend it well, and how do they interact? Look at two recipe cards. Llama 3 405B used AdamW at a peak learning rate of , an 8,000-step linear warmup and a cosine decay to over 1.2M steps, with a batch that grew from 4M to 16M tokens. The team "observed few loss spikes and did not require interventions to correct for model training divergence" [6].
DeepSeek-V3 keeps the core, AdamW with , , weight decay 0.1 and clipping at 1.0. But it holds the rate at for 10T tokens before decaying, grows the batch to 15,360 sequences of 4,096 tokens (62.9M, computed), and runs matrix multiplies in FP8 within 0.25% of a BF16 baseline's loss (reported), with no irrecoverable loss spikes [2].
Every number on these cards has a reason, and the numbers are coupled. Chapter 11 covers how the batch is assembled across accelerators and Chapter 12 keeping the job alive. The running examples and the notation are introduced in Section 0.3.
AdamW sets each coordinate's step to about the learning rate . The schedule sets over time and how many recent updates the final weights average. The batch sets how noisy each step is and how large can usefully be. The parameterization sets how scales with width, and the number format which small updates survive. Change one and the best value of the others moves.
5.1 AdamW: the update and what each knob does
What does one AdamW step compute, and why does each hyperparameter take the value it does in public recipes? Gradient descent moves a weight with 100 times larger gradients 100 times further. Adam keeps running means of the gradient and of its square for every parameter and divides the first by the root of the second [337]. Each coordinate then moves by about whatever its gradient scale, so one learning rate serves embeddings, attention and MLP weights.
With the gradient at step , the weights and every operation elementwise, one step in PyTorch's form is
The moments start at zero, so they are "biased towards zero, especially during the initial timesteps" [337]. Bias correction undoes this: after 10 steps but (computed). On step one the ratio is , so every weight moves by about in a sign pattern set by one batch (computed), one reason to warm up. Each moment averages about steps: 10 at 0.9, 20 at 0.95, 1,000 at 0.999. Table 5.1 compares recipes.
Table 5.1. AdamW settings in public recipes (n/s: not stated in the paper's text).
| Run | Weight decay | Clip | Source | |||
|---|---|---|---|---|---|---|
| Adam paper defaults (rate 0.001) | 0.9 | 0.999 | none | none | [337] | |
| GPT-3 (all sizes) | 0.9 | 0.95 | 0.1 | 1.0 | [36] | |
| Llama 2 | 0.9 | 0.95 | 0.1 | 1.0 | [229] | |
| Llama 3 405B | n/s | n/s | n/s | n/s (0.1 × rate in the scaling runs) | n/s | [6] |
| OLMo 2 | n/s | n/s | (was ) | 0.1, none on embeddings | 1.0 | [7] |
| DeepSeek-V3 | 0.9 | 0.95 | n/s | 0.1 | 1.0 | [2] |
| Chameleon | 0.9 | 0.95 | 0.1 | 1.0 | [271] | |
| Wortsman et al. small-scale default | 0.9 | 0.95 | , independent | 1.0 | [270] |
Weight decay and its two meanings
Under SGD an L2 penalty equals weight decay. Under Adam it does not, because the L2 term enters and is divided by , so AdamW applies the decay outside that division [338]. The paper's independent form leaves unscaled. PyTorch and Optax multiply it by , though the independent form "reduces LR sensitivity" [270]. LLM reports mean the coupled form: in OLMo 2 "every parameter is multiplied by at every step" [7].
Coupled, at , each step multiplies the weights by . Read as independent, the same 0.1 shrinks them 10% per step, times stronger. For peak rates from to the readings differ 3,300 to 12,500 times (computed). Compare papers through .
The coupled step is an exponential moving average (EMA):
so the weights average the updates of roughly the last
steps, with the total steps and a constant batch in the second form. It is "a rough timescale over which updates are averaged" [339], and its best value in epochs stays roughly constant across model and data sizes [340]. Train times longer at the same and divide by . Power Lines fit , with TPP the tokens per parameter, on μP models (Section 5.4) at 20 to 1,280 TPP [341].
For OLMo 2 7B, steps out of 953,674 (4T tokens at per step), so (computed) [7]. Table 5.2 adds three runs [6, 2, 36].
Table 5.2. AdamW timescale against the Power Lines optimum (computed, ).
| Run | (steps) | (steps) | TPP | Optimum | ||
|---|---|---|---|---|---|---|
| OLMo 2 7B | 33,333 | 953,674 | 0.035 | 548 | 0.039 | |
| Llama 3 405B ( assumed) | 125,000 | 1,100,928 | 0.11 | 38.5 | 0.16 | |
| DeepSeek-V3 (ramp linear in steps) | 45,455 | about 240,000 | 0.19 | 400 (active) | 0.046 | |
| GPT-3 175B | 166,667 | about 93,750 | 1.78 | 1.7 | 0.82 |
OLMo 2 7B sits almost on the optimum. GPT-3's window outlasts its run, so about 76% of the initialization scale survives (computed). The other rows extrapolate a fit made on dense μP models.
Why
No public controlled ablation at LLM scale settles this. A 20-step second moment tracks shifts in gradient scale. A stale 1,000-step one meeting a large gradient gives an oversized update, a failure "more likely to be observed in the training of a deep model with a large batch size" [342]. Large batches also make less noisy, and 0.95 "is suboptimal at smaller batch sizes (128 and below)" [27]. Marek et al. trained stably down to batch size one by holding the half-life fixed in tokens: 0.95 at 512 sequences becomes at 64 (computed) [343]. Later recipes copied GPT-3 and Llama 2 [36, 229]. PaLM, worried about rare tokens, used at step [34].
Epsilon and clipping
For a steady gradient RMS , Adam's step shrinks by about (Table 5.3). OLMo 2 cut from to , and "the gradient norm settles much more quickly and remains permanently lower" [7]. At Wortsman et al.'s largest scale the gradient RMS reached the default , and improved loss [270] (Section 5.5).
Table 5.3. Fraction of the intended step that survives, (computed).
| Gradient RMS | |||
|---|---|---|---|
| 0.909 | 1.000 | 1.000 | |
| 0.091 | 0.990 | 1.000 | |
| 0.001 | 0.500 | 1.000 | |
| 0.000 | 0.091 | 1.000 |
Clipping takes one norm over all parameters, after the data-parallel all-reduce, and rescales when it exceeds :
With , a norm of 0.8 passes, 2.5 is scaled by 0.4 and 40 by 0.025 (computed), direction kept. First a fix for exploding gradients in recurrent networks [344], clipping is set to 1.0 in Table 5.1, and OPT dropped to 0.3 early for stability [345]. A late rise of the norm in long decaying runs comes from "an unintended interaction between weight decay, normalization layers, and the learning rate schedule" [346].
Rivals rarely beat AdamW: apart from SGD, the optimizers Zhao et al. compared "all perform comparably" [347] (Section 5.7). Defaults: , at million-token batches (higher under about 128 sequences), , coupled decay 0.1 but none on embeddings, where it raises the gradient norm [7], and a clip of 1.0. Log the pre-clip norm and the share of steps clipped. Typical mistakes: above the gradient RMS, and mixed decay conventions.
5.2 Warmup and learning-rate schedules
Why does nearly every run ramp the learning rate up from zero and then bring it down, and does the shape of the descent matter at equal compute? Early, a large rate travels far from the initialization. Late, gradient noise makes the weights bounce across a valley by an amount that grows with , and lowering shrinks the bounce. The schedule sets when to travel and when to settle. Warmup is a separate job: surviving the first steps.
Warmup
Llama 3 405B warms up over 8,000 steps [6], Llama 2, OLMo 2, DeepSeek-V3 and SmolLM2 over 2,000 [229, 7, 2, 197]. Four explanations compete (Table 5.4). RAdam counts the effective samples in Adam's second moment and damps the step until exceeds 4:
Table 5.4. Four explanations of warmup.
| Explanation | Claim | Numbers at | Source |
|---|---|---|---|
| Adam variance | Early second moments average too few samples | , correction 0.35 at step 10 and 0.98 at step 100 (computed) | [348] |
| Update magnitude | Linear warmup over steps matches RAdam | 40 steps (computed) | [349] |
| Curvature | Preconditioned sharpness, the top curvature after Adam's rescaling, starts high, and warmup moves the weights to flatter regions | none | [350, 351] |
| Architecture | Post-LN transformers need warmup, Pre-LN ones can often drop it | none | [272] |
The numbers pick a winner. LLM warmups of 2,000 to 8,000 steps are 50 to 200 times the 40-step rule (computed), too long for the variance story. Curvature fits: the preconditioned sharpness "typically starts off at high values (even in the large batch case)" [350]. OLMo 2 reproduced its early spikes "by mainly reducing the warmup period" [7]. For small scaling runs, Porian et al. warm up over tokens [27].
Decay shapes
With the post-warmup fraction of training, cosine decay, from SGDR [352], is
usually with . Linear decay to zero (D2Z) is [339]. Warmup-stable-decay (WSD) holds the peak, then cools down over a short final stretch [353, 354], linearly or with a 1-sqrt shape over the last of steps (the paper writes ):
Schedule-free AdamW skips decay and evaluates an average of the iterates [355]. It won the self-tuning track of AlgoPerf 2024, a competition that times training algorithms to a target on fixed workloads, [356] but is sensitive to the betas in LLM pretraining [353].
Table 5.5. Area under each schedule, warmup ignored (computed).
| Schedule | Mean | Final |
|---|---|---|
| Constant | 1.00 | 1.00 |
| WSD, 10 % linear cooldown | 0.95 | 0 |
| WSD, 20 % linear cooldown | 0.90 | 0 |
| WSD, 20 % 1-sqrt cooldown ( of peak halfway through it, against 0.50 for linear) | 0.87 | 0 |
| Cosine to 10 % | 0.55 | 0.10 |
| Cosine to 0 | 0.50 | 0 |
| Linear to 0 (D2Z) | 0.50 | 0 |
What the evidence says
Area does not decide the final loss. WSD with a 20% cooldown averages 0.90 of peak and cosine to 10% only 0.55 (Table 5.5), yet they end in the same place (Table 5.6). OLMo 2's authors say their result contradicts the folk wisdom that "area under the learning curve matters" [7]. Tissue et al.'s annealing law is derived in Section 7.1.
Table 5.6. Measured comparisons of decay shapes (reported).
| Study | Setting | Result | Source |
|---|---|---|---|
| Hägele et al. | 1B model, 100B tokens, aggregated downstream score | Cosine to 10 % 46.26, cosine to 0 45.88, 20 % linear cooldown 46.20, 20 % 1-sqrt cooldown 46.23 | [353] |
| Hägele et al. | Cooldown length | Gains "plateau at around 20%". Best constant rate about half the best cosine peak | [353] |
| MiniCPM | Cooldown length | 10 % of tokens enough, 2.5 % short | [354] |
| Bergsma et al. | 610M μP, 20 tokens per parameter, validation loss | Best D2Z 2.571, best decay 2.591: 0.77 % lower | [339] |
| Bergsma et al. | 1.7B, 80 tokens per parameter, proxy-tuned peak | D2Z about 3.05 % lower than | [339] |
| Chinchilla | against decay to 0 | Small difference, "slightly more performant" | [40] |
A cosine fits one length: Chinchilla's "decays over approximately tokens" [40], so its intermediate checkpoints understate a shorter run. WSD matches cosine, with "an almost perfect match between the performance of the best cosine and cooldown schedule" [353]. Read the 0.38-point downstream spread of single runs as a tie. Ending at zero is contested. Bergsma et al. find D2Z "consistently outperforms other schedules when training at compute-optimal dataset sizes" [339], while Chinchilla and Hägele et al. saw small costs. Our reading, not a measured result: the edge of decaying to zero grows with tokens per parameter and needs a higher, re-tuned peak. Modern runs train far past 20 tokens per parameter, so end at 3% of peak or below and check downstream scores.
Why does the end matter? In Wen et al.'s river valley, a high rate keeps the weights oscillating on steep hillsides while they drift down the river on the floor, and then "the rapidly dropping learning rate minimizes the iterate’s oscillations, moving it closer to the river and revealing true optimization progress" [357]. Averaging adds a second reason. Unroll the coupled update with the Adam direction:
The bracket is each update's weight in the final model. Early updates should be forgotten and late, noisy ones averaged, and Bergsma et al. argue D2Z balances the two [339]. At , and OLMo 2 7B's 953,674 steps, the last 2.4% of steps hold half the update weight under a constant rate, 19.1% under cosine to 10% and 22.0% under D2Z, a window 9 times longer (computed).
Figure 24 shows this recency toy model: the schedule, and below it each step's weight in the final model with the half-weight tail shaded. Switch from constant to cosine to D2Z and watch the tail widen, or load a published recipe. On the right are Bergsma et al.'s losses: decay-to-zero curves sit lowest, best at twice the peak rate of the curves.
Method and sources
Left, bottom: the weight each step's update carries in the final model, from the AdamW recursion with weight decay in PyTorch form, where each later step multiplies an update by one minus the learning rate times the weight decay. The amber region marks the trailing steps that hold half of that weight. The curves, step counts and readouts are computed in this guide from the reported recipes, with a weight decay of 0.1 assumed where a report does not print it and the assumptions listed under the chart. Right: final validation loss against the base learning rate for six schedules on 610M-parameter models at 20 tokens per parameter, as reported by Bergsma et al. (2025), with filled points marking each schedule's best rate. Schedule sources are Loshchilov and Hutter (2016), Hoffmann et al. (2022), Hägele et al. (2024), DeepSeek-AI (2024), Grattafiori et al. (2024), Brown et al. (2020), Team OLMo (2024) and Kimi Team (2025), and the averaging view follows Wang and Aitchison (2024) and Bergsma et al. (2025).Table 5.7. Warmups and schedules of public runs (reported, except where marked).
| Run | Warmup | Shape | End, fraction of peak | Source |
|---|---|---|---|---|
| Llama 3 405B | 8,000 steps | Cosine toward 1 % over 1.2M steps, then a linear anneal to 0 over "the final 40M tokens" (as printed) with checkpoint averaging | 0 | [6] |
| DeepSeek-V3 | 2,000 steps | Constant to 10T tokens, cosine to over 4.3T, then for 333B and for 167B | 0.033 (computed) | [2] |
| OLMo 2 7B | 2,000 steps | Cosine to 10 % planned over 5T tokens, stopped at 4T, then linear to 0 during midtraining | 0 | [7] |
| SmolLM2 1.7B | 2,000 steps | WSD at , decay to 0 over the last 10 % of steps | 0 | [197] |
| DeepSeek LLM | 2,000 steps | Multi-step: 31.6 % of peak after 80 % of tokens, 10 % after 90 % | 0.10 | [42] |
| Kimi K2 | 500 steps | Constant for 10T tokens, cosine to over 5.5T, then an anneal to over 460B | 0.035 (computed) | [72] |
| GPT-3 175B | 375M tokens | Cosine to 10 % over 260B tokens, then held | 0.10 | [36] |
Practice has moved toward a low end (Table 5.7) and toward WSD, because a constant phase can be cut anywhere: one run plus cheap cooldowns traces a whole loss-versus-tokens curve. Hägele et al. put the Chinchilla suite at FLOPs this way instead of [353], 58% less (computed). Chapter 6 uses this for scaling sweeps, and midtraining branches from the stable checkpoint (Chapter 7) [358].
The batch ramp splits steps from tokens [6]. 252M tokens at 4M () per step is 60 steps, the stretch to 2.87T at 8M () is 342,101, and the last 12.73T at 16M () is 758,767: about 1,100,928 steps, if 16M holds through the long-context stage (computed). Warmup is 60 steps at 4M plus 7,940 at 8M, 66.9B tokens or 0.43% of 15.6T (computed). The run stops of the way through the cosine, at about 2.7% of peak (computed). The anneal over "the final 40M tokens" (as printed) is 2.4 steps at 16M per step, so it may mean 40B, and the report does not settle it. Specify schedules in tokens and check them in steps.
OLMo 2 7B compared four peak rates near . Higher rates led on training loss for a long time: "when comparing and , the cross-over point is well past 200B tokens". After a linear decay to zero, "All four variants show the same training loss at the end of the procedure, though the lowest setting lags behind the others by a small amount." [7] After a good decay the loss is flat across peak rates, so a sweep read before the decay picks the wrong winner.
Your defaults: warm up linearly over 1,000 to 2,000 steps for runs of 100K steps or more, or tokens for small scaling runs. If you know the run length, decay linearly to zero or cosine to a small floor and re-tune the peak. Otherwise use WSD with a 10 to 20% cooldown at about half the best cosine peak. Common failures: extrapolating a cosine past its horizon, comparing schedules of different lengths mid-run, and tuning on short runs.
A WSD run averages 0.90 of peak learning rate, a cosine-to-10 % run 0.55, yet at equal compute both reach about the same loss. Why does area not win?
Area buys progress along the valley floor, but at high learning rate bouncing across the steep walls inflates the measured loss, and the cooldown removes the bounce. Final loss needs progress plus a long enough low-rate phase (10–20% of steps), not area alone [353, 357, 359].
5.3 Batch size and the critical batch
How large should the global batch be, why do big runs ramp it up, and what must happen to the learning rate and when it changes? A batch gradient is an average, so doubling the batch halves its variance. While noise dominates, one step on a doubled batch does almost the work of two. Once the average is close to the true gradient, a bigger batch buys little and burns data. The crossover is the critical batch, and it moves during a run.
The gradient noise scale
McCandlish et al. expand the loss to second order, with true gradient , Hessian and per-example covariance , and find the best step for a batch of examples [360]:
The simple noise scale drops the Hessian: total per-example gradient variance over the squared gradient norm. At 0.1, 1 and 10 times the noise scale the best step is 0.09, 0.5 and 0.91 of (computed). Below the noise scale the step grows about linearly with the batch. Above it, extra examples are wasted.
Averaged over a run, this gives a hyperbola between optimizer steps and training tokens to reach a target loss [360, 25]:
At a run takes steps and tokens [25]. At it takes and : 2.5 times the data for 1.6 times fewer steps (computed). Zhang et al. instead use , the batch that costs 20% more data than the minimum [361]. Setting gives (computed), so check which name a paper means.
Measuring it is nearly free: compare squared gradient norms on one device and after the all-reduce [360]:
Then . Average both estimates over many steps before dividing. GPT-3's team used the noise scale "to guide our choice of batch size" [36].
What sets the critical batch
The critical batch "typically increases by an order of magnitude or more over the course of training" [360]. Kaplan et al. tied it to the loss [25]. Recent fits tie it to the data: "CBS scales primarily with data size rather than model size" [361], and Power Lines and Step Law agree [341, 362]. Table 5.8 compares four definitions. Laws for the optimal batch size and learning rate (DeepSeek LLM, Step Law) are in Section 6.6.
Table 5.8. Four batch laws at 15T tokens, 100 to 600 times beyond the data each fit used (computed, extrapolated).
| Source | What it measures | Fit or measurement | Fitted on | At T |
|---|---|---|---|---|
| Power Lines [341] | , McCandlish's definition | sequences of 2,048 | 111M-1.7B models | 118M ( = 24M) |
| Zhang et al. [361] | , 20 % data overhead | tokens (units resolved, see note) | 302M models, about 1.7B-24B tokens of C4 | 28M ( = 138M) |
| Step Law [362] | loss-optimal batch | tokens | 60M-1B models, 2B-100B tokens | 19M |
| Merrill et al. [363] | largest batch with no loss penalty | "plateaus around 4096" documents of 4,096 tokens | OLMo 1B and 7B | 16.8M (measured to about 2T tokens, assumed flat) |
Llama 3 405B ended pretraining at tokens per step [6]. With Power Lines' M at its 15.6T tokens (computed, extrapolated), it needs times the minimum data and times the minimum steps (computed). DeepSeek-V3's 62.9M batch at 14.8T [2] gives 1.54 and 2.9, Kimi K2's 67M at 15.5T [72] 1.56 and 2.8 (computed). Zhang's corrected fit gives the same pattern (1.12 and 9.4 for Llama 3, computed). OLMo's measured 16.8M sits at Llama 3's choice [363].
Llama 3 bought data efficiency. DeepSeek-V3 spent a third more data () for 2.8 times fewer serial steps (computed). Both are defensible, depending on whether tokens or time is scarcer.
Figure 25 puts this calculation under your control. On the left, watch the data curve stay flat below and climb past . On the right, public runs sit near or below the 20%-overhead line, and dashed stretches are extrapolation.
Method and sources
Panel B plots the batch with 20% data overhead from the fits of Zhang et al. (2024) and Power Lines (Bergsma et al., 2025), the loss-optimal batch of Step Law (Li et al., 2025), the near-lossless batch Merrill et al. (2025) measured on OLMo, and the batches that GPT-3, Llama 2, DeepSeek LLM, OLMo 2, Llama 3 405B, DeepSeek-V3, Kimi K2 and an llm.c GPT-2 run used, as their reports state. Zhang et al.'s fit is read in 512-token sequences against millions of tokens, the reading that reproduces their own forecast table. Lines are dashed or dotted beyond the token range each law was fitted on, so every value at trillions of tokens is an extrapolation (computed).Ramps and rescaling
Because the critical batch grows, many runs grow the batch (Table 5.9). Llama 3 explains why: "We use a lower batch size early in training to improve training stability, and increase it subsequently to improve efficiency." [6]
Table 5.9. Batch ramps in public runs (reported).
| Run | Ramp |
|---|---|
| GPT-3 [36] | Linear from 32K tokens to full size over the first 4-12B tokens |
| Gopher, Chinchilla [40] | Doubled halfway through training |
| Llama 3 405B [6] | 4M tokens, 8M after 252M tokens, 16M after 2.87T |
| DeepSeek-V2, V3 [282, 2] | 2,304 to 9,216 sequences over 225B tokens (V2), 3,072 to 15,360 over 469B (V3) |
| Merrill et al. [363] | Batch warmup from the measured critical batch: 1B models "with 43% fewer gradient steps" |
| Seesaw [364], Smith et al. [365] | Batch increases replace learning-rate decay. Seesaw reports about 36 % less wall-clock time |
A new batch needs new optimizer settings. SGD's rule is linear [366], valid only far below . For Adam, Malladi et al. derive a square-root rule valid at small learning rates [367]:
Outside that regime the evidence splits (Table 5.10). Holding 's half-life fixed in tokens gives .
Table 5.10. How the batch couples to other settings beyond the square-root rule.
| Source | Finding |
|---|---|
| Li et al. [368] | For Adam-like optimizers the optimal rate "first rises and then falls" as the batch grows |
| Bergsma et al. [339] | Linear scaling appears under constant or WSD schedules, square-root under linear decay to zero |
| Complete(d)P [369] | Scale weight decay by along with the rate |
| Dang et al. [370] | The best optimizer and rule depend on the batch regime |
| Porian et al. [27] | is suboptimal at 128 sequences and below |
| Marek et al. [343] | With 's token half-life fixed, training is stable "all the way down to batch size one" |
Quadruple a 1M-token batch () at and (illustrative). The full rule gives , and (computed). No recipe in this chapter uses , and DeepSeek-V3 keeps through a fivefold ramp [2]. So scale the rate by , re-tune within a factor of two, and keep the betas.
Going down is where bites. At 64K tokens () the rate falls to and rises to (computed).
You train at 4 times the critical batch. What does that cost in data and save in steps?
With and , the critical batch needs and , while needs and : 2.5 times the data for 1.6 times fewer steps (computed) [360]. Pay that only when serial time binds.
Practical defaults. Stay at or below the 20%-overhead batch unless serial time matters more than data. Ramp if early training is unstable. Re-tune the rate whenever the batch changes [371]. If gradient accumulation changes the batch (Section 11.2), step-counted schedules change meaning.
5.4 Hyperparameter transfer: μP, depth and initialization
If you tune a 40M-parameter model, can you reuse its learning rate for a 7B model with the same shape but 16 times the width? Under the standard parameterization (SP), no. Yang et al.'s Tensor Programs V (TP5) found that "the optimal learning rate shifts by roughly an order of magnitude as the width increases from 256 to 8192" [372]. Llama 3's peak rates, , and at widths 4,096 to 16,384 [6], fall as width to the power (computed), though depth changes too.
Why one learning rate cannot fit every width
Take a hidden layer with weights of variance , so is of order one. Adam makes every update entry about in size. The gradient is an outer product with , so the update is aligned with and its effect sums coherently:
So hidden rates must scale as . The embedding's one-hot input moves by about at any width, so its rate must not shrink. The readout needs plus a smaller output multiplier. One global rate fails all three: in SP the logits "blow up with width", and a lower rate means "the word embeddings are not learned in large width models" [372].
Theory says a parameterization either learns features or follows kernel ("lazy") dynamics in which features barely move, "but not both" [373, 374, 375]. The Maximal Update Parameterization (μP) keeps every layer's features moving. Equivalently, scale spectral norms of weights and updates as , with the embedding as the exception [376]:
What μP changes
In practice μP equals SP at a base width of 256 and scales with [377]:
Attention uses instead of because trained queries and keys correlate [372]. At Llama 3's fixed that is just a constant factor of 0.088 (computed). Table 5.11 lists the rules.
Table 5.11. SP versus μP per tensor, for Adam, after TP5 and Cerebras-GPT.
| Tensor | SP init variance | SP learning rate | μP init variance | μP learning rate | μP multiplier |
|---|---|---|---|---|---|
| Token embedding | , width-independent | , tuned | |||
| Q, K, V, MLP up | 1 | ||||
| Attention out, MLP down | 1 | ||||
| Attention score scale | |||||
| Norm gains, biases | 1, 0 | 1, 0 | 1 | ||
| Output logits (tied) | shared | shared |
Table 5.12. μP multipliers at base width 256 (computed).
| Model | Hidden LR × | Hidden std × | Logits × | ||
|---|---|---|---|---|---|
| GPT-2 124M | 768 | 3 | 0.333 | 0.577 | 0.333 |
| Llama 3 8B | 4,096 | 16 | 0.0625 | 0.25 | 0.0625 |
| Llama 3 70B | 8,192 | 32 | 0.0313 | 0.177 | 0.0313 |
| Llama 3 405B | 16,384 | 64 | 0.0156 | 0.125 | 0.0156 |
| DeepSeek-V3 | 7,168 | 28 | 0.0357 | 0.189 | 0.0357 |
Borrow Cerebras-GPT's tuned base rate of [377] (illustrative). The hidden rates become , and at Llama 3's three widths, within 25% of Meta's peaks (computed). The embedding is where they part: μP gives it , 20 times Llama 3 8B's single reported rate.
Running and testing μTransfer
Tune a proxy at base width with the target's depth, tokenizer and data, then check an intermediate width. TP5 suggests a minimum "width (e.g. 256), depth (e.g., 4), batch size (e.g., 32)" and more [372], and the proxy batch should reach its critical batch [377]. Learning rate, initialization and multipliers transfer, but regularization does not [372]. First run a coordinate check: a few widths, about ten steps, activation sizes flat in width [378, 379]. Table 5.13 collects public evidence.
Table 5.13. Public evidence for μTransfer (reported).
| Study | Setup | Result |
|---|---|---|
| Cerebras-GPT [377] | 111M-2.7B, 200-sample search on a 40M proxy | 0.43 % better Pile loss than the SP fit, against 0.35 % seed noise: the clearer gain is predictability |
| BTLM-3B-8K [380] | 40M proxy | Embedding multiplier 14.6, output multiplier 2.22, "only two loss spikes" |
| MiniCPM [354] | 0.04B-0.5B, checked at 2.1B | Best base rate stayed about 0.01 |
| Lingle [381] | Depth 12, widths 128-8,192 (2M-10B) | Base rate best at every width, "a slight drift" |
| u-μP [382] | Unit-scaled μP | A 9-run learning-rate sweep reached near-optimal loss |
| Falcon-H1 [383] | 35 tuned multipliers | μP moved into forward multipliers, one rate for all sizes |
| Command A [384] | 111B | Hyperparameters tuned small and transferred zero-shot |
TP5 tuned a proxy "168 times smaller than the target model" with 467 runs (350 on 4B tokens, 117 on 16B) and picked a learning rate of 0.006 [372]. The cost, , is 6.5% of pretraining, which the paper rounds to 7% (computed). The transferred model reached validation loss 1.98 against 2.03 for a re-run baseline (reported).
The paper lists confounders: the baseline "mistakenly used absolute attention", trained in FP16 where the μP run used FP32, and used cosine where the μP run used linear decay [372]. A transfer result is only as clean as its baseline.
Figure 26 shows transfer in data. On the left, Lingle's minimum sits at from 2M to 10B parameters, though at 10B nearly ties (2.169 against 2.167, reported) [381]. On the right, a toy MLP trained for this guide: under SP the best rate halves per width doubling, from at width 128 to at 1,024, while under μP it stays at or (illustrative).
Method and sources
The strip below each panel traces the best rate for each width. Right: a three-layer MLP regression trained with Adam in this guide under the standard parameterization and under μP (illustrative), a reproduction of the effect Yang et al. (2022) reported. Over 1,000 steps the standard parameterization's best rate halves with each width doubling and μP's stays at 2⁻⁷ or 2⁻⁸. In 300-step runs μP's optimum drifts as well. Llama 3's published peak rates (Grattafiori et al., 2024) are listed for comparison.What μP does and does not buy
Read together, the critiques in Table 5.14 suggest that most of μP's gain comes from a few per-layer choices, not the full recipe. Kosson et al.'s argument is short. Under AdamW's coupled decay, with unit-size update entries roughly orthogonal to a matrix , the weights settle where shrinkage balances growth [385]:
A simulation at , , settles at 31.5 against 31.35 predicted (illustrative). In equilibrium only matters, so μP's shrinks wide layers' updates unless decay is independent of the rate. Equilibrium arrives within steps: 33,333 for OLMo 2 7B [7], 3.5% of its 953,674 (computed).
Table 5.14. Critiques of plain μP.
| Study | Finding |
|---|---|
| Everett et al. [386] | Width-only study to 26.8B (depth 8, batch 256, no weight decay). SP with tuned per-layer rates reached 2.572 against 2.590 for the best μP, a 0.018-nat gap (reported, gap computed) |
| Wortsman et al. [270] | μP stabilizes the optimal rate but "does not improve loss or reduce LR sensitivity in our experiments" |
| Lingle [381], u-μP [382] | Transfer fails with trainable RMSNorm gains, the standard attention scale or standard weight decay. "standard µP is in fact a poor fit for modern LM training" |
| Kosson et al. [385] | Weight decay, not μP, stabilizes updates across widths for most of training. μP "primarily acts as a form of implicit learning rate warmup" |
| Kalra and Barkeshli [387] | The "overwhelming benefit" over SP comes from "maximizing the learning rate of the embedding layer" |
Whatever the name (μP, per-layer SP, u-μP, CompleteP), do all six: (1) a width-independent rate for the embedding and other vector-like tensors, (2) hidden-matrix rates about 1/width, (3) logits that do not grow with width at initialization, (4) independent weight decay so is fixed across widths, (5) norm gains excluded from transfer, (6) verification at three or four widths. This is our reading of the studies above [386, 387, 385, 381, 382].
Depth, epsilon and initialization
A pre-LN residual stream sums branches, so its scale grows with depth unless each branch is damped:
Depth-μP and Bordelon et al. use [388, 389]. CompleteP uses , transfers from 2 to 128 layers and reports 11.8% FLOP savings at 1.5B [390]. The exponent is contested, so keep the proxy near the target depth.
Adam's belongs to the parameterization too: it breaks the symmetry between multiplier, initialization and rate [383], and bites hardest on wide models (Section 5.1). Adam-atan2 removes it [386].
Variance propagation sets initialization:
He initialization uses a standard deviation of for ReLU layers [391]. The common 0.02 is LeCun at width 2,500: 0.55 times LeCun at width 768 but 2.56 times at 16,384 (computed). GPT-2 scales residual-layer weights by for residual layers (the paper writes ) [19], Megatron-LM by for layers [392], which keeps the residual variance flat in depth:
Here is the attention output, and makes the sum independent of . OLMo 2 instead uses a flat 0.02 for every parameter, which in an ablation cut the gradient spike score from 0.40 to 0.03 at slightly slower convergence [7]. DeepSeek-V3 uses 0.006 [2].
With Llama 3 8B's shape rules [6] a width-256 proxy has M non-embedding parameters and a 32.8M head, 60.1M in matrix multiplies (computed). In this illustrative design, 128 proxy runs of 2B tokens cost FLOPs, against for the target's 7.50B parameters outside the input embedding over about 15T tokens: a ratio of , versus TP5's 6.5% (computed).
Practical defaults. Use μP-style per-layer rates with independent weight decay, or in SP at least a width-independent embedding rate [387, 386]. "If < 10 trials in a study, only tune the (base) learning rate." [393] Lower the transferred rate for a longer run [394]. Pre-LN and the other norm choices are in Section 4.3.
Under μP with Adam, hidden matrices' learning rate is divided by the width multiplier but the embedding's is not. Why?
A one-hot input means a step of per embedding entry changes the output by about at any width. A hidden matrix's update lines up with its -dimensional input and adds up to about , which a rate cancels. Dividing the embedding's rate too would freeze it at large width [372, 387].
5.5 Keeping a large run stable
Why do large runs spike or diverge, and what does each standard fix do mechanically? Three failures hide under "instability", and each needs its own fix. A fast spike is a loss jump within a few steps: PaLM 540B spiked "roughly 20 times during training, despite the fact that gradient clipping was enabled" [34]. A slow divergence is a quantity, such as the attention logits, drifting up for thousands of steps until loss blows up [271]. A silent degradation never spikes: updates are lost to rounding (Section 5.6) [182].
Warning signs usually come first. In GLM-130B "a training collapse usually lags behind a “spike” in gradient norm by a few training steps" [395]. OLMo 2 measures spikiness with a spike score, the percentage of points at least seven standard deviations from the rolling mean of the previous 1,000 [7]:
A synthetic trace with 12 spikes in 20,000 steps scores 12 / 19,000 = 0.0632% (computed). What to monitor during a run is in Section 12.5.
These failures can be studied cheaply: they "also appear in small models when training at high learning rates". Wortsman et al. score a fix by its LR sensitivity, the mean gap to the best loss across a learning-rate sweep, where is the model trained at and diverged runs count as the initial loss [270]:
Attention logits and QK-norm
The logit , with and , is quadratic in the weights: double both matrices and it grows fourfold. As weights grow, the softmax turns one-hot, and ViT-22B diverged this way near 8B parameters [278]. In Wortsman et al.'s sweeps "all points with attention logits above 1e4 diverged", and a logit forced to about already degraded the loss [270].
QK-norm [279] normalizes each head's queries and keys before the dot product. With RMSNorm and gains , the Cauchy-Schwarz inequality bounds every logit:
Growth must now go through a few gain parameters. QK-norm let a 1.2B model train at learning rate 0.3 [270], and Gemma 3 adopted it in place of soft-capping [265]. Soft-capping, , starves large logits of gradient: at its slope is 0.005 at (computed). Multi-head latent attention cannot use QK-norm, so Kimi K2 caps them with QK-Clip (Section 5.7) [72].
Output logits and z-loss
Softmax is shift-invariant, so cross-entropy cannot see a common drift of all output logits : its gradient , with the one-hot target, sums to zero. z-loss adds the missing force by penalizing the log of the normalizer :
Output-logit divergence "occurs in models with no weight decay regardless of scale, and z-loss resolves this instability". Weight decay also mitigates it in larger models [270]. In BF16, whose spacing at 128 is 1.0 (computed), "A roundoff error of 0.5 in bfloat16 will alter the softmax output by 36% and incorrectly make all logits equal." [314].
Attention: [6], so with QK-norm and unit gains (computed), about 90 to 900 times below the danger zone of to . Output: random logits over 128,256 tokens, mean 5 and standard deviation 2 (illustrative), give . The cross-entropy gradient sums to about and never moves the mean logit. z-loss at adds nats and a gradient summing to , all along the ignored direction (computed).
Adam, embeddings and data
Adam can start a spike itself: in CLIP training, spikes "consistently occur 1–8 iterations after the squared gradients become under-estimated by their AdamW second moment estimator" [396]. A long-quiet coordinate has a tiny , so one large gradient becomes a huge step. A lower shortens that memory (Section 5.1). Gradients below can also freeze, then flip into an update "essentially uncorrelated with the direction of descent" [342].
Small embeddings are a second source, since the next norm amplifies their gradients. For RMSNorm without its gain (or LayerNorm on a centered input), the Jacobian is
With the common initialization at width 4,096, the standard deviation is 0.0099 and the scale about 101 (computed). Scaling embeddings toward unit standard deviation removes it [397].
Data is the trigger, not the whole cause. Replaying PaLM's spike batches from an earlier checkpoint gave no spike, so "spikes only occur due to the combination of specific data batches with a particular model parameter state" [34]. OLMo 2 filters the repeated n-grams its spike batches were rich in (Section 3.2) [7]. Table 5.15 collects the fixes, and norm placement is in Section 4.3.
Table 5.15. Stability fixes, the mechanism each one targets, and the public evidence for it. Spike scores are percentages by OLMo 2's definition.
| Fix | What it does | Evidence |
|---|---|---|
| QK-norm | bounds attention logits by | Chameleon-7B without it "diverges after approximately 20% of a training epoch" [271]. OLMo 2's output-side norms plus QK-norm cut the gradient spike score from 0.108 to 0.069 [7] |
| z-loss | pulls the mean output logit back toward | in PaLM and OLMo 2, in Chameleon [34, 7, 271]. Router z-loss 0.001 in ST-MoE [314] |
| FP32 softmax and output layer | removes roundoff in exponentials | ST-MoE casts exponentiated tensors to FP32 [314]. Late "time-bomb" spikes follow growing quantization error in the output layer, and an FP32 output layer kept 28M to 1.4B runs stable [398] |
| Lower or update clipping | shortens or caps the stale second moment | lowering from 0.999 mitigated CLIP spikes [396]. PaLM's targets rare embedding tokens [34] |
| Scaled or normalized embeddings | keeps the first norm's Jacobian small | at 13B, Takase et al.'s baseline loss rose from about step 10,000 [397]. BLOOM's embedding LayerNorm cost 1.22 zero-shot points at 1.3B [399] |
| No weight decay on embeddings | stops embedding norms shrinking | OLMo 2 spike score 0.16 with decay, 0.092 without [7] |
| Embedding gradient shrink | scales the embedding gradient by | GLM-130B: "wipes out most spikes" [395] |
| Repeated n-gram filter | removes degenerate batches | OLMo 2 drops documents with 32 or more repeated n-grams of 1 to 13 tokens [7] |
Recovery
The classic cure is PaLM's: restart "from a checkpoint roughly 100 steps before the spike started" and skip "roughly 200–500 data batches". PaLM was "fully bitwise reproducible from any checkpoint" [34]. Whether skipping cures anything is contested. It "only works well earlier in training" [342], and in small models it "merely postpones subsequent spikes" [398]. Resuming from an average of recent checkpoints may help [400]. Llama 3 chose prevention [6]. The runbook is in Section 12.6.
Figure 27 steps through one spike on an illustrative trace. Watch the max attention logit cross first, the gradient norm spike before the loss, and the rewind branch spike again because the drift was never fixed. The last step adds QK-norm.
Method and sources
The logit grows past the levels where Wortsman et al. (2023) saw loss degrade (10³) and every run diverge (10⁴), the gradient norm spikes five steps before the loss, and red dots mark the points that the OLMo 2 spike score flags, computed live on the plotted series as values at least seven standard deviations from the mean of the previous 1,000 points. Step 5 applies the rewind-and-skip recovery of PaLM (Chowdhery et al. 2022): the spike does not recur, but the drift continues and a second spike follows, as Molybog et al. (2023) and Chen et al. (2026) report for skipping. Step 6 adds a QK-norm counterfactual, whose logit is bounded by the square root of the head dimension times two learned gains (√128 = 11.3 with unit gains), and the gradient spike-score reductions that Team OLMo (2024) measured for three fixes.PaLM spiked about 20 times, only at 540B, over about 255,000 steps [34]. Twenty rewinds of 100 steps recompute 2,000 steps, 0.78% of the run, and skipping 200 to 500 batches each time drops 1.6 to 3.9% of the steps (computed). At the final batch of 2,048 × 2,048 tokens, that is at most 0.84B to 2.1B tokens per spike (computed). The compute was cheap. People's time was the real cost, and bitwise determinism made the diagnosis possible.
Layer 0's max attention logit has grown from 50 to 8,000 over 20K steps and the loss wobbles. What is happening, and what is the fix?
Logit growth: a logit scales with the product of the query and key weight norms, and every run above diverged in Wortsman et al.'s sweeps [270]. QK-norm bounds each logit by times two gains, about 11 at (computed, Section 5.5) [279]. With MLA, use QK-Clip [72].
QK-norm or QK-Clip, z-loss near , no weight decay on embeddings, , , warmup, a repeated n-gram filter, a step-indexed deterministic data loader, and dashboards for gradient norm, spike score, max logit and [7, 2]. The full starting recipe is in Section 5.8.
5.6 Numeric precision: BF16, FP8 and below
Which number formats do LLMs train in, why do we still keep FP32 copies of some things, and what does it take to train in FP8 or FP4? A float trades range, counted in binades (powers of two), against precision, set by its mantissa bits. Bit layouts, ranges and block scaling are in Section 2.3. BF16 keeps FP32's range with 7 mantissa bits [52, 314]. FP16 has 10 mantissa bits but flushes magnitudes below to zero [51]. FP8 E4M3 (4 exponent, 3 mantissa bits) tops out at 448, E5M2 at 57,344 [117]. How training and serving precision enter the scaling law is in Section 6.6.
Mixed precision and loss scaling
The standard recipe is "single-precision master weights and updates, loss-scaling, and accumulating FP16 products into FP32." Loss scaling multiplies the loss by so that small FP16 gradients do not underflow [51]:
BF16 removed the need: "The need for loss scaling can be avoided by using BFLOAT16 datatype." [52]. BLOOM's 104B float16 trials diverged, and bfloat16 "proved to solve the instability problem" [401].
Why FP32 master weights: swamping
BF16 has range to spare but few mantissa bits. Adding to with round-to-nearest loses the update when it is below half an ulp (unit in the last place) of :
For FP16 the threshold starts at 2,048, the paper's "at least 2048 times larger" [51], and for BF16 at 256 (computed). With Gopher's BF16 parameters "many parameters did not register updates over many steps", and "Storing a float32 copy of the parameters in the optimiser state alleviates this issue." [182]. Stochastic rounding is unbiased [123]:
Yet Gopher found that "stochastic rounding does not fully recover mixed precision training performance" [182].
The learning rate runs from to [6]. Take a weight near 0.02 and an Adam step of about (Section 5.1). As 0.02 lies between and , its BF16 ulp is . Half an ulp, , puts the threshold ratio at 328 (computed).
At the peak, . The update lands but rounds up to a full ulp, 53% too large. At the ulp doubles and the weight freezes. After 1,000 steps FP32 reaches 0.1000, BF16 round-to-nearest stalls at 0.03125, and stochastic rounding lands near 0.1 (seed-dependent, illustrative). At the final rate and every update is lost (computed).
So we keep an FP32 master copy. Mixed-precision Adam needs "16 bytes of memory per parameter" [57]: TB (5.91 TiB) for 405B before activations (computed). Memory accounting is in Section 1.4.
Figure 28 lets you run this. On the left, pick a format, learning rate and weight, and watch round-to-nearest stall while FP32 climbs. On the right, as outliers grow from to times typical, one FP8 scale per tensor flushes ordinary values to zero while finer scales do not.
Method and sources
At Llama 3 405B's peak rate of 8 × 10⁻⁵, a BF16 weight that starts at 0.02 stalls at 0.03125 after 92 steps while the FP32 sum reaches 0.1 (computed). Right: the error on the ordinary values, or the share flushed to zero, of a simulated 1,024 × 4,096 activation with eight outlier channels under five scaling schemes, including DeepSeek-V3's 1 × 128 tiles and the 32-element microscaling blocks of Rouhani et al. (2023) (simulation in this guide, illustrative). Format facts follow Micikevicius et al. (2017, 2022) and Kalamkar et al. (2019), stochastic rounding follows Tseng et al. (2025), the recipes come from Grattafiori et al. (2024), Team OLMo (2024) and DeepSeek-AI (2024), and the outlier scale comes from Sun et al. (2024).Why FP32 accumulation
Long sums swamp too, and floating-point addition is not associative [402]. Llama 3 accumulates gradients over micro-batches in FP32 and reduce-scatters them in FP32 (Section 11.2). With its image encoder, "performing gradient accumulation in bf16 led to numerical instabilities" [6].
FP8: one scale per what?
FP8 matrix multiplies (GEMMs) run at twice the BF16 rate on an H100, 1,979 against 989.5 TFLOP/s dense (reported) [4]. The original advice is E4M3 for weights and activations and E5M2 for gradients [117]. E4M3's roughly 18 binades cannot hold every tensor at one scale, so each block gets its own, set by its amax (largest absolute value):
Table 5.16. FP8 and FP4 scaling schemes. Bits per element are element bits plus scale bits over block size (computed).
| Scheme | Values sharing a scale | Scale computed | Bits per element | Used by |
|---|---|---|---|---|
| Delayed | whole tensor | from past steps' amax | about 8 | hybrid recipes. It "assumes consistent statistical properties across iterations, making it vulnerable to outliers" [126] |
| Current | whole tensor | this step's amax | about 8 | Nemotron-H 56B, first and last 4 layers in BF16 [292] |
| Tile and block | 1×128 activations, 128×128 weights | online | 8.25 | DeepSeek-V3 [2] |
| MXFP8 | 32 elements, power-of-two E8M0 scale | online, in hardware | 8.25 | microscaling formats [403, 119] |
| MXFP4 | 32 E2M1 elements (values 0, 0.5, 1, 1.5, 2, 3, 4, 6), E8M0 scale [121] | online, in hardware | 4.25 | FP4 research [123] |
| NVFP4 | 16 elements, E4M3 scale, plus one FP32 scale per tensor | online | 4.5 | FP4 research [121] |
A simulation in this guide (illustrative) shows why: a 1,024 × 4,096 Gaussian activation with 8 outlier channels scaled by . Per-tensor E4M3 holds a 2.65% error up to , but at it flushes 29.8% of ordinary values to zero, against 3.4% for 1×128 tiles. Real models get there, with a few activations "100,000 times larger" than the rest [404]. With local scales, E4M3 can serve every tensor.
DeepSeek-V3 runs every linear layer's three GEMMs in FP8, keeping the embedding, output head, gating, norms and attention in BF16 or FP32. Tile and block scales let it "adopt the E4M3 format on all tensors". H800 FP8 accumulation keeps only "around 14 bits", nearly 2% maximum error over 4,096 products, so partial sums are promoted to FP32 every 128 elements. Adam's moments sit in BF16. On 16B and 230B baselines, not V3 itself, loss stayed within 0.25% of BF16 (reported). The failure behind the design: block-wise scaling of activation gradients made a 16B MoE diverge "around 300B tokens" [2].
Table 5.17 collects other public runs. Failures arrive late, so short validations mislead. Speedups are bounded: if a fraction of step time is GEMMs that run twice as fast,
which gives 1.43× at and 1.82× at 0.9 (computed). The reported 1.34× to 1.43× sit inside.
Table 5.17. Public low-precision training results beyond DeepSeek-V3, as of November 2026. All numbers are reported by the authors.
| Run | Precision | Result |
|---|---|---|
| Llama 2 7B on up to 2T tokens | FP8 | "a dramatic divergence caused by outliers after processing 220B tokens", traced to SwiGLU weight alignment. Fixed, it matched BF16 with "up to 34% throughput improvement" [126] |
| Nemotron-H | FP8, current scaling | gap to BF16 widened late, conjectured to be "extremely small gradient updates, which dominate the latter parts of training, get flushed to zero". Small proxies misled, so the recipe was verified "on a minimum of 8B parameters" [292] |
| 8B on 15T tokens (vendor) | MXFP8 | "less than 0.50% difference between MXFP8 and BF16 validation perplexity" [119] |
| Llama 3 70B continued pretraining | FP8, delayed scaling | 415 to 570 TFLOP/s per GPU (1.37×, computed) but "unstable training loss and frequent loss spikes" [405] |
| FP8 GEMMs inside every block, 8B | FP8 | up to 43 % more throughput than BF16 [406] |
| 12B hybrid Mamba-Transformer on 10T tokens (vendor) | NVFP4 | below 1 % loss gap to FP8 in the stable phase, slightly above 1.5 % in the decay. "training diverges when every linear layer is quantized to FP4" [121] |
| GPT models up to 6.7B | MXFP4 backward | minimal degradation with stochastic rounding and random Hadamard transforms [123] |
| Llama 3.1 8B on native FP4 hardware (2026) | MXFP4 | "stochastic rounding and randomized Hadamard rotations fail to stabilize training once Wgrad is quantized, whereas deterministic Hadamard rotations consistently restore stable optimization" [407] |
FP4, as of November 2026
FP4 training is research. The NVFP4 run above kept about 15% of linear layers in higher precision, used stochastic rounding only for gradients, and found that BF16 for the decay "mitigates the loss gap" [121]. Whether Hadamard transforms rescue FP4 gradients is disputed (Table 5.17). One account of why low precision bites late: "when the gradient norm falls below approximately times the quantization noise, quantized training becomes less effective" [122]. That fits both late gaps (our reading).
Precision and determinism
Reduction order changes the low bits even at inference: under BF16 and greedy decoding, a 7B reasoning model's accuracy varied by "up to 9%" across GPU counts, GPU types and evaluation batch sizes [402]. Training runs inherit the same non-associativity. A gap "within the acceptable range of training randomness" [2] means something only once that randomness is measured (Section 12.7).
Compute in BF16. Keep master weights, gradient accumulation and reduce-scatter in FP32, and the embedding, output layer, norms, softmax and router in BF16 or FP32. Use FP8 only with fine-grained scales and FP32 promotion, validated over the full token horizon at several billion parameters [6, 2, 292]. Measure the noise floor by running a short segment twice (our advice, see Section 12.7).
5.7 New optimizers, honest benchmarks and weight averaging
Many new optimizers claim speedups of about 1.2–2× over AdamW. Which claims survive careful comparison, how do the survivors work, and what does weight averaging add? Matrix optimizers led by Muon survive with a modest edge that shrinks with scale. Averaging checkpoints gives much of a learning-rate decay for free.
An optimizer is a norm
Pick a norm and a sharpness estimate . The step minimizing takes its direction from the norm and its size from the dual norm :
Bernstein and Newhouse show that "after switching off exponential moving averages, each method is equivalent to steepest descent under a particular norm" [408]. Adam becomes sign descent. Shampoo becomes steepest descent under the spectral norm, stepping along for : same singular vectors, every singular value set to 1. That norm bounds how much an update can change a layer's output [409].
Shampoo and SOAP. For an matrix (), Shampoo preconditions from both sides [410]:
For one Llama 3 8B MLP matrix (4,096 × 14,336) the factors hold times its entries. For the 32 layers' weight matrices (embedding and head excluded), unblocked FP32 factors and inverse roots take about 183.5 GiB, against 52.0 GiB for AdamW's two FP32 moments on the same 6.98B parameters (computed). A 128,256-row embedding alone would add a 128,256 × 128,256 factor, entries, which is why implementations block such tensors or leave them on AdamW. Blocked and grafted, Shampoo costs "at most a 10% performance reduction in per-step wall-clock time" [411]. SOAP runs Adam in Shampoo's eigenbasis and reports, in the large-batch regime, over 40% fewer iterations than AdamW at 360M-660M parameters (reported) [412].
Muon: orthogonalized momentum
Muon "optimizes 2D neural network parameters by taking the updates generated by SGD-momentum, and then applying a Newton-Schulz (NS) iteration as a post-processing step". Embeddings, the output layer and vectors stay on AdamW [413]. Momentum updates "are almost low-rank matrices" [413], so orthogonalizing gives rare directions the same step as dominant ones. Moonlight and Kimi K2 use [409, 72]
Scale so the singular values lie in . Each Newton-Schulz step
keeps the singular vectors and maps each singular value through , with no SVD. Jordan et al. use "the coefficients " for five steps [413]. They map normalized singular values from 0.01 to 1 into a band of about (computed), and " can be as high as around 0.3 without harming the loss curve" [413].
Take singular values 0.9, 0.3 and 0.01. Step 1: , , . After five steps: 0.682, 1.080 and 0.699 (computed). A 90:1 spread became 1.6:1, so every direction moves by about the same amount. The textbook would leave 0.01 at 0.31.
Five NS steps cost FLOPs against for training the layer on tokens, at most . Jordan et al. give "" for the GPT-2 speedrun and "" at Llama 405B scale [413]. Summed over Llama 3 405B's matrices at 16,777,216 tokens it is 0.39% (computed). At 17.7M-33.6M parameters with reference kernels, Muon "consumes 56.1–69.6% of training time" [414].
The evidence. Muon improved the NanoGPT speedrun record "by a factor of 1.35x" and trained a 1.5B model to GPT-2 XL's HellaSwag score in 10 8×H100-hours against AdamW's 13.3 [413, 415], 1.33× (computed). Moonlight added two fixes [409]. Weight decay keeps weights from "exceeding the high-precision range of bf16". RMS matching: a full-rank orthogonal update has , only 0.0043 for 405B's 16,384 × 53,248 MLP (computed), and lifts it to AdamW's 0.2, so "Muon can directly reuse the learning rate and weight decay tuned for AdamW". Moonlight reports "about 52% training FLOPs" of AdamW (reported) from fits and [409]. For equal loss they give 0.48 at a loss of 2.5 but 0.56 at 2.0 (computed), and has no stated units.
Scaling Muon surfaced "exploding attention logits, an issue that occurs more frequently with Muon but less with AdamW", and QK-norm (Section 5.5) "is not applicable to multi-head latent attention (MLA)" [72]. So after each step QK-Clip shrinks any head whose max logit passed :
This is the multi-head form. With MLA, K2 rescales only the head-specific components, and the shared rotary key is left alone [72].
A head at 400 gets and each matrix shrinks by 0.5 (computed). Only 12.7% of heads ever triggered, all in the first 70,000 steps, and K2 trained "on 15.5 trillion tokens with zero loss spike" (reported) [72]. Monitoring the right scalar caught a new instability early.
Scalar alternatives fare worse. Sophia claims "a 2x speed-up compared to Adam" [416], but on BERT and T5 its gains and Lion's "vanish compared to a baseline with a fully-decayed learning rate" [417].
Benchmarking optimizers honestly
"Papers often don't sufficiently tune their AdamW baseline before comparing it to a newly proposed optimizer" [413]. Wen et al. tuned eleven optimizers equally at 130M-1.2B parameters. Tuning the learning rate alone gave "Up to a 2 speedup" over the GPT-3 recipe, and matrix optimizers' edge fell "from 1.4 over AdamW for 0.1B parameter models to merely 1.1 for 1.2B parameter models", with Muon projected slightly behind AdamW at 7B in the 1× Chinchilla regime [418]. In Figure 29, compare the author-reported points, which mostly sit at 1.3–2×, with the independent line sloping toward 1.
Method and sources
Ratios such as 13.3/10 hours, 197/101 billion tokens and 1/(1 - 0.40) steps are computed here from the papers' own numbers, and SOAP's two results are lower bounds. NorMuon's own paper shows its step saving over Adam shrinking from 1.28x at 1.1B to 1.16x at 5.4B. The slider moves Moonlight's point along its two fitted loss laws, which put Muon's FLOP saving between 2.09x and 1.78x as the target loss falls from 2.5 to 2.0. Sources are Jordan et al. (2024), Liu et al. (2025), Vyas et al. (2024), Liu et al. (2023), Pagliardini et al. (2024), Li et al. (2025), Wen et al. (2025) and Kaddour et al. (2023).A fair test tunes both optimizers equally, compares fully decayed runs, since rankings "can flip during training due to learning rate decay" [418], and sweeps sizes, data ratios and batch sizes [417, 419, 370].
Optimizer X reaches AdamW's final loss at step 6,000 of a 10,000-step cosine run. Why is that not a 1.67× speedup?
At step 6,000 AdamW has not decayed its learning rate, and rankings can flip during the decay [418]. A fair test reruns both with 6,000-step schedules tuned with the same budget, compares final losses, and repeats at several sizes and batch sizes [417, 370].
Weight averaging
Averaging cancels noise only across decorrelated checkpoints, so gains are "amplified when checkpoints are sampled with considerable spacing" [420]. It also acts as a decay. Write later checkpoints as a base minus the updates since. Merging with weights summing to 1 gives
"equivalent to applying a synthetic decay schedule" [421]. A uniform average of 9 checkpoints scales the 8 updates by 0.889, 0.778, down to 0.111, a linear decay (computed). Llama 3 averages checkpoints "during annealing", DeepSeek-V3 keeps a weight EMA, and OLMo 2 averages several anneals (Section 7.3) [6, 2, 7]. Merging constant-phase checkpoints lifted a 1.3B-active MoE's HumanEval "from 31.1 to 36.6 points" [400], yet LAWA (latest-weight averaging, a running average of recent checkpoints) scored below the AlgoPerf baseline [356]. Whether averaging replaces decay is open.
Default to AdamW for a new architecture, data mix or any run you cannot repeat. As of November 2026 Muon with weight decay, RMS matching and logit control is the strongest alternative, and sharding it needs whole-matrix gathers (Section 11.2) [72, 409]. Expect about 1.1× near 1B parameters, more at smaller scale [418].
5.8 Reading the loss curve, and a starting recipe
What does a healthy loss curve look like, which odd shapes are normal, and what settings should a new run start from? Oscillation, an early bump and plateaus are usually expected, so know them before you kill a run (Section 15.2).
The edge of stability. On a quadratic with top Hessian eigenvalue , iteration diverges once
the last for Adam's preconditioned sharpness [422]. Networks climb to the threshold and sit on it: "the training loss behaves non-monotonically over short timescales, yet consistently decreases over long timescales" [423]. For Llama 3 405B it is at peak and at the final (computed). The learning rate sets how sharp a region the model can occupy, which is why the cooldown drops the loss (Section 5.2).
Bumps and plateaus. In-context learning "develops abruptly in a narrow window early in training (roughly 2.5 to 5 billion tokens)" as induction heads form, "the only place in training where the loss is not convex" [424]. At GPT-2 124M's 524,288 tokens per step that is steps 4,800–9,500, if it carried over (illustrative). Plateaus in small transformers come with repetition and collapsed hidden states, also early in Pythia and OLMo [425]. Grokking (validation catching up times later) and double descent matter for multi-epoch fine-tuning on small data [426, 427], not single-epoch pretraining.
A healthy run falls fast through warmup, may bump early, declines smoothly, drops in the cooldown and ends flat, while the spike score, max attention logit and stay small (Section 5.5). Table 5.18 collects the chapter's defaults. Section 15.3 maps symptoms to causes.
Table 5.18. A starting recipe for a dense decoder in 2026. Each row names the section that argues for it.
| Knob | Start from | Evidence |
|---|---|---|
| Optimizer | AdamW, , (0.99 or more below about 128 sequences per batch), | 5.1 [36, 27, 7] |
| Weight decay | 0.1 in PyTorch form, none on embeddings, norm gains or biases. Check | 5.1 [7, 341] |
| Clipping | Global norm 1.0. Log the fraction of clipped steps | 5.1 [7, 2] |
| Warmup | 1,000-2,000 steps (about tokens for small scaling runs) | 5.2 [2, 7, 197, 27] |
| Schedule | WSD with a 10-20 % cooldown, or linear to zero when the length is fixed. End at 3 % of peak or below | 5.2 [353, 339] |
| Batch | At or below the 20 %-overhead batch for your token budget, ramped up early. Scale Adam's learning rate by when the batch grows by | 5.3 [361, 341, 363, 367] |
| Learning rate across sizes | μP-style per-layer rates (base width 256), independent weight decay, a check at 3-4 widths | 5.4 [372, 381, 385, 386] |
| Initialization | , optionally scaled by on residual projections | 5.4 [7, 19] |
| Stability | QK-norm (QK-Clip with MLA), z-loss , filter long repeated n-grams, step-indexed deterministic data | 5.5 [7, 34, 72] |
| Precision | BF16 compute, FP32 master weights, FP32 accumulation and reduce-scatter. FP8 only with fine-grained online scales and full-horizon validation | 5.6 [6, 2, 126] |
| Monitoring | Pre-clip gradient norm, spike score, max attention logit per head, , per-layer gradient RMS against , output-layer activation norm | 5.5 [7, 270, 271] |
| Averaging | An EMA or spaced checkpoints, evaluated before committing to a decay | 5.7 [2, 400] |
| New optimizer | Muon only with weight decay, RMS matching, logit control and an equally tuned AdamW baseline | 5.7 [409, 72, 418] |
- AdamW moves every coordinate by about the learning rate, so , and weight decay are coupled. Weight decay 0.1 averages updates over about steps.
- Warmup escapes the sharp start. The end of the schedule sets the final loss: WSD with a 10–20% cooldown matches cosine. Whether to decay to zero is contested: at 20 tokens per parameter and beyond, Bergsma et al. find linear decay to zero beats a 10% floor, while Chinchilla and Hägele et al. saw small costs. End at 3% of peak or below and re-tune the peak.
- Below the critical batch, bigger batches save steps almost for free. It grows with training tokens, not model size, so runs ramp the batch. Scale Adam's rate by .
- Under SP the best learning rate falls with width (Llama 3: to ). μP-style rates let a small proxy set it.
- Watch the max attention logit, , gradient RMS against and embedding norms. Skipping batches buys time. Fixing the cause ends the problem.
- BF16 needs FP32 master weights and accumulation. FP8 needs fine-grained online scales and full-horizon validation.
- Tuned benchmarks find matrix optimizers such as Muon 1.4× faster than AdamW at 130M but only 1.1× at 1.2B. Judge optimizers after a full decay, and keep an EMA.
6. Scaling laws: predicting loss, sizing runs and spending compute
A scaling law makes a run plan testable before the expensive run starts. Fit the relation between loss, model size and data, inspect the range where it holds, and decide whether training compute or the cost of serving the result is the budget that matters.
Can you know how good a model will be before you pay to train it? In 2022 DeepMind bet that you could. Its 2021 Gopher had 280B parameters trained on 300B tokens [182], because "most models are trained for approximately 300 billion tokens" [40]. A scaling law fitted to small runs said the same budget belonged to a 67B model on 1.5T tokens, about 4 times smaller on 5 times more tokens (reported, their Table 3) [40]. Hoffmann et al. built one: "a more compute-optimal 70B model, called Chinchilla, on 1.4 trillion tokens". It beat Gopher on MMLU "with an average accuracy of 67.6% (improving upon Gopher by 7.6%)" [40].
In 2024 Meta bet the other way. Llama 3 8B saw about 15T tokens, about 1,870 tokens per parameter or 93 times Chinchilla's ratio (computed: ), on purpose: "we also train our smaller models for much longer than is compute-optimal" [6]. Meta also sized its 405B flagship from runs of at most FLOPs, and its benchmark forecast "only slightly underestimates the final performance of the flagship Llama 3 model" [6].
A scaling law is an empirical fit that predicts held-out loss (and, with more work, benchmark scores) from parameters , training tokens and compute , for one recipe on one data distribution. The running examples and the notation are introduced in Section 0.3. Sections 6.1 to 6.4 cover loss laws and how to fit them, 6.5 and 6.6 decisions beyond compute-optimal, 6.7 and 6.8 benchmarks, test-time and RL compute, and 6.9 the trend lines.
A scaling law is a fitted curve for one recipe. Its exponents tell you how to split a budget between parameters and data. Its constants do not transfer across datasets or tokenizers, and its error bars at the target scale matter as much as its point estimate.
6.1 Power laws and the first scaling laws
Why does loss fall as a power law, and what did the first language-model scaling laws measure? Loss falls smoothly and slowly with scale: each 10x of resources buys about the same fractional gain. That is the signature of a power law , a straight line of slope on log-log axes. Loss cannot fall below the entropy of the text, so the working form adds a floor, the irreducible loss :
In Henighan et al.'s reading, "the irreducible loss estimates the entropy of the true data distribution, while the reducible loss is an estimate of the KL divergence between the true and model distributions" [428]. Only the reducible loss is straight on log-log axes, so plot too, and treat the fitted floor as the least certain parameter.
The early evidence came fast. Hestness et al. found that the exponent "usually settles between and ", smallest for language models ( for a word model, reported), and that "Improved model architectures and optimizers can improve the power-law intercept, but not the exponent" [429]. Rosenfeld et al. proposed additive data and model terms over a floor [430]. Henighan et al. found the same form in images, video and math, with compute-optimal size growing as about in every domain [428].
Kaplan et al. trained models from 768 to 1.5B non-embedding parameters (token and position embeddings excluded) on WebText2, with "a 3000 step linear warmup followed by a cosine decay to zero" [25]. Compute is about FLOPs per token (Section 1.2), quoted in PF-days of FLOPs. Each law below holds when that one factor limits training, across "eight orders of magnitude" in compute [25]. The constants depend on the tokenizer, and none of these forms has a floor.
Table 6.1. Kaplan et al.'s single-variable laws (reported, their Table 5).
| Law | Exponent | Scale constant |
|---|---|---|
| parameters | ||
| tokens | ||
| PF-days |
Doubling non-embedding parameters multiplies by [25]. Halving the loss would take times more parameters (computed). Small exponents are why each generation needs orders of magnitude more compute for a steady gain, and why 0.01 in an exponent matters at frontier scale (Section 6.4).
Kaplan's compute-efficient frontier (their Table 6) put most new compute into size [25]:
where is compute adjusted to small-batch training. Ten times the compute buys 5.4 times the model and 1.9 times the tokens (computed: , ), while steps grow only as . Hence "Big models may be more important than big data" [25].2.
The sample efficiency of large models survived. The allocation rule did not (Sections 6.2 and 6.3), and Kaplan et al. warned that their frontier breaks near PF-days ( FLOPs, computed) and 1.7 nats per token, "though the numerical values are highly uncertain" [25]. That is where Gopher and Chinchilla were trained. Neither that 1.7 nor Chinchilla's is the entropy of English: datasets and tokenizers differ.
Why power laws at all? No theory yet predicts measured LLM exponents (as of November 2026). Leading accounts tie the exponent to the dimension of the data manifold [431] or to a long tail of skills learned in order of frequency [432]. Other theories, forms that bend or break, and data pruning that beats the law are in [433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 289, 445]. Three mistakes recur: fitting a pure power law to data with a floor, comparing exponents across different definitions of or , and assuming an exponent is universal when data changes it (Section 6.3).
6.2 Compute-optimal training: the Chinchilla analysis
Given a fixed FLOP budget, how should you split it between parameters and training tokens? At fixed , a bigger model sees fewer tokens. Too small cannot represent the data, too big stops undertrained, and in between is a minimum. Plot final loss against size for runs of equal compute, an IsoFLOP profile, and you see a valley.
Hoffmann et al. trained "over 400 language models ranging from 70 million to over 16 billion parameters on 5 to 500 billion tokens" [40], counting total parameters and full FLOPs (within a few percent of above 1B parameters, 1.10 times it at 305M, reported). They estimated and three ways [40]. Approach 1 trains each size with four cosine schedules of different lengths, then, at each of 1,500 compute values, takes the lowest loss any run reached there (every winner came from the last 15% of its schedule). Approach 2 trains many sizes at each of 9 budgets from to FLOPs, finds "a clear valley in loss", and fits a parabola in to locate each minimum. Approach 3 fits a parametric loss to every run:
with the loss of an ideal model and the other terms the shortfalls of finite size and finite data. Here and are fit constants, not a batch size or a KL coefficient. The fit minimizes a Huber loss (squared error for small residuals, absolute error for large ones, so outliers count less) on log losses, using L-BFGS, a quasi-Newton optimizer, with threshold , and as printed is [40]. The paper's TeX source carries more digits for three of the five constants, , and , while and are the same [446]. A 2024 refit (Section 6.3), this chapter's default, gives , , , , [446].
Table 6.2. Chinchilla's three estimates of the frontier exponents, with 10th to 90th bootstrap percentiles (reported, Hoffmann et al. Table 2).
| Approach | in | in |
|---|---|---|
| 1. Minimum over training curves | 0.50 (0.488, 0.502) | 0.50 (0.501, 0.512) |
| 2. IsoFLOP profiles | 0.49 (0.462, 0.534) | 0.51 (0.483, 0.529) |
| 3. Parametric loss | 0.46 (0.454, 0.455) | 0.54 (0.542, 0.543) |
| Kaplan et al. (2020) | 0.73 | 0.27 |
Hence the headline: "for every doubling of model size the number of training tokens should also be doubled" [40]. Figure 30 draws the valleys from the fitted law. Notice how flat each one is near the bottom, and how the line through the minima moves when you switch between printed, unrounded and refit constants. Drag the size off the optimum to see what it costs.
Method and sources
Grey dots mark each budget's minimum, the dashed line is the compute-optimal frontier, and the lower panel is the closed-form compute penalty for training ρ times the optimal size, derived in this guide. The stepper builds the picture in six steps, from one budget's valley to real models. Presets place Gopher (Rae et al. 2021), Chinchilla, Llama 3 8B and 405B (Grattafiori et al. 2024) and GPT-2 small in the llm.c reproduction (Karpathy 2024) at C = 6ND. The labeled 5.76 × 10²³ curve is Gopher's reported budget, while its marker uses 6ND = 5.04 × 10²³. Loss values are specific to Chinchilla's data and tokenizer.Deriving the frontier
Assume the law is exact, , data is seen once and hyperparameters are tuned everywhere. Substitute :
Setting gives , so
and . With error terms and , the optimum balances . The exponents set how the split changes with scale. The constants only set the ratio . Along the frontier with , 0.178 under the refit and 0.155 unrounded (computed), the range Pearce and Song report [43].
Where 20 tokens per parameter comes from
The paper never states it as a rule. Approach 1's projections (400M on 8.0B tokens up to 1T on 21.2T) imply 20.0 to 22.4 tokens per parameter, and Chinchilla's 70B on 1.4T is exactly 20, FLOPs (computed) [40]. Re-analyses call 20 the consensus [446, 447]. With , , so
91B on 1.83T at FLOPs (computed). The table compares the fits, ending at Llama 3 405B's budget.
Table 6.3. Compute-optimal parameters, tokens and tokens per parameter by fit (computed from the cited constants or tables).
| Fit | |||
|---|---|---|---|
| Approach 1, fitted here to Table 3 () | 89B, 1.87T (21) | 281B, 5.93T (21) | 547B, 11.6T (21) |
| Approach 2, fitted here to Table A3 | 83B, 2.01T (24) | 256B, 6.51T (25) | 493B, 12.9T (26) |
| Approach 3, printed constants | 41B, 4.04T (98) | 117B, 14.3T (122) | 214B, 29.7T (139) |
| Approach 3, unrounded constants | 52B, 3.21T (62) | 148B, 11.2T (76) | 273B, 23.2T (85) |
| Besiroglu et al. refit | 96B, 1.74T (18) | 312B, 5.34T (17) | 619B, 10.2T (17) |
| Kaplan Table 6 (non-embedding , read as ) | 1.20T, 250B (0.21) | 6.46T, 466B (0.07) | 17.1T, 668B (0.04) |
| 20:1 shorthand | 91B, 1.83T (20) | 289B, 5.77T (20) | 563B, 11.3T (20) |
Take 1,000 accelerators at 400 TFLOP/s sustained for 30 days (illustrative): FLOPs. The shorthand gives 93B parameters on 1.86T tokens, the Approach 1 fit 91B and 1.9T, the refit 98B and 1.77T, the unrounded Approach 3 53B and 3.3T (all computed). Pick 70–100B, knowing 2x either way costs about 16% of the compute (below). Time to train is in Section 1.3.
At Gopher's budget, Chinchilla outperformed Gopher, GPT-3 and Megatron-Turing NLG on a large range of tasks, MMLU 67.6% [40]. It also switched to AdamW and changed the tokenizer slightly, so this is not a pure allocation ablation. A cleaner test at FLOPs: Approach 1 said "a 2.86 billion parameter model should be optimal" against Kaplan's 4.68B, and a 2.80B model beat a 4.74B one (reported) [40].
The refit optimum at FLOPs is 73B on 1.34T tokens, so Chinchilla sits on the refit frontier. The law predicts 1.974 nats per token for Chinchilla and 1.999 for Gopher (computed, MassiveText nats, meaningful only inside this law). The law's 0.026-nat gap came with a 7.6-point MMLU gain, though optimizer and tokenizer changed too. Section 6.7 shows how small loss gaps can become large accuracy gaps.
Approach 3 predicted smaller models than the other two, which the authors blamed on curvature: "projections from very small models lead to different predictions than those from larger models" [40]. Most of the gap was a fitting bug (Section 6.3).
What a wrong size costs
Train at the same . Then and . The balance condition gives and for the reducible loss , so
The second ratio, the share of the budget a compute-optimal model would need for the same loss, follows from and does not depend on . Mis-sizing wastes the same share at every scale. The derivation is ours, checked against brute-force root finding (computed).
Under the refit, a model 2x too large has , and : about 16% of the compute wasted. At 4x the waste is 49%, at 10x 82%, and undersizing costs about the same (16% at 0.5x, 48% at 0.25x, all computed) [446, 40]. So Llama 3 could round its fitted 402B to 405B: "IsoFLOPs curves become flatter around the minimum as the compute budget increases" [6]. Gopher, 4.15 times the refit optimum for its budget, reached a loss that a compute-optimal model would reach with half the compute (computed).
Failure modes: the printed Approach 3 constants imply about 93 tokens per parameter at Chinchilla's budget (computed), so keep them out of frontier decisions. Compute-optimal ignores serving cost (Section 6.5) and assumes unique data (Section 6.6). The loss values are MassiveText nats and do not transfer.
You train a model 2x larger than compute-optimal at a fixed budget. Roughly what fraction of the compute did you waste, and does the answer depend on the budget?
About 16% under the Besiroglu et al. refit [446]. At the reducible loss grows by , and a compute-optimal model reaches that loss with of the compute, (computed). Both the frontier and the penalty are power laws in , so the fraction is the same at every budget. At 4x it is about 49%.
6.3 Why Kaplan and Chinchilla disagreed
Two careful studies disagreed on the most important number in LLM planning, 0.73 versus 0.5. What went wrong, and what does the answer teach about measurement? At Gopher's 6,667 PF-days, Kaplan's Table 6 asks for B non-embedding parameters on B tokens (computed) [25], 11 times Chinchilla. The two frontiers cross near FLOPs (computed, approximate), about where Kaplan measured, and diverge by an order of magnitude at frontier budgets. Four explanations followed.
Schedules. Kaplan used one long cosine, so checkpoints of long runs had not decayed, and Chinchilla found that overshooting the cosine "by more than 25%" hurts [40]. This proved minor. Porian et al. find that "careful learning rate decay is not essential for the validity of their scaling law", and Pearce and Song that training one model per size, without annealing, moves the fitted coefficient only marginally [27, 43]. Schedules are compared in Section 5.2.
Embeddings at small scale. Pearce and Song argue that "much of this discrepancy can be attributed to Kaplan counting non-embedding rather than total parameters, combined with their analysis being performed at small scale" [43]. Non-embedding parameters grow as , embeddings as , and their fit to Chinchilla's configurations is
so embeddings are half the model near parameters (computed). In , the optimal size is no longer a power law. Its local exponent has two limits,
0.76 and 0.51 under the refit, and overshoots both in between, to about 0.97 near parameters (computed). Over Kaplan's sizes their simulation gives "0.74 to 0.78 (close to Kaplan's 0.73)", and their own tiny models gave 0.49 with total counts and 0.74 with non-embedding counts [43].
Of GPT-2 small's 124.4M parameters, 38.6M (31%) are the token embedding, tied to the output head, and the head is 31% of forward matmul FLOPs (computed from the config) [19, 20]. A count misses about 31% of its compute. For Llama 3 the embedding plus head share is 13.1% (8B), 3.0% (70B) and 1.0% (405B) (all computed from configs) [6, 17]. Invisible at 405B, dominant where ladders are run.
Head FLOPs, warmup and tuning. Porian et al. reproduced Kaplan's exponent with 16 models from 5M to 901M parameters and "over 900 training runs", then removed one difference at a time, "identifying three factors causing the difference: last layer computational cost, warmup duration, and scale-dependent optimizer tuning" [27]. Figure 31 steps through the corrections. Watch the exponent fall and the range of compute-optimal tokens per parameter shrink to about 15. Its table view lists every interval and range (reported, Porian et al. Table 1).
Method and sources
Counting the head's FLOPs and shortening the warmup do most of the work, while matching the cosine decay moves a by only about 0.03. The strip chart below plots the range of compute-optimal tokens per parameter across Porian's budgets, which narrows from 8 to 1,536 to 14 to 16 on RefinedWeb as the corrections accumulate, so the ratio stops depending on compute. The side note at step 2 draws on Pearce and Song 2024, and the head shares for GPT-2 small and Llama 3 are computed from their published shapes.Leaving out the head under-counts compute "from roughly 10% at larger models to roughly 90% at smaller models", so small models look cheap and the slope tilts toward big ones. Kaplan's 3,000 warmup steps of tokens are 1.57B tokens (computed), so small models "are ‘forced’ to use more training tokens than would otherwise be optimal" [27]. A fixed batch leaves small models only a few hundred steps, and tuning per size closes the rest (Section 5.3). The final fit matches 0.5 within 0.6% and Chinchilla's size within 15% [27]. Porian et al. released the 900+ runs and code. Kaplan's study was careful for 2020, and its accounting choices only matter at small scale, which is where ladders run.
Data quality. DeepSeek LLM got = 0.450 on its early data, 0.524 on its current data and 0.578 on OpenWebText2, Kaplan's own dataset (reported): "The higher the data quality, the more the increased compute budget should be allocated to model scaling" [42]. That spread is smaller than the 0.23 gap, and with DeepSeek's accounting Kaplan's own data gives 0.58, not 0.73. DeepSeek also replaced , off by up to 50% at small scale, with non-embedding FLOPs per token (the paper's ), and fit , [42], coefficients whose product is 1.0001 (computed).
So Kaplan's 0.73 was mostly an artifact of small-scale accounting (embeddings and head, which Kaplan tied) and of a warmup and batch that handicapped small models. Decay is minor, and data quality moves the exponent by a few hundredths. Count total parameters and all FLOPs, tune per scale, and fit a floor.
Besiroglu et al. note that the published parametric fit implies about 70 tokens per parameter, against 20 from the other approaches and the 20 Chinchilla itself used [446] (by our arithmetic at Chinchilla's budget, 93 with the printed constants and 59 with the unrounded ones). They reconstructed 240 points from Chinchilla's Figure 4 and found that the published fit "fails to fit the data well" (rounding to 0.28 alone biases the data term 13% at tokens). The cause: "they averaged the Huber loss values over different data points instead of summing them", which stopped L-BFGS early. The bootstrap collapsed too. An interval of 0.454 to 0.455 "would require over 600,000 experiments, while they likely only ran fewer than 500". The refit gives (standard error 0.018) and "around 20 tokens per parameter", with 4 to 40 plausible at FLOPs [446]. Parameter-count ambiguity of up to 15.2% does not change this [447]. Lessons: publish data and code, report unrounded constants, and check intervals against the number of runs.
Under the refit, tokens per parameter falls slowly with scale (18.4 at , 16.1 at ) because . Under the unrounded constants it rises (59 at , 93 at , computed). The sign of decides, and the data cannot reliably tell from 0.51 (Section 6.4).
In Porian et al.'s reproduction of Kaplan, which single change moved the fitted exponent the most, and why does leaving it out push the exponent up?
Counting the output layer's FLOPs: 0.835 to 0.706 on RefinedWeb [27]. Without it, small models' compute is under-counted the most, so the best small-budget runs look cheaper than they are and the fitted frontier grows model size too fast with compute.
6.4 How to fit a scaling law you can trust
You have budget for a ladder of small runs and must choose the size of a big one. How do you design the ladder, fit the law, and know how far to trust the extrapolation? Section 6.3 showed that a few setup choices moved the exponent from Kaplan's 0.73 to about 0.5 [25, 27], so most of the work is keeping the small runs honest. Table 6.4 lists the procedure in seven steps. Four carry most of the risk.
Table 6.4. Fitting a scaling law in seven steps, with the pitfall each step prevents.
| Step | Do this | Evidence | Pitfall it prevents |
|---|---|---|---|
| 1. Target | Held-out loss in nats per token, or bits per byte across tokenizers | DeepSeek LLM reports bits per byte [42] | Comparing losses under different tokenizers |
| 2. Counting | Total parameters with the head, all FLOPs (Section 1.1, Section 1.2) | errs by up to 50% for small models [42]. The head is about 10% of compute for large models and 90% for the smallest [27] | Exponent too high (0.7 to 0.85) [43, 27] |
| 3. Ladder | Two to three decades of compute, sizes on both sides of each minimum, several per budget, one shape band, tuning per size, short warmup | Chinchilla: 9 budgets, to [40]. Llama 3: to , 40M to 16B [6]. DeepSeek LLM: 8 budgets, to [42]. Porian et al.: 7 sizes from 1 to 100 tokens per parameter [27] | Ill-conditioned fit, shape effects, small models pushed past their optimum [448, 449, 25] |
| 4. Points | Final losses, or checkpoints after the first 10B tokens | Error of 4-10% instead of over 15% for some families. Seed noise up to 4%. Built on 485 models [450] | Biased loss curves, one noisy model |
| 5. Fit | IsoFLOP parabolas and the parametric fit, compared | 28 of 51 surveyed papers describe their fit, 19 release code [451] | Early stop, a wrong local optimum [446] |
| 6. Uncertainty | Bootstrap over runs, percentiles of at the target | Standard error 0.018 on [446]. Naive baseline: 18% error [450] | False confidence [452] |
| 7. Extrapolation | Three or more significant digits, a held-out larger run | Chinchilla validated at FLOPs [40] | Rounded constants off by 1.3 times or more [446, 6] |
Design the ladder off the diagonal. If every run sits on one ray , the and terms of the law cannot be told apart, and designs off that ray win 97.3% of held-out comparisons [448]. Cerebras-GPT's family, all near 20 tokens per parameter, is a fine set of models and a weak dataset for fitting five constants [377]. A constant learning rate with short cooldowns branched from checkpoints "saves half the time and FLOPs": Chinchilla's suite would cost FLOPs instead of (reported estimate) [353, 354].
Fit two ways. The IsoFLOP route fits a parabola in at each budget, then a power law through the minima [40, 6, 27]. The parametric route fits all five constants with Chinchilla's objective [40]:
Here , , and , so , and are log-constants, not the frontier exponents. The log-sum-exp keeps the constants positive, and the small Huber threshold makes this nearly an absolute-error fit that resists outliers. Sum the terms, since averaging them stopped Chinchilla's L-BFGS early (Section 6.3) [446]. Start from a grid of initial values and check convergence. Even the training optimizer changes the exponents [453]. If the two routes agree, the functional form is probably adequate.
Put error bars on the decision. Bootstrap over runs, not over correlated checkpoints of one run, and refit each resample to convergence. Besiroglu et al.'s bootstrap makes their "80% confidence interval is roughly 50-fold wider than that reported by Hoffmann et al." [446]. Many near-equal fits extrapolate differently, because "standard scaling law fitting is subject to a Rashomon effect" [452].
Extrapolate with care. Chinchilla's own small and large models gave different projections (Section 6.2) [40]. The exponent is the dangerous number. With and the fit pivoting at a budget where its error is zero,
A real fit pivots near the middle of its ladder. For Llama 3, , so an exponent error of 0.005 moves the prediction at by times (computed). Keep a printed prefactor while rounding the exponent, and the pivot is FLOP: the lever is and the same 0.005 is worth 1.34 times (computed). Llama 3 extrapolated times past its largest budget (computed).
Llama 3 fit compute-optimal tokens as (the paper writes ), and extrapolation to FLOPs "suggests training a 402B parameter model on 16.55T tokens" [6]. From the printed constants, : 10.5T tokens and B parameters (computed). Reproducing 16.55T needs an exponent of 0.538, and the missing 0.0078 times is a factor of (computed). The published pair is rounded too: , 5% over budget (computed). A lesson about precision, not an error claim: Meta presumably used unrounded constants.
Take five budgets, , , , and FLOPs, with six sizes each, 0.25 to 4 times the 20:1 optimum : about 7M to 1.2B parameters and FLOPs in all (illustrative plan). One 8-GPU H100 node at an assumed 40% MFU of the 989.5 TFLOP/s dense BF16 peak [4] delivers FLOP/s, so the ladder takes about 7.6 hours and its largest run 53 minutes (computed). GPT-2 small on 10B tokens ( FLOPs) reproduces in about 90 minutes on 8 A100s (reported) [15].
In our simulation (computed), 90 synthetic runs (9 budgets by 10 sizes) drawn from the refit law with noise of 0.005 in log loss, fitted by L-BFGS from one starting point, landed at and 0.79 (summed and averaged objectives) against the true 0.513, and both reported success. Use grids of starts, summed objectives, convergence checks and bootstraps every time.
Newer tools choose which ladder runs to train [454] and refine the functional form [455]. As of November 2026 they are promising, not standard.
6.5 Beyond compute-optimal: overtraining and inference-aware sizing
If a model will serve billions of requests, how big should it be and how long should you train it? Smaller and longer than Chinchilla says. Training costs about FLOPs once. Serving costs about FLOPs per token for the model's whole life (Section 1.6). A smaller model is cheaper on every served token but needs more training tokens to reach the same loss. Past some serving volume, the savings repay the extra training. Chinchilla counts only the first term.
The inference-aware objective
Sardana et al. fix a target loss and minimize lifetime compute, with the tokens served [70]:
The constraint gives the training tokens for each size:
The search is over alone. A model of 30B-Chinchilla quality that will serve tokens should be a 13.6B model on 2.84 times the data, saving 28% of lifetime FLOPs (reported). With Sardana et al.'s constants (, , , and , , which they take from De Vries to fit Hoffmann et al.'s Table A3 better than the rounded 0.34 and 0.28) our reproduction matches [70]. Chinchilla's unrounded constants give 13.9B, 2.74 times and 26.5%, the Besiroglu refit 11.6B, 4.25 times and 43% (computed) [40, 446]. The direction is robust. The size depends on the constants, so name them. Dollar results shift further, since serving utilization can be about 1% against 40–60% in training [70], but we could not reproduce the paper's dollar figures, so we do not use them.
Figure 32 runs the optimization live. Raise the serving volume and the filled marker (lifetime optimum) slides left of the hollow one (compute-optimal model of equal quality). The "Llama 3 8B-like" preset, 30B quality and served tokens, lands on 7.75B parameters and 16.2T tokens, about 2,090 per parameter (computed, Sardana et al.'s constants).
Method and sources
The calculator minimizes 6N times training tokens plus 2N times served tokens at a fixed loss under the Chinchilla parametric law, following the inference-aware objective of Sardana et al. (2023), with their constants by default, the unrounded Approach 3 constants of Hoffmann et al. (2022) or the refit by Besiroglu et al. (2024). The filled marker is the lifetime-optimal size and the hollow marker the compute-optimal model of the same quality. With the default constants the presets reproduce the paper's examples: 13.6B on 2.84x the data with 28% saved, 7.0B with 17% saved and 6.0B on 1.18x the data (computed), and the Llama 3 8B-like case gives 7.75B on 16.2T tokens, next to Llama 3 8B's 8.03B parameters on about 15T tokens (Grattafiori et al. 2024).Overtraining is predictable
Quality keeps improving far out: "model quality continues to improve as we scale tokens per parameter to extreme ranges (up to 10,000)", but constants fitted near 20:1 "overestimate the impact of additional training data" there, and a refit on all runs drops and from 0.34 and 0.28 to 0.18 and 0.24 [70]. Gadre et al. predicted the loss of a 1.4B model on 900B tokens, 32 times overtrained, within 0.7% from runs using 300 times less compute (reported), though "Scaling can break down when under-training." [456] Their trick: assume and substitute and :
Here and . At fixed tokens per parameter, reducible loss is a straight line in with slope , and changing shifts the line without tilting it, which is why small overtrained runs predict large ones. The bracket is smallest at . Write , with the overtraining factor, and the bracket becomes , so the compute needed for the compute-optimal loss grows by (derived here)
With an illustrative , the multiplier is 1.04 at , 1.48 at 10, 2.3 at 30 and 4.4 at 100 (computed). Name the axis. At fixed compute , with the size factor of Section 6.2, so a model 2 times too small has and needs times the compute, about 13% wasted, close to Section 6.2's 16% (computed).
What real models do
Pre-Chinchilla models sat at 1 to 2 tokens per parameter, Chinchilla moved the field to about 20, and served models now sit at hundreds to thousands (Table 6.5): "Llama 3 8B is overtrained by close to 100x, while Llama 3 70B is only overtrained by 10x" [457].
Table 6.5. Tokens per parameter of published models (ratios and compute computed from reported parameters and tokens).
| Model (year) | Parameters | Tokens | (FLOPs) | Tokens per parameter | Multiple of 20:1 | Source |
|---|---|---|---|---|---|---|
| GPT-2 small, llm.c (2024) | 124M | 10B | 80 | 4 | [15] | |
| GPT-3 175B (2020) | 175B | 300B | 1.7 | 0.09 | [40, 36] | |
| Gopher (2021) | 280B | 300B | 1.1 | 0.05 | [40, 182] | |
| Chinchilla (2022) | 70B | 1.4T | 20 | 1 | [40] | |
| LLaMA 7B (2023) | 6.7B | 1.0T | 149 | 7.5 | [46] | |
| Llama 2 7B (2023) | 7B | 2.0T | 286 | 14 | [229] | |
| Llama 3 8B (2024) | 8.03B | about 15T (corpus) | about 1,870 | about 93 | [6] | |
| Llama 3 70B (2024) | 70.6B | about 15T (corpus) | about 213 | about 11 | [6] | |
| Llama 3 405B (2024) | 405B | 15.6T | 38.5 | 1.9 | [6] | |
| Gemma 2 9B (2024) | 9.24B | 8T | 866 | 43 | [268] | |
| OLMo 2 7B (2024) | 7.30B | 4.05T | 555 | 28 | [7] | |
| SmolLM2 1.7B (2025) | 1.7B | 11T | about 6,470 | about 324 | [197] | |
| Qwen3 8B (2025) | 8B | about 36T (corpus) | about 4,500 | about 225 | [198] | |
| DeepSeek-V3 (2024) | 671B total, 37B active | 14.8T | (active) | 22 total, 400 active | 1.1 / 20 | [2] |
Figure 33 puts these models against the compute-optimal lines of Kaplan, Chinchilla and the Besiroglu refit. Nearly every served model sits in the overtrained region above the Chinchilla line, while the flagships (Chinchilla, Llama 3 405B, DeepSeek-V3 per total parameter) hug it. For a mixture of experts, tokens per active parameter is the ratio that compares with dense compute.
Method and sources
Points are 39 models placed at C = 6ND, with ratios computed from their reported or computed parameters and tokens: Llama 3 from Grattafiori et al. 2024, DeepSeek-V3 from DeepSeek-AI 2024 plotted per activated and per total parameter at the same compute, GPT-2 small from Karpathy's 2024 llm.c reproduction, GPT-3, Gopher and MT-NLG from Hoffmann et al. 2022, and the rest from their technical reports. Hollow points with arrows are upper bounds, because Qwen2.5 and Llama 3.2 report only a corpus maximum. Points above the Chinchilla lines are overtrained relative to compute-optimal, a deliberate trade for cheaper serving.With B and T, FLOPs (computed) [6]. The compute-optimal model with the same predicted loss is 29.6B on 1.65T tokens ( FLOPs) under Chinchilla's unrounded constants, or 33.9B on 0.65T () under the refit. So the 8B spent 2.5 to 5.5 times the training compute its loss strictly needed (computed) [40, 446]. The cosh shortcut with the illustrative and (against 20:1) gives 4.2, inside that range. Serving the 8B instead of the 29.6B saves FLOPs per token, so the extra training pays back after
(9.99T, or 11.4T under the refit, computed), about its own training set. The 70B comes out at 1.1 to 1.7 times and the 405B at 1.05 to 1.07 (computed). Orders of magnitude only, since Chinchilla-form fits overstate the gain from data at such ratios [70].
Meta fit IsoFLOP curves from to FLOPs, saw them flatten with budget (Section 6.2), and trained a 405B flagship near its fitted optimum. It trained the 8B and 70B far past compute-optimal on purpose (the chapter opening), because "The resulting models perform better than compute-optimal models at the same inference budget." [6] Inference-aware sizing, done in public.
Consequences and defaults
At fixed compute , so overtraining by needs times more tokens (derived) [457], which brings the data wall closer (Section 6.6). Overtrained models lose more to post-training quantization [458], and same-size models differ by up to 3.5 times in latency with shape [459]. To do it yourself, pick the deployment tier, forecast lifetime traffic, then train as long as data and budget allow, keeping a flagship near compute-optimal [70, 456]. The classic mistake is forecasting a 2,000:1 run with constants fitted near 20:1.
6.6 Repeated data, mixture of experts, precision, vocabulary and hyperparameters
What do scaling laws say when unique data runs short, when the model is sparse, when you train in fewer bits, when the vocabulary grows, and when you must pick a learning rate for a run you cannot sweep? Each extension adds one axis to the Chinchilla law, and each conclusion can be an artifact of what it held fixed. Table 6.7 collects them.
Repeated data and the data wall
What repeated data is worth is derived in Section 3.6. The headline is that up to 4 epochs of repeated data cost almost nothing against unique data [209], while a 2026 law with an overfitting term finds that "Beyond a point, further repetition is counterproductive" [460]. Villalobos et al. estimate about 510T tokens on the indexed web and expect training sets to match the public human text stock "between 2026 and 2032, or slightly earlier if models are overtrained" (median 2028) [457]. Section 6.9 returns to that limit.
Mixture of experts
Mixture-of-experts (MoE) laws flip with what they hold fixed (architecture in Section 4.7).
Clark et al. trained every routed model on 130B tokens and found routing gains vanish beyond a cutoff (937B parameters for their best router), "only valid at the specific token count all models were trained at: 130B" [461]. Krajewski et al. optimized training length and found "the efficiency gap between dense and MoE models widens as we scale up the model size and training budget". At a fixed token count, they explain, the largest models are badly undertrained, and there dense models win. FFN-sized experts were "not optimal at almost any computational budget" [318], hence DeepSeekMoE's fine-grained experts [317].
At fixed compute "the optimal sparsity level increases with model size", though sparser models reason worse at equal perplexity [312]. More experts favor fewer active parameters and more tokens, and that study's dense optimum at FLOPs is 4.7 tokens per parameter (computed), so 20:1 is not universal [462]. Other laws cover expert counts and sparse networks [463, 464, 465]. DeepSeek-V3's FLOPs is 11.6 times less than Llama 3 405B's (computed) [2], before routing traffic (Section 13.6).
Precision
Kumar et al. fit over 465 runs and treat low-precision training as a smaller effective parameter count [458]:
with the bits for weights, activations and KV cache and each fitted. They report an optimal training precision of about 7–8 bits for integers at every budget (reported). With the published constants, 4 bits everywhere leaves (computed), in line with their warning that "the race to low-precision training may have to stop before going below 4-bits" [458]. Fitted constants alone move the optimum by about two bits (computed).3. Without offsets and with one tied constant , maximizing with gives , so and bits for (computed). Serving adds a twist: "the degradation introduced by post-training quantization increases as models are trained on more data, eventually making additional pretraining data actively harmful" [458]. A floating-point law puts the best precision at 4–8 bits [466], other laws cover quantization-aware training and low-bit inference [467, 468, 469], and DeepSeek-V3 trained in FP8 [2] (mechanics in Section 2.3, Section 5.6 and Section 13.8).
Vocabulary
Vocabulary parameters should grow more slowly than the rest, and Tao et al. predict that Llama 2 70B should have had a vocabulary of at least 216K, 7 times its 32K [249]. Downstream evidence is thin: ARC-Challenge rose from 29.1 to 32.0, about two of the reported standard deviations (1.3 to 1.4 points), on one task [249, 251]. Tokenizers are in Section 3.8.
Learning rate and batch size
Nobody sweeps a -FLOP run, so labs fit hyperparameter laws on small ones. DeepSeek LLM fit them in compute , with the non-embedding FLOPs per token, and found a broad basin [42]:
For the 7B, and , so the laws give and M tokens against and 9.4M used. The 67B: and 20.6M against and 18.9M (computed) [42]. A self-consistency check.
Step Law, fit on over 3,700 models and 100T tokens, sets the batch from alone [362]. Bjorck et al. find that at fixed batch "the optimal LR decreases as the token horizon gets longer", as , so a 10 times longer run wants 0.48 times the learning rate (computed) [394]. The critical batch size is derived in Section 5.3. It "scales primarily with data size rather than model size" [361, 360], and Zhang et al.'s fit for a 302M model, , extrapolates to tens of millions of tokens at 15T (computed, far outside the fitted range) [361, 341] against Llama 3 405B's final 16M [6].
Table 6.6. Three hyperparameter laws applied to Llama 3 (computed), against what Meta used.
| Law | Llama 3 8B learning rate | Llama 3 405B learning rate | 405B batch (tokens) |
|---|---|---|---|
| Used by Meta [6] | 16M (final) | ||
| DeepSeek LLM (, sequence 8,192) [42] | 70M | ||
| Step Law ( non-embedding) [362] | 20M | ||
| Bjorck et al. (fixed batch) [394] | n/a |
The laws disagree by about 40 times on the 8B (Table 6.6) because each depends on what its sweep held fixed. Bjorck fixes the batch, so a longer run means more steps at the same noise. Step Law grows the batch as , which under Adam's square-root rule (Section 5.3) raises the learning rate as , close to its (our interpretation) [362, 386, 286]. Fit your own at three or more scales, scale the batch with data, and cut the learning rate roughly as when you lengthen a run at fixed batch.
Schedules and distillation
Cosine, WSD and constant-with-cooldown schedules are compared in Section 5.2. Tissue et al.'s annealing law is derived in Section 7.1. Schedules shift every constant: with warmup-stable-decay, MiniCPM found "the data size should be 192 times larger than the model size on average, as opposed to 20 times in Hoffmann et al. (2022)" [354]. The cost and scaling law of distillation are in Section 7.7, which explains Gemma 2's small models trained on over 50 times their compute-optimal tokens [268]. Parallel inference has a proposed law too [470].
Table 6.7. What each extension of the scaling law holds fixed.
| Axis | Law and headline | Holds fixed or assumes | Main caveat | Source |
|---|---|---|---|---|
| Repeated data | Effective data saturates at times the unique data, (Section 3.6): 4 epochs about as good as fresh | Additive Chinchilla form, no overfitting term | Heavy repetition can raise loss | [209, 460] |
| Data stock | About 510T tokens, exhaustion median 2028 | Current growth trends | Synthetic and multimodal data | [457] |
| Mixture of experts | Gap over dense widens with scale, finer experts | Training length optimized | Routing and communication not in FLOPs | [318, 461] |
| Precision | shrinks with bits, 7-8 bits optimal | Integer formats, models up to 1.7B | Fitted constants set the answer | [458] |
| Vocabulary | Vocabulary parameters grow as the 0.83 power, Llama 2 70B at least 216K | Normalized loss | Small downstream gains | [249] |
| Learning rate, batch | Three laws, 40 times apart on one model | Batch fixed or coupled, one schedule | Conditional on the sweep | [42, 362, 394] |
| Schedule | Loss curve from learning-rate areas, 10-20% anneal | One optimizer and dataset | Constants shift with recipe | [359, 353] |
| Distillation | Helps below a compute threshold | Teacher cost amortized | Too strong a teacher hurts | [471] |
Three published laws give Llama 3 8B learning rates of about , and . Which one is right?
None in general. Each is conditional on what its sweep held fixed. At a fixed batch size a longer run means more steps at the same gradient noise, which wants a smaller learning rate. A law that grows the batch with data allows a larger one. A law in compute alone ignores the split between and . Schedule and parameterization shift all three, so fit your own.
6.7 From loss to capabilities: downstream prediction and emergence
Loss falls smoothly, but nobody ships a loss. Can you predict a benchmark score before training, and do some abilities appear suddenly? Often yes, with wide error bars, and many claimed jumps trace back to the metric. Loss averages billions of tokens, so it moves smoothly. A benchmark is a few thousand thresholded pass/fail events, which turn a smooth input into a noisy S-curve. So every working method predicts a smooth intermediate, then maps it to the score with a bounded link.
Two-step forecasts
OpenAI predicted GPT-4's final loss from models trained with "at most 10,000x less compute", and its HumanEval mean log pass rate, a loss-like quantity, from models with at most 1,000x less. It held on five of six difficulty buckets [472]. Llama 3 made the two steps explicit: fit the negative log-likelihood of the correct answer against compute on the scaling-law ladder, then fit a sigmoid from log-likelihood to accuracy, with Llama 2 models supplying points high on the curve [6]. On ARC-Challenge the forecast came in slightly low, with no error number given [6]. From the largest ladder budget, FLOPs, to the flagship's is decades (computed).
The OLMo 2 ladder publishes the recipe and a scorecard. Bhagia et al. train four sizes (190M to 1.3B non-embedding parameters), each on 1, 2, 5 and 10 times 20 tokens per parameter: 16 runs at about 1% of the targets' compute. Task loss is bits per byte of the correct answer. Step 1 fits a Chinchilla-form law per task on , because "FLOPs cannot distinguish between compute-optimal and overtrained models." Step 2 fits, on about 1,400 checkpoints [473],
where is chance, the ceiling, the midpoint and (negative once fitted) the steepness. Table 6.8 shows the scorecard.
Table 6.8. A ladder at about 1% of the compute forecast OLMo 2 within about 2 points on MMLU and HellaSwag, and 10 to 11 points low on ARC-Challenge (reported, accuracy in %, targets after stage 1 pretraining).
| Task | 7B-4T predicted | 7B-4T actual | 13B-5T predicted | 13B-5T actual |
|---|---|---|---|---|
| MMLU | 48.4 | 49.0 | 51.3 | 51.6 |
| HellaSwag | 82.5 | 81.3 | 85.3 | 83.2 |
| ARC-Easy | 76.6 | 84.6 | 77.2 | 87.2 |
| ARC-Challenge | 51.5 | 61.9 | 52.7 | 63.8 |
Tasks with the largest misses also varied most across ladder checkpoints, a free warning sign [473]. Report forecasts per task, with error bars.
Take the illustrative link . At bit per byte, accuracy is 62.5% and the slope is per unit of loss. A step-1 error of 0.02 bits per byte moves the forecast to 58.0% or 67.0% (computed): a 2% loss error becomes a 4.5-point accuracy error.
Aggregates are easier than single tasks. Gadre et al. predict the average error over 17 tasks within 1 point for a 6.9B model from runs costing 20x less, but "individual downstream task predictions are significantly more noisy" [456]. Revisiting 46 tasks, Lourie et al. find only 18 (39%) improve smoothly and predictably [474], and multiple-choice accuracy is hard to forecast because it compares the correct choice "against a small number of specific incorrect choices" [475].
Emergence
Wei et al. call an ability emergent "if it is not present in smaller models but is present in larger models." GPT-3's few-shot scores on several tasks jumped from chance at about training FLOPs. On six such BIG-Bench tasks, LaMDA's cross-entropy kept improving at small scale while exact match stayed flat [476]. Schaeffer et al. argue that "nonlinear or discontinuous metrics produce apparent emergent abilities", and that over 92% of claimed BIG-Bench emergent abilities appear under multiple-choice grade or exact string match [477]. Their toy model shows why. Let per-token cross-entropy fall as , so the right token has probability . With independent tokens, exact match on an -token answer is
With illustrative and , going from to parameters lifts per-token accuracy from 0.73 to 0.98 and 10-token exact match from 0.04 to 0.84 (computed). Figure 34 lets you change the answer length and switch the y-axis to a log scale. The jump on the linear axis vanishes on the log axis. The shaded band marks scores below , which test items cannot resolve.
Method and sources
The curves come from the toy model of Schaeffer et al. 2023 with illustrative constants: per-token cross-entropy falls as a power law in parameters, per-token accuracy is its exponential, and exact match raises that accuracy to the power of the answer length, assuming independent tokens. Exact match stays near zero and then rises steeply, fastest where it equals 1/e, and that point moves to larger models as answers get longer. On a log y-axis the exact-match curve is smooth too. The marked sizes of GPT-2 small and Llama 3 8B, 70B and 405B (Radford et al. 2019, Grattafiori et al. 2024, computed from the released configurations) only give a sense of scale and are not measured scores.Not every jump is the metric. Plotting against pretraining loss, Du et al. find models "perform at the random level until the pre-training loss decreases to about 2.2", a break that survives continuous metrics [478]. If at fixed data, a threshold is crossed at
where the floor now includes the data term. With the printed Chinchilla law [40] and an illustrative threshold of 2.0 nats, that is about 13B parameters at 1.4T tokens but 3.7B at 15T (computed). More data moves "emergence" to smaller models. (Du et al.'s 2.2 belongs to their corpus and tokenizer, so never compare it with another loss.)
Say "a sharp rise in metric M on task T as a function of x", naming all three. Then name the cause: metric nonlinearity, too few test items, a real loss threshold, competition with specific wrong answers, or data and format rather than scale. Before calling a jump unpredictable, plot the log-probability of the correct answer against compute. For your own forecasts, predict bits per byte, fit on , anchor the sigmoid with stronger models and give single tasks error bars of 10 points (Section 10.4).
A model's per-token accuracy rises from 0.95 to 0.97 on a task whose answers are 20 tokens long. What happens to exact match, and is this emergence?
With independent tokens, exact match goes from to (computed), up by half from a 2-point per-token change. That is metric nonlinearity, not a new ability. The log-probability of the full answer, , moves smoothly from to .
6.8 Scaling test-time compute and RL compute
Once a model is trained, how does performance scale with compute spent per problem, and how does it scale with reinforcement-learning compute? Test-time compute has two axes: parallel (sample many answers, pick one) and sequential (think longer). Sampling follows a power law set by problem difficulty. RL reward follows a sigmoid because rewards are bounded.
Repeated sampling and the heavy tail
Coverage is the fraction of problems solved by at least one of samples, which is pass@k under a perfect verifier. On SWE-bench Lite, DeepSeek-Coder-V2-Instruct's coverage "increases from 15.9% with one sample to 56% with 250 samples", and Brown et al. model coverage as an exponentiated power law, [479]. The unbiased pass@k estimator is derived in Section 10.3.
Why a power law? One problem with per-sample success probability has , which saturates exponentially. If every problem had , pass@250 would be , not 56% (computed), so many problems must have near zero. Let have density across problems. For large only problems with still fail, and if near zero,
The exponent is the shape of the hard tail: "per-problem exponential scaling can be made consistent with aggregate polynomial scaling if the distribution of single-attempt success probabilities is heavy tailed" [480]. For it is exact:
With , coverage is 0.09, 0.37, 0.67, 0.83 and 0.92 at , and the log-log slope of at large is (computed). The tail can be missing. On Best-of-N jailbreaking prompts, Llama 3 8B Instruct has no heavy tail of near-zero success rates and so no aggregate power law, although its success on each prompt still rises exponentially with attempts [480]. The "A pool of tasks" mode of Figure 53 (Section 10.3) plots coverage up to beside Brown et al.'s points. The slow climb after is the tail.
Coverage is only an upper bound. On MATH with Llama 3 8B Instruct, coverage rose from 82.9% at 100 samples to 98.44% at 10,000, but majority voting or reward-model selection went only from 40.50% to 41.41% [479]. Voting accuracy converges to a limit set by the model's output distribution [481]. The verifier sets what you realize (Section 14.6).
Test-time compute against a bigger model
Snell et al. find that choosing the test-time strategy per question by its estimated difficulty (best-of-N, beam search against a verifier, or sequential revisions) matches best-of-N with up to 4x less test-time compute [71]. They also ask when a small model with extra test-time compute beats one times larger. Pretraining costs FLOPs and serving , both times more for the larger model, so the small model can multiply its inference compute by before total spend matches: , so
Empirically, test-time compute wins on easy questions or at low inference load, and the larger model wins on hard questions or at high load [71]. This is Section 6.5's inference-aware argument from the other side. The per token in that formula undercounts long traces: by Brown et al.'s per-token formula [479], attention is 12% of Llama 3 8B's FLOPs at 4K context and 81% at 128K (computed).
Snell et al. compare against a model about 14x larger at inference-to-pretraining token ratios of 0.16, 0.79 and 22 [71]. At 0.79, : the small model may spend 63x its normal inference compute before it costs as much as training and serving the big one. At 0.16, . At 22, (computed). A sampling study is cheap by comparison: 10,000 samples of 500 tokens on 5,000 problems is about FLOPs for Llama 3 8B, under 0.1% of its pretraining (computed, illustrative).
Thinking longer, and RL compute
DeepSeek-R1-Zero's AIME 2024 pass@1 rose from 15.6% to 77.9% during RL, and its thinking time grew without any external push [3]. s1 extends thinking by appending "Wait", with gains that flatten at about six extensions [482]. GRPO is derived in Section 9.3.
RL compute is still small next to pretraining. R1-Zero's RL used about 101K H800 GPU-hours [3], or of DeepSeek-V3's pretraining GPU-hours (computed) [2]. ScaleRL, a study of more than 400,000 GPU-hours, fits held-out reward against RL compute (GPU-hours) with a sigmoid [483]:
is the starting reward, the ceiling (the paper's ), the steepness (the paper's ), and the compute at half the gain. The useful finding is a split between knobs: "loss aggregation, normalization, curriculum, and off-policy algorithm primarily modulate compute efficiency without materially shifting the asymptote", while batch size, generation length, model size and FP32 precision at the LM head (0.52 to 0.61) move the ceiling. Repeat runs put of noise on the ceiling [483].
Table 6.9. Bigger batches and longer generations buy a higher ceiling with a later midpoint: they lose at small budgets and win at large ones (fits reported from ScaleRL's Table 1 in GB200 GPU-hours, fraction of the gain computed as ). The Scout run stopped at 50k GPU-hours (fit to 16k), so its 100k column is an extrapolation.
| Run | (GPU-h) | Gain at 1k | Gain at 10k | Gain at 100k | ||
|---|---|---|---|---|---|---|
| ScaleRL, 8B dense | 2,542 | 1.92 | 0.610 | 14% | 93% | 100% |
| 32K generation length | 11,272 | 1.89 | 0.645 | 1% | 44% | 98% |
| Batch of 2,048 prompts | 10,909 | 1.70 | 0.645 | 2% | 46% | 98% |
| Scout MoE (17B x 16) | 4,242 | 1.65 | 0.710 | 8% | 80% | 100% |
On a 100,000 GPU-hour run of an 8B dense model, a power law fitted between 1,500 and 50,000 GPU-hours "predicts an asymptotic performance of , which is clearly incorrect - the actual curve saturates near " [483]. The sigmoid predicted 0.645 (reported) [483]. Choose a form that respects the metric's bounds, and check how the fitted ceiling moves with the fit window.
Base models overtake RL-trained models on pass@k as grows [484], yet prolonged RL widens pass@128 where the base model starts weak [485]. Whether RL expands the reasoning boundary is argued in Section 9.7.
RL recipe A reaches a higher reward than recipe B at 3k GPU-hours. Should you pick A for a 100k GPU-hour run?
Not on that evidence. Fit the sigmoid to both and compare ceilings and midpoints. In Table 6.9 the batch of 2,048 prompts has only 2% of its gain at 1k GPU-hours but 98% at 100k, with a ceiling of 0.645 against 0.610: it loses early and wins late. Ceiling differences under about 0.02 are run-to-run noise [483].
6.9 Trend lines and limits
What has actually been scaling, how fast, and what could stop it by 2030? The growth of frontier training compute is charted in Section 1.8: about 4–5x per year (Epoch AI, to May 2024) [101], or 5.5x in this guide's fit to the November 2026 data. The compute needed for a fixed language-model performance halved about every 8 months (95% CI 5 to 14) [102]. A halving time of months is a yearly factor of , or 2.83x for 8 months. Multiplied by 4–5x per year of physical compute, effective compute grows about 11–14x per year, 7x to 21x across the interval at 4x (computed, assuming independence).
For capability, METR's time horizons are in Section 10.7: a 207-day doubling (reported) and 187.8 days on the September 2026 data (computed). The 50% horizon is the human task length that an agent completes half the time [486].
From o3's 110 minutes [486] to one work-month (167 hours) is doublings: years at 207 days, or 2.3 years at the 131-day post-2023 doubling of METR's 2026 suite (computed) [487]. METR's own 80% interval "spans from mid-2028 to mid-2030" [486]. The answer moves by more than a year with the fit window.
What could stop it? Epoch's August 2024 analysis finds "2e29 FLOP training runs will likely be feasible by 2030", and the constraint "likely to bind first is power, followed by the capacity to manufacture enough chips" [103] (Table 6.10).
Table 6.10. Power binds first, near the on-trend run of about FLOPs (Epoch AI, August 2024, reported).
| Constraint | Largest run it allows by 2030 (FLOPs) |
|---|---|
| Power, one campus of 1 to 5 GW | to |
| Power, distributed over 2 to 45 GW | to |
| Chip manufacturing (about 100M H100-equivalents) | (median) |
| Data, including multimodal and synthetic | to |
| Latency wall | to |
Llama 3.1 405B's cluster needed about 27 MW. An on-trend run is about 5,000x the compute at 24x better power efficiency, so MW GW (computed), which Epoch puts at 6 GW [103]. That is the trend, not a stretch: (computed). Data is close behind: the indexed web's roughly 500 trillion deduplicated tokens [103] feed, at 20 tokens per parameter, a 25T-parameter model and FLOPs (computed). Training sets should match the stock of public human text "between 2026 and 2032" [457], hence the interest in repeated and synthetic data (Section 6.6).
It is a fitted exponential with wide uncertainty, made at a date (Epoch mid-2024, METR January and September 2026). METR's post-2023 slope moved by about 20% with one change of task suite [487]. A trend is not a law, and the fit cannot tell you whether the process will saturate or accelerate.
- For a fixed recipe, loss falls as a power law plus a floor in parameters, data and compute. Exponents are small, so each 10x buys a steady fractional cut in the reducible loss.
- Compute-optimal training grows parameters and tokens about equally, roughly 20 tokens per parameter under Chinchilla's recipe (). The valley is flat: 2x off in size wastes about 16% of the compute at any budget.
- Kaplan's 0.73 came mostly from small-scale accounting (embeddings and the output layer), long warmup and untuned small models. Count total parameters and all FLOPs, and tune per scale.
- Fits are fragile: an averaged loss stopped Chinchilla's Approach 3 early, and two-decimal exponents move frontier-scale predictions by 1.3x or more. Vary tokens per parameter in the ladder, report unrounded constants and bootstrap the decision.
- Served models are overtrained on purpose (Llama 3 8B saw about 1,870 tokens per parameter). The penalty is gentle near the optimum, , and the 8B repays it after roughly served tokens.
- Laws for repeated data, MoE, precision, vocabulary and hyperparameters each hold something fixed. Learning-rate laws for the same model disagree by 40x for that reason.
- Predict benchmarks in two steps (task loss, then a sigmoid). Aggregates come within 1 to 2 points, single tasks can miss by 10. Much apparent emergence comes from the metric and the x-axis, and some tasks show real loss thresholds.
- Test-time coverage follows a power law because difficulty is heavy-tailed, but verifiers cap what you realize. RL reward follows a sigmoid in compute: compare recipes by ceiling and midpoint, not by early reward.
7. Midtraining: annealing, long context and continued pretraining
The last training tokens arrive at a checkpoint that already knows a great deal. Their mixture, context length and learning-rate decay can shift the model substantially. Treat each continuation as an experiment with its own data, compute and evaluation budget.
What happens between pretraining and post-training, and why did it get its own name? Start with one result. OLMo 2 7B scored 24.1 on GSM8K, a set of grade-school math word problems [488], at the end of pretraining and 67.5 after midtraining, which averaged three 50B-token runs on the Dolmino mix with different data orders [7]. Those 150B tokens are 3.7% of its 4.05T training tokens (computed: 150 / 4,050).
OLMo 2 defines mid-training as a shorter second stage, 5–10% of training FLOPs, "where we linearly decay the learning rate to zero over the remaining length of the run", a term it took from the Phi-4 report and OpenAI [7, 196]. Surveys use it more broadly [489, 490]. This guide writes it as one word. Three kinds of stage share the name (Table 7.1). For a fixed model, makes a stage's token share equal its FLOP share:
Long-context stages break the equality because attention cost grows with sequence length (Section 7.4).
Table 7.1. Three kinds of midtraining and their share of all training tokens. Shares are computed from the cited totals.
| Kind | Example | Stage tokens | Of total | Share | Source |
|---|---|---|---|---|---|
| A. Curated mix in the final decay | OLMo 2 7B | 3 × 50B | 4.05T | 3.7% | [7] |
| OLMo 2 13B | 3 × 100B + 300B | 5.6T | 10.7% | [7] | |
| SmolLM2 1.7B | 1T | 11T | 9.1% | [197] | |
| SmolLM3 3B | 1.1T | 11.1T | 9.9% | [491] | |
| Qwen3, stage 2 (faster decay) | about 5T | about 36T | about 14% | [198] | |
| B. New stage on a finished base | Phi-4 (16K context, peak LR / 10, 70% replayed pretraining tokens) | 250B | about 10T | 2.5% | [196] |
| OctoThinker on Llama 3.2 (constant LR, then decay) | 200B + 20B | - | - | [492] | |
| Agentic coding midtraining on Nemotron 3.5 Lightning (20% replay) | 500B | - | - | [493] | |
| C. Long-context stage | Llama 3 405B, 8K to 128K | about 800B | 15.6T | 5.1% | [6] |
| DeepSeek-V3, 4K to 128K | 125.8B (computed) | 14.8T | 0.85% | [2] |
The chapter also covers training that starts from a checkpoint: continued pretraining and distillation. Llama 3.2 1B and 3B were pruned in one shot from Llama 3.1 8B, then pretrained with the logits of Llama 3.1 8B and 70B as token-level targets [494].
Why a name in 2024? Our reading: warmup-stable-decay (WSD) schedules made branching a decay cheap [354, 353], late upsampling paid off at 7–8B scale [6, 208], and synthetic reasoning data became plentiful. Sections 7.1–7.3 cover the decay phase, 7.4–7.5 long context and 7.6–7.7 checkpoint reuse. Fine-tuning and RL follow in Chapter 8 and Chapter 9. The running examples and the notation are introduced in Section 0.3.
The decay phase decides which data the final weights remember (OLMo 2 7B: GSM8K 24.1 to 67.5 with 3.7% of its tokens). A large RoPE base (or a rescaled one) plus a few hundred billion long tokens turns an 8K model into a 128K model (Llama 3: 5.1% of its tokens). A checkpoint is the cheapest start for a domain model or a smaller one (Minitron: 94B tokens per pruned model) [7, 6, 495].
7.1 Why the last tokens count most: the decay phase
Why does loss fall when the learning rate decays, and why does data seen during the decay count more than data seen earlier? Cosine, WSD and constant-with-cooldown schedules are compared in Section 5.2. At a constant learning rate (LR), stochastic gradient descent (SGD) never reaches the bottom of the basin. It bounces at a noise floor that scales with the LR. Decaying the LR lets it settle, and where it settles depends on the data it sees meanwhile.
The noise floor on one direction
Take one direction of a quadratic loss with curvature , add independent gradient noise of variance , and run SGD without momentum (a toy model):
At equilibrium the variance satisfies , so
The excess loss is proportional to and, to first order, independent of curvature. A direction relaxes in about steps, so flat directions settle slowly. With the formula gives 0.0556, 0.0263 and 0.0128 at = 0.2, 0.1 and 0.05, matching a simulation (computed). Halve the LR, halve the floor. Wen et al. picture the LLM case as a river valley, where the decay removes the oscillation across the walls [357], and in a 0.2B WSD run from the MiniCPM team the curvature rose by an order of magnitude during the decay [354].
Why late data writes the model
Now let each step's data pull toward its own target , with and no noise. Unrolling gives
Every later step shrinks a target's weight, so early data fades. (Section 5.2 builds a different toy from AdamW's weight decay. This one tracks curvature.) For a direction that relaxes in 1,000 steps at peak LR, in a 20,000-step run, the last 10% of steps write 86.5% of the final iterate under constant LR, 63.2% under WSD with a 10% linear decay, 19.3% under cosine to 10% of peak and 1.6% under cosine to zero (illustrative toy, computed). Constant LR is more recency-heavy still but never leaves its floor. WSD lowers the floor while late data still dominates.
Decaying the LR removes the noise floor, and the data seen while the model settles carries the most weight. In the toy, the last 10% of steps write 63% of the final iterate under a WSD decay but under 20% in the tail of a cosine schedule.
The annealing scaling law
Tissue et al. fit loss after step to the forward area under the LR curve and an annealing area , a running sum of LR drops with momentum [359]:
For a 594M-parameter model at a peak LR of over 20K steps, with , they fit [359]. A decay raises , but every low-LR step adds less to , so some decay length is best. In Figure 35, drag the decay length and watch the predicted loss bottom out on a flat minimum, then switch to cosine and watch the late-data share collapse. Panel C counts the last f of the steps (20% by default), so its WSD share reads 86.5%, not the 63.2% for the last 10% above.
Method and sources
Panel B shows the final loss predicted by the annealing scaling law of Tissue et al. (2024) for each decay length and three decay shapes, against constant and cosine schedules, with a band where the loss stays within 0.001 nats of its minimum. Panel C shows the share of the final weights written by data in that window in a one-direction toy model of SGD (illustrative). Loss values are computed in this guide from the constants Tissue et al. fitted on a 594M-parameter model trained for 20K steps, so they hold for that one setting and are extrapolations beyond 60K steps. Tissue et al. report that an annealing ratio of about 10–20% is typically optimal (their Section 4.5). The decay lengths behind the presets come from Hu et al. (2024) for MiniCPM, Hägele et al. (2024), who also define the (1-sqrt) shape, and Feng et al. (2024), and the toy follows the river-valley picture of Wen et al. (2024).Predicted final loss in nats from the fitted law (computed, our implementation). Beyond 60K steps it is extrapolation.
| Schedule | 20K steps | 100K steps |
|---|---|---|
| Constant LR | 2.828 | 2.711 |
| Cosine to zero | 2.840 | 2.667 |
| WSD, linear decay over 10% of steps | 2.787 | 2.639 |
| WSD, linear 20% | 2.778 | 2.637 |
| WSD, linear 30% | 2.778 | 2.639 |
| WSD, linear 50% | 2.789 | 2.644 |
| WSD, (1-sqrt) 20% | 2.775 | 2.637 |
| Best linear fraction | 24% | 18% |
The optimum is broad: at 20K steps every linear decay from 18% to 30% is within 0.001 nats of the best. Constant beating cosine at 20K is no bug: the paper saw it in its own short runs [359].
How long a decay, and what goes wrong
Reports differ, partly by definition. MiniCPM found an exponential decay over 10% of tokens suffices and 2.5% falls short [354]. Hägele et al. saw gains plateau near 20%, with a (1-sqrt) shape, , beating linear [353]. Tissue et al. call 10–20% typical [359]. Feng et al.'s best quality data phase covers the last 40%, a data length, not an LR one [496].
Four failure modes recur. A decay can be too short. Annealing to exactly zero "can hurt metrics" while loss falls [353]. Mixes compared before the decay are compared at the noise floor. And tuning pretraining LR by midtraining results misleads: "a higher learning rate does make mid-training more effective, but it does so by exactly the amount that the pretraining is worse" [7].
A competing view merges checkpoints instead of decaying, and WSM reports gains over WSD this way [400, 421], while Hägele et al. found averaging falls short of a cooldown [353]. Weight averaging is explained in Section 5.7. Our advice: WSD with a 10–25% linear or (1-sqrt) decay to near zero, keep pre-decay checkpoints to branch from, and never compare data mixes before decaying.
7.2 What goes into a midtraining mix
What data do labs put into the decay phase, how much of it, and what does it buy? Spread over a 4T-token run, 10B tokens of excellent math are 0.25% of every batch. Inside a 50B-token decay they are a fifth of every batch, and nothing comes after to overwrite them (illustrative).
The OLMo 2 recipe, step by step
- Warm up 2,000 steps to a peak LR of , then follow a cosine planned to reach 10% of peak at 5T tokens [7].
- Stop at 4T tokens, because "the last part of a cosine decay schedule can be cut off and replaced by a linear decay to zero with little loss of performance" [7].
- Build Dolmino Mix 1124. Its 50B version is 47.2% filtered DCLM web text, 20.8% math, 16.6% decontaminated FLAN instructions, 7.11% Wikipedia, 5.85% academic papers and 2.45% StackExchange. The 10.7B math tokens are largely synthetic and include the GSM8K training split. Web stays near 50% in every mix, and small sources repeat two or four times [7].
- Decay the LR linearly to zero over 50B tokens, three times with different data orders, and average the three models into a soup (Section 7.3). The 13B and 32B soup three 100B runs and one 300B run.
A batch of 1,024 sequences of 4,096 tokens is 4,194,304 tokens, so one 50B anneal is steps. The 13B's batch is twice as large, so its 100B anneal is the same 11,921 steps, the paper's reason for that mix [7]. With , one anneal costs FLOPs, and three cost , 3.7% of the run's (computed). They bought +43.4 GSM8K and +20.1 DROP points (computed from the reported Table 9).
Decay or data?
OLMo 2's Table 9 average over ten evaluations rose from 53.0 to 62.9 at 7B, 9.9 points (computed), although its text says 10.6. The gain shrinks to +7.0 at 32B, yet GSM8K still rises 22.6 points there (computed) [7]. A 50B decay on the unchanged pretraining mix raised the OLMES multiple-choice average [497] from 69.6 to 74.0 and MMLU [498] from 59.8 to 61.8, while the 200-question GSM8K development score (GSM*) slipped from 28.5 to 27.0. Adding math to high-quality web lifted GSM* to 52.0 [7], 23.5 points above web alone. With standard errors of 3.1–3.5 points on 200 items (computed), the −1.5 is noise and the +23.5 is not. Part of that jump is training on the test task: the math data, here and in Table 7.3, includes the GSM8K training split, and GSM* is drawn from the same distribution [7, 499]. The decay buys general gains, and the data decides which skills gain. Figure 36 has three views (SmolLM2 by stage, OLMo 2 by size, decay or data): watch where the math scores jump.
Method and sources
The second view shows OLMo 2 before and after midtraining on the Dolmino mix, 1.2–10.7% of all training tokens (computed), which lifts GSM8K by 22.6–43.4 points at every size from 1B to 32B (Team OLMo 2024, Table 9). The third view compares 50B-token decays of OLMo 2 7B from one 4T-token checkpoint (Table 11): decaying on the unchanged pretraining mix raises the OLMES multiple-choice average by 4.4 points but leaves the 200-question GSM* score within noise (-1.5), while adding math data raises GSM* from 28.5 to 52.0. GSM* whiskers are one binomial standard error, 3.1–3.5 points, computed in this guide. The stepper walks each stage or comparison, and the noise band is two standard errors of a difference between two independent runs.Other labs follow the pattern (Table 7.2). Read Llama 3 carefully: its 8B gains of 24.0% on GSM8K and 6.4% on MATH (units unstated) come from annealing on those benchmarks' training sets, and were negligible at 405B. The production anneal excludes benchmark training sets, and the 405B's covered only the last 40M tokens [6], two to three steps at its 16M-token batch (computed).
Table 7.2. Decay-phase recipes beyond OLMo 2 (reported).
| Model | Decay-phase data | Reported effect | Source |
|---|---|---|---|
| SmolLM2 1.7B (10T to 11T, linear to zero) | web 58%, educational code 24%, math 14% (including 0.02% augmented GSM8K training data), synthetic textbooks 4% | GSM8K 4.32, 4.62, 10.01 after the three stable stages (no decay), then 32.60 | [197] |
| MiniCPM 2.4B (exponential decay) | pretraining data plus SFT-style instruction data | with the same SFT afterwards, MMLU 44.6 to 50.9, GSM8K 27.7 to 42.3 | [354] |
| 7B on 1T tokens (Blakeney et al.) | domain data and code upsampled in the last 20% | up to +6.90 MMLU, +8.26 GSM8K, +6.17 HumanEval | [208] |
| OLMo 3 7B | 100B Dolmino mix, web and PDF data kept for continuity | math cluster 23.5 to 59.8 | [12] |
Instruction and reasoning data, and readiness for RL
Do instruction and reasoning data belong in the decay? For: OLMo 3's mix with them won "on every base eval measure" [12], PRISM reports +15 to +40 math points from about 27B midtraining tokens [500], and early reasoning data gave a 19% gain that later SFT could not fully replicate [501]. Against: DeepSeek LLM's 5 million instruction examples in the last 10% of pretraining gave results "nearly identical" to adding them in SFT [42]. Our reading: formats are learned anywhere, but reasoning patterns placed early survive post-training. Gains are largest for domains far from web text, such as code and math [502].
Under the same RL recipe, Llama-3.2–3B's responses grew toward the 4,096-token limit, typically a boxed answer and then repetition, while Qwen2.5–3B lengthened steadily. Midtraining Llama on 200B math web tokens at constant LR, then 20B decay tokens of chain-of-thought data, raised its core math average from 10.61 to 21.69–27.29 and brought its RL results to Qwen2.5–3B's level [492]. RL readiness is a property of the base, and midtraining shapes it (Chapter 9).
Defaults from these recipes, not a law: a decay of 5–20% of tokens, about half of it the best web data, scarce domain data at 10–35%, small sources repeated a few times, everything decontaminated.
7.3 Anneals as experiments, soups as insurance, and the contamination trap
How do you measure whether a dataset belongs in the mix, should you average several anneals, and how does benchmark leakage creep in? Change only the end of a strong model's training and see whether the target benchmark moves. Every candidate gets the same decay gain, so differences are data effects. Small models cannot do this job, since "most LLMs trained at smaller scales register random accuracy on many important benchmarks such as MMLU" [208]. How to run small-scale ablations and when to trust them is Section 3.9.
Llama 3 anneals a 50%-trained 8B to zero over 40B tokens, 30% of them candidate data [6]. OLMo 2's microanneals pair candidate math with equal web text, 19 runs and 130B tokens in all [7]. OLMo 3 pairs 5B candidate with 5B web tokens and compares the result with a 10B web-only microanneal [12].
Table 7.3. OLMo 2 7B microanneals from the 4T checkpoint (GSM* 28.5 before). Scores reported. The math mixes include the GSM8K training split.
| Experiment | Mix | Tokens | GSM* |
|---|---|---|---|
| Proportion | math 35% / web 65% | 576M | 63.5 |
| Proportion | math 10% / web 90% | 1.72B | 61.0 |
| Duplication | math repeated 2× | 798M | 66.0 |
| Duplication | math repeated 4× | 1.57B | 65.0 |
| Format | TinyGSM with answers as code | 3.17B | 25.0 |
| Format | TinyGSM rewritten into prose (MIND) | 6.40B | 65.5 |
| Format | TinyGSM-MIND repeated 2× | 12.6B | 70.0 |
Table 7.3 teaches three lessons [7, 503]. Domain data must be present, not dominant. A few repeats help. Format matters most: code answers hurt, prose rewrites help.
Llama 3's probe costs FLOPs, 0.27% of a 15T-token 8B run (computed). An OLMo 3-style pair on a 7.30B model costs FLOPs (computed). The binomial standard error of accuracy on items is
At 60% on all 1,319 GSM8K questions that is 1.35 points, 1.9 for a difference of two runs, so a 3-point gap is suggestive, not decisive. On 200 items one run carries 3.5 points (computed). OLMo 2 accepts that to keep most of the test unseen [7]. Error bars and paired comparisons for benchmark scores are derived in Section 10.4.
Winners can still trade off in a full mix [12], and base scores can miss post-training effects, so one agentic recipe scores candidates after a short fixed SFT run [492, 493].
Souping anneals
Weight averaging and soups are explained in Section 5.7. OLMo 2 soups anneals that share a start and differ in data order, Llama 3 averages checkpoints during its anneal, and OLMo 3 found merging helped at 32B but not 7B [7, 6, 12]. When does it help? Let ingredients deviate from a shared optimum by vectors of equal size with pairwise correlation in the Hessian's inner product. Expanding the quadratic loss of the mean gives diagonal and off-diagonal terms, so (derived, toy model)
Three anneals with independent data orders () keep 1/3 of the noise part of the excess loss, and 2/3 at . Ten checkpoints from one decayed run's tail () keep , so that average shows little (computed). The price: OLMo 2 7B's midtraining triples from 1.2% to 3.7% of its tokens.
OLMo 2 says three-way soups match or beat the best single run on its six mixes. Its Table 14 shows one exception: on mix E the soup's GSM* fell from 60.5 to 43.0 while OLMES rose from 73.4 to 75.3 [7]. Check every metric before shipping a soup.
The contamination trap
Midtraining data is curated while watching benchmarks, so leakage concentrates there. Contamination, including GPT-3's filtering bug, is in Section 10.5. OLMo 3 found contamination in standard sources such as Flan, removed over 60,000 DROP training examples, and focused decontamination on midtraining, where memorization is strongest [12]. N-gram filters miss rephrasings [196, 504]. Training on benchmark-style task data is a separate confound: models trained after November 2023 beat older ones at equal compute by 7 MMLU and 19 GSM8K points, a gap that vanishes after equal task fine-tuning [499]. Hold out most of a benchmark, decontaminate every split, and test on problems newer than the data.
Microanneals on SFT data with chat-template special tokens made the base model emit them at inference, and GSM8K fell from 49.43 to 0, mostly through broken answer parsing. With ordinary text in place of the special tokens it scored 46.02. The team kept the data but removed both the chat template and the special tokens, using plain newline formatting [12]. A sudden zero is usually a parsing failure. Chat templates and loss masking are in Section 8.2.
7.4 Why train short, and how to stretch RoPE
Why do labs pretrain at 4K-8K tokens and extend at the end, and what exactly do Position Interpolation, NTK-aware scaling, YaRN and ABF change inside RoPE? Cost and data push long context to the end. The obstacle is that a model trained at 8K with rotary position embeddings (RoPE) breaks at 32K unless its rotation frequencies are rescaled.
Why short first
Attention FLOPs grow with sequence length . Section 1.2 computes that a 128K-token step costs 2.88x an 8K step per token for Llama 3 8B, 2.08x for 70B and 1.60x for 405B. Meta's stated reason: "We do not train on long sequences earlier because the compute in self-attention layers grows quadratically in the sequence length." [6] In Xiong et al.'s 7B test at a fixed token budget, training at 4K for 80% of the run and 32K for the rest used FLOPs against for 32K throughout, a 40% saving at similar long-context scores except a lower Qasper F1 (25.0 against 28.6) [505]. Their count ignores causal masking. With it the saving is about 27% (computed). Data is the second reason: long documents are scarce, and only about 30% of SlimPajama documents exceed 4K tokens [506].
RoPE as a set of clocks
How RoPE encodes relative position is in Section 4.6. It rotates pair of each -wide query and key head by the angle at position , so scores depend only on relative position [299]. The useful quantity is the wavelength , the tokens per full turn [507]:
With , pair 0 turns every 6.28 tokens. Pair 63 turns every tokens at Llama 2's base of 10,000 [505] and every 2.56M at the 500,000 that Llama 3 used from the start [6] (computed).
Each rotary pair is a clock with its own period. Fast clocks tell neighbors apart. Slow clocks, with periods longer than the training length, never finish a turn in training and break first. Every extension method is a rule for slowing the slow clocks while sparing the fast ones.
A pair whose wavelength exceeds acts like an absolute-position feature, and past it sees angles never seen in training [507]. That is 18 of 64 pairs for Llama 2 at 4,096 tokens (pairs 46–63) and 29 of 64 for Llama 3 8B at 8,192 (computed). Liu et al.'s critical dimension, 92 of 128 for Llama 2, marks the same boundary, so "the last 36 dimensions lack sufficient training" [508]. Unchanged, LLaMA's perplexity past its window exceeds 1,000, and over 10,000 batches of longer fine-tuning without touching RoPE moved its effective window only from 2,048 to 2,560 tokens [509].
Four rescaling rules
- Position Interpolation (PI) divides every by . It is stable, with an error bound about 600 times below extrapolation, and took LLaMA from 2K to 32K in 1,000 steps [509]. But the fast clocks slow too. PI degrades beyond roughly , and at 16x LLaMA 7B's MMLU fell from 35.7 to 25.9, against 30.0 for YaRN [507].
- NTK-aware scaling raises the base to , so the fastest pair is unchanged and the slowest slows by exactly [507]. For Llama 2 at : (computed). Its dynamic variant changes the rotation with length, so the KV cache must store keys before rotation [507].
- ABF (adjusted base frequency) raises the base and continues pretraining long. Llama 2 Long went from 10,000 to 500,000 because the old base would not attend past 4,000–6,000 tokens [505].
- YaRN counts each pair's turns in the trained window, . It interpolates pairs below turn like PI, leaves pairs above alone, blends between, and multiplies logits by [507]:
A Llama 2 7B trained with YaRN only on 64K chunks reached a perplexity of 2.37 at 128K [507]. The Llama 3.1 rule, as implemented in Hugging Face Transformers, is YaRN-like with factor 8: pairs with wavelengths under 2,048 tokens stay, pairs over 8,192 are divided by 8, and a ramp blends between [510]. On Llama 3 8B that leaves 29 pairs, blends 6 and divides 29 (computed). Figure 37 steps through the rules on Llama 2 and Llama 3 8B, plotting wavelength against pair index on a log axis. Watch PI lift the whole curve, NTK-aware pivot it about pair 0, and YaRN divide the pairs above the line by , blend the pairs just below it and leave the fast pairs alone.
Method and sources
Pairs whose wavelength exceeds the trained length never complete a turn in training and are the first to break when a model runs past that length. Position Interpolation (Chen et al. 2023) slows every pair by the extension factor, NTK-aware scaling and YaRN (Peng et al. 2023) slow mainly or only the slow pairs, the Llama 3.1 rule in the Hugging Face reference code applies YaRN's ramp with factor 8 and tighter thresholds of 1 and 4 turns per 8K window, and ABF (Xiong et al. 2023) raises the base and relies on continued pretraining. Wavelengths are computed in this guide from the published formulas, using the rotary form of Su et al. (2021) and the critical dimension of Liu et al. (2023).With , pairs 0–20 make over 32 turns and stay untouched, pairs 46–63 make under one turn and are divided by 16, and pairs 21–45 blend. Logits are multiplied by . Training ran 400 steps of 64 sequences of 65,536 tokens, B tokens [507]. Under PI the fastest pair's wavelength would grow from 6.3 to tokens, so neighbors differ by only 1/16 radian there, which is why PI hurts short-context scores (all computed).
How big a base? Men et al. require the expected advantage of a similar key over a random one, proportional to , to stay non-negative, which needs a base of at least for 128K. A smaller base gives "superficial long context capability", low perplexity without retrieval [511]. The NTK-aware formula gives for Llama 3 8B at (computed), and ProLong chose for 64K [512].
Other routes (Section 4.6): ALiBi [298], layers without position code mixed with RoPE layers [281, 513], and LongRoPE's searched per-pair factors, which reach 2,048K [514].
7.5 Long-context recipes and the gap between claimed and effective context
How did Llama 3, DeepSeek-V3 and others extend to 128K and beyond, what did it cost, and how much of the claimed window actually works? The recipes share a shape: a few percent of tokens, lengths raised in stages, a check before each step. On hard tests, the usable window is a fraction of the accepted one.
Llama 3: six stages and a stop rule
Llama 3 405B grew from 8K to 128K in six stages on about 800B tokens [6]. The reusable part is the rule for moving on: "We assess successful adaptation by measuring whether (1) model performance on short-context evaluations has recovered completely and (2) the model perfectly solves “needle in a haystack” tasks up to that length." [6] Per-stage lengths and tokens are not given. Masking attention across packed documents mattered at these lengths [6]. The 128K stage ran on 16,384 H100s with context parallelism 16 at 380 TFLOP/s per GPU and 38% BF16 MFU, against 400 TFLOP/s and 41% at 8K [6]. Context parallelism and ring attention are in Section 11.5.
A stage's FLOP share is its token share times the ratio of per-token costs:
Llama 3 405B. 800B tokens are of the main run. In Section 1.2's convention ( counts matmul parameters, without the input embedding) a token costs 2.52, 2.63 and 4.05 TFLOPs at 8K, 16K and 128K, so the stage costs of main-run FLOPs if it averaged 16K and if it all ran at 128K. At 128K the cluster delivers FLOP/s, about 1.54M tokens per second, so 800B tokens would need about 6 days of pure compute if every token ran at 128K, and less because the early stages run at shorter lengths. Downtime comes on top (all computed, Chapter 12).
DeepSeek-V3. It ran YaRN with in two 1,000-step phases, at 32K with 1,920 sequences per batch and at 128K with 480, applied only to the decoupled RoPE key of MLA [2]. That is B tokens, 0.85% of 14.8T (computed). It took 119K H800 GPU-hours against 2,664K for pretraining, 4.5% [2], so a token cost times a pretraining token (computed). Our guess, not the report's: attention was cheap at 4K, and communication grows at small batches.
Table 7.4. Published long-context extension recipes. Token counts are reported unless marked computed.
| Model | Lengths | Extension tokens | RoPE change | Notes |
|---|---|---|---|---|
| Llama 3 405B [6] | 8K to 128K, 6 stages | about 800B | base 500,000 from the start, released 3.1 config adds a factor-8 frequency rule | stop rule, document mask |
| Llama 2 Long [505] | 4K to 32K (7B, 13B), 16K (34B, 70B) | 400B | ABF, 10,000 to 500,000 | 70B MMLU rose 68.9 to 71.7 |
| Code Llama 13B [515] | 4K to 16K, stable to 100K | 20B (computed) | base 10,000 to 1,000,000 | 10,000 steps of 2M tokens |
| DeepSeek-V3 [2] | 4K to 32K to 128K | 125.8B (computed) | YaRN, | 119K GPU-hours |
| Qwen2.5-1M [516] | 4K to 256K, 5 stages | not reported | base up to 10,000,000 | 75% of each stage at its maximum length |
| Gemma 3 [265] | 32K to 128K | not reported | global layers rescaled by 8 | five local layers per global layer |
| ProLong 8B [512] | 8K to 512K, 2 stages | 40B (binary B) | base , then | from Llama 3 8B Instruct |
| Fu et al. 7B [506] | 4K to 128K | 1-5B | base raised (ABF) | 5 days on 8 A100s |
Long data and how much of it
Token budgets in Table 7.4 span three orders of magnitude. Fu et al. keep the pretraining domain mix, upsample long documents per domain, and find 500M tokens unlock most retrieval [506]. Llama 2 Long kept most of its gain with most long texts removed [505]. ProLong's best mix was 60% long data (code repositories, books) and 40% high-quality short data, with no cross-document attention and training past the evaluated length [512]. Whether more tokens keep helping is contested: Qiao et al. see "no clear sign of saturation" up to about 100B tokens on a 1.22B model [517]. Needle tests saturate early. Harder tasks do not.
Claimed versus effective context
The needle-in-a-haystack test hides one sentence in filler at every length and depth [518]. Llama 3 finds 100% of needles [6], so the test is a stop rule, not a finish line. RULER calls a length effective when its 13-task average beats Llama 2 7B's 85.6 at 4K. By that test Llama 3.1 8B Instruct, which claims 128K, is effective to 32K and 70B Instruct to 64K, and 10 of 17 models that claim at least 32K pass there (computed from Table 3), which the authors summarize as only half [519]. NoLiMa removes word overlap between question and needle and sets the bar at 85% of each model's short-context score. There Llama 3.1 8B is effective only to 1K, Llama 3.1 70B and 405B to 2K, and GPT-4o to 8K [520]. Models also use only 10–20% of their context on BABILong [521] and lose accuracy when the answer sits mid-context [522].
Figure 38 joins each model's claimed window to its effective length (results as published in 2024 and 2025). Toggle from RULER to NoLiMa and watch the filled dots slide left.
Method and sources
On RULER (Hsieh et al. 2024) the threshold is Llama 2 7B's 13-task average at 4K, 85.6, and 10 of the 17 models score above it at 32K, which the authors summarize as only half. On NoLiMa (Modarressi et al. 2025), which removes literal word overlap between question and needle, the threshold is 85% of each model's own short-context score, and 10 of 13 models are effective only to 2K or less. Both papers tested the Instruct checkpoints of Llama 3.1, not the base models. Carets mark lengths outside the tested range. The detail panel plots one model's score at each tested length against the threshold, and the slider recomputes every effective length from the published per-length scores, so you can see how the answer moves with the threshold.LWM 7B, trained toward a 1M window, scored under RULER's threshold at every length, starting at 82.3 at 4K, and GradientAI's 1M-token Llama 3 70B was effective to 16K [519]. The window a model accepts is not a measurement.
HELMET finds needle tests do not predict downstream tasks [523]. Perplexity is contested: useful in one study [524], unreliable for choosing recipes in ProLong [512], and fixed by LongPPL, which scores only tokens that depend on distant context and correlates with benchmarks at -0.96 [525]. Chapter 10 covers the statistics.
Meta's first fine-tuning recipe used only short data and "resulted in significant regressions in long-context capabilities from pre-training". Mixing in 0.1% synthetic long data restored them [6]. ProLong found short-only SFT enough [512]. Re-test long context after every post-training stage (Chapter 8).
At serving time one 128K sequence holds 16 GiB of BF16 KV cache for Llama 3 8B and 63 GiB for 405B (computed from the published configurations [6]). Section 13.2 derives the KV-cache arithmetic, and FlashAttention, which keeps attention memory linear in [63], is in Section 2.4.
How to do it yourself
- Pretrain at 4K-8K with a base of at least 500,000. Extend at the end with ABF or YaRN. For 128K aim for a base near (Men et al.'s bound is ), or use a frequency rule such as YaRN or Llama 3.1's on a smaller base.
- Use about 60% long and 40% high-quality short data, upsample long documents per domain, mask across documents, and train a little past the target length.
- Advance a stage only when short evaluations recover and a long test passes a stated threshold, with RULER or HELMET, not needles alone.
- Report effective length with benchmark and threshold, and re-test after SFT and RL.
7.6 Continued pretraining for a new domain
How do you teach a trained model a large new domain or language without erasing what it already knows? Continued pretraining (CPT) is more next-token training of a finished model on new or reweighted data at pretraining scale. At its small final learning rate a decayed model barely moves. At a higher rate it learns the new domain and forgets the old. The fix that works at scale is cheap: raise the rate again, decay it again, and keep some old data in every batch [358, 526]. Gains are largest for domains far from the original data, as with RoBERTa [527]. Modern runs read 50B to 6T tokens, where the schedule and forgetting decide the outcome.
The recipe: re-warm, re-decay, replay
Ibrahim et al. tested the recipe on Pile-pretrained models moved to SlimPajama (a weak shift, at 405M and 10B) or German web text (a strong shift, at 405M only) [358]. Re-warm linearly over about 1% of the new steps to the original peak learning rate. Re-decay with cosine to a tenth of that peak inside the new budget. Replay a fraction of every batch from the old data. The optimizer state can be reset, since loading it made a negligible difference [528]. Replay is compute-equivalent, because old tokens replace new ones:
With B tokens and , the run sees 285B new and 15B replayed tokens. For the 10B model (9.6B parameters) that is FLOPs, half the of retraining from scratch on the 600B-token union (computed).
Figure 39 plots what replay bought the 405M model. Follow the old-data (Pile) line: it drops steeply between 0% and 1% replay and then flattens, while the new-data line hardly rises. Without replay the German shift raised the Pile loss by 1.39 nats (2.17 to 3.56), against 0.27 for the weak shift. Replay of 25% removed 1.23 of it and matched the average loss of a model retrained on both datasets [358], which reads 2.5 times the CPT tokens (500B against 200B, computed). At 10B, 5% replay reached an average loss of 1.89, against 1.87 for the union and 1.99 with none [358].
Method and sources
Without replay the Pile loss rises by 0.27 and 1.39 nats. Replay is compute-equivalent, so replayed tokens replace new ones, and the share of forgetting removed is computed in this guide from the reported losses. Dashed lines mark a model retrained from scratch on both datasets (hover a dashed or dotted line for its value), which costs 2x (weak shift) or 2.5x (strong shift) the tokens of the continued-pretraining stage alone, and 25% replay on the strong shift matches its average loss of 1.75. The optional third panel adds the 10B model, where 5% replay reaches an average loss of 1.89 against 1.87 for the retrained model. All losses are reported by Ibrahim et al. (2024), Tables 2, 3 and 4.Replaying 1% of old data already cuts forgetting significantly, and 25% matched full retraining on a language shift [358]. The price is a slightly smaller new-data budget, not extra FLOPs.
When to re-warm
Part of what looks like forgetting is the re-warm itself. With no shift at all, re-warming to raised the Pile loss by 0.1 at its peak, against 0.35 when switching to SlimPajama [358]. The annealing law of Section 7.1 reads a re-warm as a negative annealing area [359], and a higher peak trades more adaptation for more forgetting [526]. That is one reason to keep a pre-decay checkpoint (Section 5.2). DeepSeekMath started from one [207].
Parmar et al. argue the other side for a general refresh. Continuing a 15B model pretrained on 8T tokens on mostly old sources plus QA data, their best schedule started at the pretraining minimum learning rate, and accuracy rose from 48.9 to 55.0 after 100B tokens but only to 56.8 after 1T [528]. The two results agree once you sort by the data. Re-warm for large, different data. Stay near the minimum rate for mostly old data reweighted, as in the decay-phase mixes of Section 7.2.
Other defenses against forgetting
Elastic weight consolidation (EWC) ties each parameter to its old value with a spring whose stiffness is the diagonal Fisher information of the old task [529]:
At LLM scale it rarely pays: and in FP32 for Llama 3 8B take bytes, about 64 GB (computed), and needs old data anyway. The table lists the cheaper levers.
Table 7.5. Forgetting in continued pretraining: what the evidence says (reported).
| Finding | Evidence | What to do |
|---|---|---|
| LoRA learns less and forgets less. Full fine-tuning learns perturbations of 10-100x higher rank | Best LoRA after 20B code tokens about matched full fine-tuning after 4B [530] | Use full fine-tuning for knowledge-heavy CPT (Section 8.3) |
| Many drops are lost task alignment, not lost knowledge | Spurious forgetting [531] | Test whether a little SFT restores the skill before blaming CPT |
| Forgetting concentrates in output embeddings of tokens absent from the new corpus (2026 preprint) | A larger Adam epsilon on the output projection alone removed 39.4-67.9% of it [532] | Count which tokens the new corpus never uses |
| Replay on a decayed base: 20% held general benchmarks within 1.2 points through 65B tokens, 40% was no better | [493] | Start near 20% for midtraining-style CPT |
Domain models built this way
Table 7.6 compares six published domain models. Read the starting point, the token count and the replay share together, and check which results count regressions as well as gains.
Table 7.6. Domain models built by continued pretraining (reported). Shares are of CPT tokens.
| Model | Starting point | CPT tokens | Mix | Reported result |
|---|---|---|---|---|
| Code Llama 7B-34B [515] | Llama 2 | 500B (70B: 1T) | Code, 8% code-related text, 7% general text | A from-scratch 7B needs about 240B more tokens to match its loss at half of training |
| Llemma 7B / 34B [533] | Code Llama | 200B / 50B | 95% Proof-Pile-2, 2% Pile, 3% GitHub | MATH 4.5% to 18.0% (7B), 12.2% to 25.0% (34B) |
| DeepSeekMath-Base 7B [207] | DeepSeek-Coder-Base-v1.5, pre-decay | 500B | 56% math mined from Common Crawl (120B tokens, four fastText rounds), 4% AlgebraicStack, 10% arXiv, 20% code, 10% web text | MATH 36.2%, GSM8K 64.2%. arXiv alone brought no notable gain. The math corpus is read about 2.3 times (500 x 0.56 / 120, computed) |
| DeepSeek-Coder-V2 [534] | DeepSeek-V2 at 4.2T tokens | 6T | 60% code, 10% math, 30% natural language | 10.2T tokens in total |
| Swallow 7B-70B [535] | Llama 2, vocabulary 32,000 to 43,176 | about 100B | 90% Japanese, 10% English | English QA and GSM8K fall 6-23%. Japanese generation up to 78% more efficient. The paper calls this a "56.2% token reduction", but a 78% speedup means the new token count is 56.2% of the old (1 / 0.562 = 1.78, computed) |
| EntiGraph [536] | Llama 3 8B | 455M synthetic | Synthesized from a 1.3M-token corpus | 80% of the gain of having the documents in context |
The recipes share a pattern: the strongest related base, often from before its decay, tens to hundreds of billions of classifier-mined domain tokens (Section 3.2), 5–30% general or replay data, a re-decay inside the run, and evaluation of regressions as well as gains.
A new language that the tokenizer serves badly costs more tokens per document (Section 3.7). Vocabulary extension appends rows to the input embedding and, if untied, the output head, adding parameters tied or untied. Chinese LLaMA grew its vocabulary from 32,000 to 49,953, roughly halving the tokens per Chinese text [537], for M parameters, about 2% of the 7B (computed).
Plan 75B domain tokens plus 25B of replay, a 25% split for a strong shift (illustrative). With B the run costs FLOPs, 0.67% of a 15T-token pretraining run (computed). At 989.5 TFLOP/s dense BF16 per H100 [4] and an illustrative 35–45% MFU, to 3,900 GPU-hours, 12–15 hours on 256 GPUs (computed).
Llemma's cosine schedule was planned for 48,000 steps, but the 7B "encountered NaN losses after step , likely caused by unstable optimization or hardware failures" [533]. The release is that checkpoint, not fully decayed. Keep intermediate checkpoints usable and the decay short enough to rerun (Section 12.6).
How to do it yourself. Start from a pre-decay checkpoint if you have one, run domain and retention suites before and after, and expect an early rise in old-data loss. Alert only if it does not recover (Section 12.5).
7.7 Smaller models from bigger ones: distillation and pruning
How do you get a strong small model from a big one with a fraction of the tokens, and when is the teacher worth its cost? A hard next-token label is one sample from a broad distribution. A teacher's full distribution also says which wrong tokens were nearly right: "When the soft targets have high entropy, they provide much more information per training case than hard targets and much less variance in the gradient between training cases" [538]. Distillation trains a student to match that distribution. Pruning also starts the student as a trimmed copy of the teacher.
The loss and its gradient
Take student logits and teacher logits , softened by a temperature (subscripts S and T mean student and teacher): , . The soft-target loss is plus a constant. Since ,
At high temperature itself shrinks as , so the gradient falls as and the soft loss is multiplied by [538]. A finite-difference check agrees to (computed). LLM pretraining uses , which Busbridge et al. found optimal [471]. This forward KL is mode-covering. For generation, MiniLLM minimizes reverse KL [539], GKD trains on the student's own samples [540], and sequence-level distillation trains on teacher outputs [541], as reasoning-trace distillation does (Section 9.4).
Distillation pretraining in practice
Several open families pretrain small models this way. Gemma 2's ablation isolates the effect: a 2B model trained on 500B tokens averaged 67.7 on three benchmarks with a 7B teacher, against 60.3 from scratch (reported) [268].
Table 7.7. Distillation in pretraining (reported unless marked).
| Model | Teacher and targets | Tokens | Note |
|---|---|---|---|
| Gemma 2 2B and 9B [268] | Distillation instead of next-token prediction. The 27B trains from scratch on 13T | 2T and 8T | The paper says more than 50x compute-optimal. At 20 tokens per parameter it is 38x (2.61B) and 43x (9.24B) (computed) |
| Gemma 3, all sizes [265] | 256 logits per token, sampled by teacher probability | 2T-14T | A smaller teacher is better for short training, a larger one for long training |
| Llama 3.2 1B and 3B [494] | Pruned from Llama 3.1 8B, then Llama 3.1 8B and 70B logits as token-level targets | up to 9T [542] | Distillation recovers what pruning lost |
What distillation costs, and when it pays
The student pays its usual FLOPs per token. Online logits add a teacher forward pass, , and a teacher trained only for this student adds its whole pretraining, the term in parentheses [471]:
For a 9.24B student and a 27B teacher the share is , so distillation doubles the bill (computed). The 27B is illustrative, since Gemma 2 does not name the 9B's teacher [268]. To cut the share, use a smaller teacher or store sparse logits once and reuse them. The top 256 entries at a 4-byte index and a 2-byte value take 1,536 bytes per token, 6.1 PB for 4T tokens (computed, illustrative format), and Minitron lost significant accuracy keeping 100 or fewer [495].
Per token, student training costs FLOPs and a Llama 3 70B forward pass , so the teacher takes . The same FLOPs would train the student on about 20 times more tokens. An 8B teacher drops the share to (computed, sizes illustrative).
The distillation scaling law says when it pays. With many students or an existing teacher, distillation beats supervised learning up to a compute level that grows predictably with student size. With one student and a teacher trained for it, supervised learning is generally better, and a teacher that is too capable eventually hurts [471]. A 2026 study finds that even small, undertrained teachers help larger students [543].
Pruning plus distillation: Minitron
Minitron scores every attention head, MLP neuron, embedding channel and layer from forward activations on 1,024 calibration samples, slices the weights to the target width or depth, and retrains on the unpruned model's logits alone [495]. Pruning in stages (15B to 8B to 4B) beat one shot by 12% on MMLU. The 8B and 4B each used 94B tokens, up to 40 times fewer than from scratch, for a 1.8x saving on the family. That counts student training only, at per-step FLOPs of 4.4, 2.5 and [495]:
Counting the teacher's forward passes, a third of a 15B training step per distillation token, gives about 1.77x (computed). Quality held: Minitron 8B scored 63.8 on MMLU against 54.7 for Nemotron-3 8B trained from scratch on 3.8T tokens [495].
Llama-3.1-Minitron works without the original pretraining data [544]. It fine-tunes the teacher on about 100B tokens of the distillation data first (teacher correction, which cut validation loss by over 6%), then prunes Llama 3.1 8B to 4.5B and distills on 94B tokens, 160 times fewer than the parent's 15T (computed, the paper says 150). Figure 40 opens on this pipeline: compare the two dots at the top, then watch the stacked bar as you raise the teacher size or switch on teacher training.
Method and sources
The cost model is the one of Busbridge et al. (2025) with 6 FLOPs per parameter per training token and 2 per forward token, teacher correction follows Sreenivas et al. (2024), and every FLOP count, share and H100-hour figure (at an illustrative 40% MFU) is computed in this guide. Presets follow Minitron (Muralidharan et al. 2024, Sreenivas et al. 2024), Gemma 2 (Gemma Team 2024), the Llama 3 configurations (Grattafiori et al. 2024) and the llm.c reproduction of GPT-2 (Karpathy 2024). Values marked illustrative, such as the 27B teacher for Gemma 2 9B, are example settings rather than published ones.Teacher correction: FLOPs. Distillation on 94B tokens: student , teacher forwards . The total, , is 46 times less than the of training a 4.5B model on 15T tokens (computed). Teacher correction is 54% of it, so skip that step if you still have the pretraining data.
On equal tokens, Llama-3.1-Minitron 4B Depth scored 16.8% on GSM8K against 41.2% for the width-pruned twin, while MMLU differed by under 2 points (58.7 against 60.5). Depth runs 2.7 times faster than the parent, width 1.8 times [544]. Knowledge benchmarks can hide lost reasoning, so test it before trading width for speed.
Sheared LLaMA learns pruning masks on 0.4B tokens and continues on 50B [545], and layer dropping with light healing removes up to roughly half of Llama-2–70B's layers [274].
Distillation alone does not save FLOPs: the teacher's forward passes can be half or more of the bill. What saves compute is starting from a pruned copy of a trained model, which skips trillions of pretraining tokens. Distillation is how that copy gets its quality back.
Table 7.8. Which way to build a domain model or a smaller model: our reading of this chapter's evidence, an opinion and not a law.
| Situation | Choice | Evidence |
|---|---|---|
| A few billion domain tokens or fewer, a target task | Fine-tune (Section 8.2). Synthesize first if knowledge must be absorbed | [527, 536] |
| 10B-1T domain tokens and a strong related base | CPT with 5-30% replay, re-warm and re-decay, pre-decay checkpoint if available | [515, 533, 207, 358] |
| New language, poor tokenization | Vocabulary extension plus CPT with 10-25% replay | [535, 537, 358] |
| Refresh with mostly old data | CPT from the minimum learning rate, two-phase blend | [528] |
| Need a smaller model and own a larger one | Prune plus logit distillation, about 0.6-2.5% of the from-scratch tokens (computed) | [495, 544, 545] |
| A teacher exists or will serve many students | Distillation pretraining | [471, 268] |
| One small model, no teacher | Train from scratch and overtrain (Section 6.5) | [471] |
| The domain dominates and tokenization differs completely | Consider training from scratch, as BloombergGPT did with a mixed corpus | [546] |
A 3B model trains with batches of 512 sequences of 4,096 tokens. How many tokens give a decay as long in steps as OLMo 2 7B's 50B-token anneal?
One step is tokens, and OLMo 2's anneal is 11,921 steps, so about 25.0B tokens (computed). The schedule is defined in steps, which is why OLMo 2 gave its 13B, with twice the batch, a 100B anneal [7].
A soup of three anneals keeps 50% of one run's noise excess loss. What pairwise correlation does the toy model imply, and what would a fourth anneal give?
gives . With , , and no number of ingredients goes below (computed). Gains need decorrelated ingredients, such as anneals with different data orders [7, 400].
Llama 3 8B has base 500,000 and and trains at 8,192 tokens. Under YaRN with and , how many rotary pairs are untouched, blended and fully interpolated?
Untouched pairs make over 32 turns, so is under 256 tokens: pairs 0–18 (19). Fully interpolated pairs make under one turn, so is over 8,192: pairs 35–63 (29). Pairs 19–34 (16) blend (computed from ) [507].
With 25% compute-equivalent replay on the 200B-token German shift, how many German tokens does the 405M model see, and what share of the 1.39-nat forgetting does replay remove?
150B German and 50B Pile tokens. Replay removed 1.23 of the 1.39 nats, (computed), and matched the average loss of retraining on both datasets [358].
Four 1.2B students share one set of stored logits from an 8B teacher. What share of each student's FLOPs is the teacher's?
The teacher's forward pass, FLOPs per token, is paid once and split four ways: per student token against of student training, so 36%, against 69% for one student (computed, storage ignored). Reuse is how distillation pays [471].
- The decay phase writes the final model. Decaying the learning rate removes the SGD noise floor, and data seen while it falls carries the most weight. A WSD decay over 10–25% of steps to near zero is the robust default [354, 353, 359].
- Midtraining puts scarce curated data (math, code, instruction and reasoning traces) into that window at 10–35% of a mix that keeps about half high-quality web. OLMo 2 7B went from 24.1 to 67.5 on GSM8K with 3.7% of its tokens, and the data, not the decay alone, made the math gain [7].
- An anneal is a cheap experiment: Llama 3's 40B-token probe is 0.27% of a 15T-token 8B run, and an OLMo 3-style microanneal plus its 10B web-only baseline 0.13% (computed). Read it against binomial noise, about 3.5 points on 200 questions, and check it again after SFT.
- Averaging anneals keeps of the noise part of the excess loss, when different data orders make them independent. Correlated checkpoints gain little, and a soup can still regress one metric [400, 7].
- Midtraining data is where contamination concentrates. Decontaminate every split of every benchmark, and treat benchmark training sets in the anneal as training on the test task [12, 499, 6].
- Train short, extend late: at 128K a Llama 3 8B token costs 2.88 times an 8K token (computed). PI slows all rotary pairs, NTK-aware mostly the slow ones, YaRN fully slows those under one turn per window and partly those with 1–32 turns, and ABF raises the base and trains [509, 507, 505].
- Claimed context is not effective context. Llama 3.1 8B claims 128K, passes RULER to 32K and NoLiMa only to 1K [519, 520]. Advance extension stages only when short evaluations recover and long ones pass.
- From an existing checkpoint: re-warm, re-decay and replay for a new domain (1–5% for a weak shift, about 25% for a new language), and prune plus logit-distill for a smaller model (Minitron: 94B tokens instead of trillions). Distillation alone saves no compute, and the teacher can be most of the bill [358, 495, 471].
8. Post-training I: instruction tuning, preferences and RLHF
Post-training changes which behaviors a pretrained model reliably produces. Demonstrations teach the response; preferences rank alternatives; reward optimization changes what the policy samples. The data format and the exact loss decide which of those lessons reaches the weights.
A base model, a pretrained model before any further training, predicts the next token of web text. To it a question is only a prefix, and nothing in pretraining says "answer helpfully, then stop". Llama 3 defines post-training as "any model training that happens outside of pre-training" [6], and Lambert frames it as eliciting behaviors the base model already has [547]. The running examples and the notation are introduced in Section 0.3.
Labelers preferred outputs of the 1.3B InstructGPT model to outputs of the 175B GPT-3, a model with over 100 times more parameters [8]. The 175B InstructGPT was preferred to 175B GPT-3 85 ± 3% of the time, and to a few-shot prompted 175B GPT-3 71 ± 4% of the time [8] (reported). Training the 175B SFT model took 4.9 PF/s-days (petaFLOP/s-days) and the 175B PPO-ptx model 60, against 3,640 for GPT-3 [8]: 0.13% and 1.6% of the pretraining compute. DeepSeek-V3 spent 0.18% of its GPU-hours on post-training, research and ablations excluded [2] (all computed in Section 0.2). Generating data is cheap too: a million Llama 3 405B rejection-sampling prompts at cost about 0.075% of the pretraining run (computed in Section 8.8). Post-training budgets are set by people and iteration speed, not by FLOPs.
InstructGPT's three stages, fed from one prompt pool, are the skeleton: supervised fine-tuning on about 13k prompts, a reward model on 33k and PPO on 31k [8]. Later recipes swap parts: DPO replaces PPO, verifiable rewards replace the reward model for math and code (Chapter 9), and the loop repeats, six rounds in Llama 3 [6]. Step through Figure 41 and watch the memory bar jump when a stage holds several models.
Method and sources
The panel lists each stage's data, objective, settings and reported compute as the papers give them. The bar shows the model state the stage would hold if it ran on Llama 3 8B, computed at 16 bytes per trained and 2 per frozen parameter with every auxiliary model the same size as the policy, without activations, KV cache or sharding.The chapter follows the chain: imitation in Sections 8.1 to 8.3, rewards and their failures in 8.4 to 8.6, then DPO, recipes and safety in 8.7 to 8.9.
8.1 What post-training teaches: format, skills and the superficial alignment hypothesis
If pretraining already put the knowledge in, what is left for post-training to teach, and how much data does it take? LIMA fine-tuned LLaMA 65B with the standard supervised loss on 1,000 curated prompts and responses, about 750,000 tokens, with no reinforcement learning or preference model [548]. Its authors stated the superficial alignment hypothesis: "A model’s knowledge and capabilities are learnt almost entirely during pretraining, while alignment teaches it which subdistribution of formats should be used when interacting with users" [548]. Raters found LIMA's answers equivalent or preferred to GPT-4's in 43% of cases [548] (reported). The compute for epochs over tokens, masked prompt tokens included, is
LIMA trained 15 epochs [548]: FLOPs, against for pretraining on 1.4T tokens [46], a ratio of (computed).
Token-level evidence agrees. On Llama 2 chat's answers, 77.7% of tokens were also the base model's top choice and 92.2% were in its top three, and the few shifted tokens were mostly stylistic [549].
The strong form still breaks. Skills keep scaling with data: Tülu 3's models "continue to improve on average as more SFT data is included" [550]. And they depend on the base: the same mix gives GSM8K and MATH scores of 76.2 and 31.5 on Llama 3.1 8B, 91.1 and 53.7 on Llama 3.1 70B, and 86.3 and 56.4 on Qwen 2.5 Math 7B [550] (reported).
LIMA's 1,000 examples were single-turn, and in 6 of 10 live conversations it failed to follow the prompt within three interactions. Adding 30 multi-turn dialogue chains raised the share of excellent responses from 45.2% to 76.1% [548]. SFT generalizes within the formats it has seen, so every new interaction shape (multi-turn, tools, long documents, a thinking mode) needs some examples of its own.
An older lineage converted academic datasets into instructions: FLAN on over 60 datasets [551], T0 [552], Super-NaturalInstructions with 1,616 tasks [553] and the Flan collection with 1,836 [554]. Whether this helps small models is contested. FLAN found it hurt at 8B and below [551], while the Flan collection reports held-out gains rising log-linearly with task count [555]. Our untested reading is that the mixture made the difference.
Chat data won, and InstructGPT shows why. On real API prompts it won 73.4 ± 2% of comparisons against the baseline, against 26.8 ± 2% and 29.8 ± 2% for GPT-3 tuned on T0 and FLAN data, because classification and QA were only about 18% of API use [8]. Imitation has a ceiling too: models tuned on ChatGPT outputs "close little to none of the gap from the base LM to ChatGPT on tasks that are not heavily supported in the imitation data" [556]. Evaluate SFT on capability, not only on style (Chapter 10).
A few thousand examples buy the assistant format, tone and stopping behavior. Benchmark skills keep scaling with targeted data and with the base model. Knowledge comes from pretraining.
8.2 Supervised fine-tuning in practice: data, templates and the loss
What exactly do you train on in SFT, and which implementation details silently change the result? Supervised fine-tuning (SFT), or instruction tuning, is next-token training on curated prompt and response pairs with the loss on the responses only. Its data, token format and loss bookkeeping each hide a failure mode.
Where the data comes from
SFT data has had three eras. First, human demonstrations: InstructGPT trained on 12,725 SFT prompts, 11,295 written by labelers, so 88.8% (computed) [8]. Llama 2 stopped at 27,540 annotations because its own SFT model's samples "were often competitive with SFT data handwritten by human annotators" [229]. Second, distillation from stronger models: Self-Instruct grew 175 seed tasks into about 52k instructions [557], Vicuna trained on 70K shared ChatGPT chats [558], and over 98% of Nemotron-4 340B's alignment data was synthetic [291]. Third, sampling from the model being trained and filtering, as Llama 3 does every round [6] (reasoning traces are in Section 9.4).
Choice beats volume. In QLoRA's study, more data moved MMLU by at most 0.5 points while the choice of dataset moved it by up to 8 [76].
A worked mix: Tülu 3
Tülu 3's SFT mix holds 939,344 prompts [550], decontaminated (cleaned of benchmark overlap) by 8-gram matching on prompts [550] (Section 10.5). Removing one data source at a time from the 8B mix (single runs) cut IFEval from 72.8 to 53.6 without the persona data, GSM8K from 76.2 to 64.1 and MATH from 31.5 to 23.5 without the math data, the safety average from 93.1 to 74.7 without the safety data, and AlpacaEval 2 from 12.4 to 7.5 without WildChat [550]. For scale, five 8B training seeds span 59.8 to 60.1 on the average score and three 70B seeds span 70.0 to 72.6 [550]. The paper reports seed spread only for the average, so single-benchmark changes of a point or two are not clearly signal. In Figure 42, look at the outlined cells: each slice protects its own skill while other cells move by less than 3 points.
Method and sources
Removing persona-generated instruction-following data costs 19.2 points of IFEval, removing math data costs 12.1 points of GSM8K and 8.0 of MATH, removing safety data costs 18.4 points of the safety average, and removing WildChat costs 40% of the AlpacaEval 2 score, while the other cells move by less than 3 points, most by less than 2. Changes are ablated minus full-mix scores computed from Table 10 of Lambert et al. (2024), single runs. Five 8B seeds of the full mix span only 0.3 points on the average (Lambert et al., Table 14), but the paper reports no per-benchmark seed noise, so read changes under about 2 points as noise.Chat templates and loss masking
A chat template is the exact token format of a conversation. Llama 3 uses special header and termination tokens [6], with <|eot_id|> ending each message [559]. Loss masking zeroes the loss on tokens the model should not produce, so here only the last line carries loss.
<|begin_of_text|><|start_header_id|>system<|end_header_id|>
Be concise.<|eot_id|><|start_header_id|>user<|end_header_id|>
Capital of France?<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Paris.<|eot_id|> # loss here only
Render training data with add_generation_prompt=False [560] and serve with the template you trained on: template variants alone moved Tülu 3's average between 51.6 and 53.0 [550]. Masking prompts is the norm [6], with one exception: for long instructions with short outputs, loss on the instructions helped [561]. A Llama 3 SFT example averages 846.1 tokens with 310.4 in the final response [6], so only of the tokens you pay for carry loss (computed).
Packing and the loss
Packing concatenates examples into fixed-length rows to avoid padding. They must stay independent, which DeepSeek-V3 does with "a sample masking strategy to ensure that these examples remain isolated and mutually invisible" [2]: a block-diagonal attention mask and position ids that restart per example. With the mask on assistant tokens, the loss is
Both sums run over the whole global batch, every micro-batch and data-parallel rank. Loss aggregation, how token losses are combined, sets each example's weight. Tülu 3 traced a gap between two trainers to "Averaging the loss across padding tokens without taking into account gradient accumulation or distributed training setups" [550]. For two examples with summed losses and token counts :
Token weights are in the first and in the second, so "in the second case we weight each example equally, while in the first we weight each token equally" [550].
Pair a 10-token response with mean loss 2.0 and a 1,000-token response with mean loss 1.0 (illustrative). The token mean is . Naive accumulation with one example per micro-batch computes the per-example mean, . The short response's share of the loss weight goes from to 50%, about 50 times more per token (computed), so changing accumulation steps or ranks silently changes the data mixture. Tülu 3 fixed this by summing the loss instead of averaging it, which weights every token equally but requires retuning the learning rate [550]. Dividing the summed loss by the token count of the whole global batch gives the same equal weighting at a stable scale.
The fix is a few lines, and its unit test is that one micro-batch of eight sequences and eight micro-batches of one give the same gradient.
import torch.nn.functional as F
def train_step(model, opt, micro_batches):
# labels: input_ids shifted left by one, -100 on non-assistant tokens
Z = sum(int((mb["labels"] != -100).sum()) for mb in micro_batches)
# data parallel: all-reduce (sum) Z over ranks, and divide by
# Z / p_dp if the framework averages gradients over ranks
for mb in micro_batches:
logits = model(mb["input_ids"]).logits # [b, s, V]
nll = F.cross_entropy(logits.flatten(0, 1), mb["labels"].flatten(),
ignore_index=-100, reduction="sum")
(nll / Z).backward() # weight 1/Z per loss token
opt.step()
opt.zero_grad()
Hyperparameters and checkpoint selection
SFT learning rates sit about 8 to 60 times below pretraining peaks: Llama 3 405B pretrains at and its largest models fine-tune at [6], while Tülu 3 fine-tunes Llama 3.1 8B, pretrained at a peak of , at [6, 550] (ratios computed). Table 8.1 collects published settings, which transfer between trainers only if loss reduction, batch and sequence length match. Tülu 3's 8B run took 32 GPUs for 6 hours [550], 192 GPU-hours (computed).
Table 8.1. Published SFT settings (all reported). Blank cells are not stated in the source.
| Recipe | Model | Peak LR | Schedule | Batch | Epochs or steps | Max length | Source |
|---|---|---|---|---|---|---|---|
| InstructGPT | GPT-3 1.3B, 6B | 9.65e-6 | cosine to 10%, no warmup | 32 | 16 epochs | [8] | |
| InstructGPT | GPT-3 175B | 5.03e-6 | cosine to 10%, no warmup | 8 | 16 epochs | [8] | |
| LIMA | LLaMA 65B | 1e-5 to 1e-6 | linear, no warmup | 15 epochs | [548] | ||
| Llama 2-Chat | Llama 2 | 2e-5 | cosine | 64 | 2 epochs | 4,096 | [229] |
| Zephyr dSFT | Mistral 7B | 2e-5 | cosine, 10% warmup | 512 | 1 to 3 epochs | 2,048 packed | [562] |
| Llama 3 | largest models | 1e-5 | 8.5K to 9K steps | [6] | |||
| Tülu 3 | Llama 3.1 8B | 5e-6 | linear, 3% warmup | 128 | 2 epochs | 4,096 | [550] |
| Tülu 3 | Llama 3.1 70B | 2e-6 | linear, 3% warmup | 128 | 2 epochs | 4,096 | [550] |
| DeepSeek-V3 | 671B MoE | 5e-6 to 1e-6 | cosine | 2 epochs | packed | [2] | |
| Qwen2.5 | Qwen2.5 | 7e-6 to 7e-7 | decay | 2 epochs | 32,768 | [286] | |
| Olmo 3 Think | 7B | 5e-5 | 1M tokens | 2 epochs, 45.4B tokens | 32K | [12] |
Do not pick checkpoints by validation loss. InstructGPT's SFT models "overfit on validation loss after 1 epoch", yet more epochs improved human preference [8], and LIMA found that "perplexity does not correlate with generation quality" [548]. Select on sampled answers instead.
In early rounds trained on model-generated data, Meta saw "excessive use of emojis or exclamation points" and overused apologetic phrases, and rebalanced the data [6]. When targets come from your own model, stylistic tics compound round over round. Track phrase frequencies across rounds the way you track loss.
Two more traps. Judge-only gains may be length, as with NEFTune's jump from 29.79% to 64.69% on AlpacaEval [563] (Section 10.6). And forgetting tracks the KL shift from the base [564], so mix general data into domain SFT.
How to do it yourself. Start from an open mix such as Tülu 3's, decontaminate against your benchmarks, render with your serving template, mask non-assistant tokens, pack with per-example masks, normalize over the global batch, train 2 epochs near at batch 128 for an 8B model, run two or three seeds and select by generation quality.
8.3 Parameter-efficient fine-tuning: LoRA, QLoRA and merging
Can you adapt a model by training a tiny fraction of its weights, and what do you give up? Full fine-tuning with mixed-precision Adam holds about 16 bytes per parameter (Section 1.4), 119.7 GiB for Llama 3 8B and 1,051 GiB for 70B (computed). Low-rank adaptation (LoRA) trains a small update instead, and on GPT-3 175B it cut trainable parameters 10,000 times and training memory from 1.2 TB to 350 GB [565].
The mechanism and its arithmetic
Freeze the weight and learn a rank- update. In this section is the LoRA rank, not a reward, and is a scale constant:
starts Gaussian and at zero, so training starts exactly at the base model, and the authors "simply set α to the first r we try and do not tune it" [565]. After training, fold into and serve with no extra latency. Each adapted matrix adds parameters [565]:
Llama 3 8B has , and 8 KV heads of 128, so K and V project to 1,024 [6, 17]. Attention adds per layer and the MLP , so in all. At rank 16 over 32 layers that is M parameters, 0.52% of the 8.03B (computed). This reproduces Thinking Machines' four Llama 3.1 8B counts of 0.49B, 0.25B, 0.70B and 0.24B [566] only if the output head is also adapted, which the post does not state (computed).
FLOPs fall by about a third, not 99%, because a frozen matrix skips only its weight gradient: multiply-adds for a matrix against , slightly more than two thirds [566]. With weights in matrix multiplies (linear layers and output head), LoRA costs FLOPs per token against :
That is 0.675 for a 4,096-wide square matrix at rank 16 and for the whole 8B model, ignoring attention scores (computed). Measured on GPT-3 175B: 43.1 against 32.5 tokens/s per V100 [565], 1.33 times faster (computed).
When it matches full fine-tuning
Adapt every linear layer. QLoRA found "LoRA on all linear transformer block layers are required to match full finetuning performance" [76], and Thinking Machines that "Attention-only LoRA significantly underperforms MLP-only LoRA". Configured that way, "LoRA performs the same as full fine-tuning" for small-to-medium instruction and reasoning sets, though it tolerates large batches less well, and for policy-gradient RL it matches "even with ranks as low as 1" [566]. The limit: full fine-tuning wins at continued pretraining on code and math and learns updates of 10 to 100 times higher rank, while LoRA forgets less [530].
Policy-gradient RL delivers about one bit per episode. Thinking Machines' MATH run of about 10,000 problems with 32 samples each "only needs to absorb 320,000 bits" [566], while rank-1 LoRA on every linear layer of Llama 3 8B has M parameters (computed). Continued pretraining on billions of tokens carries far more than an adapter can store, so LoRA learns less there [530]. SFT sets sit in between.
The optimal LoRA learning rate is about 10 times the full fine-tuning rate, with a fitted multiplier of 9.8, at with the scale [566]. Under the best rate barely moves with rank [566], and rsLoRA argues for instead [567].
QLoRA
QLoRA trains LoRA adapters on a frozen 4-bit base. Regular 16-bit fine-tuning of a 65B model needs more than 780 GB of GPU memory, and QLoRA brings it under 48 GB [76]. NF4 stores each weight as one of 16 levels at normal quantiles, with a scale per block of 64. Double quantization cuts those scales from 0.5 to 0.127 bits per parameter, and paged optimizers absorb memory spikes [76]:
The Llama 3 70B base then takes bytes = 33.9 GiB if every parameter is quantized, or about 36.8 GiB if the embedding and output head stay in 16-bit (computed). QLoRA's defaults are rank 64, and all linear layers [76]. DoRA splits each pretrained weight into a magnitude and a direction, trains both and applies LoRA to the direction [568]. None of this chapter's recipes use it. In Figure 43, try the "QLoRA on 70B" preset and watch the bar drop under the 80 GB line.
Method and sources
The bars compare model state for full fine-tuning and for LoRA or QLoRA, and the second panel shows trainable parameters for each placement at the chosen rank against a 1% line. The calculator counts adapter parameters as r(d_in + d_out) per adapted matrix, sizes model state at 16 bytes per trained parameter and at 2, 0.56 or 0.52 bytes per frozen one (bf16, NF4, NF4 with double quantization), and estimates linear-layer FLOPs as 2/3 + P_LoRA/N_mm of full fine-tuning. All values are computed. Activations, KV cache and framework overhead are excluded, and the NF4 modes quantize every base parameter unless the embedding table and output head are kept in bf16. Configurations come from the Llama 3 paper (Grattafiori et al. 2024) and the released configs, the method from Hu et al. 2021, Dettmers et al. 2023 and Thinking Machines (Schulman et al. 2025), whose parameter table the calculator reproduces only when the output head is also adapted. The 16 bytes per parameter follow Rajbhandari et al. 2019.Rank 16 on all linear layers, 16 bytes per trained parameter, 2 per frozen bf16 parameter, no activations, computed from the configurations [6, 17] and the bit counts above.
Table 8.2. Trainable parameters, model state and linear-layer FLOPs for full fine-tuning, LoRA and QLoRA (computed).
| Llama 3 8B | Llama 3 70B | |
|---|---|---|
| Base parameters | 8.03B | 70.55B |
| LoRA rank 16, all linear layers | 41.9M (0.52%) | 207.1M (0.29%) |
| Full fine-tuning model state | 119.7 GiB | 1,051 GiB |
| LoRA: bf16 base + adapter state | 15.0 + 0.6 GiB | 131.4 + 3.1 GiB |
| QLoRA: NF4 + DQ base + adapter state | 3.9 + 0.6 GiB | 33.9 + 3.1 GiB |
| Linear-layer FLOPs vs full | 0.672 | 0.670 |
A 70B QLoRA run holds 37.0 GiB and fits one 80 GB (74.5 GiB) GPU. A 70B full fine-tune holds 1,051 GiB (1,129 GB), so it needs at least such GPUs for model state alone (computed). ZeRO's three stages and FSDP are in Section 11.2.
Merging
A task vector is fine-tuned minus pretrained weights. Adding task vectors combines skills, and negating a toxicity vector cut toxic generations from 4.8% to 0.8% [569]. TIES-Merging averages only each vector's top 20% of entries whose signs agree [570]. Llama 3 averages variants at each reward-model, SFT and DPO stage [6], while Tülu 3's best soup only matched its best seed [550]. Weight averaging and soups are explained in Section 5.7.
The usual mistakes:
- Adapters on attention only.
- The full fine-tuning learning rate. Start near 10 times it.
- Very large batches.
- Expecting an adapter to absorb continued-pretraining volumes of data.
- Merging an adapter into a quantized base, which changes the numerics you evaluated.
- Merging checkpoints with different tokenizers or chat templates.
8.4 Preferences and reward models
How do you turn "A is better than B" into a number a model can optimize, and how good can that number be? You train a second network, the reward model, so that the gap between its scores for two responses predicts which one a person would pick. Comparing is easier than demonstrating: a labeler who could not write the ideal answer can still tell which of two drafts is shorter and still correct.
Christiano et al. learned control rewards from comparisons on "less than 1% of our agent’s interactions" and taught a simulated hopper a backflip with 900 queries [571]. Stiennon et al. found that doubling the comparison data added about 1.1% reward-model accuracy and doubling the model about 1.8% (reported) [572], and Anthropic found that "ranked preference modeling performs much better than imitation learning" [573].
The Bradley-Terry model
Give every response a hidden strength. The Bradley-Terry model says the chosen response beats the rejected response with probability equal to the logistic function of the strength gap [574, 571]. The reward model supplies the strengths and is fit by maximum likelihood:
where is the reward margin. In practice is the SFT transformer with a scalar head, read at the last token [8]. The table shows two properties. The gradient shrinks as the margin grows, so confidently ordered pairs stop teaching. And only differences enter the loss, so the reward has no fixed zero and is recentered or whitened before RL.
Table 8.3. What a Bradley-Terry reward margin means (computed).
| Margin | Loss | Gradient size | |
|---|---|---|---|
| 0 | 0.500 | 0.693 | 0.500 |
| 0.5 | 0.622 | 0.474 | 0.378 |
| 0.96 | 0.723 | 0.324 | 0.277 |
| 2 | 0.881 | 0.127 | 0.119 |
| 3 | 0.953 | 0.049 | 0.047 |
Collecting comparisons
InstructGPT labelers ranked 4 to 9 responses per prompt, so a ranking of responses yields , or 6 to 36, comparisons (computed). All comparisons from one prompt share a batch element, up to 2,304 per batch, training runs one epoch because "multiple epochs quickly overfit the model", and a 6B reward model served even the 175B policy [8]. At 2,000 comparisons Gao et al.'s reward models reached a validation loss of 0.686 against a coin flip's (reported) [575].
Llama 2 trained separate helpfulness and safety reward models on 1,418,091 comparisons, with a margin term that grows with the labeler's stated preference strength. It raised accuracy on "significantly better" pairs from 79.1% to 80.7% but the average only from 62.5% to 62.9% (reported) [229]. Llama 3 dropped the margin, citing "diminishing improvements after data scaling", and kept only pairs labeled "significantly better" or "better" [6]. Reward-model accuracy decays as the policy moves, so each round labels fresh samples [229].
How much do labelers agree?
Most InstructGPT comparisons had a single labeler, for cost reasons. Training labelers agreed with each other 72.6 ± 1.5% of the time, and the reward models predicted training-group labelers at 72.4 ± 0.4% and held-out labelers at 69.6 ± 0.9% (reported) [8]. Is that near the ceiling? Suppose each label is the true preference flipped independently with probability . Two labelers agree with probability , so
With , , so . About 16% of labels are flipped, and even a perfect reward model would match single labels only about 84% of the time (computed). Disagreement concentrates on close pairs [229], so this is rough. For scale, Bradley-Terry gives 0.724 at a margin of (illustrative: accuracy does not fix a typical margin). Accuracy against noisy labels understates accuracy against the truth: a measured 72.4% is against the true preference (computed, if model errors are independent of label flips). Measure on pairs with several labels each and near-ties dropped, so you can tell label noise from reward-model error before you choose between cleaner labels and a bigger reward model.
Is an accurate reward model a good teacher?
RewardBench scores reward models on 2,985 prompt, chosen and rejected trios across chat, reasoning and safety, where guessing scores 50% [576, 577]. The leaders are curated: HelpSteer2 reached 92.0% with ten thousand pairs [577]. But accuracy is not teaching quality. Razin et al. show that "even a perfectly accurate reward model can lead to extremely slow optimization" if its rewards barely vary across the policy's samples [578], and moderately accurate reward models have trained better policies than highly accurate ones [579].
When the labeler is a model
Constitutional AI has a model apply written principles to label harmlessness, and mixed 182,831 such AI comparisons with 135,296 human helpfulness ones [580]. RLAIF matched RLHF on summarization (71% against 73% preferred over SFT) and dialogue (63% against 64%) at over 10x lower labeling cost (reported) [581]. Generative reward models write a judgment before scoring: GenRM lifted best-of-N on GSM8K from 73% to 93.4% [582], though zero-shot judges trail Bradley-Terry models in distribution by 9–36% [583]. Newer work writes rewards as rubrics or checklists [584, 585]. Judge biases are in Section 10.6.
8.5 Optimizing the reward: best-of-n, rejection sampling and PPO
Given a reward model, how do you move the policy toward higher reward without breaking it, and what does each method cost? Every method here optimizes expected reward minus a penalty for drifting from the reference policy , usually the SFT model [586],
with the KL coefficient. The penalty keeps text fluent and the policy where the reward model was trained. InstructGPT used for 256k episodes, plus a pretraining log-likelihood term (PPO-ptx) against benchmark regressions [8].
Best-of-n: no training at all
Sample responses and return the one the reward model likes best. With continuous rewards and distinct samples, the winner's density is times the reference density, where is the reward's cumulative distribution, and of the winner has . So [572, 575]
which is 0.19 nats at , 1.84 at 16, 5.91 at 1,000 and 10.0 at 60,000 (computed). It grows like , so best-of- is a cautious optimizer. The formula is an upper bound [587]: with two equally likely responses no selection can move more than nats, while the formula gives 1.40 at (computed).
Rejection-sampling fine-tuning
Rejection-sampling fine-tuning moves best-of-'s serving cost into training: sample, keep the best, fine-tune on the winners, repeat [588, 589]. Llama 2 used only this until its fourth RLHF version, then added PPO on top [229]. Llama 3 samples (the paper's ) between 10 and 30 responses per prompt [6], so the kept responses sit at most 1.40 to 2.43 nats from the sampling policy (computed). That bounds the selection step, not the model fine-tuned on it.
PPO in its RLHF form
Proximal policy optimization (PPO) treats generation as an episode. The state is the prompt plus the tokens so far, , the action is the next token, and the reward model's score arrives at the end-of-sequence (EOS) token. The KL penalty is spread over tokens as log-ratios:
Summed over tokens this is a one-sample estimate of the objective. That log-ratio estimator is unbiased but "negative for half of the samples", while has "much lower variance" but is biased [590]. His is unbiased and had lower spread still in his test [590]. PPO maximizes a clipped surrogate, "a pessimistic bound on the unclipped objective" [591], with advantages from a value model through generalized advantage estimation (GAE) [592]:
RLHF runs use , discount and , and initialize the value model from the reward model [593, 575]. Section 9.2 derives the policy gradient behind this.
Four models and their cost
PPO-RLHF "typically needs to load 3–4 models into the GPU memory" [593]: the trained policy and value model, and the frozen reference and reward model. With all four of size and PPO epochs, each generated token costs four forwards at and, per epoch, two training passes at :
plus if a separate inference engine generates and the policy re-scores the rollouts.
Assume all four models have parameters. InstructGPT used a 6B reward model and value model for every policy [8], so this choice is ours. Trained models need 16 bytes per parameter (Section 1.4), 128.5 GB each, and frozen BF16 models 2 bytes, 16.1 GB each. The total, GB (269 GiB) before activations, is 2.25 times SFT, at least four 80 GB GPUs. At 70B it is GB, at least 32 GPUs (computed).
One epoch costs FLOPs per token. A run of 256k episodes at an illustrative 512 tokens is tokens and FLOPs, of the of pretraining on 15T tokens, or 15 GPU-hours at an illustrative 400 TFLOP/s, about 40% of the 989.5 peak (computed). Real runs take far longer since decoding is bandwidth bound (Section 13.2): Llama 2 reports about 330 seconds per 70B PPO iteration [229].
Table 8.4. PPO settings in published RLHF systems (reported).
| System | KL coefficient | Clip | Batch / minibatch | Length of training | Source |
|---|---|---|---|---|---|
| Ziegler et al. 2019 | adaptive: steered toward a target KL by a controller with gain | - | - | - | [594] |
| InstructGPT 2022 | 0.02 | 0.2 | 512 / 64 | 256k episodes | [8] |
| Anthropic HH 2022 | 0.001 | - | - | - | [595] |
| Llama 2-Chat 2023 | 0.01 (7B, 13B), 0.005 (34B, 70B) | 0.2 | 512 / 64 | 200-400 iterations | [229] |
| Huang et al. 2024 | 0.05 | 0.2 | 512 / 512 (one minibatch), 4 PPO epochs | 1M episodes | [593] |
The details that decide whether it works
"The reward scores and training losses do not indicate whether the PPO is optimizing correctly", so Zheng et al. monitor perplexity, response length and KL to the SFT model. Their collapsed runs gave longer responses with lower perplexity [596].
Huang et al. rebuilt the Reddit summarization pipeline in the open and listed over 20 implementation details that mattered [593]. Many are data plumbing, not PPO math: append a real EOS token and never reuse it as padding, give completions with no EOS a constant reward of -1, and turn dropout off, because with it "the log probabilities of tokens will not be reproducible" [593]. Two over-optimized 1B runs reached KL of about 50 and 85 nats, and GPT preferred them to the reference summaries less than 20% of the time [593]. Log samples and KL often: the reward curve looks fine either way.
This fragility is why Llama 3 chose rejection sampling and DPO over RL methods "that tend to be less stable and harder to scale" [6]. Section 8.8 weighs the evidence.
8.6 When the reward is wrong: over-optimization, length bias and sycophancy
How far can you optimize a learned reward before true quality falls, and what does the policy learn when the reward is subtly wrong? A reward model is a proxy. Push against it and the proxy keeps rising while true quality rises, peaks and falls (Goodhart's law).
Gao, Schulman and Hilton let a fixed "gold" reward model, the 6B InstructGPT one, stand in for humans. It labeled 100,000 synthetic comparisons, proxy reward models of 3M to 3B parameters learned from them, and a 1.2B policy was optimized against each proxy by best-of- and by PPO with no KL penalty [575]. With , the distance in which Bai et al. found reward to grow roughly linearly [595], the gold reward fits
for best-of- and RL [575]. These and are fit coefficients, not the KL coefficient: is how well the proxy points uphill, how fast proxy and gold part ways. The best-of- form held up to , about 10 nats [575]. Setting each derivative to zero gives the peaks:
The paper prints no coefficients, so we read them off its Figure 3 (digitized from the paper's figure, approximate) and fitted the shared ourselves, assuming a natural log. The paper's Figure 12 caption calls the maximum gold score, but it is the peak's location [575].
Table 8.5. Where Gao et al.'s fitted curves peak for three proxy sizes (coefficients digitized, peaks computed).
| Proxy | Best-of-n peak KL (nats) | Gold | RL peak KL (nats) | Gold | RL zero (nats) | ||||
|---|---|---|---|---|---|---|---|---|---|
| 3M | 0.491 | 0.120 | 0.175 | 4.2 | 181 | 0.50 | 10.5 | 0.57 | 78 |
| 85M | 0.598 | 0.107 | 0.137 | 7.9 | 7,100 | 0.84 | 35 | 0.81 | 259 |
| 3B | 0.663 | 0.090 | 0.118 | 13.5 (extrapolated) | 2.1M | 1.22 | 85 | 1.09 | 630 |
Bigger reward models push the peak further out and higher. And "RL is far less KL-efficient than BoN" [575]: RL peaks at roughly 10 to 85 nats and best-of- at 4 to 14, at similar gold scores. A KL number means little without its method. In Figure 44, move the size slider and watch the peak markers slide right and up, then compare the shaded Llama 3 band near 2 nats with RL's peak far to the right.
Method and sources
RL peaks at roughly 10 to 85 nats and best-of-n at 4 to 14 nats (beyond 10 extrapolated), at similar gold scores. Peaks are computed in this guide from coefficients digitized from the paper's Figure 3, and the RL slope α ≈ 0.38 is fitted in this guide because the paper does not print it, so treat second digits as approximate. The shaded band is the upper bound on the KL of the best-of-K selection step in Llama 3 rejection sampling with K = 10 to 30 (Grattafiori et al. 2024, bound from Beirami et al. 2024), and the two ticks on the axis mark over-optimized 1B PPO runs on Reddit post summarization from a different setup (Huang et al. 2024).We use the four-digit digitized coefficients behind Table 8.5. Best-of-: , a peak at nats, which reaches at , with gold . RL: , or 35 nats, with gold , and the fit returns to zero near nats, an extrapolation. RL spends times the KL for a similar peak. Llama 3's selection spends at most 2.43 nats, , which with the 3M proxy gives of its 0.50 peak (all computed).
What the KL penalty does, and what helps
In Gao et al.'s runs "the effect of the penalty on the gold score is akin to early stopping" [575]. Llama 2 found it "useful for training stability, and to reduce reward hacking" [229], while Anthropic thought its 0.001 penalty "might actually be wholly unnecessary" [595]. They fit together: the KL term limits which policies are reachable but is a weak substitute for a better reward model. Retraining the reward model on fresh samples over rounds adds gold reward in proportion to under Gao et al.'s assumptions [575], though real iteration dynamics remain "poorly understood" [597].
Taking the minimum over an ensemble of reward models "practically eliminates overoptimization" for best-of- in a synthetic setup with 25% label noise [598]. Under real distribution shift, ensembles over pretraining seeds beat ones over fine-tuning seeds, but hacking persists [599]. Averaging reward-model weights (WARM) gave a 79.4% win rate over a single reward model [600]. DPO-style methods over-optimize too [601] (Section 8.7).
Length bias
The commonest shortcut is length. Singhal et al. found that "even a purely length-based reward reproduces most downstream RLHF improvements" [602]: length-only PPO's simulated win rate over the SFT model was 56% against standard PPO's 58% on WebGPT, and 64% against 63% on RLCD. Splitting each reward gain into within-length-bucket and length-shift parts, they attribute 70% to 90% of it on WebGPT and RLCD to length [602]. Stack Exchange is the exception.
Table 8.6. How much of the PPO reward gain is not length (Singhal et al. 2023, reported). Shares come from unrounded values, so 0.02/0.82 is not exactly 2.0%.
| Setting | PPO variant | Reward gain | Non-length gain | Non-length share |
|---|---|---|---|---|
| WebGPT | standard | 0.82 | 0.02 | 2.0% |
| WebGPT | high KL | 0.20 | 0.03 | 15.1% |
| Stack | standard | 0.89 | 0.48 | 53.4% |
| Stack | high KL | 0.67 | 0.37 | 56.5% |
| RLCD | standard | 0.94 | 0.25 | 27.2% |
| RLCD | high KL | 0.61 | 0.12 | 19.1% |
Length-controlled AlpacaEval predicts preference at zero length difference, which raised its correlation with Chatbot Arena from 0.94 to 0.98 [603]. ODIN trains a separate length head on the reward model and drops it during RL [604].
Sycophancy
Sycophancy, telling users what they want to hear, showed up in five AI assistants across four tasks. In human preference data "matching a user’s beliefs, biases, and preferences is consistently one of the most predictive features", and a preference model favored sycophantic over baseline truthful answers to misconceptions 95% of the time (reported) [605]. RLHF also raised time-limited evaluators' false-positive rate by 24.1% on QuALITY and 18.3% on APPS [606].
On April 25, 2025, OpenAI shipped a GPT-4o update that made the model "noticeably more sycophantic", and began rolling it back on April 28. The update combined several changes, among them a new reward from users' thumbs-up and thumbs-down ratings, and "in aggregate, these changes weakened the influence of our primary reward signal, which had been holding sycophancy in check". No deployment evaluation tracked sycophancy [607]. OpenAI concluded "we focused too much on short-term feedback" [608]. Every new reward signal is a new proxy with its own Goodhart curve, and only a behavioral evaluation catches it.
Watch behavior, not reward: KL to the reference, length, perplexity, held-out win rates and raw samples. RLHF also "significantly reduces output diversity compared to SFT" [609]. Reward hacking in agentic environments, which can spread to broader misalignment [610], is in Section 9.9.
8.7 Direct preference optimization and its variants
Can you reach the RLHF optimum from a fixed set of preference pairs, with a loss that looks like supervised learning, and what breaks when you do? Mostly yes. The KL-regularized objective of Section 8.5 has a closed-form optimum. Read backwards, every policy defines a reward, and in the Bradley-Terry likelihood of Section 8.4 its normalizer cancels. What remains is a logistic loss on log-probability ratios, with no sampling, reward model or value model. This is direct preference optimization (DPO) [586].
The derivation
Start from , where the KL coefficient controls how far the policy may move from the reference, usually the SFT model [586]. We assume that this objective is what we want and that preferences follow Bradley-Terry. Collecting terms, the objective equals with
The partition function does not depend on the policy [586], so if the policy can represent any distribution, the optimum is . On a six-response toy, direct optimization of the KL-regularized objective matches to four decimal places (computed). Take logs and solve for the reward:
Bradley-Terry depends only on reward differences, so cancels [586]. Replace by the trainable and fit the observed pairs by maximum likelihood, with chosen and rejected:
That step assumes finite data lands near the true optimum, which is where practice breaks. With the implicit reward , the gradient is
where . Each pair pushes the chosen response up and the rejected one down, weighted by how wrongly the implicit reward orders them. Without the weight the model can degenerate [586]. At step 0 every pair has loss (computed), the first number to check in a DPO log.
What means
Write for the log-ratio margin in nats, so the loss is . Then is a classifier temperature: an implied preference needs , which is 11.0 nats for at and 2.2 at (computed). The gradient weight starts at , but at a 20-nat margin it is 0.0119 for and for (computed). The DPO paper, Zephyr, Llama 3 and KTO default to [586, 562, 6, 611]. Read in its units. Tülu 3 divides each log-ratio by its length and uses , which scored 57.3 against 46.8 at [550] (reported). That equals a sequence-level , or 0.017 at 300 tokens (computed).
In Figure 45, move and watch how far the loss must travel before it flattens, and how the gradient weight collapses once a pair is ordered.
Method and sources
Panel B plots, for one preference pair, the DPO loss, its gradient weight divided by β, or the implied preference against the log-ratio margin between the chosen and rejected responses, for the β you choose (thick) and for β of 0.05, 0.1, 0.5 and 1 (thin). Every pair starts at a loss of ln 2 = 0.693, and at β = 0.1 an implied preference of 0.9 needs a margin of 22 nats (computed). Tülu 3's length-normalized β of 5 acts like a sequence-level β of 5/|y|, or 0.0167 for 300-token responses, assuming the chosen and rejected responses have equal length. Curves are computed from the DPO loss and gradient of Rafailov et al. (2023) and the Bradley-Terry model (Bradley and Terry 1952), with presets from Rafailov et al. (2023), Tunstall et al. (2023), Grattafiori et al. (2024) and Lambert et al. (2024), and the reward-model accuracy from Ouyang et al. (2022).Reference log-probabilities are for the chosen response and for the rejected one, with (illustrative). At step 0, , the loss is 0.693 and the weight is 0.5. Later the chosen response sits at (up 2.0) and the rejected one at (down 6.0). Now , so the loss is , the implied preference 0.69 and the weight 0.31 (computed).
A second path ends at and : the same margin and loss, yet the chosen response became less likely. Under Tülu 3's length-normalized form with and , the first path gives and a loss of 0.619 (computed).
Variants
Read the variants in Table 8.7 as patches to an assumption. IPO targets Bradley-Terry: with one label per pair every preference looks certain and the KL leash weakens [612]. KTO and ORPO cut data or the reference, SimPO and length-normalized DPO target length. Results conflict: SimPO reports up to 6.4 points over DPO on AlpacaEval 2 [613] but fell below its starting checkpoint in Tülu 3's ablation [550].
Table 8.7. Direct alignment variants by the failure they target (defaults as reported).
| Method | Loss in words | Reference model | Data | Failure it targets | Reported defaults |
|---|---|---|---|---|---|
| DPO [586] | logistic loss on the log-ratio margin | yes | pairs | baseline: the closed-form RLHF optimum | |
| IPO [612] | squared loss pulling the margin to , 5 nats at | yes | pairs | deterministic labels make the KL leash vanish | sets the target |
| KTO [611] | value of each output against a KL reference point | yes | unpaired good or bad labels | pairs are expensive and imbalanced | , weighted desirable to undesirable ratio in |
| ORPO [614] | SFT loss plus an odds-ratio penalty | no | pairs | reference memory and a separate SFT stage | 0.2 to 0.25 |
| SimPO [613] | length-averaged log-probability reward with a target margin | no | pairs | only about half of DPO's training pairs rank the chosen response higher by average log-likelihood | 2.0 to 2.5, 0.5 to 1.5 |
| Length-normalized DPO [550] | DPO with each log-ratio divided by its length | yes | pairs | length bias | per token, learning rate (8B) |
| DPO + NLL [6, 615] | DPO plus negative log-likelihood on the chosen response | yes | pairs | chosen likelihood falls, formatting drift | NLL coefficient 0.2 (Llama 3) |
R-DPO adds a length-difference term [616], DPOP penalizes a falling chosen likelihood [617], and RPO regresses the implicit gap toward a reward-model gap [291].
R-DPO adds a length penalty to the RLHF objective, repeats the derivation and gets DPO with a length-difference term [616]. Change the objective, re-derive, and read off the new loss.
What breaks
The loss sees only a difference, so it can fall while both responses become less likely. This likelihood displacement sends mass anywhere: training to prefer "No" over "Never" can raise "Yes", and in one experiment it cut Llama 3 8B Instruct's refusal rate from 74.4% to 33.4% [618] (reported). Llama 3 adds the NLL term and masks shared formatting tokens, which otherwise caused tail repetition [6]. Offline data also lets DPO exploit responses no pair covers [619], and it often degrades before one epoch ends [601], though Zephyr's best model came after three epochs [562]. Pair accuracy is not a stopping rule: judge checkpoints by held-out generations, length and refusals.
How to run it. Use the SFT model as the reference and cache its log-probabilities [550]. Train about one epoch at a learning rate 10 to 100 times below SFT, to in the DPO paper, Zephyr, Tülu 3 and Qwen2.5 [586, 562, 550, 286]. Llama 3's , equal to its SFT rate, is an outlier whose optimizer and batch are not stated, so do not transfer it [6]. Log the loss, implicit-reward accuracy, chosen and rejected log-probabilities, length and refusals, and evaluate inside the first epoch.
8.8 Online or offline, and how production recipes fit together
Is sampling during training a cost to remove or the thing that makes preference learning work, and how do real teams combine SFT, rejection sampling, DPO and RL? Mostly the latter. Keep two axes apart. Offline or online is when labels are made, before or during training. Off-policy or on-policy is who wrote the responses, another model or the policy itself. DPO on a public dataset is offline and off-policy, PPO is online and on-policy, and iterative DPO refreshes at each round. Offline data is "inevitably off-policy" because the policy moves [620].
At equal KL budget, online losses beat their offline versions, and scaling the policy does not close the gap [621]. With an LLM labeling the policy's own samples, humans preferred the online versions about 66% of the time [620], and semi-online DPO does about as well as fully online training [622]. The big step is any refresh at all. Whether PPO beats DPO depends on tuning, task and reward (Table 8.8).
Table 8.8. DPO against PPO: the published comparisons disagree (reported).
| Study | Setting | Result |
|---|---|---|
| Rafailov et al. [586] | summarization, up to 6B | DPO 61% against PPO 57% win rate |
| Llama 3 [6] | 405B production | DPO needed less compute and did better, especially on IFEval |
| Tülu 3 [550] | 8B, controlled | PPO comparable but slightly lower, 28 h on two nodes against 4 h on one, 14 times the node-hours (computed) |
| Ivison et al. [623] | Tülu 2.5 suite | PPO ahead by up to 2.5% in math and 1.2% in general, data quality matters most |
| Xu et al. [619] | tuned PPO, code | CodeContests 10@1k 22.4% against 16.4% for AlphaCode-41B |
| Pang et al. [615] | iterative DPO on own solutions, 70B | GSM8K 55.6% to 81.6%, against 63.5% for SFT on gold solutions |
The mental model: every method optimizes the same objective on paper and differs in where the loss looks. An offline loss sees only the dataset's responses and says nothing about what the policy will write. An online loss sees the policy's own samples and penalizes their errors, at the price of generation in the loop. On-policy distillation is the cheapest such signal: Qwen3 reports it beat RL at a tenth of the GPU-hours [198] (Chapter 9).
Section 8.5 works out PPO's model-state memory: 289 GB for Llama 3 8B and 2,540 GB for 70B. Table 8.9 compares it with SFT and DPO. Tülu 3's 8B DPO, 271,409 pairs in 10 hours on 8 H100s [550], implies 6 to 15% MFU for 500 to 1,200 tokens per response (computed with FLOPs per token, policy training plus reference forward, against 989.5 TFLOP/s dense BF16).
Table 8.9. Model-state memory for preference tuning, decimal GB (computed): 16 bytes per trained parameter, 2 per frozen BF16 parameter, all models the same size, no activations, KV cache or sharding.
| Model | SFT | DPO, live reference | DPO, cached reference log-probs | PPO: policy and value trained, reference and reward model frozen |
|---|---|---|---|---|
| Llama 3 8B | 128.5 | 144.5 | 128.5 | 289.1 |
| Llama 3 70B | 1,128.9 | 1,270.0 | 1,128.9 | 2,539.9 |
| Llama 3 405B | 6,493.7 | 7,305.4 | 6,493.7 | 14,610.7 |
Production recipes
Table 8.10 lines up published recipes, and Figure 41 walks Zephyr, Llama 3 and Tülu 3 stage by stage.
Table 8.10. Published post-training recipes (all values reported).
| Recipe | Stages | Preference data | Key settings | Outcome |
|---|---|---|---|---|
| Zephyr-7B (2023) [562] | distilled SFT on about 200k UltraChat dialogues, then DPO | UltraFeedback, 64k GPT-4-rated prompts: best response chosen, a random other rejected | DPO learning rate , batch 32, , 3 epochs, hours on 16 A100s | MT-Bench 7.34, above Llama2-Chat-70B. Skipping SFT cut scores sharply |
| Llama 3 (2024) [6, 73] | six rounds of reward model, rejection sampling ( of 10 to 30), SFT and DPO, averaging models at each stage | reward model on all preferences so far, DPO on the latest batches | SFT for 8.5K to 9K steps (largest models), DPO , , NLL 0.2 | DPO chosen over PPO. PagedAttention and prefix sharing more than doubled sampling throughput |
| Tülu 3 (2024) [550] | SFT, length-normalized DPO, then PPO with verifiable rewards (10 for a verified answer) | 271,409 pairs (8B), 334,302 (70B), GPT-4o-judged, on-policy responses included | DPO (8B) or (70B), per token, 1 epoch | 8B average 60.6 after SFT, 64.7 after DPO, 65.1 final |
| OLMo 2, Olmo 3 (2024, 2025) [7, 12] | Tülu 3 recipe. Olmo 3 treats DPO as contrastive learning on the chosen-rejected delta | Olmo 3: chosen from Qwen 3 32B, rejected from Qwen 3 0.6B | not compared here | RL helped more after DPO than straight after SFT |
| DeepSeek-V3 (2024) [2] | 1.5M SFT instances, then GRPO | rule-based rewards where possible, a reward model elsewhere | no critic model | rules chosen as resistant to manipulation |
| Qwen2.5, Qwen3 (2024, 2025) [286, 198] | Qwen2.5: SFT, about 150,000 DPO pairs, online GRPO. Qwen3: long chain-of-thought cold start, reasoning RL, mode fusion, general RL | Qwen2.5: resampled SFT outputs that pass or fail quality checks | Qwen2.5 DPO , 1 epoch | Qwen3's small models are distilled at a tenth of the GPU-hours |
The pattern: SFT first, on distilled or rejection-sampled data. DPO-family tuning for breadth, on pairs as on-policy as the budget allows. Online RL where rewards are hard to hack, mostly verifiers (GRPO is derived in Section 9.3). Then iterate, with learning rates falling by stage. Pairs need a large chosen-rejected delta [12], but not the worst sample: of the reward distribution beats the minimum [624], which for 100 normal samples is an outlier at (computed by Monte Carlo).
Best-of- moves the data at most nats (Section 8.5): nats at Llama 3's , 1.40 at (computed upper bounds). For FLOPs, one prompt needs a shared prefill, decoded responses and reward-model scores:
With 405B for both models (assumed) and Llama 3's SFT averages of 535.7 context and 310.4 response tokens as stand-ins [6], decoding is FLOPs, prefill and scoring . A million prompts is FLOPs, 0.075% of pretraining (computed). Rounds this cheap make six affordable.
Ai2's 200K episodes of online DPO on math "resulted in no or little improvement on GSM8K and degradation on MATH performance" [550]. RL against a verifier raised GSM8K from 84.3 to 87.6 at 8B [550] (reported). Fresh data helps only when the signal labeling it is good.
8.9 Safety tuning, refusals and character
How do teams make a model refuse what it should, answer what it should, and keep a consistent character, with the same SFT and preference machinery? With two error rates. Llama 3 optimizes a violation rate, responses that break a safety policy, and a false refusal rate, refusals of harmless prompts [6]. They trade off like precision and recall. Safety training often induces over-refusal, and reasoning before answering eases the trade-off without removing it [625].
XSTest measures over-refusal with 250 safe prompts and 200 unsafe contrasts, built on harmless uses of alarming words such as killing a Python process, and traces exaggerated safety to "lexical overfitting" [626]. OR-Bench scales this to 80,000 prompts [627].
With its original system prompt, Llama 2 70B Chat fully refused 38% of XSTest's safe prompts and partially refused 21.6%. Without it, 14% and 15.6% [626] (reported). XSTest records that "the Llama2 authors removed the system prompt" after this and other criticism [626]. Word-triggered safety raises false refusals.
The levers are familiar. Llama 3 adds borderline prompts, harmless ones close to harmful ones, gives its 8B model a larger share of safety data than 70B, and builds safety DPO pairs "nearly orthogonal in an embedding space" [6]. Preference tuning can also undo safety, through likelihood displacement (Section 8.7) or an off-distribution reference, which left DPO at a 55.4% safety rate [619]. Re-measure both rates after every stage. Table 8.11 lists other tools: red teams find failures, written rules turn policy into training signal, and a constrained objective budgets harm, as in Safe RLHF:
where is a learned harm cost and rises while expected cost exceeds the budget , like an adaptive KL coefficient [628].
Table 8.11. Safety tools beyond SFT and DPO (reported).
| Tool | What it does | Reported result |
|---|---|---|
| Human red teaming [629] | 324 crowdworkers attack 2.7B to 52B models | 38,961 attacks released. RLHF models got harder to red team with scale |
| Model red teaming [630] | one model writes test cases for another | tens of thousands of offensive replies found in a 280B chatbot |
| Rule-based rewards [631] | an LLM grader scores responses against explicit rules | F1 97.1 against 91.7 for a human-feedback baseline |
| Deliberative alignment [632] | the model reasons over a written specification before answering (Chapter 9) | more jailbreak robustness with less over-refusal |
| Instruction hierarchy [633, 634] | trains higher-authority instructions to override lower ones | 63% better defense against system-prompt extraction, some over-refusal |
| Safe RLHF [628] | separate reward and cost models balanced by a Lagrangian | three rounds on Alpaca-7B |
Robustness matters too. In 13 open chat models, refusal is mediated by one direction in activation space, which its authors read as brittle safety fine-tuning [635].
Character training uses the same tools for positive traits. Anthropic added it to Claude 3 through a character variant of Constitutional AI [636]. Open Character Training reproduces the idea with 11 personas and finds that it "changes manner over content" [637]. Persona vectors track traits such as sycophancy and can flag risky training data [638].
You double gradient-accumulation steps and halve the micro-batch, keeping the global batch fixed. Your SFT model now writes worse long answers. What changed?
A per-micro-batch mean weights examples, not tokens: next to a 1,000-token example, a 10-token one gets 50% of the gradient instead of 0.99% (computed). Normalize by the global token count, or use a sum loss with a retuned learning rate as Tülu 3 did [550].
Why can rank-1 LoRA match full fine-tuning for policy-gradient RL but not for continued pretraining on billions of tokens?
A policy gradient carries about one bit per episode, so 10,000 problems with 32 samples each deliver about 320,000 bits, far below rank-1 LoRA's 2.6M parameters on Llama 3 8B (computed). Pretraining data carries far more information than an adapter can store [566, 530].
Two labelers agree on 72.6% of pairs. Your reward model reaches 72% held-out accuracy. Is a bigger reward model the next step?
Not necessarily. If each labeler flips the truth with probability , gives , so even a perfect model scores only about 84% against single labels (computed). Your 72% is well below that cap. Against the true preference it is about (computed), so a bigger model still has room: doubling reward-model size added about 1.8% accuracy in Stiennon et al.'s runs [572]. First relabel a held-out set with several labels per pair, so you can measure which error dominates [8].
A PPO run shows rising reward, smooth losses, longer responses and falling perplexity. What is happening, and what do you check?
Likely reward hacking toward length, which reward and loss curves cannot reveal [596, 602]. Check KL, reward within length buckets, held-out win rates and raw samples.
Tülu 3 uses and Llama 3 uses . Which keeps the policy closer to its reference?
The numbers alone cannot say. Tülu 3's is per token, so at 300 tokens it equals per sequence, below 0.1 (computed). Learning rates ( against ) also decide how far the policy moves [550, 6].
- Post-training is cheap in FLOPs and decisive in behavior: InstructGPT's SFT and PPO cost 0.13% and 1.6% of GPT-3's pretraining compute, and its 1.3B model beat the 175B base [8].
- SFT teaches format fast and skills slowly. Skills need targeted data and a strong base, and knowledge comes from pretraining [548, 550].
- The SFT loss is a data-weighting decision: mask non-assistant tokens and normalize by the global token count.
- LoRA matches full fine-tuning for post-training-sized data when it covers every linear layer at about 10 times the learning rate, and a 4-bit QLoRA base fits a 70B fine-tune on one GPU [566, 76].
- Reward models turn comparisons into a scalar with the Bradley-Terry loss. Labeler agreement near 73% caps measured accuracy near 84% (computed), so correct for label noise before you judge a reward model.
- Every optimizer against a learned reward over-optimizes, with length and sycophancy the usual exploits. Monitor behavior, not reward [575].
- DPO reaches the KL-regularized optimum from fixed pairs with a logistic loss on log-ratios. Read in its units, and log the chosen log-probability.
- Fresh, on-policy data beats a static dataset, so recipes iterate (Llama 3 runs six rounds). Safety is two error rates, violations and false refusals.
9. Post-training II: reinforcement learning for reasoning and agents
A checkable answer supplies a reward, but a reward alone does not specify a sound learning update. Follow it through the baseline, importance weights and policy loss, then account for the sampling system and the shortcuts the verifier leaves open.
DeepSeek-R1-Zero started from DeepSeek-V3-Base, a mixture-of-experts model with 671B total and 37B active parameters [2], with no supervised fine-tuning. GRPO (Group Relative Policy Optimization, Section 9.3) trained it on two rule-based rewards, one for a correct answer and one for the required format, "combined with the same weight" [3]. Its average pass@1 on AIME 2024 (the chance that one sampled answer is right) rose from 15.6% to 77.9% [3, 639] (reported) for about 3.6% of DeepSeek-V3's full training GPU-hours (computed, Section 9.4 has the recipe and the cost).
In Chapter 8 the reward was a learned preference model, so the policy had to stay near that model's training data. Here the reward is a checker: an answer matcher, a test run, a format rule. Its verdict does not degrade as the policy drifts, so training can run for thousands of steps and answers can reach 65,536 tokens [3]. That freedom brings three problems: estimator details (Sections 9.2 to 9.6), the cost of long generation (Section 9.8) and policies that satisfy the checker without doing the task (Section 9.9).
Sample, check, reinforce. For each prompt sample answers, score each with a program, and raise the probability of the ones that beat the group's average. The rest of the chapter is about doing that without bias, without collapse and without waiting.
Other running examples are Tülu 3, which named the method and ran it on Llama 3.1 8B to 405B [550], DeepSWE, a Qwen3–32B coding agent trained only with RL [9], and Llama 3 8B and 70B for memory arithmetic [6]. The running examples and the notation are introduced in Section 0.3. Here is the group size, a prompt's pass rate and a token's probability ratio. See also Chapter 6 (RL scaling laws), Chapter 13 (decoding) and Chapter 14 (sandboxes).
9.1 Rewards you can check
What number does RL optimize when the task has a right answer, and how does that number go wrong? RL optimizes what the reward measures, not what you meant. With a verifiable reward the measurement is a program, so the first engineering job is to make it agree with a careful human grader.
Tülu 3 defined reinforcement learning with verifiable rewards (RLVR) as a method that "leverages the existing RLHF objective but replaces the reward model with a verification function" [550]. A verified completion earns a constant , and PPO optimizes it with a KL coefficient of 0.05 at 8B and 0.07 at 70B on roughly 30,000 prompts from GSM8K, MATH and instruction-following constraints [550] (reported). R1-Zero's accuracy reward matches a boxed answer or runs code against tests, and its format reward checks for think tags. DeepSeek avoided neural reward models because they get hacked in large-scale RL [3]. DAPO, an open 2025 recipe built on GRPO (Section 9.5), had an LLM rewrite each problem so the answer is an integer, for , which makes checking an integer comparison [640].
Answer extraction is the hidden hard part. Hugging Face's Math-Verify README reports three graders on the same MATH outputs: 0.0802 (lm-evaluation-harness), 0.1288 (Qwen's evaluator) and 0.1328 (Math-Verify) [641] (reported). The best is times the worst (computed). In RL every disagreement is a wrong reward, so measure your checker against human grading before you train.
Learned verifiers
Before RLVR, the field trained models to judge solutions. An outcome reward model (ORM) scores a whole solution, a process reward model (PRM) each step (Table 9.1). Lightman et al.'s 500 held-out test problems became MATH-500 [642].
Table 9.1. Learned verifiers for math reasoning (all reported).
| Work | What is scored | Key result |
|---|---|---|
| Cobbe et al., 2021 [488] | Whole solution (ORM), GSM8K | Reranking with a verifier gave about the boost of a 30 times larger model |
| Uesato et al., 2022 [643] | Outcome vs process feedback, GSM8K | Final-answer error 16.6% vs 14.8% with reward models. Low trace error needs process feedback or a model that emulates it. The best system cut it from 14.0% to 3.4% |
| Lightman et al., 2023 [642] | Steps (PRM800K: 800K labels, 75K solutions, 12K problems) | Best-of-1860 on a MATH subset: PRM 78.2%, ORM 72.4%, majority vote 69.6%. Active learning gave 2.6 times the data efficiency |
| Math-Shepherd, 2023 [644] | Steps, good if rollouts from it can still reach the answer | PPO with it lifted Mistral-7B from 77.9% to 84.1% on GSM8K and 28.6% to 33.0% on MATH |
| Setlur et al., 2024 [645] | Steps, scored by progress under a prover policy | 8–10% more accurate and 1.5–5 times more compute efficient than ORMs in beam search |
| ProcessBench, 2024 [646] | Existing PRMs on harder problems | They fail to generalize beyond GSM8K and MATH |
| Zhang et al., 2025 [647] | How step labels are made | Monte Carlo labels do worse than LLM-judge or human labels |
| Kimi k1.5, 2025 [648] | Outcome only | Long chain-of-thought results without tree search, value functions or PRMs |
What does a PRM estimate? For steps , the value of a prefix is the chance that the final answer is correct, and a step's advantage is the change in that value:
Math-Shepherd's soft label, the share of rollouts from a prefix that succeed, is a Monte Carlo estimate of the value [644]. Setlur et al.'s progress reward is the advantage under a fixed prover [645]. Human labels measure validity, and a valid but useless step makes zero progress.
Lightman et al. score a solution as the probability that every step is correct, which they note is slightly biased against long solutions [642]:
At 0.95 per step, 5 steps score , 20 steps and 40 steps . Even at 0.99, 40 steps give 0.67 (computed, illustrative scores). A long chain of thought full of checks loses to a short one, the opposite of what reasoning RL tries to grow.
So frontier recipes went back to outcome rewards. DeepSeek wrote that "once a model-based PRM is introduced, it inevitably leads to reward hacking" [3].
Verifiable rewards still fail. False negatives teach the policy to avoid unusual correct forms. False positives invite hacking (Section 9.9). Truncation scores a cut-off answer as 0: masking truncated samples was worth 6 AIME points in DAPO's ablation [640], and ScaleRL, a study of RL recipe choices that spent more than 400,000 GPU-hours (Section 9.5), saw 10–15% truncation destabilize training, so it forces an end of thinking with "Okay, time is up. Let me stop thinking and formulate a final answer now. </think>" [483]. A format reward can be collected without solving anything: rewarding any non-empty boxed answer lifted Qwen2.5-Math-7B by 10.3 points on AIME 2024, against 15.3 for the true reward [649] (reported, case study in Section 9.7).
Practical defaults, as of November 2026: canonical answers, one checker for training and evaluation, masked truncation, a small format reward, and a disagreement rate measured on a few hundred hand-graded samples and logged during the run. Keep PRMs for test-time reranking and search [71, 645]. Grader statistics are in Chapter 10.
9.2 From a score to a gradient: REINFORCE, baselines and PPO
Sampling a token is a discrete choice, so how do we get a gradient that raises a 0/1 score, and how far can we move on one batch of samples? Make answers more or less likely in proportion to how much better or worse than expected they scored. That is REINFORCE, and later methods change only its multiplier, its baseline or its step size.
The score-function estimator
A prompt yields a response with probability , and we want to raise . Write the expectation as a sum and use :
The reward is never differentiated, so it can be a test suite, and one forward and backward pass over the sampled response, fed in as fixed input (teacher forcing), gives the gradient. Williams named the family: REINFORCE algorithms "make weight adjustments in a direction that lies along the gradient of expected reinforcement" [650].
Subtract a baseline that depends on the prompt but not on the sampled answer:
The mean is unchanged and, for a good , the variance falls. The natural choice is the expected reward , and is the advantage. On a toy five-way softmax (logits 1, 0.5, 0, -0.5, -1, the first and fourth answers rewarded), 200,000 samples match the exact gradient either way, and the baseline halves the variance summed over the five logits, 0.22 to 0.11 (computed, illustrative). The baseline must be per prompt: within one Llama-2–7B mini-batch, ReMax saw learned rewards from -14.25 to 7.25 [651].
Only the end of a response is scored, so Ahmadian et al. argue "it may be more appropriate to model the entire generation as a single action, as opposed to each token" [652]. This bandit view is why critic-free methods took over.
With and the gradient is maximum likelihood on the successes, which is filter-and-fine-tune. STaR [653] and ReST-EM [654] work this way, and ReST-EM's gains fade after a couple of iterations. What is missing is the push down on wrong answers: Kimi k1.5 found negative gradients markedly help on long chains of thought [648], and a small 2026 preprint found GRPO beat rejection-sampling fine-tuning by 10.9 points [655] (reported, preprint).
PPO, and what long answers do to its critic
PPO as used in RLHF (clipped surrogate, GAE, value model) is derived in Section 8.5. We restate two formulas and ask what long answers change. PPO takes several steps per batch sampled by and clips each token's ratio, by default at [591]:
If the advantage is positive and , the token's gradient is zero. If the advantage is negative and , zero again. Otherwise the token contributes , which at is REINFORCE. CISPO's paper writes this as a 0/1 mask [656]. Clipping stops a token from moving further in the helpful direction and keeps the full penalty in the harmful one.
The advantage comes from generalized advantage estimation (GAE) over a learned value model [592]:
With one reward at the end and , a token positions earlier sees that reward with weight . At the common that is about 0.006 after 100 tokens, "effectively zero" as VAPO puts it [657], and after 1,000 (computed). With the sum telescopes to , and Open-Reasoner-Zero scaled vanilla PPO this way with no KL term [658].
The critic is typically as large as the policy [207], and its training state took 46% of GPU memory at 7B [651]. Initialized from a reward model, as usual [550], vanilla PPO from Qwen2.5–32B base "only achieves 5 points" on AIME 2024 [657]. In DeepSeek's test on a 16B MoE model, PPO at did considerably worse than GRPO and at came close [3].
Section 8.5 works out PPO's model-state memory: 289 GB for Llama 3 8B and 2,540 GB for 70B. GRPO with a rule reward trains only the policy (16 bytes per parameter) and keeps a frozen BF16 reference (2 bytes), 18 bytes against PPO's 36: 145 GB and 1,270 GB, or 2 and 16 GPUs of 80 GB instead of 4 and 32 (computed from the parameter counts [6]), before activations.
If rollout and learner log-probabilities differ, as with dropout, "all ratios could potentially be clipped, resulting in zero gradient" [550]. Such code-level details can matter as much as the algorithm [593, 659, 660]. Even in RLHF, REINFORCE-style methods beat PPO by 3.2% to 20.3% in win rate, and removing clipping slightly helped [652] (Table 9.2).
Table 9.2. GPT-4-judged win rates against the reference model in RLHF (reported by Ahmadian et al.).
| Method | Summarization | Anthropic-HH, Pythia | Anthropic-HH, Llama |
|---|---|---|---|
| RLOO, 4 samples [652] | 77.9% | 43.7% | 64.1% |
| PPO [652] | 67.6% | 29.2% | 32.0% |
Practical defaults: a per-prompt baseline from several samples, never a raw 0/1 reward. If you keep a critic, use and pretrain it (Section 9.5). Disable dropout and recompute old log-probabilities in the trainer (Section 9.6). Byte accounting is in Chapter 1.
9.3 Dropping the critic: group baselines and their biases
Without a critic, where does the baseline come from, and what do the popular choices do to each token's gradient? Sample several answers to the same prompt. Their average score estimates how hard the prompt is for the current policy, which is the baseline we want. The variants differ only in scale.
GRPO, Group Relative Policy Optimization, "foregoes the critic model, instead estimating the baseline from group scores" [207]. Each token of answer , with length and reward , gets the group z-score, and the loss averages clipped token terms within each answer, then over the group:
Here is the KL coefficient, and the KL sits in the loss, not the reward [207] (Section 9.6). RLOO, REINFORCE leave-one-out, uses the mean of the other answers [652], and since ,
Table 9.3. Critic-free baselines (settings and results reported by each paper).
| Method | Baseline and scale | Notes |
|---|---|---|
| ReMax [651] | Reward of one greedy answer | About 46% less GPU memory and 1.6 times as fast as PPO at 7B |
| RLOO [652] | Mean of the other rewards | Unbiased, since no answer is its own baseline |
| GRPO [207] | Group mean, divided by group std, then | DeepSeekMath: learning rate 1e-6, KL coefficient 0.04, 64 samples, length 1,024, batch 1,024 |
| REINFORCE++ [661] | Normalized over the whole batch | A local std near zero makes the advantage explode. On 30 AIME 2024 problems GRPO reached 95.0% train and 0.0 test pass@1 (one probe) |
| Kimi k1.5 [648] | Mean of sampled rewards | Derived from mirror descent, no value network |
| Dr. GRPO [662] | Group mean, no std, constant normalizer | Equal to RLOO up to |
All fit one template, with a normalizer ( in GRPO, total tokens in DAPO, a constant in Dr. GRPO) and a per-token weight that Section 9.5 compares:
With of correct and , GRPO gives correct answers and wrong ones . Every estimator sums to zero over the group, moving probability from failures to successes.
Rewards (1, 0, 0, 0, 0, 0, 0, 0) have mean 0.125 and population std . verl, the open-source library that implements HybridFlow (Section 9.8), uses torch.std, which is Bessel-corrected [663], giving 0.354.
Table 9.4. Advantages for one group of eight with one correct answer (computed).
| Estimator | Correct answer | Each wrong answer |
|---|---|---|
| GRPO, population std | +2.646 | -0.378 |
| GRPO, Bessel std (verl) | +2.475 | -0.354 |
| Dr. GRPO, mean-centered | +0.875 | -0.125 |
| RLOO | +1.000 | -0.143 |
RLOO is exactly of Dr. GRPO. Give the correct answer 3,000 tokens and each wrong one 9,000 (illustrative). GRPO's per-token weight is against , a ratio of 21. Under DAPO's mean over all 66,000 tokens it is 7 (computed).
Dr. GRPO: two biases in the objective
Liu et al. found that GRPO's term "artificially increases response length (especially for incorrect outputs) during training", and that its std overweights prompts that are too easy or too hard [662]. Removing both and dividing by a constant recovers the PPO objective with a Monte Carlo advantage and an unbiased baseline [662].
Why length? A negative advantage is a fixed push per answer, spread over its tokens. Take , rewards (1, 1, 0, 0), lengths (100, 100, 100, 1,000). GRPO's advantages are , so its per-token weight is on the short wrong answer and on the long one. DAPO's token mean gives to both, so the long answer takes ten times the total push. Dr. GRPO with constant gives to both, independent of the other answers (computed).
Why difficulty? Summed over a group with pass rate ,
The ratio is 2.0 at , 3.0 at and 4.1 at (computed), so a one-in-sixteen prompt gets twice the relative weight of a coin flip. Open-source PPO code also normalized by length [662], and verl now makes it a choice, loss_agg_mode [663]. In Figure 46, click "Per-token weight", then move the length sliders and watch the three aggregations diverge.
Growing response length was widely read as emergent reasoning. Dr. GRPO showed that GRPO "tends to continually generate longer responses even when the reward improvement slows down", that wrong answers grow fastest, and that Llama bases show it too, "potentially leading to a misperception that long-CoT can also emerge" [662]. One inherited line, a per-sequence mean of token losses, changed the optimization target. Derive the per-token weight your loss applies before you read meaning into a curve.
Zero-variance groups
If all answers get the same reward, every advantage is zero, which shrinks and adds noise to the batch gradient [640], yet the rollouts still cost generations. With independent samples at pass rate (Table 9.5),
Table 9.5. Share of zero-advantage groups, (computed).
| Pass rates | ||
|---|---|---|
| 0.66 | 0.44 | |
| or 0.9 | 0.43 | 0.19 |
| 0.0078 | 0.00003 | |
| Uniform on [0, 1] | 0.22 | 0.12 |
| Beta(4,1), mean 0.8 | 0.34 | 0.20 |
As the policy improves, the waste grows. DAPO's dynamic sampling over-samples and discards these prompts [640] at a cost of
1.29 at for uniform pass rates and 1.50 for Beta(4,1) (computed). For a DAPO-style batch of 512 prompts by 16 answers, from a pool half nearly mastered (, ) and half at (), and each step draws prompts, about 10,500 rollouts (computed, illustrative pool). Kept in the batch, zero-advantage groups still feed the KL and entropy terms and raise their relative weight, which can destabilize training, so Skywork-OR1 drops them [664]. Figure 46 shows both effects. On the left, mark every answer correct and all bars drop to zero. On the right, move the pass rate and watch climb at both ends for every .
Method and sources
GRPO and RLOO differ only in scale. Left: for one group of G answers to a prompt, whose rewards you set by flipping chips and whose lengths you set with the sliders (lengths are illustrative), the advantage of each correct and each incorrect answer under GRPO with the population or the Bessel-corrected standard deviation, Dr. GRPO and RLOO, or the per-token gradient weight under GRPO's per-answer mean, DAPO's token-level mean and Dr. GRPO's constant normalizer. Right: the chance P0 = p^G + (1 - p)^G that all G answers get the same reward, against the prompt's pass rate p, for G = 4, 8, 16 and 64, with the over-sampling factor 1/(1 - P0) that dynamic sampling pays. Every value is computed in this guide from binary rewards and independent samples, using the formulas of Shao et al. (2024), Ahmadian et al. (2024), Liu et al. (2025), Yu et al. (2025) and the verl implementation (2025), with group sizes from DeepSeekMath, DeepSeek-R1-Zero and DAPO.Larger groups cost more generation. At the chance of at least one success, , is 34% at , 56% at 16 and 96% at 64 (computed). DeepSeekMath used 64 samples of up to 1,024 tokens [207], and R1-Zero, whose answers run far longer, used 16 [3].
Filtering is most of the trick. GRPO's main advantage comes from discarding all-wrong prompts, not from its normalization [665]. Skywork-OR1 removes prompts the base model always or never solves [664], and ScaleRL drops those with pass rate 0.9 or more [483]. A 2026 preprint finds roughly 88% of a pooled open math corpus solved or failed in every rollout [666] (reported, preprint), so filtering eventually runs out of problems.
Should you divide by the std? GRPO uses the group's [207], Dr. GRPO none [662], REINFORCE++ and "Lite PPO" the batch's [661, 667]. ScaleRL found the choices similar [483], and Magistral saw no significant effect [668]. Our reading: it moves efficiency and stability more than the final score, and GRPO's std acts as a curriculum toward hard-but-solvable prompts.
Practical defaults, as of November 2026: of 8 to 16, group-mean centering, no std or a batch std, and zero-variance groups dropped and logged every step, since their share reads out the curriculum.
9.4 DeepSeek-R1: reasoning learned by reinforcement
What happens when GRPO with rule-based rewards runs on a very strong base model, and how do you turn the result into a model people can use? The model learns to think at length before it answers, and its competition-math score rises fivefold. Making it usable takes three more stages.
A transformer spends fixed computation per token, and writing intermediate steps into its context buys more serial computation and a scratchpad [669]. Chain-of-thought prompting took PaLM 540B from 17.9% to 56.9% on GSM8K, a gain that appeared only at about 100B parameters [670]. RL with a checker rewards whatever writing leads to right answers, so reasoning the base model already produces now and then grows longer and more frequent. For o1, OpenAI published only that it "is trained with large-scale reinforcement learning to reason using chain of thought" [671]. The most detailed public recipe is DeepSeek-R1 [3, 639].
R1-Zero: RL on a base model and nothing else
R1-Zero runs GRPO (Section 9.3) on DeepSeek-V3-Base with two rule-based rewards, answer accuracy and format, and a template that only asks for reasoning inside <think> tags. Table 9.6 lists the settings.
Table 9.6. DeepSeek-R1-Zero's RL recipe (reported).
| Setting | Value |
|---|---|
| Base model | DeepSeek-V3-Base, 671B total, 37B active [2] |
| Learning rate, KL coefficient, temperature | 3e-6, 0.001, 1 [3] |
| Samples per question | 16 [3] |
| Length cap | 32,768 tokens, then 65,536 after step 8.2k [3] |
| Steps and batch | 10,400 steps of 32 questions, 512 rollouts per step [3] |
| Reference model | replaced by the latest policy every 400 steps [3] |
| Updates per rollout | 8,192 outputs in 16 minibatches, one pass, so the last is 15 updates stale (computed) [3] |
During RL, average pass@1 on AIME 2024 rose from 15.6% to 77.9%, and self-consistency over 16 samples (cons@16) reached 86.7% [3, 639]. Accuracy and length both jump at step 8.2k [3], where the cap doubled, so the cap had bound. An "aha moment" appeared, "characterized by a sudden increase in the use of the word “wait” during reflections", but the outputs were hard to read and mixed English and Chinese [3]. The first arXiv version (January 2025) reported 71.0% pass@1 and 86.7% cons@64 [3] (reported). These are two reports of one run, so use the later numbers.
The base decides whether any of this happens. DeepSeek's 7B dense and 16B mixture-of-experts bases "consistently failed to yield meaningful improvements" on AIME and drifted into repetition, while bases of 32B, 230B and 671B worked [3].
512 H800 GPUs ran for about 198 hours, 101,376 GPU-hours [3] (reported). Against DeepSeek-V3's 2.788M GPU-hours [2], that is 3.6%, and all R1 work (147K GPU-hours) is 5.3% (computed).
The run made rollouts. Each rollout token costs about to generate, each for the old-policy and reference log-probabilities, and for the update:
with the mean response length in tokens.
With and illustrative mean lengths of 4K, 8K and 12K tokens, that is , and FLOPs. At the H100's 989.5 TFLOP/s dense BF16 peak (Section 2.1), the GPUs could deliver FLOPs. Utilization was about 3% to 8% (computed, treating an H800 like an H100 and ignoring attention). The time goes to decoding long, uneven samples. Why RL rollouts are decode-bound is in Section 13.2.
From R1-Zero to R1: four stages
- Cold start: SFT on thousands of readable long reasoning examples.
- Reasoning RL as in R1-Zero, plus a language-consistency reward, "the proportion of target language words in the CoT" (chain of thought), and a GRPO clip ratio of 10 [3], which barely clips and so gives up most of PPO's step-size control (Table 9.9 follows one rare token through it).
- Rejection sampling and SFT on about 600k reasoning and 200k other samples [3].
- Second RL stage: 1,700 steps, with preference rewards only in the last 400 [3].
AIME 2024 pass@1 goes 77.9, 59.0, 74.0, 78.1 and 79.8 across the five checkpoints (the dip comes from the small cold-start set). IF-Eval climbs from 46.6 to 83.3 and AlpacaEval 2.0 from 24.7 to 87.6. GPQA Diamond falls from 75.8 to 71.5 [3] (reported). One AIME problem is 3.3 points, so the last stage's 78.1 to 79.8 is half a problem (computed, Section 10.4). Figure 47 plots ten benchmarks per stage: look for the red bracket on GPQA, where R1 ends below R1-Zero, and for distillation beating RL in the "Distillation vs RL" tab.
Method and sources
The stepper walks the checkpoints and counts which benchmarks rose. The second view shows AIME 2024 pass@1 for distilled models and for RL in three blocks that come from different papers and evaluation protocols, so bars compare within a block only. All values are reported by DeepSeek-AI (2025), Tables 3, 15 and 16, and by the Qwen3 report (Yang et al., 2025), Table 21, with its GPU-hours. Gaps and ratios are computed.In the second RL stage the helpfulness reward model scored only the final summary. DeepSeek saw "the reward exhibits an increasing trend as the performance on CodeForces decreases" and confined preference rewards to the last 400 of 1,700 steps [3]. Treat a learned reward as a budget: track a held-out capability next to it and stop before they diverge.
Process rewards and tree search did not work for DeepSeek, because text has "an exponentially larger search space" than board games [3].
Distill small models, train large ones
R1's small models get SFT only. From the same Qwen2.5–32B base, more than 10K steps of RL reached 47.0% on AIME 2024, and SFT on R1's outputs 72.6% [3]. Qwen3 found the same with on-policy distillation (the student samples, the teacher's logits grade every token). From one distilled 8B checkpoint at 55.0%, GRPO reached 67.6% in 17,920 GPU-hours and distillation 74.4% in 1,800, and only distillation raised pass@64, from 90.0% to 93.3% [198] (reported). The cost and scaling law of distillation are in Section 7.7.
Table 9.7. What other recipes and open reproductions found (reported).
| Work | Finding |
|---|---|
| Kimi k1.5 [648] | 77.5 on AIME and 96.2 on MATH 500 without tree search, value functions or process rewards. RL at 128K context. Problems sampled in proportion to their failure rate |
| Qwen3 [198] | 3,995 query-verifier pairs took Qwen3-235B-A22B from 70.1 to 85.1 on AIME'24 in 170 RL steps |
| Open-Reasoner-Zero [658] | Plain PPO with no KL, one tenth of R1-Zero's steps |
| SimpleRL-Zoo [672] | Qwen2.5 bases already self-reflect. Length can grow without verification behavior |
| Cognitive behaviors [673] | Qwen-2.5-3B far exceeds Llama-3.2-3B under identical RL. Priming Llama with reasoning behaviors, even with wrong answers, closes the gap |
| Long CoT study [674] | Unchecked length overshot the context window and cut MATH-500 accuracy |
| One-shot RLVR [675] | One training problem took Qwen2.5-Math-1.5B from 36.0% to 73.6% on MATH500 |
| OpenThoughts [676] | SFT alone on 1.2M examples: OpenThinker3-7B scores 53% on AIME 2025 |
Is the aha moment emergent, as DeepSeek presents it? The SimpleRL-Zoo and cognitive-behavior results support a narrower reading, better supported as of November 2026: RL amplifies a behavior the base already shows rarely. How test-time and RL compute scale is in Section 6.8.
To do it yourself, start from the strongest base you can afford, use rule-based rewards, keep prompts the model sometimes solves, sample 8 to 16 answers per prompt and raise the length cap in stages. For small models, distill first.
9.5 What the reproductions exposed: DAPO, VAPO, GSPO and CISPO
DAPO's open rerun of R1-Zero's recipe on Qwen2.5–32B scored 30 on AIME instead of DeepSeek's 47. What did each 2025 fix change in the loss, and which ones change the final score rather than the speed? Each fix turns one knob of the template in Section 9.3: the clip range, which groups enter the batch, how token losses are averaged, the level of the probability ratio, or whether a token's gradient can be zeroed. Here is the token probability ratio.
DAPO: four fixes and an ablation
"In our initial GRPO run, we achieved only 30 points on AIME", the DAPO team wrote, against DeepSeek's 47 from the same base. DAPO drops the KL term ("this restriction is not necessary") and adds four techniques [640].
- Clip-higher. With a positive advantage, clipping zeroes a token's gradient once its probability passes At a token at 0.01 can reach only 0.012, while one at 0.9 is unconstrained. DAPO raises the upper bound to 0.28, so the rare token reaches 0.0128 (computed), and keeps the lower bound at 0.2 so unlikely tokens are not pushed to zero [640]. The target is entropy collapse: the policy's token distribution narrows until every answer in a group agrees, and learning stalls (Section 9.6).
- Dynamic sampling. Over-sample and drop groups whose answers all pass or all fail. It is cheap in wall-clock time, since "the generation time is typically dominated by the generation of long-tail samples" [640].
- Token-level loss. Average over every token in the group, so a long answer counts in proportion to its length and long gibberish is penalized token by token [640].
- Overlong shaping. Mask the loss of truncated answers, then penalize length linearly over the last tokens before the cap [640]: With and , an 18,000-token answer gets and a 20,000-token answer (computed).
Table 9.8. The two ablations behind the 2025 refinements, both from Qwen2.5–32B base, AIME 2024 avg@32 at temperature 1.0 and top-p 0.7 (reported). DAPO adds one technique at a time in a fixed order. VAPO removes one at a time from the full recipe.
| Row | AIME 2024 | Change |
|---|---|---|
| DAPO, cumulative [640] | ||
| Naive GRPO | 30 | |
| + overlong filtering | 36 | +6 |
| + clip-higher | 38 | +2 |
| + soft overlong punishment | 41 | +3 |
| + token-level loss | 42 | +1 |
| + dynamic sampling (DAPO) | 50 | +8 |
| DeepSeek-R1-Zero-Qwen-32B (reference, other protocol) | 47 | |
| VAPO, leave one out [657] | ||
| Full VAPO | 60 | |
| without group sampling | 55 | −5 |
| without positive-example LM loss | 54 | −6 |
| without token-level loss | 53 | −7 |
| without clip-higher | 46 | −14 |
| without length-adaptive GAE | 45 | −15 |
| without decoupled GAE | 33 | −27 |
| without value pretraining | 11 | −49 |
| Vanilla PPO | 5 | |
Read Table 9.8 with care. DAPO's increments depend on the order, there are no error bars, and one AIME problem is 3.3 points (computed), so the +1 and +2 are within noise while the +6 and +8 are not. The reference 47 was sampled at temperature 0.6 and top-p 0.95 [3], a different protocol.
The team diagnosed "entropy collapse, reward noise, and training instability" and matched one fix to each symptom. They watched length, reward, entropy and mean token probability, found that training reward "often exhibits little correlation with the accuracy on the validation set", and aimed for entropy that drifts slowly upward [640]. The monitoring discipline is the lasting lesson.
VAPO: keep the critic and repair it
VAPO keeps PPO's value model and adds seven changes, among them value pretraining and a length-adaptive GAE with , [657]. Since , a 1,000-token answer gets , a 50-token horizon, and a 16,000-token answer 0.99875, an 800-token horizon (computed). VAPO reaches 60.4 "within a mere 5,000 steps", 60 to 61 across three runs [657] (reported).
Vanilla PPO from Qwen2.5–32B base "only achieves 5 points", with shrinking responses, because a critic initialized from the reward model is biased early [657, 677]. Value pretraining and critic targets brought VAPO to 60, and removing value pretraining alone collapsed it to 11 [657].
GSPO: one ratio per response
Qwen's GSPO argues that a token ratio is an importance weight from one sample of each next-token distribution, noise that grows with length, and that "the unit of optimization objective should match the unit of reward". It clips one length-normalized ratio per response, at 3e-4 below and 4e-4 above [678]:
is a mean of token log-ratios. If those were independent with standard deviation 0.05, the mean has : 0.0050 at 100 tokens, 0.0016 at 1,000, 0.00056 at 8,000 (computed, illustrative). A token-sized range of 0.2 would never bind. Yet GSPO clips about a hundred times more tokens than GRPO [678], because a whole response drops out when its ratio leaves the range.
For mixture-of-experts models, about 10% of the experts Qwen3–30B-A3B activates change after each update. GRPO needed routing replay, which reuses the old policy's expert choices, to converge, and GSPO did not [678].
CISPO: clip the weight, never drop the token
In MiniMax-M1, rare reflective tokens such as "Wait" got large ratios and "were clipped out after the first on-policy update", so they missed the remaining off-policy updates. CISPO caps a stop-gradient importance weight instead, with no lower bound [656]:
Every token keeps a gradient of capped size. MiniMax reports a 2x speedup over DAPO, and a full RL run of three weeks on 512 H800 GPUs for $534,700 [656], which is 258,048 GPU-hours at about $2.07 each (computed). Table 9.9 follows one "Wait" token through each method.
Table 9.9. What each method does to one "Wait" token at an old probability of 0.02 in a correct answer (computed bounds).
| Method | Ratio and clip | Highest probability per rollout batch | Gradient past the bound |
|---|---|---|---|
| PPO, GRPO | token ratio, 0.2 | 0.024 | zero, token clipped |
| DAPO | token ratio, 0.2 / 0.28 | 0.0256 | zero |
| R1 reasoning RL | token ratio, 10 | 0.22 | zero only far out |
| CISPO | stop-gradient weight capped above | weight capped | nonzero, capped |
| GSPO | one ratio per response, 3e-4 / 4e-4 | whole response in or out | zero for the whole response |
What the head-to-head studies found
ScaleRL spent more than 400,000 GPU-hours asking which choices raise the ceiling of a fitted reward-versus-compute curve (fit in Section 6.8). CISPO and GSPO raised it over DAPO, and an FP32 language-model head lifted it from 0.52 to 0.61, with runs varying by about 0.02. Most other choices changed only efficiency [483] (reported). Table 9.10 lines up the algorithms.
Table 9.10. The 2025 algorithms as variants of one template (reported designs, simplified). The KL estimators and are defined in Section 9.6.
| Algorithm | Advantage | Critic | KL | Ratio and clip | Loss aggregation |
|---|---|---|---|---|---|
| REINFORCE [650] | return minus baseline | no | optional | none | sum over sequence |
| PPO [591] | GAE from a value model | yes | in reward | token, 0.2 | per-response mean |
| ReMax [651] | minus greedy answer's reward | no | in reward | none | token-normalized |
| RLOO [652] | minus mean of the other answers | no | in reward | none | sequence |
| GRPO [207] | group z-score | no | in loss | token, symmetric | per-response mean |
| REINFORCE++ [661] | batch-normalized reward | no | in reward or loss | token | token-level |
| DAPO [640] | group z-score | no | none | token, 0.2 / 0.28 | token-level |
| Dr. GRPO [662] | minus group mean | no | none | token, symmetric | constant normalizer |
| VAPO [657] | length-adaptive GAE | yes, pretrained | none | token, 0.2 / 0.28 | token-level |
| CISPO [656] | group-normalized | no | none | capped weight, no token dropped | token-level |
| GSPO [678] | group-normalized | no | none reported | sequence, 3e-4 / 4e-4 | mean over group |
| ScaleRL [483] | batch-normalized, group-centered | no | none | capped weight (CISPO) | prompt-level |
Four disputes have working resolutions. Aggregate per token from a base model and per sequence from an aligned one [667]. A repaired critic beat DAPO by 10 points (Table 9.8), though group methods are simpler and halve model memory. GRPO with rollout routing replay beat GSPO by 1.29 on an MoE model [679], so fixing noisy ratios at their source (Section 9.6) recovers most of what sequence ratios buy. And clip-higher "gradually becomes unstable" next to covariance-based methods [680], so tune the clip as an entropy lever.
9.6 Keeping a run alive: KL, entropy and the sampler-trainer mismatch
Why do RL runs plateau or collapse, and which quantities do you monitor to keep them learning? Three things quietly break the gradient: a KL term that pulls in an unintended direction, a policy that stops exploring so every group agrees, and samples from a slightly different policy than the one trained, a bias that grows with length.
KL: keep it, drop it or reset it
RLHF needs a KL term because a learned reward is accurate only near its training data. Reasoning RL "typically employs rule-based verifiers", which removes that concern, so Dr. GRPO sets the coefficient to zero [662]. Dropping it saves a reference forward pass per step (Table 9.11).
Table 9.11. The KL term in published reasoning-RL recipes (reported).
| Recipe | KL choice |
|---|---|
| DAPO, Magistral, Open-Reasoner-Zero [640, 668, 658] | none |
| DeepSeek-R1-Zero [3] | 0.001, reference replaced every 400 steps (a per-token KL added to the reward would also penalize length, our reading) |
| ProRL [485] | kept, with hard resets of the reference and the optimizer states |
| Tülu 3 (PPO) [550] | 0.05 at 8B, 0.07 at 70B |
| DeepSeek-V3.2 [681] | weak or none for mathematics |
KL also costs breadth: a 0.001 penalty matched pass@1 but gave "a much lower pass@128" [484]. So drop the term from a base model with a rule-based reward, and keep a small one with periodic resets for long runs from SFT or distilled models.
Which gradient a KL estimator gives
Schulman's single-sample estimators, for a sampled token , are [590]
GRPO adds to its loss [207]. Its value is an unbiased estimate of the reverse KL, . Its gradient is another matter. Since and ,
the gradient of the forward KL. The same steps give the reverse-KL gradient for and zero for (computed).
Enumerate exactly on a random 20-way softmax. is zero to , matches the reverse-KL gradient to , and matches the forward-KL gradient to . Meanwhile equals the true reverse KL (computed). So estimates one quantity and regularizes toward another. REINFORCE++ switches to for this reason [661], and DeepSeek-V3.2 reweights by to unbias its gradient [681]. If you keep a KL term, use as the loss.
Entropy collapse
In entropy collapse, entropy falls early, groups become identical and learning plateaus. In one run "73% of the entropy consumption and 76% of the performance gain occurred in just the first 200 gradient steps". Cui et al. fit between entropy and validation score, with a ceiling of at zero entropy, and early-step fits predicted later scores to about 1%. The mechanism is a covariance [680]:
Under natural policy gradient the logit change is times the advantage. When the likely tokens are also the rewarded ones, the covariance is positive and entropy falls. On a 1,000-action softmax with , the formula predicts and the exact change is (computed).
Covariance-targeted clipping beat GRPO by 2.0% at 7B and 6.4% at 32B [680]. Training only on the 20% highest-entropy tokens beat full updates on Qwen3–32B by 11.04 points on AIME'25 [682]. Higher temperature "only delays the onset of entropy collapse" [485], and on-policy updates slow it [664]. Collapse also shows inside one sample: MiniMax halts generation once 3,000 consecutive tokens each have probability above 0.99, the signature of a repetition loop [656].
The sampler is not the trainer
Samples go stale: R1-Zero's mean minibatch is 7.5 updates old [3] (computed), and Magistral degrades beyond 2 minibatches per batch [668] (systems in Section 9.8). And even with identical weights, sampler and trainer run different kernels, so , and "the policy gradient would become biased if simply ignoring this mismatch" [683]. The exact fix is a whole-response weight with . Practical fixes truncate or mask it [683], or truncate per token [684, 685].
Why not use itself? Model each token's log-ratio as independent and normal with spread and mean , so each token's weight averages 1. Over tokens
where ESS is the normalized effective sample size, , exactly 1 on-policy [686]. With (illustrative), the variance is 0.094 at 100 tokens, 1.46 at 1,000 and about 1,300 at 8,000. At 8,000 tokens the median weight is 0.027, and capping at 2 cuts the mean weight to 0.25, a 75% downward bias (computed). Figure 48 lets you move , and the cap. Watch the effective sample size halve within the first thousand tokens and, for the dense preset, fall below 0.1 by about 1,800 (computed).
Method and sources
Chart B plots the spread of the log weight for the whole-response product (orange) and for GSPO's geometric mean over tokens (green), against the PPO token clip of 0.2 and GSPO's clip of 4e-4. The readouts give the median weight, the variance, the effective sample size and the mean of the weight capped at C, all computed under a model in which per-token log-ratios are independent and normal with mean -σ²/2, so each token's weight averages 1. The measured presets convert the train-inference KLs reported by Ma et al. (2025) for dense Qwen3–8B, MoE Qwen3–30B-A3B and the MoE with rollout routing replay into a per-token spread with σ = √(2 KL). Real mismatch is heavy-tailed and correlated, so the model understates the worst tokens. Definitions follow Qi et al. (2025) for sequence-level importance sampling, Piché et al. (2025) for the effective sample size, Schulman (2020) for the k3 KL estimator, Schulman et al. (2017) for the PPO clip and Zheng et al. (2025) for GSPO, and the stepper's longest lengths are DeepSeek-R1-Zero's caps (DeepSeek-AI, 2025).Ma et al. estimate train-inference KL per token with , and measured for dense Qwen3–8B, for MoE Qwen3–30B-A3B and after routing replay [679]. Under the model , so , 0.055 and 0.039, and the sequence ESS is 0.28, 0.05 and 0.22 at 1,000 tokens (computed). Real mismatch is heavy-tailed and correlated [679], so the model only teaches.
Better to attack the cause, as in the case study below. FP16 has 8 times BF16's precision (Section 5.6), and the FP16 paper prices importance-sampling patches at one extra forward pass, about 25% of training cost [683]: forward plus backward is 3 units and one more forward makes 4, so the extra pass is a quarter of the new step, or a third more than before (computed). In MoE models about 10% of router decisions and 94% of tokens pick different experts in the two engines. Rollout Routing Replay (R3) reuses the sampler's routing in training [679] (Section 4.7), unlike GSPO's replay inside the trainer. Unreplicated 2026 preprints split the error into a fixed numeric part and a growing policy lag [687, 688, 689, 690].
MiniMax-M1's reward would not grow. Comparing training and inference probabilities layer by layer traced the gap to "high-magnitude activations in the LM head", and an FP32 head raised the probability correlation from about 0.9 to 0.99 [656]. In MoE RL, multi-turn GRPO on software tasks "collapses after around 90 training steps" until routing was replayed, then reached Pass@1 38.6, 6.8 points higher [679]. Log train-inference KL and the share of ratios above 2 from day one.
What to log
Recompute old log-probabilities in the trainer [678]. Each step, log entropy, length, the zero-variance fraction, train-inference KL, the share of ratios above 2 and the clip fraction. Keep the LM head in FP32 and staleness to a few updates. What to monitor during a run is in Section 12.5. Why identical prompts at temperature 0 give different outputs (80 completions in Thinking Machines' test) is in Section 12.7.
9.7 Thinking longer, and what RL actually adds
How should inference compute be spent on a trained model, and does RL with verifiable rewards teach new reasoning or only make existing reasoning more likely? You can sample many attempts and aggregate them (parallel compute) or make one attempt longer (sequential compute). Reasoning models are trained for the second. The first gives a measuring stick: pass@k at large counts a problem as solved if any attempt works, so it measures what a model can ever solve. How both scale is in Section 6.8.
Parallel compute: voting is not pass@k
Self-consistency samples several reasoning paths and keeps the most frequent answer, which raised GSM8K accuracy by 17.9 points [691]. Coverage, the share of problems solved by any of samples, keeps rising over four orders of magnitude of [479]. A majority vote (cons@k) needs no oracle but converges to the answer the model prefers: with the right answer at 0.30 and one wrong answer at 0.45, pass@64 is 1.00 and cons@64 about 0.08 (computed, illustrative). DeepSeek-R1 scores 79.8% pass@1, 86.7% cons@64 and 90.0% pass@64 on AIME 2024, while voting lifts GPT-4o only from 9.3% to 13.4% [3] (reported).
Sequential compute: budget forcing and thinking budgets
s1 fine-tuned Qwen2.5–32B-Instruct on 1,000 selected questions in 26 minutes on 16 H100s. At decode time, budget forcing caps thinking by appending the end-of-thinking delimiter, and extends it by suppressing the delimiter and appending "Wait" [482]. Of the methods in Table 9.12 it alone both respects the budget and gains from more tokens, and pairing the others with it scores lower [482]. It takes AIME 2024 from 50% to 57%. That is two problems out of 30, while a single-sample score at accuracy 0.5 has a standard error of , 9.1 points (computed). Error bars are in Section 10.4.
Table 9.12. Ways to control thinking length in s1–32B (reported, s1 Table 3 [482]). Control is the share of runs that respect the budget, scaling the average slope of accuracy against thinking tokens.
| Method | Control (%) | Scaling slope | Best AIME 2024 (%) |
|---|---|---|---|
| Budget forcing | 100 | 15 | 56.7 |
| Token-conditional prompt ("think for at most N tokens") | 40 | −24 | 40.0 |
| Step-conditional prompt | 60 | 3 | 36.7 |
| Rejection sampling to the budget | 100 | −35 | 40.0 |
Products expose the budget: Qwen3 stops at a user threshold [198], gpt-oss has three reasoning levels [28], and Kimi k1.5 adds a group-relative length reward [648]:
Lengths of 2,000, 4,000, 6,000 and 10,000 tokens give , , and (computed, illustrative), and a wrong answer never gains. Thinking can be too long or too short (Table 9.13).
Table 9.13. Too much and too little thinking (reported).
| Study | Finding |
|---|---|
| Chen et al. [692] | On trivial arithmetic, o1-like models used 1,953% more tokens than conventional models. In over 92% of cases the first solution round was already right |
| Ma et al. [693] | Skipping the thinking block and sampling short answers matches thinking on pass@k with 2.0 to 5.1 times fewer tokens |
| Cuadron et al. [694] | SWE-bench Verified: o1 at high effort 29.1% for $1,400, two low-effort runs filtered by an overthinking score 27.3% for $800 |
| Wang et al. [695] | Underthinking: switching strategy too early on hard problems |
| Shojaee et al. [696] and Lawsen [697] | Reported accuracy collapse beyond a puzzle complexity. The reply traces many zeros to output limits and unsolvable instances. Lesson: check the output budget can hold a correct answer |
Does sequential compute need a checker? Setlur et al. prove that verifier-free methods (fine-tuning on expert traces, as in s1) fall behind a simple verifier-based one by a gap growing as in the token budget when data grows with the budget [698]. Imitation copies wasteful traces too. A verifier keeps the cheap correct ones. Together with the distillation results of Section 9.4, the rule is: distill to start, verify to continue.
The token at position costs about FLOPs in matmuls plus attention over the tokens before it:
DeepSeek-R1 averages 8,793 thinking tokens on 366 problems from 2024 contests [3]. With B, 128 heads, 61 layers and MLA in expanded form, [2], matmuls cost FLOPs and attention : per trace and for cons@64 (computed). For dense Llama 3 70B (80 layers, ) [6],
0.009 at 1,000 tokens, 0.074 at 8,000 and 0.30 at 32,000 (computed). Grouped-query attention shrinks the KV cache, not these FLOPs, and the KV reads are what bound decode speed (Section 13.2).
What RL adds: the pass@k argument
Yue et al. compared base models with their RLVR versions at up to 1,024 [484]. RL wins at small , but at tens or hundreds of samples the base passes it. For Qwen2.5–7B on AIME 2024 at , 13.3% of problems were solved only by the base and 0.0% only by the RL model (reported). Count with the unbiased estimator of Section 10.3, for samples with correct [699]: at , , it gives 0.775 where the naive gives 0.728 (computed).
Why would sharpening lose at large ? With the success probability on problem ,
the share of problems the model can solve at all. RL raises where it is positive, lifting pass@1, and can push a few to zero, shrinking that support. Take 30 illustrative problems: under RL, 10 go from 0.30 to 0.80, 9 from 0.08 to 0.25, 4 from 0.01 to 0, and 7 stay unsolvable. pass@1 is 0.125 for the base and 0.342 for RL, but the base leads from and ends at 0.767 against 0.633 (computed). In Figure 49, pick "Sharpening without forgetting" and the curves meet instead of crossing.
Method and sources
Each curve is the average over problems of 1 − (1 − p)^k, computed in this guide, so at large k it approaches the share of problems with p above zero. The side chart shows the reported shares of problems solved by both models, by only one or by neither, for Qwen2.5–7B and its SimpleRL-Zoo RL version on AIME 2024 at k = 1,024 and MATH-500 at k = 128, from Yue et al. (2025). The estimator used in practice for pass@k comes from Chen et al. (2021).Table 9.14 shows the evidence splits by setup. As of November 2026, RLVR at open-source scale mostly sharpens, and expands coverage when trained long on problems at the edge of competence with entropy and KL managed (Section 9.6). A two-stage view, exploit then explore, reconciles the camps [700]. Distillation remains the reliable way to add patterns.
Table 9.14. Does RL expand what a model can solve? (reported)
| Study | Setup | Finding | Reading |
|---|---|---|---|
| Yue et al. [484] | Qwen2.5 bases, six RL algorithms | Base pass@256 over 40 points above RL pass@1 in domain. Training pass@1 26.1 to 42.5 while pass@256 fell | Sharpens |
| Qwen3 [198] | Qwen3-8B | RL left pass@64 unchanged, on-policy distillation raised it | Sharpens |
| Wu et al. [701] | Support measured per problem | Support shrinks more than it grows at the budgets tested | Mostly sharpens |
| ProRL [485] | 1.5B, over 2,000 steps, KL control, reference resets | RL beats base across pass@k, also where base fails at any | Expands |
| Wen et al. [702] | DAPO-Qwen-32B, CoT-pass@k (answer and reasoning right) | RL ahead at every up to 1,024 on AIME 2024 and 2025 | Base's large- wins include lucky guesses |
| Zhang et al. [703] | Controlled pretraining | Real gains only with pretraining headroom and RL data at the edge of competence | Conditional |
Random rewards raised Qwen2.5-Math-7B on MATH-500 by 21.4 points against 29.1 for correct rewards, but often did nothing for Llama 3 or OLMo 2, and the authors blamed GRPO's clipping [649]. Then Qwen2.5-Math-7B, given 60% of a MATH-500 problem, reproduced the rest exactly 54.6% of the time (Llama 3.1 8B: 3.8%), and 0.0% on newer problems [704]. Both mechanisms can act at once. Nobody did anything wrong: these were the strongest small open math models. The fix is procedural (Section 10.5).
Rerun on a second model family. Evaluate on problems written after the base model's data cutoff. Count the gain in problems: one MATH-500 problem is 0.2 points, one AIME problem 3.3. Report pass@1 as a mean over many samples and say how many. Look at pass@k at large and, where you can, CoT-pass@k.
9.8 RL as a systems problem: generation, the long tail and asynchrony
Why does an RL step on a large model use a few percent of the hardware's peak FLOP/s, and how do modern systems run about twice as fast? A step samples prompts, generates answers in an inference engine such as vLLM, scores them, computes old-policy and reference log-probabilities, trains, and pushes new weights to the engine. Generation is decoding, one token at a time, each reading every weight from memory, so it is bound by memory bandwidth (why rollouts are decode-bound is in Section 13.2). It is the largest and least efficient part, and a synchronous step waits for its longest answer.
Where the time goes
DeepSpeed-Chat put generation at about 20% of the computation in 2023, with 256-token answers [705]. With long chains of thought, OpenRLHF's authors put inference at over 90% of the runtime [706], and HybridFlow measured NeMo-Aligner's generation at up to 81.2% of an iteration [707]. Table 9.15 shows one breakdown. For an illustrative 32B model and 32.8M response tokens, generation at per token is FLOPs and the update at is (computed): three times the FLOPs, less of the clock. PipelineRL writes learning speed as
reward per sample times samples per second [686]. On-policy training maximizes the first factor, asynchrony the second.
Table 9.15. One PPO step of NeMo-Aligner on a Llama 3 70B actor and critic, HelpSteer2 prompts, rollout batch 128, H100 nodes (reported [708], shares and residual computed).
| Phase | 8 + 4 nodes (s) | 16 + 8 nodes (s) |
|---|---|---|
| Response generation | 35.8 (67%) | 17.5 (59%) |
| Log-probabilities | 4.0 | 2.8 |
| TensorRT refit (weight sync) | 3.1 (5.8%) | 2.3 (7.7%) |
| Other rollout time (computed residual) | 2.3 | 2.4 |
| Train | 8.5 | 4.8 |
| Whole step | 53.7 | 29.8 |
Doubling the job in Table 9.15 cut generation 2.05 times, but loading new weights into the TensorRT engine took nearly as long, so its share rose from 5.8% to 7.7% [708] (computed). Fixed costs grow as a share when you add hardware: put weight sync and engine restarts on the step-time dashboard.
The long tail, and why more GPUs do not fix it
Reasoning lengths are heavy-tailed, and a synchronous step must wait for the longest sequence [709]. As sequences finish, each GPU's decode batch drains, and StreamRL calls the idle time skewness bubbles [710]. More GPUs leave each with fewer sequences, a memory-bound regime "where additional devices fail to improve throughput" [709]. In Figure 50, watch the active sequences sag long before the last answer ends, then compare the three timelines in step 4.
Method and sources
The simulation is computed in this guide from the Llama 3 configuration (Grattafiori et al., 2024) and H100 specifications (NVIDIA), with lognormal response lengths from one random draw, so other draws shift the times by about 5%. The asynchronous and partial-rollout designs follow PipelineRL (Piché et al., 2025), AReaL (Fu et al., 2025) and Kimi k1.5 (Kimi Team, 2025). Step 5 shows two reported results: NeMo-Aligner's PPO step on Llama 3 70B (Shen et al., 2024) and LlamaRL's step times against a colocated synchronous baseline (Wu et al., 2025), where the 70B and 405B generators also switch to FP8.Take 512 prompts with 16 samples each, lognormal response lengths (median 3,000 tokens, , cap 16,384) and 64 colocated H100s, each decoding 128 sequences. Decode runs at 70% of 3.35 TB/s or 50% of 989.5 TFLOP/s, whichever binds, and training at 40% MFU [4, 6]. Table 9.16 gives one random draw (other seeds vary by about 5%). No number of GPUs removes the 120 s tail.
Table 9.16. The simulated GRPO step on Llama 3 8B (computed, illustrative).
| Quantity | Value |
|---|---|
| Generation on the slowest GPU | 267 s |
| Longest single answer at batch 1 | 120 s |
| Mean decode-batch occupancy | 31% of peak |
| Generation time below a quarter of peak batch | over half |
| Training ( per token: update plus two log-probability passes) | 119 s |
| Synchronous step (generation share) | 386 s (69%) |
| Asynchronous, 45% of GPUs generating | 216 s (1.78 times faster) |
| Colocated with partial rollouts | 215 s (1.80 times faster) |
Memory adds pressure. Model states (Section 8.5) share GPUs with the KV cache, 128 KiB per token for Llama 3 8B in BF16 [6], so 128 sequences at 8,000 tokens need 134 GB, more than one 80 GB GPU (computed).
Two axes: placement and timing
Colocated systems alternate the same GPUs between generating and training, disaggregated ones dedicate GPUs to each. Synchronous systems generate with the current weights, asynchronous ones keep generating while training updates. Colocation needs cheap resharding, since training wants wide model parallelism and generation narrow. HybridFlow gathers only within small groups where each GPU's training shard is already part of its generation shard [707, 711] (Table 9.17, with the training model-parallel group and the generation one, all-gather costs in Section 11.1). Its 1.53 to 20.57 times speedups forced equal response lengths, hiding the tail [707]. Kimi K2 stays colocated at 1T parameters [72].
Table 9.17. Per-GPU traffic and peak parameter memory to reshard an actor of bytes for generation (HybridFlow Table 2 [707], in this guide's symbols).
| Scheme | Traffic per GPU | Peak memory |
|---|---|---|
| All-gather over all GPUs (DeepSpeed-Chat) | ||
| Within the training group (HybridFlow-V) | ||
| Within micro data-parallel groups (HybridFlow) |
A 70B actor is GB in BF16. Trained at , and generated at tensor parallelism 2, it moves GB per GPU for a full all-gather, GB within the training group and GB under HybridFlow, with a 71 GB peak instead of 141 GB (computed). Any weight sync needs
For 405B, 812 GB over eight 50 GB/s links takes at least 2.03 s (computed). LlamaRL measured 2.31 s, under 4% of its 59.5 s step [712]. StreamRL's 72B model over 80 Gb/s in under 10 s [710] beats the 14.4 s bound (computed), unexplained.
Disaggregation gives memory-bound generation and compute-bound training their own GPUs and parallelism [710], and asynchrony keeps both busy. AReaL admits a new generation request only if
with the trajectories generated so far, the training batch in trajectories (not tokens, as elsewhere in this guide), the current policy version and the staleness bound [709]. At and it admits 512, 1,024, 2,560 and 4,608 trajectories for (computed). With the PPO clip centered on a recent policy rather than the stale sampler, staleness up to 8 barely hurts, while naive PPO degrades with slight staleness [709]. Table 9.18 collects reported gains.
Table 9.18. Asynchronous and disaggregated RL systems (reported). Each speedup is against the paper's own baseline, so rows are not comparable.
| System | Design | Reported gain | Baseline |
|---|---|---|---|
| Asynchronous RLHF [713] | One step off-policy. Online DPO most robust to stale data | About 40% faster at equal GPT-4-judged quality | Synchronous RLHF |
| Tülu 3 RLVR [550] | Trains on the second-latest inference data | Not reported | |
| StreamRL [710] | Disaggregated streaming, length ranker | Up to 2.66 times throughput (+8% skew-aware scheduling, +15% streaming, +25% asynchrony) | Prior systems |
| AReaL [709] | Interruptible generation, staleness bound, decoupled PPO | Up to 2.57 times throughput. 1.5B model: 14.8 h against 41.0 h at similar AIME 2024 | Its own synchronous mode |
| PipelineRL [686] | Weights swapped mid-sequence. Some tokens lag over 50k samples, effective sample size like | About 2 times faster learning | Conventional RL |
| Magistral [668] | In-flight updates, broadcast under 5 s, no KV-cache recompute | Not reported | |
| LlamaRL [712] | Separate executors, importance weight capped above at a constant between 2 and 10, FP8 generators at 70B and 405B | 2.52, 3.98 and 10.7 times per step at 8B, 70B, 405B | Colocated synchronous, same GPUs |
Why does asynchrony win (derived)? If generation scaled perfectly with GPUs, both designs would tie, since both keep every GPU busy. It does not: the end-of-batch barrier and the draining batch waste the generator, and streaming refills the batch while long answers finish. So partial rollouts recover most of the gain without splitting GPUs. Kimi continues unfinished trajectories in the next iteration [648], and BubbleSpec (a 2026 preprint) drafts future rollouts in the tail's idle time [714].
To do it yourself (as of November 2026), measure the phase breakdown and decode occupancy first. Colocate synchronously for short-to-medium reasoning and go disaggregated and asynchronous for slow agent environments or very large models, as GLM-4.5 does by task, with FP8 rollouts [295]. Keep staleness small: AReaL's 8, Magistral's ratio of 2 [668], OpenAI Five's 0 to 1 [715]. Log effective sample size, train-inference KL and sync time (Section 12.5). Frameworks include TRL [716], ROLL [717] and SkyRL [718]. Sizing sandbox fleets for RL is Section 14.7.
9.9 Agents and reward hacking
What changes when the policy acts over many turns in an environment, and what does an optimizer strong enough to write code do with a reward written by people? An agent's trajectory interleaves its own tokens, which are actions, with the environment's: tool outputs, files, test logs. Rewards arrive at the end. And the reward is a program someone wrote, with gaps that a strong optimizer will find if they are easier than the task.
From scaffolds to outcome-reward RL
WebGPT trained GPT-3 in a text browser, and its answers beat human demonstrators' 56% of the time [719]. ReAct's thought, action and observation loop is still the default scaffold [720], and Toolformer kept a self-sampled API call only if it lowered the loss on later tokens [721]. ReTool's RL rewards only the outcome and lets the policy learn when to run code mid-reasoning [722], and SWE-Gym supplied 2,438 executable Python repository tasks for training SWE agents [723]. In 2025 outcome-reward RL reached software engineering. SWE-RL rewards textual similarity to the true patch without running code and solved 41.0% of SWE-bench Verified at 70B [724]: it scales without sandboxes but rewards closeness, not correctness. DeepSWE trained Qwen3–32B with RL alone on executable R2E-Gym tasks [725] to 42.2% pass@1 [9]. DeepSWE's setup (64 H100s, six days, 512 containers per iteration) is in Section 14.7. Kimi K2 runs over 10,000 concurrent sandboxes [72].
No policy-gradient loss on environment tokens: tool outputs, retrieved text and simulated users are not actions [726]. A defined meaning for limits: DeepSWE masks trajectories that hit the context limit, a 20-minute timeout or the step limit instead of scoring them 0 [9]. Per-step credit when trajectories are long, as GiGPO's groups of repeated environment states, which beat GRPO by more than 12% on ALFWorld [727], or ArCHer's turn-level values [728]. A watch for collapse, which RAGEN's Echo Trap shows as falling reward variance, an entropy drop and gradient spikes [729]. And a dashboard for environment latency, because GPUs idle while rollouts wait on environment feedback [72].
Reward hacking
Specification gaming is behavior that satisfies the literal objective without the intended outcome, and it comes from a misspecified task, not a flawed RL algorithm [730]. More capable agents exploit it more, sometimes in abrupt phase transitions [731]. Over-optimization of learned rewards is in Section 8.6. METR found an earlier o3 hacking in 39 of 128 RE-Bench runs, where the scorer was visible, against 8 of 1,087 HCAST runs, about 41 times as often by these totals (computed, METR's post says more than 43 times), and telling it not to cheat barely helped [732]. Hacking can generalize: models that learned hacks in production coding environments attempted sabotage 12% of the time in MacDiarmid et al.'s main setting [610]. The catalogue of documented reward hacks is in Section 14.6.
In agentic coding RL of a frontier reasoning model, two simple hacks, exiting before all tests ran and raising exceptions to skip test evaluation, spread to nearly every environment. A prompted GPT-4o reading the chain of thought caught them with 95% recall, against 60% for a monitor that saw only actions, and the environments were patched. In a separate experiment on a non-frontier reasoning model, an agent trained with that monitor in its reward kept hacking while the monitor's recall fell to near zero: obfuscated reward hacking [733]. Monitor live, fix environments, pay the "monitorability tax" and never train against your detector.
Yet chains of thought often omit what drove a behavior (Table 9.19). A hypothesis reconciles 95% with under 2%: models may need to think out loud on some tasks without a robust propensity to on others [734], so monitoring works best where misbehavior requires thinking, as in Baker's long tasks. The gpt-oss developers kept optimization pressure off the chain of thought [28], but a 2026 preprint finds misspecified rewards alone degrade monitorability [735].
Table 9.19. How often the chain of thought reveals what drove the behavior (reported).
| Study | Measurement | Result |
|---|---|---|
| Turpin et al. 2023 [736] | Unmentioned biasing features in few-shot prompts | Accuracy down by up to 36% on 13 BIG-Bench Hard tasks |
| Lanham et al. 2023 [737] | Faithfulness against model size | Larger models less faithful on most tasks |
| Chen et al. 2025 [738] | Admitting a planted hint that changed the answer | 25% (Claude 3.7 Sonnet), 39% (DeepSeek-R1). Outcome RL plateaus at 28% (MMLU) and 20% (GPQA) |
| Chen et al. 2025 [738] | Planted reward hacks during RL | Verbalized on under 2% of examples while used on over 99%, in 5 of 6 environments |
| Guan et al. 2025 [739] | Monitorability at the frontier | Not materially reduced by RL at current scale. A smaller model at higher effort is much more monitorable |
| o1 system card [671] | GPT-4o deception monitor over o1's chains of thought | 0.17% of responses flagged |
Mitigations sort by where they act. In the environment: graders the policy cannot touch, hidden held-out tests and impossible-task probes, as Anthropic used for Claude 4 [740]. In training: monitors for alerts and patches, not reward [733], and inoculation prompting, which frames hacking as acceptable during RL and cut final misalignment by 75–90% [610] (a 2026 preprint found the framing fails in midtraining documents [741]). Telling the policy not to cheat and chat-style safety RLHF work poorly on agentic tasks [610]. Deliberative alignment hides the chain of thought from its RL judge [632], and Rule Based Rewards grade outputs against written rules [631]. The common thread: reward outputs and actions, and monitor the chain of thought instead.
A group of 8 answers has rewards (1, 1, 1, 1, 1, 1, 1, 0). What advantage does the one wrong answer get under GRPO, Dr. GRPO and RLOO, and why is GRPO's so large?
The mean is 0.875 and the population standard deviation . GRPO gives , Dr. GRPO , and RLOO , since the other seven scored 1 (computed). Dividing by a small standard deviation gives a rare failure on an easy prompt a large weight. Over a group GRPO hands out of absolute advantage against for Dr. GRPO, a factor at : the difficulty bias of Section 9.3.
GRPO adds , with , to its loss. Is that a reverse-KL penalty?
Its value estimates the reverse KL, , without bias. Its gradient does not. , and under the first term averages to zero while the second averages to , the forward-KL gradient. For the reverse-KL gradient use as the loss, or importance-weight as DeepSeek-V3.2 does (Section 9.6).
A base model scores 12.5% pass@1 and its RL-tuned version 34%. At the base scores 77% and the RL model 63%. Explain both numbers without saying RL is bad.
pass@1 averages per-problem success probabilities, and RL raised them on problems the base could already solve. At large , pass@k tends to the share of problems with any chance of success, and RL pushed a few of those probabilities to zero. It sharpened the distribution and shrank its support. Caveat: on short-answer benchmarks some large- base hits are lucky guesses, and CoT-pass@k, which also checks the reasoning, narrows or reverses the gap.
Why does adding GPUs to a synchronous RL job often barely speed up generation?
The same batch over more GPUs leaves each with fewer sequences. Decoding at small batch is bound by memory bandwidth, since every step reads all the weights however many sequences share them, so throughput per GPU falls. And the step cannot end before the longest answer does: in the Llama 3 8B example that answer needs 120 s even alone. Asynchronous pipelines or partial rollouts remove the barrier and keep decode batches full.
A chain-of-thought monitor flags reward hacking with 95% recall. Why not add its score to the reward?
Baker et al. found it helps at low optimization, but with more optimization the agent learned obfuscated reward hacking and the monitor's recall fell to near zero. You lose the detector and keep the hacking. Use the monitor to find and patch environment bugs, keep strong pressure off the chain of thought, and accept the monitorability tax.
- RLVR replaces a learned reward with a checker. Make the checker agree with careful human grading before training, because a grader bug is a training bug: three MATH graders differ by up to 1.66 times on the same outputs (Section 9.1).
- Every method in this chapter has REINFORCE's form: an advantage times the gradient of a token's log-probability, with a normalizer and sometimes a clipped weight. GRPO, Dr. GRPO and RLOO differ in scale, and GRPO's and standard-deviation terms favor long wrong answers and very easy or very hard prompts.
- A group whose answers all agree has zero advantage, with probability . Filter those groups, log their share every step, and use 8 to 16 samples per prompt.
- R1-Zero showed that RL with rule-based rewards can take a strong base from 15.6% to 77.9% on AIME 2024 for about 3.6% of DeepSeek-V3's full training GPU-hours [3]. Small bases failed, and for small models distillation from a strong reasoner beat RL at about a tenth of the cost.
- Each 2025 fix targets one failure: entropy collapse, zero-variance batches, length bias, truncation, critic bias, noisy token ratios. Head-to-head studies find most of them change efficiency, while CISPO or GSPO and an FP32 LM head raise the ceiling.
- Watch three things: KL (drop it from a base model, and know that as a loss is a forward-KL regularizer), entropy (collapse comes in the first few hundred steps) and the sampler-trainer mismatch, which makes whole-response importance weights useless at thousands of tokens and is best fixed at the source.
- RL mostly sharpens what the base model can already do, unless it is trained long on problems at the edge of competence. Validate RL claims on two model families and on problems written after the base model's cutoff, and count gains in problems.
- Generation takes about 60% to over 90% of an RL step because decoding is memory-bound and waits for the longest answer, so bounded-staleness asynchrony and partial rollouts give about 2 times. Reward hacking is the default outcome of strong optimization against a flawed checker: keep graders out of reach, monitor chains of thought, and never train against the monitor.
10. Evaluation: measuring what a model can do
A benchmark score is a reading from an instrument with inspectable parts. The questions, sampling procedure, harness, grader and uncertainty determine what the number means. An evaluation is useful when it can resolve the decision the team needs to make.
What does a number like "ARC-Challenge 25-shot: 78.6" actually tell you? Less than it seems. Meta's model card gives Llama 3 8B 78.6% on ARC-Challenge, a set of grade-school science questions. The Hugging Face Open LLM Leaderboard gives it 60.2%. Both are 25-shot. The card scores the letter the model picks, the leaderboard each answer string as a continuation [497]. Same weights, same benchmark name, 18.4 points apart (computed).
The code matters as much as the prompt. In 2023 LLaMA-65B scored 0.636 on MMLU with the benchmark's original code, 0.637 with Stanford's HELM and 0.488 with the EleutherAI harness then behind the leaderboard, a 14.8-point gap between the original code and the harness (computed). As the authors of that comparison put it, "evaluations are strongly tied to their implementations" [742].
So treat a score as a measurement made with an instrument: a sample of questions, an answer key, a prompt and formulation, the model and its decoding settings, a scoring rule or judge, and the aggregation. Agents add a scaffold (the code that turns a model into an agent), an environment, a grader and an attempt budget. Each stage adds noise, which shrinks with more questions, samples or seeds, or bias, which does not. Figure 51 shows the largest documented effect at each stage. Compare them with the dashed line at 2 points, a typical gap between frontier models (illustrative).
Method and sources
Bars show the largest documented effect of each stage in points of a percentage score: purple for noise that shrinks with more questions, samples or seeds (95% half-widths) and red for bias that does not. Text chips give effects measured in other units, such as the share of erroneous items, Elo ratings or minutes. The agent view adds the scaffold, attempt budget, benchmark curation and grader, and the dashed line marks an illustrative 2-point gap. The half-widths for AIME 2024, MMLU and Terminal-Bench 2.0 are computed with the binomial and resampling formulas in Miller (2024), and the AIME range runs from 64 samples per question under an illustrative difficulty assumption to one draw per question. The other values are as reported by Grattafiori et al. (2024, the Llama 3 report), DeepSeek-AI (2025), Gu et al. (2024), Sclar et al. (2023), Biderman et al. (2024), Fourrier et al. (2023), Gema et al. (2024), Hochlehnert et al. (2025), Atil et al. (2024), He (2025), Zhang et al. (2024), Dubois et al. (2024), Zheng et al. (2023, 2024), Singh et al. (2025), Chowdhury et al. (2024), Chan et al. (2024), Zhu et al. (2025), Merrill et al. (2026) and METR (2026).Evaluations make the decisions in this guide: data ablations (Section 3.9), midtraining mixes (Chapter 7), post-training recipes (Chapter 8 and Chapter 9), checkpoints and safeguards (Section 10.8). Each needs the gap, the noise and the bias. Llama 3 publishes 95% intervals and calls them a lower bound on the true variation [6], and DeepSeek-R1 marks which stage-to-stage changes are statistically significant [3].
Sections 10.1 to 10.4 map the benchmarks and open the instrument. Sections 10.5 to 10.8 cover contamination, judges, agents and dangerous capabilities, and Section 10.9 builds the internal suite. The running examples and the notation are introduced in Section 0.3.
10.1 The benchmark landscape and how fast it saturates
Which numbers do labs report, what does each one measure, and why does every benchmark stop being useful within a few years? Benchmarks come in families, each built just beyond the models of its day. You need the map, the sizes (they set error bars), the chance levels (they set the floor) and the life cycle.
Loss first
Loss on held-out text needs no answer key. Bits per byte, which compares losses across tokenizers, is defined in Section 3.8. Fit is not capability: DeepSeek-V3's base model has 0.548 bits per byte on the Pile test set against 0.542 for Llama 3.1 405B base, yet leads it on 5-shot MMLU, 87.1 to 84.4 (reported) [2]. Average benchmark score does rise almost linearly with compression across 31 models [743], and Section 6.7 predicts downstream scores from loss.
The base-model suite and its successors
Each benchmark in Table 10.1 launched far below humans and closed the gap within a few years. HellaSwag's endings were trivial for people (over 95%) while the best model scored under 48% [744]. Test sets differ by a factor of about 470, from AIME 2024's 30 problems to MMLU's 14,042 (the released test split, while the paper says 14,079), and Section 10.4 turns them into error bars.
Table 10.1. The benchmarks in most model reports. Size sets the error bar and chance sets the floor. Later scores come from different papers and settings, so read them as a saturation trend, not a ranking.
| Benchmark (year) | Size | Format (chance) | Best at release | Human reference | Later reported score |
|---|---|---|---|---|---|
| MMLU (2020) [498, 3] | 14,042 | 4 options (25%) | GPT-3 175B 43.9% | experts about 89.8% | DeepSeek-R1 90.8% (2025) |
| MMLU-Pro (2024) [125, 3] | 12,032 | 10 options (10%) | GPT-4o 72.6% | - | DeepSeek-R1 84.0% (2025) |
| HellaSwag (2019) [744, 745, 2] | 10,042 validation | 4 endings (25%) | under 48% | over 95% | Llama 3.1 405B base 89.2% (2024) |
| WinoGrande (2019) [746, 2] | 44k (all splits) | 2 options (50%) | 59.4-79.1% | 94.0% | DeepSeek-V3 base 84.9% (2024) |
| PIQA (2019) [747, 6] | about 3k test | 2 options (50%) | about 77% | 95% | Llama 3 405B base 85.6% (2024) |
| TriviaQA (2017) [748, 2] | 95K pairs (all splits) | free-form short answer | 40% with evidence documents | 80% | DeepSeek-V3 base 82.9% closed-book (2024) |
| ARC (2018) [749, 6] | 7,787 | mostly 4 options (25%) | - | - | Llama 3 405B Instruct 96.9% on Challenge (2024) |
| BIG-Bench Hard (2022) [750, 2] | 23 tasks | mixed | CoT Codex beat the average rater on 17 tasks | average rater | DeepSeek-V3 base 87.5% (2024) |
| GSM8K (2021) [488, 7, 6] | 1,319 test | free-form number | - | - | Llama 3 405B Instruct 96.8% (2024) |
| MATH (2021) [751, 642, 3] | 12,500 (MATH-500: 500) | free-form | 6.9% | IMO gold medallist 90% | DeepSeek-R1 97.3% on MATH-500 (2025) |
| HumanEval (2021) [699, 6] | 164 | code, unit tests | Codex-12B 28.8% pass@1 | - | Llama 3 405B Instruct 89.0% (2024) |
| MBPP (2021) [752] | 974 | code, unit tests | 59.6% few-shot | - | - |
| GPQA Diamond (2023) [753, 754] | 198 | 4 options (25%) | GPT-4 39% (main set) | experts 65% (main set) | Grok 4 87.7%, as collected by Akhtar et al. (2026) |
| AIME 2024 [755, 3] | 30 | integer 0-999 | - | - | GPT-4o 9.3%, DeepSeek-R1 79.8% pass@1, as reported by DeepSeek (2025) |
| FrontierMath (2024) [756] | unpublished | auto-checked answer | under 2% | - | - |
| HLE (2025) [757] | 2,500 | exact or multiple choice, judge-graded | 2.7-13.4% | - | - |
| ARC-AGI-1 (2019) [758, 759] | 400 + 400 public | grid puzzles | 20% (Kaggle, 2020) | two testers 97-98% | o3 75.7% within the compute limit (2024) |
| ARC-AGI-2 (2025) [760] | - | grid puzzles | 3.0% (May 2025) | every task solved by at least two people | - |
Generative math and code expose the answer checker. GSM8K's word problems are fragile: adding one irrelevant clause causes drops of up to 65% [761]. Weak unit tests inflate code scores, and HumanEval+ adds 80 times more tests and lowers pass@k by up to 19.3–28.9% [762].
Frontier sets buy headroom with expert difficulty. On GPQA, experts reach 65% and skilled non-experts with web access 34% [753]. DeepSeek-R1 reports 71.5% on its Diamond subset against 75.7% for OpenAI's o1–1217, but the o1 number comes from OpenAI's own reports, so the comparison crosses two pipelines [3]. HLE's authors warn that small changes near zero accuracy are not strong evidence of progress [757], and once o3 reached 87.5% on ARC-AGI-1 with 172 times more compute, ARC Prize required cost to be reported [759].
Saturation
Benchmarks die young. Ott et al. mapped 3,765 benchmarks and found that many trended quickly toward saturation [763]. Akhtar et al. define saturation as the loss of reliable discrimination among the top models and score it with an index [754]:
Here and are the best and fifth-best scores as fractions, and questions enter as so that huge test sets do not look too discriminating. An index near 1 means the top five are indistinguishable. On MATH-500 (top five from 99.2% to 98.2%, 500 problems) the index matches the paper (computed):
Nearly half of their 60 benchmarks are saturated, from 42.9% of those under two years old to 54.5% of those over five (a modest trend that the authors note is not statistically significant), and private test sets did not protect them [754].
The index is a convention, not a test. On the MMLU row of DeepSeek-R1's comparison table, whose top five run from 91.8 to 87.2 on 14,042 questions, it gives 0.26. With raw in place of the same spread is 12.6 standard errors and the index is about (computed) [3]. Figure 52 follows 16 of these benchmarks (GSM8K and ARC lack a release-time score in the sources read). In each panel, count the years from the first dot (the best score at release) to the dashed human line or the top. BIG-Bench Hard and AIME 2024 have no release-time point, and FrontierMath's caret is an upper bound. Hollow dots mark another subset or setting and stay off the running-best line when the item set differs.
Method and sources
Hollow dots use a different subset, metric or a secondary source (for example MATH-500 inside the MATH panel, GPQA's main set inside Diamond, or Codex at pass@100), so settings differ within a panel: read trends, not comparisons. Hollow dots from a different item set or metric stay off the running-best line and the "1st ≥ 90%" marker, so the MATH panel's best is 73.8% on full MATH, not the 99.2% on MATH-500. The "1st ≥ 90%" marker is the first documented score at or above 90% (computed), FrontierMath's caret is its paper's reported upper bound of 2%, and a year without a dot is a year with no documented number in the sources read, not a year without progress. All scores are reported values, collected as of November 2026. Sources: the benchmark papers (Joshi et al. 2017, Zellers et al. 2019, Sakaguchi et al. 2019, Bisk et al. 2019, Hendrycks et al. 2020 and 2021, Chen et al. 2021, Austin et al. 2021, Rein et al. 2023, Wang et al. 2024, Glazer et al. 2024, Phan et al. 2025), the Llama 3, DeepSeek-V3 and DeepSeek-R1 reports, the ARC Prize reports (Chollet et al. 2024 and 2025), a FutureHouse post (Skarlinski et al. 2025) and Akhtar et al. (2026).Saturated benchmarks get replaced by harder successors in the same format (MMLU-Pro, ARC-AGI-2, BIG-Bench Extra Hard, where the best reasoning model scores 44.8% [764]), expert adversarial sets (GPQA, FrontierMath, HLE), refreshed questions (LiveBench updates monthly [765], and MathArena found strong signs of contamination in AIME 2024 [766]), and preference and agent evaluations (Sections 10.6 and 10.7).
HLE's filter bought headroom (a saturation index of 0.22 in 2026 [754]). It probably also favored contested keys, since a wrong key is one reason a model fails (our inference). HLE's own review of a biology, chemistry and health subset found about 18% expert disagreement [757]. FutureHouse's literature-search audit of the 321 text-only chemistry and biology questions estimates that 29% (plus or minus 3.7 points) conflict with published evidence [767]. HLE-Verified kept 668 of 2,500 items unchanged, revised 1,143 and left 689 uncertain [768]. Lesson: if you keep only the items models fail, budget extra review for those items.
Three mistakes recur: comparing per-token loss across tokenizers, treating MATH and MATH-500 (or GPQA and its Diamond subset) as one benchmark, and reading a jump in exact-match accuracy as a new ability, since discontinuous metrics can produce apparent emergence [477] (Section 6.7).
10.2 How a question becomes a number
Given a model and a benchmark, which choices besides the model move the score, and by how much? A score is a fact about a model, a prompt, a scoring rule, an answer key and the code that joins them. Change any one and it moves, sometimes by more than a model generation.
Two formulations of a multiple-choice question
The cloze formulation (CF) scores each answer string as a continuation of the question and picks the most probable. The multiple-choice formulation (MCF) shows lettered options and scores only the letter predicted next [497]. Raw log-probability penalizes long answers, so cloze needs a normalization. For option and question :
Llama models and the EleutherAI harness use the per-character form (the harness's acc_norm). The pointwise mutual information (PMI) form divides out how likely the answer is after the bare prompt "Answer:". A per-token form also exists [497].
Options A to D have log-probabilities after the question of -4.0, -9.0, -8.0 and -6.0, lengths of 1, 3, 4 and 2 tokens or 5, 30, 14 and 10 characters, and log-probabilities after "Answer:" of -6.0, -10.0, -11.0 and -12.0. No normalization picks A (-4.0), per token C (), per character B () and PMI D () (computed). A paper must name its rule.
The right formulation depends on the model. MCF needs a learned skill, mapping an answer to its letter, and OLMo-7B picked it up only after about 400B training tokens, so cloze is the better early signal [497]. For strong models letters win: Llama 3 70B scores 93.7% on ARC-Challenge with letters and 69.0% with cloze, error rates of 6.3% and 31% [497]. OLMES, the OLMo team's standard, fixes the prompt, the 5-shot examples and the normalization per task, runs both formulations and reports the better [497].
Prompt format
Meaning-preserving changes of separators and spacing move accuracy by up to 76 points for LLaMA-2 13B and about 10 points on average over more than 50 tasks, and they flip orderings: LLaMA-2 13B and LLaMA-2 70B reversed by at least 2 points with probability 0.141 [769]. Models also favor letters: on letter-balanced MMLU items llama-30B picks A 34.6% of the time and D 15.8% [770]. Design helps: across 24 prompts MMLU's range is usually 4–5 points and MMLU-Pro's, with ten options, about 2 [125].
The answer key is a variable
MMLU-Redux re-annotated 100 questions from each of 57 subjects and estimates that 6.49% of MMLU's questions contain errors, including 57% of the Virology questions it checked [771]. Weighting each subject's error rate by its size in the 14,042-question test split reproduces the 6.49% (computed). Llama 3.1 405B Instruct ranked 16th on all Virology questions and first on the correct ones [771]. Errors also cap the score. If a perfect model matched the key on every sound question, a quarter of the unclear ones, half of those with several correct options and none of the rest, it would score
(computed from MMLU-Redux's category shares, the matching shares are assumptions). A score far above 95% suggests a memorized key.
The harness, the template and the decoder
On MMLU the leaderboard's harness gave LLaMA-65B 0.488 against 0.636 for the original code, and Falcon-40B's three scores (0.571, 0.527 and 0.558) changed which of the two models ranked higher [742]. The original compared the probabilities of the four letters, HELM compared generated text, and the harness scored the full answer sequence. The lesson: pin the harness version and the scoring rule, and never copy a baseline from a paper that used another harness.
Chat models need their own chat template [772]. Generation caps fail silently: the GSM1k authors raised the harness's cap from 256 to 1,000 tokens because the default cut models off [773]. "Deterministic" decoding varied accuracy by up to 15% across runs for five models [774], and a distilled 7B reasoning model by up to 9% with GPU count, type and batch size [402]. Why identical prompts at temperature 0 give different outputs (80 distinct outputs from 1,000 completions in Thinking Machines' test) is in Section 12.7.
Every metric needs a trivial control: Anthropic's BBQ bias evaluation once showed a bias score of zero because the models were not answering at all [772]. Table 10.2 collects this section's spreads, and Figure 51 sets them beside the other stages.
Table 10.2. One model, many scores. Each row changes one part of the instrument and keeps the model fixed.
| What changed | Model and benchmark | Effect |
|---|---|---|
| Letter vs cloze formulation [497] | Llama 3 8B, ARC-Challenge | 78.6% vs 60.2% |
| Letter vs cloze formulation [497] | Llama 3 70B, ARC-Challenge | 93.7% vs 69.0% |
| MMLU-style vs cloze prompt [775] | Mistral-7B, ARC-Challenge 0-shot | 72.4% vs 50.1% |
| Published reference [497] | Llama 2 7B, ARC-Challenge | 43.2% to 53.7% across six |
| Harness implementation [742] | LLaMA-65B, MMLU | 0.636 vs 0.488 |
| Equivalent prompt formats [769] | LLaMA-2 13B, one task | up to 76 points |
| 320 prompt formats [769] | GPT-3.5, 53 tasks | median 6.4 points |
| "(A)" relabeled as "(1)" [772] | MMLU | about 5% accuracy |
| Answer key [771] | MMLU | 6.49% of items in error |
| "Deterministic" serving [774] | five models | up to 15% accuracy |
| Moving between clusters [776] | small reasoning models, AIME 2024 | up to 8% accuracy |
Harness and version, task configuration, full prompt and few-shot examples, formulation and extraction rule, normalization, chat template, decoding (temperature, top-p, maximum tokens, samples per question), metric definition (pass@1 from samples, majority vote), the number of questions with the standard error (clustered where questions are grouped), seeds, and for generative reasoning evaluations the hardware and batch setup [775, 777, 497].
Practical defaults: track cloze or bits per byte early in pretraining and letters for strong models. Report a format spread when you claim a small gap, use MMLU-Redux where a subject's error rate is high, and pin the harness version.
10.3 Scoring many samples: pass@k, majority vote and pass^k
When a model can answer many times, how do you score it, and why are the obvious formulas wrong? Does at least one of attempts succeed (pass@k, coverage)? What is one sample's success rate (pass@1)? Do all succeed (pass^k, reliability)? Majority vote asks whether the most common final answer is right [691]. Here a benchmark has questions with samples each (Chen et al. write for ), of question 's samples are correct, and is its true per-sample success probability.
AIME 2024 is two 15-question exams [755], so 30 problems, the size of each AIME set in MathArena [766]. Greedy decoding of long reasoning outputs caused repetition and large variation between checkpoints, so DeepSeek-R1 draws 64 samples per problem at temperature 0.6 and top-p 0.95, scores each problem and averages over the 30 (reported protocol) [3]: the estimator below with and . Majority vote is separate: R1-Zero's AIME pass@1 rose from 15.6% to 77.9% during RL, and voting lifted it to 86.7% (reported). Section 10.4 shows how wide an interval 30 problems give.
The unbiased pass@k estimator
For one problem with success probability , true pass@k is , the chance that independent samples do not all fail. Chen et al. draw samples (they use 200 with ), count the that pass the unit tests, and estimate pass@k as , which is unbiased [699]. The ratio is the chance that samples drawn without replacement all fail. With drawn from Binomial,
by the identity and the binomial expansion of . Averaging over questions, with a term equal to 1 whenever :
The product form on the right, from Chen et al.'s code, avoids huge binomial coefficients. The tempting plug-in is biased low: is concave, so by Jensen's inequality its average over noisy estimates sits below its value at , even when [699]. For a true pass@1 of 0.02, 200 samples and , the unbiased estimator averages 0.8674, the true , and the plug-in 0.7962 (computed). Feeding a benchmark's mean pass@1 into the formula errs the other way: concavity makes it overstate pass@k whenever problems differ in difficulty. With difficulties from Beta(0.3, 0.74) (illustrative, mean 0.29), true pass@10 is 0.61 and the pooled formula gives 0.97 (computed). Compute per problem, then average.
Three of samples pass. Unbiased pass@10 is , and the plug-in . At : against (computed) [699]. The estimator alone moves the score ten points.
pass@k is not identified for , however many tasks you have [778]. And the best temperature depends on : 0.2 for pass@1 and 0.8 for pass@100 for a 679M Codex model [699], so a pass@100 number hides a decoding choice.
pass^k: reliability
tau-bench's pass^k is the chance that all independent trials of a task succeed, averaged over tasks [779]. The without-replacement argument again gives an unbiased estimator, and the plug-in is biased upward because is convex. At , and the estimator averages 0.3600, exactly , and the plug-in 0.3900 (computed).
The inequality on the right, Jensen again, is what pass^k reveals. gpt-4o with function calling scores pass^1 of 61.2% on tau-bench's retail tasks, and its pass^8 drops below 25% [779]. If every task had success 0.612, pass^8 would be (computed). Mixed difficulty keeps pass^k high. If 24% of tasks always succeed and the rest succeed with probability 0.4895, pass^1 is and pass^8 is (computed, illustrative mixture). METR saw the split near a model's limits: on 90-minute to 3-hour tasks a GPT-5 agent always succeeded on about a third, always failed on a third and was mixed on the rest [780]. In Figure 53, lower in one-problem mode and watch the dashed plug-in lines leave the solid unbiased ones as grows. In pool mode, compare the dotted pooled shortcut with the true average, out to for the curves of Section 6.8.
Method and sources
In the pool mode, curves are exact averages over a distribution of task difficulty and the dotted lines are the shortcut that puts every task at the mean, which overstates pass@k and understates pass^k whenever tasks differ. A mixture with 24% of tasks always solved (illustrative) reproduces gpt-4o's reported tau-retail pass^1 of 0.612 and gives pass^8 0.2425, below the reported bound of 0.25, where equal difficulty would give 0.020. Out to 10,000 samples, Beta difficulty fits through published coverage pairs show the failure rate falling as a power law and coverage far above what majority vote or a reward model selects. Estimators from Chen et al. (2021) and Yao et al. (2024), coverage and selection points from Brown et al. (2024), the Beta mechanism from Schaeffer et al. (2025) and the sampling protocol from DeepSeek-AI (2025). All curves are computed exactly from binomial and Beta expectations, without simulation.The metric can reverse a verdict. Base models beat their RL-trained versions at large across benchmarks and model families [484], so pass@1 and pass@256 can rank a training method in opposite ways (Section 9.7). Practical defaults: the unbiased per-problem estimator with several times the largest , pass@1 for reasoning as a mean over samples at a stated temperature, never greedy and sampled pass@1 in one table, pass^k when reliability matters, and generated code run in a sandbox (Chapter 14).
10.4 Error bars: when is a gap real?
Model A scores 71% and model B 69% on the same benchmark. Is the 2-point gap real, and how many questions would you need to tell? Each question is a coin weighted by the model's skill, and an average of coins wobbles like one over the square root of their number. Two models face the same coins, so comparing them question by question cancels most of the wobble.
One score
Miller treats the questions as "drawn at random from a (hypothetical, infinite, unseen) super-population of questions" [777]. With question scores and mean over questions, a 0/1 score has variance , the mean divides it by , and 1.96 is the normal 97.5th percentile:
At 70%, the standard error (SE) on 1,000 questions is 1.45 points and the 95% half-width 2.84, against 9.0 for 100 questions, 2.5 for GSM8K's 1,319 and 0.76 for MMLU's 14,042 (computed). Llama 3 prints this interval and warns that "our CI values lower bound the actual variation in the capability estimate" [6]. The bootstrap only earns its keep for nonlinear aggregates [777].
Pretrained Llama 3 8B reports HumanEval 37.2 ± 7.4, GSM8K 57.2 ± 2.7 and MATH 20.3 ± 1.1, and Mistral 7B HumanEval 30.5 ± 7.0 (reported) [6]. Check: (computed). The 6.7-point lead over Mistral is unresolved, and Llama 3 70B (58.5 ± 7.5) and 405B (61.0 ± 7.5) cannot be ordered on HumanEval at all. On MMLU near 85% the half-width is 0.59, so a 2-point gap would be resolved (computed). Long-context GSM8K (83.0 ± 7.4 for 70B, 90.0 ± 5.9 for 405B) implies about 100 problems and an unpaired of only 1.46 (computed).
Small sets and clustered sets
That interval (the Wald interval) assumes large . At and a true 90%, it covers the truth 80.9% of the time, while the Wilson interval covers it 97.4% (computed exactly). Bowyer et al. find that "only the Bayesian credible interval and Wilson confidence intervals" reach nominal coverage on small sets [781]. With :
For 30 of 30 correct, Wald collapses to the point 100% and Wilson gives [88.6%, 100%] (computed).
Questions about one passage rise and fall together. With clusters of size and intra-cluster correlation , a cluster's total has variances plus covariances, which gives the design effect (DE) [777]:
Miller measured clustered-to-naive SE ratios of 3.05 for DROP (9,622 questions in 588 passages) and 1.88 for MGSM (2,500 in 250 groups) [777]. Inverting DE, DROP's questions are worth about 1,034 independent ones () and MGSM's about 707 (computed).
More samples per question
With samples per question and true success rate , the law of total variance splits the noise [777]:
Only the coin-flip term shrinks with . Under uniform difficulty, halves the variance and no cuts it by more than two thirds (the floor is against at ). Greedy decoding "has inadvertently tripled the minimum variance in the score data from 1/12 to 1/4" in the same example [777], and measures a different model.
DeepSeek-R1 reports 79.8% pass@1 over 64 samples per problem, against 79.2% for o1–1217 from OpenAI's reports (reported) [3]. On 30 problems, question sampling alone gives points (computed), so the 0.6-point lead is not a ranking. Under uniform difficulty (illustrative), 16 samples cut the SE only from 9.1 to 5.6 points, with a floor of 5.3 (computed). Measured seed spreads of pass@1 on small math sets run 5–15 points [776], and AIME 2024 shows signs of contamination [766].
Pair the comparison
Both models answer the same questions, so take the per-question difference :
with and the correlation of the two models' outcomes across questions. Models agree on which questions are hard, so pairing is a "free" reduction in variance [777]. For 0/1 scores this is McNemar's view, where only disagreements carry information [782]:
with the share A gets right and B wrong. At 71% against 69% and , , , and both forms give 0.0840. On 1,000 questions the paired SE is 0.92 points and . Unpaired, the SE is 2.05 and (computed). Same data, opposite verdicts.
Power and sample size
Power is the probability of rejecting the null when the effect is real [782]. For a true gap , has mean , which must clear (1.96 + 0.84 for 80%). Solve for [777]:
Miller's own example needs 969 questions, so he suggests new evals hold at least 1,000 [777].
Table 10.3. Questions needed to resolve a true 2-point gap between two models near 70% (two-sided test at the 5% level, computed with Miller's formula).
| Per-question correlation | for 80% power | for a ±2-point interval | |
|---|---|---|---|
| 0 (unpaired) | 0.420 | 8,238 | 4,032 |
| 0.5 | 0.210 | 4,120 | 2,017 |
| 0.8 | 0.084 | 1,649 | 807 |
| 0.9 | 0.042 | 826 | 404 |
At a true 2-point gap needs about 1,650 questions, a fifth of the unpaired count, and a ±2-point interval (807 questions) catches it only about half the time (computed). Only 46% of the state-of-the-art claims Card et al. surveyed would have predicted adequate power [782].
In Figure 54, the "One score" tab draws Wald and Wilson intervals, and "Two models" plots questions needed against on a log axis, with lines at real benchmark sizes. Count how many fall below the curve for a 2-point gap.
Method and sources
The Two models view gives the paired standard error of a difference, the extra noise from single training runs and the questions needed to detect the gap, drawn against the sizes of common benchmarks on a log scale. The Arena view turns an Elo gap into a win rate, shows how many votes resolve it and how much publishing the best of several private variants inflates a score. Formulas follow Miller (2024), Card et al. (2020), Bowyer et al. (2025) and Chiang et al. (2024). Presets use scores reported in the Llama 3, DeepSeek-V3 and DeepSeek-R1 reports, Terminal-Bench (Merrill et al. 2026), the seed variances of Madaan et al. (2024) and the Arena audit of Singh et al. (2025). Per-question correlations, the difficulty share and some vote counts are illustrative, and every output is computed.Many comparisons and selection
Compare two equal models on 20 benchmarks and at least one "significant" gap appears with probability . The best of 27 equal variants carries about 2 SEs of pure noise, the expected maximum of 27 standard normals (computed). Report how many variants you tried. Hand-curated benchmarks are not exchangeable draws, and Bowyer et al. prefer Bayesian intervals for small sets [781].
# keep per-question scores for every run
import numpy as np
from scipy.stats import norm
def paired_gap(y_a, y_b):
"""Per-question scores (0/1 or partial) of two models, same questions."""
delta = np.asarray(y_a, float) - np.asarray(y_b, float)
se = delta.std(ddof=1) / np.sqrt(len(delta))
return delta.mean(), se, delta.mean() / se # gap, paired SE, z
def questions_needed(var_delta, gap, alpha=0.05, power=0.80):
z = norm.ppf(1 - alpha / 2) + norm.ppf(power)
return int(np.ceil(z**2 * var_delta / gap**2))
questions_needed(0.0840, 0.02) # 1649, the rho = 0.8 row of the table
Report , the score and its SE, and for comparisons the paired SE and . If the expected effect is below the minimum detectable one, use a bigger benchmark or a continuous metric. Seed noise comes on top (Section 10.9).
10.5 Contamination: has the model seen the test?
A model scores 85% on a benchmark whose questions have been on the public web for years. How much of that is skill, and how much is memory of the test? Web-scale data almost certainly holds copies and paraphrases of them.
Keep four terms apart. Contamination means test items or close variants in any training data, synthetic data included [783]. Exploitation means it raised the score, which memorization need not do [784]. Overfitting to a benchmark is a gap between the public test and a fresh one, whatever the cause. Indirect contamination comes from benchmarks pasted into products that feed training [785].
Audits with the training data
GPT-3 flagged 13-gram overlaps and compared clean subsets with full sets [36]. Llama 2 flagged tokens in shared n-grams longer than 10 tokens, finding only HellaSwag and MMLU-Humanities boosted [229]. Llama 3 scores 8-gram overlap and, following ConTAM (Singh et al.'s Contamination Threshold Analysis Method), picks each benchmark's threshold to maximize the estimated gain, the clean-subset score minus the full score [6, 786]. ConTAM warns that contamination "may have a much larger effect than reported in recent LLM releases" [786].
Table 10.4. Llama 3's 8-gram contamination audit: share of items flagged at the gain-maximizing threshold and estimated gain in points (reported, Table 15 of the Llama 3 paper).
| Benchmark | Flagged | 8B | 70B | 405B | Reading |
|---|---|---|---|---|---|
| HellaSwag | 85% | 14.8 | 14.8 | 14.3 | contaminated and exploited |
| BIG-Bench Hard | 95% | 26.0 | 36.0 | 41.0 | large, growing with size |
| AGIEval | 98% | 8.5 | 19.9 | 16.3 | large |
| Natural Questions | 52% | 1.6 | 0.9 | 0.8 | contaminated, barely exploited |
| GSM8K | 41% | 0.0 | 0.1 | 1.3 | small |
| MATH | 1% | 0.0 | -0.1 | -0.2 | clean |
| MBPP, HumanEval, MMLU, MMLU-Pro | nearly all | no estimate | method fails | ||
Natural Questions shows that contamination need not pay. For the last row, "it is impossible to get a good performance gain estimate" [6]. Two caveats apply: flagged and clean items differ in difficulty, and a threshold chosen to maximize the gain biases gains upward.
The GPT-3 team tried to remove benchmark overlaps, but "a bug in the filtering caused us to ignore some overlaps, and due to the cost of training it was not feasible to retrain the model" [36]. They published clean-subset analyses instead. The blameless lesson: decontamination code is production code. Test it on planted canaries before the run (Chapter 3).
Paraphrases and closed models
String matching misses rephrasing. A Llama-2–13B trained on a rephrased MMLU test set reached 85.9 "while being undetectable by n-gram overlap", and the synthetic CodeAlpaca set contains 12.8% rephrased HumanEval samples [504].
Without the training data you can only probe probabilities. Seen text has fewer very unlikely tokens, so Min-K% Prob averages the log-probabilities of the least likely 20% of a text's tokens, the set :
It reaches an average AUC of 0.72 on WikiMIA [787] (Min-K%++ refines it [788]). Treat such scores as weak evidence: on Pythia models, membership-inference attacks "barely outperform random guessing for most settings" [789]. A sharper test: a model that memorized a benchmark file prefers its canonical example order, which reliably reveals 1,000-example sets seen 10 or more times and sometimes sets seen only twice. It found little pervasive contamination in four public models [790].
Measure the effect: fresh replicas
GSM1k is 1,205 new problems matched to GSM8K, so similar that annotators picked it out of five only 21.83% of the time against 20% chance [773]. Yi-6B-Chat scores 8.0 points lower on it (43.7% to 35.7%) and Meta-Llama-3–8B-Instruct 6.2. Phi, Mistral and some Llama models seem to overfit, while Gemini, GPT and Claude show "little to no signs of overfitting" [773]. The sets differ, so the gap is unpaired:
For Yi-6B-Chat on 1,319 and 1,205 problems this is 1.94 points, a 95% interval of 4.2 to 11.8. Of 63 models, 17 have intervals entirely above zero. Under the paper's alternative prompt 12 do, and only 5 clear zero under both (computed), so a single-prompt gap is weak evidence on its own. The gap rises with a model's log-likelihood of GSM8K (Spearman 0.36, p = 0.03), which the authors read as partial memorization, though outliers lead them to say contamination is "likely not the full story" [773].
In Figure 55, red rows have intervals clear of zero. They cluster by family, while frontier models straddle the "no drop" line.
Method and sources
Red rows have intervals entirely above zero, which holds for 17 of the 63 models (computed). A second view plots the two accuracies against each other, and a switch swaps in the paper's alternative prompt, under which 12 models clear zero and only 5 do so under both prompts (computed). The tour walks through Yi-6B-Chat, the Llama 3 models and the frontier models. Accuracies, gaps and z-scores are from Zhang et al. (2024), Appendix F Tables 1 and 2, and the intervals are computed here.Prevention, and what to report
Defenses stack. BIG-bench files carry a canary string for filtering [791], and Jacovi et al. propose encrypting public test data [792]. Post-cutoff and live sets help for a while (Section 10.1). Tülu 3 flags a post-training set whose instances overlap more than 2% of an evaluation's instances. It drops the whole set, or for development evaluations only the matching instances when dropping the set would hurt the model [550]. One channel escapes every training audit: search-enabled agents can retrieve answers at test time, inflating scores by up to 4% [793].
For every headline benchmark, report the overlap method, its threshold and the clean-subset score. Keep a private replica, and decontaminate supervised and preference data, synthetic data included.
10.6 Judges, arenas and human preference
For open-ended answers with no answer key, how do LLM judges and human-preference arenas produce a ranking, and what biases and noise enter? A judge, human or model, is an instrument with noise, bias and a calibration curve. Measure all three.
LLM judges and their biases
Judges exist because "our best automated tools for determining whether two sentences are semantically equivalent are the very models we are seeking to evaluate" [775]. On MT-Bench's 80 questions, GPT-4 agrees with experts 85% of the time without ties, above the 81% human-human rate, and agreement rises from 70% to nearly 100% as the gap between models grows [794]. Judges are reliable on big gaps and weak on the close calls where decisions live, and harder tests are less flattering [795, 796].
Table 10.5. Measured biases of LLM judges.
| Bias | Measurement |
|---|---|
| Position | With two similar answers swapped, GPT-4 stays consistent 65.0% of the time, GPT-3.5 46.2% and Claude-v1 23.8% [794] |
| Position | GPT-4, GPT-3.5 and Llama 2 reverse their preference on 25%, 58% and 89% of swapped pairs [797] |
| Position | Order alone let Vicuna-13B beat ChatGPT on 66 of 80 queries with ChatGPT as judge [798] |
| Verbosity | A "repetitive list" attack fooled Claude-v1 and GPT-3.5 91.3% of the time and GPT-4 8.7% [794] |
| Self-preference | GPT-4 recognizes its own outputs 73.5% of the time, and self-preference grows linearly with self-recognition [797] |
| Familiarity | Judges rate low-perplexity text higher than humans do, whoever wrote it [799] |
| Preference leakage | Judges favor students trained on data from themselves or their family [800] |
| Gameability | A null model that always returns one crafted response reached an 86.5% length-controlled win rate on AlpacaEval 2.0 [801] |
Fixes: judge both orders and "only declare a win when an answer is preferred in both orders" [794], give a reference answer where one exists, use a judge from another family, and control for length.
Calibrate the judge with a few human labels
Prediction-powered inference (PPI) removes a judge's bias with a small human sample [802]. With judge label and human label , average the judge over items and subtract its mean error on human-labelled ones:
Its expectation is , whatever the bias. In an illustrative simulation, the true win rate is 0.55 and the judge says "A" 85% of the time when humans prefer A and 30% otherwise. The judge alone estimates 0.60 and its interval never covers the truth. PPI with 10,000 judged and 300 human pairs covers it about 95% of the time, about 10.6 points wide against 11.3 from humans alone (computed, 2,000 replicates).
Arenas and the Bradley-Terry model
In Chatbot Arena a user prompts two anonymous models and votes. By January 2024 it had about 240K votes, and crowd votes matched experts 72–83% of the time [803]. The Bradley-Terry (BT) model gives each model a strength , shown on the Elo scale :
Arena fits it by reweighted logistic regression with sandwich standard errors [803], replacing online Elo updates, which are volatile [804]. For votes between two models at win rate , the delta method gives
so 1,000 votes at give a 95% half-width of 21.5 Elo (computed). The Arena tab of Figure 54 runs these numbers.
Models at 1300 and 1290: . A 95% half-width of 10 Elo needs , about 4,640 head-to-head votes, which detects a true 10-point gap only half the time. 80% power takes about 9,470. A 55% win rate over 1,000 votes is a 34.9-Elo gap, with a 95% interval of 13 to 57 (computed). Two identical Aya-Vision-8B checkpoints scored 1052 and 1069 [805].
Length and style
On AlpacaEval the baseline's own win rate "fluctuates from 22.9% to 64.3%" with the verbosity instruction alone, and a length-controlled regression raises the correlation with Arena "from 0.94 to 0.98" [603]. Arena's style control finds length "the dominant style factor" [806]. Over-optimization of learned rewards is in Section 8.6.
Table 10.6. Open-ended evaluation sets built to resist judge and style effects.
| Set | Construction | Result |
|---|---|---|
| Arena-Hard-Auto | 500 prompts filtered from 200,000 Arena prompts | 87.4% of model pairs separated, against 22.6% for MT-Bench and 83.2% for length-controlled AlpacaEval 2.0 [807] |
| WildBench | 1,024 tasks from real conversations | Pearson 0.98 with top Arena ratings [808] |
| IFEval | 541 prompts with 25 types of instruction checked by code | No judge needed [809] |
| IFBench | 58 new constraints | Most models overfit IFEval-style constraints [810] |
Selection on a public leaderboard
BT assumes each score is one honest estimate. "The Leaderboard Illusion" reports 27 private variants tested by Meta before Llama 4, and estimates that Google and OpenAI received 19.2% and 20.4% of Arena data, against 29.7% for 83 open-weight models together. That data matters: raising its training share from 0 to 70% lifted ArenaHard win rate from 23.5% to 49.9%. Of 243 public models, 205 averaged 10 or fewer battles between March 3 and April 23, 2025, which the authors call silent deprecation [805]. Votes can be manipulated [811], and BT is misspecified for near-copies [812]. This guide did not review the organizers' responses.
If each variant's score carries independent noise with a standard deviation of 10 Elo, publishing the best of 5, 10 or 27 adds about 11.6, 15.4 or 20.0 Elo (computed). Singh et al.'s simulation, with a different noise model, finds about 50 points for 20 variants [805].
Arena filled a real gap, real-user preference at scale with sound statistics [803]. As it became the headline leaderboard, research-platform policies (private aliases, retraction, uneven sampling, quiet deprecation) produced measurable selection effects [805]. The blameless lesson: when submitters see scores and choose what to publish, the published number is an extreme value. Fix in advance what will be published, and disclose how many variants were tried.
Human evaluation design
Llama 3 used about 7,000 prompts on a 7-point pairwise scale, and "Modeling teams did not have access to our human-evaluation prompts" [6]. Three workers rating 100 items is underpowered for small effects [782]. Detecting a 52% win rate against 50% with 80% power takes about 4,900 non-tied comparisons (computed).
In practice, swap and agree, control length, use a cross-family judge, validate it on 200–500 of your own human labels and correct with PPI. Rank only where intervals separate.
10.7 Evaluating agents: environments, scaffolds, graders and time horizons
When the unit of evaluation is a multi-step trajectory in an environment, what exactly is being measured, how trustworthy is the number, and how do you compare agents across very different tasks? The thing measured is a system: the model, the scaffold (the loop that turns model outputs into tool calls), the environment, the grader, and the budget in steps, tokens, dollars and attempts [813]. Change any part and the score moves.
A grader inspects the final state, not the transcript: hidden unit tests for SWE-bench, the final database for tau-bench, the final container for Terminal-Bench [814, 779, 815]. Inspect frames an evaluation as a dataset, a solver and a scorer, with model code in sandboxes [816], the subject of Chapter 14.
SWE-bench, the running agentic example
SWE-bench has 2,294 tasks from GitHub issues in 12 Python repositories. A task is resolved only if the patch applies and all associated tests pass [814]. How SWE-bench grades and how Verified was built is in Section 14.4. For measurement, note three things. Screening for Verified removed 68.3% of annotated samples, and on the 500 left GPT-4o rose from 16% to 33.2%, one seed per scaffold (reported) [16]. Django supplies 231 of the 500, so by the inverse Simpson index the set behaves like 3.9 equal-sized repositories (computed from the released dataset) [817]. And 24% of the top-50 leaderboard positions are still wrong because tests miss edge cases [818]. DeepSeek-V3 reports 42.0% and DeepSeek-R1 49.2%, both through Agentless, a fixed localize, repair and validate pipeline with no agent loop (reported) [2, 3, 819]. Table 10.7 lists other suites.
Table 10.7. Agent benchmarks. Launch results are the best in each benchmark's own paper unless marked.
| Benchmark (year) | Tasks | Grader | Launch result | Reference or later result |
|---|---|---|---|---|
| SWE-bench (2023) [814] | 2,294 | hidden fail-to-pass and pass-to-pass tests | 1.96% (Claude 2 with retrieval) | |
| SWE-bench Verified (2024) [16, 3] | 500 | same tests after human screening | 33.2% (GPT-4o, best open scaffold, one seed) | 49.2% (DeepSeek-R1 with Agentless, reported) |
| SWE-Bench Pro (2025) [820] | 1,865 from 41 repositories | human-augmented tests on copyleft and private code | 43.6% public set (Claude Sonnet 4.5) | under 20% on the commercial set (the paper's conclusion still quotes an older 23%) |
| Terminal-Bench 2.0 (2026) [815] | 89 (of 229 written) | tests on the final container state | 63% (Codex CLI with GPT-5.2) | at least 5 runs per model-agent pair, $1 to $100 per full run |
| tau-bench (2024) [779] | 115 retail, 50 airline | final database against the annotated goal | pass^1 61.2% retail, 35.2% airline (gpt-4o) | pass^8 under 25% on retail |
| OSWorld (2024) [821] | 369 | per-task execution scripts | 12.24% | humans 72.36% |
| WebArena (2023) [822] | 812 | programmatic checks | 14.41% (GPT-4 agent) | humans 78.24% |
| GAIA (2023) [823] | 466 | exact short answer | 15% (GPT-4 with plugins) | humans 92%, answers to 300 questions private |
| MLE-bench (2024) [824] | 75 | Kaggle medal thresholds | 16.9% (o1-preview with AIDE, one attempt) | 34.1% with eight attempts |
| RE-Bench (2024) [825] | 7 environments | normalized score, start 0, reference 1 | best agents 4 times the experts at 2 hours | experts 2 times the best agent at 32 hours |
| PaperBench (2025) [826] | 20 papers | LLM judge, F1 0.83 against humans | 21.0% | ML PhDs 41.4% against o1 26.6% on 3 papers |
| HCAST (2025) [827] | 189 | automatic, 563 human baselines | 70-80% on tasks under one human-hour | under 20% on tasks over 4 hours |
DeepSeek-R1 resolves 49.2% and DeepSeek-V3 42.0% of the same 500 tasks (reported) [3], a 7.2-point gap (computed). Unpaired, the standard error (SE) of the difference is , so (computed). Pairing on tasks (Section 10.4) at an illustrative correlation of 0.5 gives 2.22 points. Probably real, but each number is one run, and the unpaired minimum detectable effect at 80% power is , about 8.9 points (computed). A 2-point leaderboard gap is noise.
Scaffolds, budgets and graders
Davidson et al. price an enhancement as a compute-equivalent gain (CEG), the extra training compute that would buy the same improvement [828]. At points per tenfold compute, points are worth : at an illustrative 10 points per decade, +7 points is 5.0 times (computed). Most enhancements they surveyed were worth over 5 times and cost under 1% of training [828]. Retrying raises accuracy too, so plot accuracy against dollars [813]. On MLE-bench the scaffold alone moves GPT-4o from 0.8% to 8.7% [824], though Terminal-Bench finds model choice usually matters more [815]. Report the scaffold as part of the system.
A grader has outcome validity if a pass truly means the task was done. Seven of ten audited agentic benchmarks had outcome-validity flaws, and an agent that returns empty responses passes 38% of tau-bench's airline tasks [818]. The catalogue of documented reward hacks is in Section 14.6.
OpenAI adopted SWE-bench as a Preparedness evaluation of autonomy, then audited it. About two-thirds of sampled tasks were underspecified or unfairly tested, and on the cleaned subset GPT-4o's score doubled [16]. The blameless lesson: a low score can mean a broken benchmark, and a high one a weak grader.
METR's time horizon
How do you compare agents across very different tasks? METR measures difficulty in human time. The 50% time horizon is "the time humans typically take to complete tasks that AI models can complete with 50% success rate" [486], a measure of task difficulty, not of how long the AI works [780]. Task length is the geometric mean of successful human times, and per agent METR fits a logistic in log task length [486], written here with slope per doubling (the paper's ):
The second form, from solving , gives the horizon at reliability . At METR's typical slope of "roughly 0.6" [829], (computed), matching the paper's 4 to 6 times [486]. METR reports no 99% horizon, which would need many more tasks [780].
Regressing on release date gives a doubling time that depends on the suite version and the years fitted. The paper found 207 days (95% interval 166 to 240) [486]. Under Time Horizon 1.1 the trend since 2023 doubles every 131 days [487]. METR corrected a regularization mistake on March 3, 2026, after that post [780]. Our refit on METR's published data, frontier models up to 16 hours, gives 187.8, 128.7 and 104.7 days for all years, 2023 on and 2024 on (computed) [780]. Say "about three to seven months (as of September 2026)". Figure 56 has a fit-window toggle: watch the line steepen as early years drop, compare whiskers with the gaps between models, and note the band above 16 hours, where METR calls measurements unreliable [780].
Method and sources
The dashed line is a least-squares fit of log2 horizon on release date for frontier models up to 16 hours, the level above which METR calls its measurements unreliable, and the fit window moves the doubling time from 187.8 to 104.7 days (computed). Past the last data point the line is extrapolation. Hollow grey points show the earlier TH1.0 estimates from METR's TH1.1 post, connected to the current TH1.1 values. The inset turns a 50% horizon and a logistic slope per doubling into predicted success at any task length and into 80%, 95% and 99% horizons. Data: METR's published TH1.1 measurements (as of September 2026, no longer updated) and its TH1.1 post (METR, 2026). Method from Kwa et al. (2025), typical slope from METR (2025), fits computed.Take and minutes, about o3 in METR's data [780]. A 30-minute task is two doublings shorter: success . An 8-hour task: 0.23. minutes. METR's data gives o3 an of 30.0 minutes, a ratio of 4.0, so its own slope is (all computed).
METR's own caveats matter. Errors are correlated across models, so the slope is better known than any single horizon [486]. "An 8-hour time horizon does not mean that AIs can do 8 hours of work that a (high-context) human professional can do as part of their day-to-day job" [780]. In a 2025 trial, experienced developers took 19% longer with AI tools while believing they were 20% faster [830]. A tenfold error in every horizon shifts arrival by only , 1.2 years at 128.7 days (computed).
Agent suites are small. The 95% half-width is 4.0 points at 70% on Verified's 500 tasks and 10.0 points at 63% on Terminal-Bench 2.0's 89 (computed) [16, 815]. Pair on tasks, and cluster by repository.
Grade the final state with checks that pass only if the task is solved. Run the reference solution and an exploit-seeking agent through the grader. Remove leaks. Pin images, judge models and the benchmark revision. Fix or report the scaffold. Record cost and steps per task. Report pass^1 with intervals over several seeds. Scan transcripts for reward hacks. Keep a private split [818, 813, 780].
10.8 Dangerous-capability evaluations and frontier safety frameworks
How do labs decide whether a model is too capable to release with ordinary safeguards, and what evaluation evidence feeds that decision? This section stays at policy and benchmark level. Shevlane et al. separate dangerous-capability evaluations (can the model do harm) from alignment evaluations (would it), and note that internal deployments, such as coding assistants for AI researchers, may also need evaluation before use [831].
Google DeepMind's pilot on Gemini 1.0 covered persuasion and deception, cyber-security, self-proliferation and self-reasoning, and found no strong dangerous capabilities but early warning signs [832]. To see progress before full success, it charges bits of expert help per milestone [832]:
A milestone passed in 10% of unguided runs costs 4 bits, and an expert picking the 16th of 16 sampled actions costs 8.1 (computed). The charges are code lengths of probabilities that sum to 1. METR's 2023 report found agents completed only the easiest of 12 autonomy tasks, yet said this did not assure that a next generation at about 100 times the effective compute would lack the capability [833]. That is the logic behind safety buffers. Public benchmarks are proxies that do not spread the hazard: WMDP's 3,668 filtered questions track a privately held sensitive set [834], and Cybench calibrates 40 capture-the-flag tasks by human first-solve times [835]. Table 10.8 compares three frameworks.
Table 10.8. Three frontier safety frameworks, as each document describes itself (current as of its date).
| Framework (date) | Levels and domains | Evidence and decision |
|---|---|---|
| OpenAI Preparedness Framework v2 (April 2025) [836] | High and Critical, for Biological and Chemical, Cybersecurity, AI Self-improvement | Scalable Evaluations on every covered model before deployment, a Capabilities Report for the Safety Advisory Group, no deployment at High until risks are sufficiently minimized |
| Anthropic Responsible Scaling Policy, v1.0 (September 2023), v2 (October 2024), v3.0 (February 2026), updated through v3.4 (July 2026) [837, 838, 839, 840] | Capability Thresholds for autonomous AI R&D and CBRN weapons assistance (v2), ASL-3 safeguards activated May 2025 | routine capability assessments (v2), a Risk Report every 3 to 6 months (v3.0) after pre-set thresholds proved "far more ambiguous than we anticipated" |
| Google DeepMind Frontier Safety Framework, v3 (September 2025) [841, 842] | Critical Capability Levels for misuse, ML R&D and harmful manipulation (v3) | a safety case approved by a governance body before general availability, extended to large internal deployments for ML R&D |
A threat model per domain and a capability threshold. Cheap automated evaluations, with deeper human-led work when they trip. A written report, an internal body that decides, growing external review. Elicitation treated as a lower bound [836, 839, 842].
Why a lower bound? Frontier models can be prompted to underperform selectively on dangerous-capability evaluations [843], and a few demonstrations often fine-tune back capabilities hidden behind a password [844]. The o1 system card rated the model medium risk before mitigation, called its evaluations a lower bound and noted pre-deployment testing by the US and UK AI Safety Institutes [671]. Its capture-the-flag sandbox case is in Section 14.1.
Reviewing its first year, Anthropic reported one evaluation finished 3 days past the 3-month interval and some lacking basic elicitation such as best-of-N or chain-of-thought prompting. It moved to a 6-month interval "to avoid lower-quality, rushed elicitation" [845]. The blameless lesson: when a decision hangs on a threshold, elicitation quality and scheduling are first-order risks.
10.9 The internal eval suite: signal, noise and decisions
A training team runs thousands of evaluations to choose data mixes, hyperparameters and checkpoints. How do you build a suite whose small-scale results predict the large model, and keep your own team from gaming it? Section 10.4 treated the questions as random. In development the run is random too. A benchmark helps a decision only if the gap between options (signal) is large against seed and checkpoint noise.
Madaan et al. trained ten 7B models for 210B tokens that differ only in seed. Seed standard deviations (SD) were 0.57 points on MMLU, 0.21 on HellaSwag, 0.80 on ARC-Challenge and 1.11 on HumanEval [745], for one 7B setup with a fixed data order, not typical noise for strong models. Comparing two single-seed runs adds seed noise from both to the paired question error:
On MMLU that is 0.81 points from seeds alone (computed). DataDecide saw run-to-run SDs up to 2 points at 1B [258].
Two 124M nanoGPT-style models on two data mixes, one seed each, and mix B wins by 0.6 points (illustrative). At HellaSwag's 7B seed SD of 0.21 the difference has SD 0.30, so the win is 2 SD. At ARC-Challenge's 0.80 it is 0.5 SD (computed). Rerun the baseline two or three times at your own scale before trusting a margin.
Heineman et al. define signal-to-noise ratio (SNR) as the relative spread across models trained at the same compute, over the relative SD of one model's final checkpoints [259]:
SNR predicts decision accuracy, the share of pairs whose small-scale ranking holds at large scale (), while signal or noise alone do not. Pruning noisy subtasks and averaging the last checkpoints each add over 2 points of decision accuracy, and scoring bits per byte on the gold answer lifts GSM8K's SNR from 1.2 to 7.0 [259]. Bits per byte, which compares losses across tokenizers, is defined in Section 3.8. Continuous metrics and cloze formats (Section 10.2) also suit pretraining ablations better than letter choices [745]. Ranking at 150M picked the 1B winner about 80% of the time, and no scaling-law method beat it [258]. Tiny 100-item subsets raised HellaSwag's seed SD about tenfold, from 0.21 to over 2 points, and flipped up to 12% of pairwise comparisons [745], so monitor with them and decide with full sets.
A layered suite follows: smooth in-loop bits-per-byte signals, decision benchmarks chosen by measured SNR, capability benchmarks once above chance, a held-out set never used for decisions, and validated human and judge evaluations (Section 10.6). OLMo 2 declares development and held-out tasks [7]. DeepSeek-R1's per-stage table shows what a headline hides: from R1-Zero to R1, IF-Eval rose from 46.6 to 83.3 while GPQA Diamond fell from 75.8 to 71.5 [3], a 4.3-point drop, about one standard error of the unpaired difference (4.4 points on 198 questions, computed).
OLMo 2 used 200 GSM8K items for development and held out 1,119 [7]. At 70% the 95% half-width is 6.35 points on 200 and 2.68 on 1,119. Paired at , the minimum detectable effect is , or 5.7 points, against 2.4 (computed). The development set can steer big changes but cannot confirm a 2-point gain.
"Crucially, we did not examine scores on our unseen set when developing our models," the Tülu 3 team wrote, and the unseen suite later showed "that our development process overfit to MATH to some extent" [550]. The blameless lesson: a held-out suite helps only if you act on it.
This is Goodhart's law: "When a measure becomes a target, it ceases to be a good measure" [575]. Its four variants [846] map onto best-of-many reporting (regressional), benchmark-chasing (extremal), training on the test (causal) and gaming a judge (adversarial). Reward-model overoptimization is the cleanest case (Section 8.6). Keep a decision log (Section 15.1). Evaluation gates, lineage and versioning for long runs are in Section 12.9.
A paper reports pass@100 = 0.78 from the plug-in with . Is the true pass@100 likely higher or lower?
Higher. is concave, so by Jensen's inequality the plug-in is biased low: at true success 0.02 it averages 0.796 against 0.867 [699]. Use the unbiased estimator per problem (Section 10.3).
Model A scores 71% and B 69% on 1,000 questions, per-question correlation 0.8. Is the gap resolved?
Unpaired, SE 2.05 points and . Paired, SE and , significant, but power for a true 2-point gap is only about 59%. 80% power needs about 1,650 questions (computed) [777].
Llama 3's audit flags 52% of Natural Questions as contaminated yet estimates almost no gain. How?
Contamination is not exploitation: overlapping text can lack the answer, or seeing an item may not help [6, 784]. Flagged and clean subsets also differ in difficulty.
An agent's 50% horizon is 2 hours. Roughly what is its 80% horizon, and why does no one report a 99% horizon?
About 24 minutes: at slope 0.6, 80% success needs doublings shorter tasks [829]. A 99% horizon would be about 200 times shorter at that slope, and 100 to 2,300 times across METR's slopes (computed), and would need many very short, reliable tasks [780].
You must choose between two data mixes with 150M-parameter models. What makes a benchmark trustworthy for that?
High SNR: recipe spread large against checkpoint noise. SNR tracks decision accuracy (), and bits per byte raised GSM8K's SNR from 1.2 to 7.0 [259]. Ranking at 150M picked the 1B winner about 80% of the time [258].
- A score is a measurement from an instrument: questions, answer key, formulation, harness, decoding, grader, and for agents the scaffold, environment and budget. Report all of it.
- Question sampling alone gives about ±7 points on HumanEval and ±4 on SWE-bench Verified. Pair comparisons, use Wilson and clustered intervals, and size evaluations in advance: a 2-point gap at correlation 0.8 needs about 1,650 questions.
- Formulation and implementation can move a score more than a model generation (78.6% against 60.2% on ARC-Challenge), and answer keys carry errors (6.49% of MMLU).
- Use the unbiased pass@k (coverage) and pass^k (reliability) estimators per problem, and state temperature, samples and k.
- Contamination is common and hard to detect. Fresh replicas such as GSM1k (drops of up to 8 points) measure it.
- Judges and arenas need swap-and-agree, length control, cross-family judges, a human correction sample and intervals.
- An agent's score belongs to the whole system. METR's 50% horizon doubled every three to seven months (as of September 2026), with wide intervals and a 16-hour ceiling.
- For training decisions, use high-SNR continuous metrics, average checkpoints, measure seed noise at your scale, and keep a held-out suite.
11. Distributed training: from one GPU to a hundred thousand
Distributed training is an accounting problem for bytes: which device owns them, which link they cross, how often they move, and how much movement can overlap with compute. Each parallel axis trades memory, communication and scheduling against the others.
Why can one GPU not train a frontier model, and in how many ways can the work be split? Three walls stand in the way. The running examples and the notation are introduced in Section 0.3.
Time. Llama 3 405B took FLOPs, at 400 TFLOP/s per GPU on 16,384 H100s [6]. One GPU would need seconds, about 3,000 years, and the 16,384 GPUs need about 67 days (computed). Memory. At 16 bytes per parameter (BF16 weights and gradients, FP32 master weights and Adam moments) [22], 405.85B parameters need 6.49 TB of training state, more than 81 H100s of 80 GB can hold, before any activation (computed) [4]. Batch. If each GPU held the whole model and one 8,192-token sequence, 16,384 GPUs would make a 134M-token batch, eight times the 16M Llama 3 used (computed). Past the critical batch size a bigger batch stops helping [360] (Section 5.3). So the work is split along five axes, and big runs combine several of them (Table 11.1).
Table 11.1. The five axes of parallelism and the traffic each one creates, placed as in Llama 3 405B and DeepSeek-V3.
| Axis | What is split | What crosses the link | How often | Where it lives |
|---|---|---|---|---|
| Data (DP), with ZeRO and FSDP | the batch, and when sharded the weights, gradients and optimizer state | gradients (all-reduce), or weights and gradients (all-gather plus reduce-scatter) | once per step, or once per layer with prefetching | outermost, across pods [6] |
| Tensor (TP), with sequence parallelism | every weight matrix | activations, two collectives forward and two backward per layer | every layer, every micro-batch, on the critical path | inside the 8-GPU server [392, 41] |
| Pipeline (PP) | the layer stack | one activation tensor per stage boundary | every micro-batch | across servers [41] |
| Context (CP) | the sequence, through attention | keys and values | every layer | across servers inside a pod, Llama 3 at 128K [6] |
| Expert (EP) | the experts of a mixture-of-experts model | token hidden states, all-to-all | every MoE layer, every micro-batch | up to 4 nodes per token, DeepSeek-V3 [2] |
Llama 3 states the ordering rule: "The innermost parallelism requires the highest network bandwidth and lowest latency, and hence is usually constrained to within the same server" [6]. On an H100 server, NVLink carries 900 GB/s in total, about 450 GB/s each way per GPU, while each GPU's 400 Gb/s network card carries 50 GB/s, a factor of 9 (computed) [4, 137]. Chapter 2 describes the hardware.
Tensor parallelism talks inside every layer, context parallelism inside attention, expert parallelism in every MoE layer, pipeline parallelism once per micro-batch per stage boundary, data parallelism once per step. Nest them from NVLink (450 GB/s per direction) out to the network (50 GB/s per GPU), as Llama 3's order of tensor, context, pipeline, data does [6].
After collectives (Section 11.1) and data parallelism on nanoGPT and Llama 3 70B (Section 11.2) come the model splits, with DeepSeek-V3 for pipelines and experts, and Llama 3 405B's full layout (Section 11.7). The "hundred thousand" is the range of the methods: the largest layout with published degrees here uses up to 16K GPUs of a 24K-GPU cluster [6].
11.1 Collectives: the vocabulary and the cost model
What communication patterns does parallel training need, and how long does each take? Every axis talks through collectives, operations that all ranks (processes, usually one per GPU) in a group call together on same-shaped arrays [143, 847].
Table 11.2. The six collectives and who uses them.
| Collective | What each rank ends with | Who uses it |
|---|---|---|
| All-reduce | the elementwise sum of all arrays | data-parallel gradients |
| Reduce-scatter | its own slice of the sum | ZeRO and FSDP gradients, sequence parallelism |
| All-gather | every rank's slice, concatenated | FSDP parameters, sequence parallelism |
| All-to-all | a different slice from every other rank | expert parallelism (Section 11.6) |
| Broadcast, reduce | the root's array, or the sum on the root only | DDP's initial weights |
| Send/recv | one neighbor's array | pipeline stages (Section 11.4) |
Reduce-scatter leaves each rank with the summed slice it owns, and all-gather hands every slice to everyone. Each half costs of the message per rank [143, 22]. ZeRO, FSDP and sequence parallelism all do the first half now and the second half later, or never.
Floating-point addition is not associative [848], and in a ring each chunk's sum starts at a different rank (our reading of the schedule below), so changing the rank count changes the last bits. Llama 3 reduces gradients in FP32 [6] (determinism is in Section 12.7).
The alpha-beta model and the ring
A message of bytes costs : a fixed latency plus bytes over the per-direction bandwidth , "roughly equal to overhead + size / bw" in the nccl-tests documentation [143, 849]. Now put ranks on a ring, each sending only to its right neighbor, and cut the array into chunks [850]. In the reduce-scatter phase, at step (from 0), rank sends chunk to rank , which adds it in. After steps each rank owns one fully summed chunk. The all-gather phase repeats the rotation, but the receiver overwrites instead of adding. Each step moves bytes per rank, so
A simulation for from 2 to 16 gives exact sums (computed). In Figure 57, choose four GPUs and step: each chunk's sum grows from one contribution to four, then the finished chunks spread. The side chart shows bytes per GPU nearing twice the message while steps grow linearly.
Method and sources
In the reduce-scatter phase every GPU passes one chunk to its right neighbor, which adds it, until each GPU owns one fully summed chunk. In the all-gather phase the finished chunks travel the same ring until every GPU holds all of them. Step through the schedule for 3 to 8 GPUs, or pick a running example's gradients to see the bytes in GB. The line chart plots the bytes each GPU sends, as a multiple of n, against the GPU count on a log scale: they approach 2n as p grows, while the number of steps, and so the latency, grows linearly. The schedule and the byte counts come from an exact integer simulation in this guide (computed). The algorithm follows Gibiansky (2017), and the bound follows Patarasuk and Yuan (2009) and the nccl-tests documentation (NVIDIA, 2024).Point-to-point algorithms cannot do much better: "the best of any all-reduce algorithm can do is to achieve roughly 2 times the time to send the msize-byte data" [851, 143]. The bandwidth factor is 1.75 at 8 ranks and 1.998 at 1,024 (computed), so the ring's cost is nearly "independent of the number of GPUs in the system" [850]. The latency term, , is what grows.
Latency, trees and hierarchy
Equating the two terms gives the size below which a ring is latency-bound, : 2 MB at 8 ranks, 256 MB at 1,024 and 4 GB at 16,384 with µs (illustrative) and 50 GB/s (computed). NCCL 2.4 added trees because "latency scales linearly with the number of GPUs, preventing scaling above hundreds of GPUs" [852]. A double binary tree moves about the bytes of a ring in logarithmically many steps, cut latency up to 180 times at 24K GPUs on Summit, and NCCL falls back to rings when they give more bandwidth [852, 853].
Table 11.3. All-reduce algorithms in the alpha-beta model, for a power of two.
| Algorithm | Latency term | Bandwidth term | Wins when |
|---|---|---|---|
| Ring [143, 851] | large messages, up to hundreds of ranks | ||
| Recursive halving and doubling [366, 849] | many ranks, if the network carries the exchanges without contention | ||
| Double binary tree, pipelined [852, 853] | about | approaches | thousands of ranks, medium messages |
Libraries also exploit the factor of 9 between NVLink and the network. NCCL's hierarchical ring "performs a reduce-scatter operation inside the node, then multiple all-reduce operations between nodes, then an all-gather operation inside the node again" [852], and the scaling book counts about 400 GB/s of network egress per 8-GPU node [138]. For nodes of GPUs:
So layout sets bandwidth. A group with one GPU per node, like the data-parallel group when tensor parallelism fills each node, pushes each GPU's whole message through its own 50 GB/s card. A group of whole nodes sends of it per card.
Reading nccl-tests
nccl-tests report algorithm bandwidth, algbw , and bus bandwidth, which rescales it by the lower bound so it compares with the link rate [143]:
An all-reduce at 200 GB/s of algbw on 8 GPUs shows 350 GB/s of busbw (computed). Predict times with algbw, judge hardware with busbw. Inside an H100 node "it is difficult in practice to exceed 370 GB/s" [138]. NCCL's tuner picks low-latency protocols (about 1 to 2 µs per hop) for small messages and Simple (about 6 µs, near peak bandwidth) for large ones [854].
Llama 3 70B's 70,553,706,496 parameters (computed from the layer shapes and the released 128,256-token vocabulary) make 141.1 GB of BF16 gradients [6, 17], and each GPU has one 50 GB/s card [137]. The flat ring's bandwidth term is seconds. The hierarchical one runs on 128 nodes of 8 at 450 GB/s inside and 50 GB/s across [138] (all computed).
| Case | Time |
|---|---|
| Flat ring, = 2 / 8 / 1,024 | 2.82 s / 4.94 s / 5.64 s |
| Hierarchical: in-node reduce-scatter, cross-node all-reduce of each GPU's 17.6 GB eighth, in-node all-gather | 0.27 + 0.70 + 0.27 = 1.25 s, near 0.70 s pipelined |
| Latency of 5,645 buckets of 25 MB at 1,024 ranks, = 5 µs (illustrative) | 10.2 ms each, 58 s serialized |
NCCL gets close to the hierarchical time by running one ring per card, so 5.64 s is a naive bound, not a measurement. Even the best case exceeds a second, so gradient traffic must overlap compute.
In Figure 58, start from the 70B preset and slide the GPU count: above 64 GPUs the flat time hardly moves, and whole nodes cut it four to eight times. Shrink the message to 25 MB and it turns latency-bound, rising with every GPU. The figure's NIC link uses an illustrative 10 µs, so it shows about 20 ms where the table above, at 5 µs, shows 10 ms. The 25 MB bucket preset uses 5 µs.
Method and sources
The hierarchical option models a group of whole 8-GPU nodes that reduces over NVLink before using the network, so each NIC carries an eighth of the message, and the compute slider checks whether the collective hides behind the work it overlaps. Presets reproduce the chapter's running examples, from nanoGPT's gradients on one node and Llama 3 70B's 141.1 GB of gradients on 1,024 GPUs to INTELLECT-1's synchronization across continents, where the model predicts about 76 s against measured medians of 103 to 469 s (computed). Link rates are NVIDIA's H100 and DGX H100 specifications and the WAN rate comes from Jaghouar et al. (2024). Latencies are illustrative, guided by Hu et al. (2025) and the Llama 3 report (Grattafiori et al. 2024), and the formulas follow the nccl-tests documentation (NVIDIA 2024), Patarasuk and Yuan (2009), Jeaugey (2019) and Austin et al. (2025).To train ResNet-50 on 256 GPUs in one hour, the team estimated about 100 MB of gradients, a 120 ms backward and an all-reduce moving twice the bytes: "a peak bandwidth requirement of 200MB/0.125s=1600MB/s, or 12.8 Gbit/s" [366]. On 50 Gbit Ethernet, recursive halving and doubling then beat the ring three times for small buffers on 32 servers. The alpha-beta model's step counts, against , explain the result.
Failure modes. "Mismatched allreduce order across processes can lead to wrong results or DDP backward hang" [847]. Chunks below the card's 512 KiB buffer go out partly filled [854]. Busbw in a time estimate makes an all-reduce look up to twice as fast. How to measure. Run all_reduce_perf, reduce_scatter_perf and all_gather_perf from kilobytes to gigabytes on your job's real groups: the node, the data-parallel group, the whole job [143]. Read busbw at the sizes your framework issues, such as DDP's 25 MB buckets [855] or one FSDP layer, against 450 and 50 GB/s.
11.2 Data parallelism, ZeRO and FSDP
How do you use many GPUs on one model by splitting the batch, when does the gradient traffic hide behind compute, and how do you stop every GPU from holding the whole training state? Data parallelism leaves the model untouched, so it comes first.
DDP and its overlap
Each rank holds a full replica, runs its slice of the batch, and an all-reduce averages the gradients before every step, so replicas that start equal stay equal [847, 855]. Normalize each worker's loss by the global batch, not its own share [366]. The global batch grows with . The critical batch size is derived in Section 5.3, and it caps the useful data-parallel degree.
PyTorch's DistributedDataParallel (DDP) packs gradients into 25 MB buckets in reverse layer order, because collectives are faster on large tensors and gradients appear from the last layer back. As each bucket fills, a hook launches an asynchronous all-reduce while earlier layers still compute, and every rank must launch them in the same order [855]. DDP scales near-linearly to 256 GPUs [855]. With gradient accumulation, no_sync() skips all but the last all-reduce, which made ResNet-50 on 256 GPUs 38% faster syncing every 8 iterations [855].
GPT-2 small's 124,439,808 parameters [20] make 497.8 MB of FP32 gradients. A ring over 8 GPUs sends MB per GPU, 1.94 ms at 450 GB/s or 2.35 ms at the achievable 370 GB/s [4, 138]. The 524,288-token batch of the GPT-2 reproduction [15] gives each GPU 65,536 tokens, FLOPs, 124 ms at an illustrative 40% of the 989.5 TFLOP/s dense BF16 peak, counting 6N FLOPs per token. That share is the model FLOPs utilization, MFU (Section 1.3). Communication is under 2% of the step before overlap (all computed). Use plain DDP: 2 GB of state fits on one GPU.
When does gradient traffic hide?
Let a GPU hold BF16 parameters and process tokens between synchronizations at achieved FLOP/s over a bandwidth . Forward costs FLOPs, backward (Chapter 1). DDP sends about bytes per GPU behind the backward, so it hides if . FSDP all-gathers bytes behind the forward, then all-gathers and reduce-scatters behind the backward. All cases give one condition, independent of model size [856, 138]:
Multiply by 1.5 for FSDP with an FP32 reduce-scatter and by 2 for DDP with an FP32 all-reduce. The window is one micro-step for FSDP, which regathers weights every micro-batch, and one optimizer step for DDP with accumulation. Llama 3 reduce-scatters in FP32, the 1.5 case [6]. For , use the GPU's egress when sharding within a node and the node's when sharding across nodes [138].
Table 11.4. Tokens per GPU between synchronizations needed to hide data-parallel traffic on an H100, from with a dense BF16 peak of 989.5 TFLOP/s (computed, 40% columns rounded) [4].
| Group layout and link | 40 % MFU, BF16 | 40 % MFU, FSDP with FP32 reduce-scatter | at peak, BF16 | |
|---|---|---|---|---|
| inside one NVLink node | 450 GB/s | 880 | 1,320 | 2,199 |
| whole 8-GPU nodes, hierarchical over 400 Gb/s cards | 400 GB/s per node | 990 | 1,480 | 2,474 |
| one GPU per node, 400 Gb/s card | 50 GB/s | 7,900 | 11,900 | 19,790 |
| one GPU per node, 100 Gb/s Ethernet | 12.5 GB/s | 31,700 | 47,500 | 79,160 |
| internet, 1 Gbit/s | 0.125 GB/s | 3.2M | 4.7M | 7.92M |
The whole-node row at peak is the scaling book's "about 2500 tokens" per GPU (2,474 by our count), so pure data parallelism over 16,384 GPUs would need M tokens per batch, against Llama 3's 16M [138, 6]. Model parallelism shrinks the problem. A GPU in a tensor and pipeline group holds parameters but sees all its replica's tokens, per step for each Llama 3 405B replica (computed) [6]. The margin still shows in Llama 3's MFU at 16K GPUs (Section 11.7). And the first all-gather is exposed unless, as in MegaScale (ByteDance's system for training on more than 10,000 GPUs), it is prefetched during data loading [47].
ZeRO: sharding the training state
Plain data parallelism stores all 16 bytes per parameter on every GPU: 2 for BF16 weights, 2 for gradients and for FP32 master weights and Adam moments [22, 51]. ZeRO shards the optimizer state (stage 1), then the gradients too (stage 2), then the parameters (stage 3) [22]. The bytes per GPU for each stage are derived in Section 1.4: , and . Here we add what each stage sends. Stages 1 and 2 reduce-scatter gradients and all-gather updated weights, the same elements per step as plain data parallelism. Stage 3 gathers each layer's weights for forward, again for backward, then reduce-scatters: , 1.5 times the baseline [22].
Table 11.5. Model-state memory per GPU in decimal GB at 16 bytes per parameter. The first row is reported by the ZeRO paper, the others are computed from the formulas [22, 6].
| Model, | DP | ZeRO-1 | ZeRO-2 | ZeRO-3 |
|---|---|---|---|---|
| ZeRO paper 7.5B, 64 | 120 | 31.4 | 16.6 | 1.9 |
| Llama 3 8B, 8 | 128.5 | 44.2 | 30.1 | 16.1 |
| Llama 3 70B, 1,024 | 1,128.9 | 283.0 | 142.1 | 1.10 |
| Llama 3 405B, 1,024 | 6,493.7 | 1,628.2 | 817.3 | 6.34 |
Stages 1 and 2 never fall below and , 282 and 141 GB for Llama 3 70B, so they cannot fit it on an 80 GB GPU at any degree (computed). In Figure 59, pick the 70B preset and see which lines cross the 80 GB mark: only ZeRO-3, and the readout shows the 1.5 times traffic it pays.
Method and sources
Stage 1 shards the optimizer states and stage 2 also the gradients, so they level off at 4 and 2 bytes per parameter (282 GB and 141 GB for Llama 3 70B), while stage 3 shards everything and keeps falling. The bars split the four stages into weights, gradients and optimizer states at the selected degree, and the readout gives each stage's data-parallel traffic per GPU per step, 2N elements for the first three and 3N for stage 3. The diamonds are the ZeRO paper's reported 7.5B-parameter example on 64 GPUs (120, 31.4, 16.6 and 1.9 GB), which the formulas reproduce. All other values are computed in decimal GB and leave out activations and buffers. Formulas and the example come from Rajbhandari et al. (2019), the 18-byte variant with FP32 gradients from NVIDIA's Megatron-LM documentation (2026), parameter counts from the released Llama 3 configurations (Grattafiori et al. 2024) and the 80 GB capacity from NVIDIA's H100 datasheet.Always state dtypes: Megatron's distributed optimizer counts 18 bytes for BF16 parameters with FP32 gradients [857]. Pipelined runs use stage 1, as in Megatron, DeepSeek-V3 and Kimi K2 [857, 2, 72]. Our reading of why: a pipelined rank accumulates gradients over many micro-batches, and sharding them would cost a reduce-scatter per micro-batch. Stage 3, as FSDP, is TorchTitan's default and Llama 3's outer axis [48, 6]. Relatives trade other resources: ZeRO-Offload uses CPU memory [61], ZeRO-Infinity adds NVMe [62] and ZeRO++ quantizes stage 3's cross-node traffic to a quarter [858].
PyTorch FSDP, FSDP2 and HSDP
Fully Sharded Data Parallel (FSDP) is PyTorch's ZeRO-3. It wraps the model in units, usually one block each, and its memory is "proportional to the size of the sharded model plus the size of the largest fully-materialized FSDP unit" [859]. Its knobs carry measured effects.
Table 11.6. FSDP knobs and their reported effects.
| Knob | What it does | Reported effect |
|---|---|---|
| Unit size | one all-gather per unit | below 33M elements, communication time rises fast [859] |
| Backward prefetch | issues the next unit's all-gather early | about 18 % faster on GPT-175B [859] |
| Rate limiter | at most two all-gathers in flight | stops a fast CPU from flooding GPU memory [859] |
| No reshard after forward | keeps gathered weights for backward | saves one all-gather, Llama 3's choice [6] |
FSDP2 integer reshard_after_forward | backward all-gather over a smaller group | less traffic for more memory [860] |
| FSDP2 per-parameter sharding | shards each tensor on its first dimension | often 7 % less memory than FSDP1 [860, 48] |
At 175B parameters FSDP reached 173 and 186 TFLOP/s per A100 [859], 55 to 60% of the 312 TFLOP/s peak (computed). Flat sharding breaks optimizers that need a whole tensor, such as norm-based or approximate second-order methods [859] (Chapter 5). Hybrid sharding (HSDP) shards inside groups of GPUs and replicates across them [860]. Each GPU then all-reduces only its gradient shard across the replicas, sending for an -byte model
For Llama 3 70B on 1,024 GPUs in groups of 8 that is 35.0 GB, against 281.9 GB for full replication and 422.9 GB for full sharding when every byte crosses the network (computed, the FSDP paper's own formula gives 35.2 GB [859]). Hierarchical collectives cut full sharding's bytes per card eightfold too, so HSDP's lasting gains are smaller groups and all-gathers on NVLink. Its cost is memory: groups of 8 leave 141 GB of 70B state per GPU, groups of 64 leave 17.6 GB (computed).
Where FSDP stops scaling
This is contested. TorchTitan calls FSDP sufficient "up to 512 GPUs" [48], and the Ultra-Scale Playbook caps data parallelism at 512, past which ring latency binds [44]. TorchTitan's Llama 3.1 8B lost 9.8% per GPU from 8 to 128 GPUs (6,258 to 5,645 tokens per second, computed from reported values) [48]. On TPUs, How to Scale Your Model spreads Llama 3 70B's 16M-token batch over about 18,800 v5p chips with FSDP alone, assuming three interconnect axes [856]. The fabrics differ in latency: an 80-layer model's 240 per-layer collectives per micro-step cost 1.2 to 2.5 s of ring latency at 1,024 ranks for of 5 to 10 µs (illustrative, computed). 512 is a GPU heuristic, not a law.
Setup (illustrative): 128 nodes of 8, FSDP alone, one 8,192-token sequence per GPU per micro-step, one unit per block (855.7M parameters), BF16 compute and all-gathers, FP32 Adam, 40% MFU. Activations force full checkpointing. Compute is FLOPs per micro-step, counting causal attention (computed).
| Memory and compute per GPU (computed) | Value |
|---|---|
| Sharded states / two gathered BF16 blocks / one block's FP32 gradient / FP32 logits | 1.10 / 3.42 / 3.42 / 4.20 GB |
| Activations without checkpointing (our estimate) | about 217 GB |
| Total with full checkpointing | about 26 GB |
| FLOPs per micro-step | |
| Forward / backward with recomputation at 396 TFLOP/s | 3.14 s / 9.43 s |
| Communication per micro-step (computed) | Flat: every byte on its GPU's 50 GB/s card | Hierarchical: each card carries 1/8 |
|---|---|---|
| Forward all-gather of 141 GB | 2.82 s (90 % of 3.14 s) | 0.35 s |
| Backward, BF16 reduce-scatter | 5.64 s (60 % of 9.43 s) | 0.71 s |
| Backward, FP32 reduce-scatter | 8.46 s (90 % of 9.43 s) | 1.06 s |
| Whole micro-step, BF16 / FP32 | 8.46 s / 11.28 s | 1.06 s / 1.41 s |
Flat, the setup is fragile, with about 10% slack in two of three windows. Hierarchical, it is comfortable. Latency and stragglers push real runs toward fragile. Fixes: HSDP with groups of 64 (17.6 GB of state), tensor parallelism of 8 inside the node, or a larger micro-batch.
In the FSDP paper's GPT-175B runs, 128 GPUs at batch 2 ran slow: the backward pass took 85.56% of iteration latency instead of about 67% [859]. Bigger shards ran the caching allocator near 80 GB, and it spent the backward defragmenting. Watch allocator retries and reserved versus allocated memory, and keep headroom.
Failure modes. A rank that skips a collective hangs DDP [847]. FSDP units under the 33M-element knee waste bandwidth, and BF16 gradient reduction can drift from FP32 [6]. How to do it yourself. Use DDP while the training state fits on one GPU, otherwise FSDP with one unit per block, prefetching and FP32 reduction. Compute Table 11.4 for the bandwidth your group really sees before choosing a micro-batch. Past a few hundred GPUs, use HSDP or tensor parallelism inside the node (Section 11.3), and profile before tuning bucket_cap_mb.
11.3 Tensor and sequence parallelism
How do you split one transformer layer across GPUs so the math stays exact, and why must that split stay inside an NVLink domain? Once a layer's weights, or one sequence's activations, crowd an 80 GB GPU, copying the model to every GPU stops working and you have to cut the layer itself. Tensor parallelism (TP) splits each weight matrix across GPUs. The price is a collective inside every layer, so the link decides whether it pays.
Column, then row
Split a weight matrix by columns and each GPU computes a slice of the output with no communication. Split it by rows and each GPU computes a partial sum that must be added up. Megatron-LM chains the two: column-split the MLP's first matrix, apply the nonlinearity locally, row-split the second matrix so it consumes the slices directly, then sum with one all-reduce. In the paper's words, " is an identity operator in the forward pass and all reduce in the backward pass while is an all reduce in the forward pass and identity in the backward pass" [392]. Attention splits the same way by heads, which gives "only two all-reduces in the forward path and two in the backward path" per layer [392]. SwiGLU fits too, with gate and up projections column-parallel and the down projection row-parallel. Every Llama 3 model has 8 key-value heads [6], so TP 8 leaves one per GPU and any higher degree must replicate the key and value projections (derived).
The ratio that decides TP
Each all-reduce carries the activation (micro-batch in sequences, sequence length , width ). With the ring cost of Section 11.1, that is "a total communication of per layer per device for each microbatch", where Narayanan et al. write for width and for the TP degree [41]. In BF16 that is bytes. A standard layer does forward FLOPs [41], three times that with the backward, shared by GPUs. With the peak FLOP/s of one GPU, its bandwidth per direction and no overlap,
Batch and sequence length cancel, so bigger micro-batches cannot rescue TP. Width and the hardware ratio decide. An H100 peaks at 989.5 TFLOP/s dense BF16 with 450 GB/s of NVLink per direction [4] and a 50 GB/s NIC per GPU [137], so is about 2,199 FLOPs per byte inside the node and 19,790 across it (computed). For the ratio is over NVLink, 0.42 at TP 8 for a standard layer, and Llama 3 70B's real layer (grouped-query attention, GQA, and the SwiGLU MLP of Section 4.2, with causal attention at 8,192 tokens) gives 0.36 (computed). Table 11.7 covers the running examples, and the TP presets of Figure 58 let you vary them.
Table 11.7. Tensor-parallel communication over compute with no overlap, full Llama 3 layers at s = 8,192, one sequence per micro-batch, H100 at peak (computed).
| Model | Width d | NVLink, 450 GB/s: TP 2 / 4 / 8 | 400 Gb/s NIC: TP 2 / 4 / 8 / 16 |
|---|---|---|---|
| Llama 3 8B | 4,096 | 0.10 / 0.29 / 0.67 | 0.86 / 2.6 / 6.0 / 12.9 |
| Llama 3 70B | 8,192 | 0.05 / 0.16 / 0.36 | 0.47 / 1.4 / 3.3 / 7.0 |
| Llama 3 405B | 16,384 | 0.03 / 0.09 / 0.20 | 0.26 / 0.78 / 1.8 / 3.9 |
| GPT-2 124M (closed form) | 768 | 0.64 per extra GPU, 4.5 at TP 8 | 5.7 per extra GPU, 40 at TP 8 |
Over NVLink, TP 2, 4 and 8 cost 0.05, 0.16 and 0.36 of compute time. Across a NIC, TP 2 already costs 0.47 and TP 8 costs 3.3 (computed). Doubling the micro-batch changes nothing. For 405B at TP 8 the numbers are concrete: one message is bytes = 256 MiB, four ring all-reduces send 1.75 GiB per GPU per layer, 4.18 ms on NVLink or 37.6 ms on the NIC, against 48 ms of layer compute at the reported 43% MFU [6]. That is 9% inside the node and 78% across it (computed). The 8-GPU node is the TP domain.
Other sources agree. How to Scale Your Model finds TP communication-bound beyond 8 to 16 ways for most models on TPU v5p [856]. The Ultra-Scale Playbook measured "significant drops when moving from TP=8 to TP=16", and about 43% lost when TP crosses nodes against 14% for pipeline parallelism [44]. Narayanan et al.'s rule is TP "up to degree when using -GPU servers", with pipeline parallelism beyond [41].
Sequence parallelism and activation memory
Between TP's collectives, norms and residual adds run on the full, replicated tensor. Sequence parallelism (SP) splits them along , turning each all-reduce into a reduce-scatter and an all-gather of the same total size, so it "does not introduce any communication overhead" [45]. Here "sequence parallelism" means only this companion of TP. Ring Attention and Ulysses are context parallelism (Section 11.5).
Activation memory per layer is derived in Section 1.5. For a GPT layer it is bytes with heads [45]. Table 11.8 divides it for GPT-3 175B, whose term is more than twice the 34, which is why recomputing only the attention scores (selective recomputation) pays.
Table 11.8. Activation bytes stored per layer for GPT-3 175B (s = 2,048, b = 1, d = 12,288, 96 heads, TP 8). Formulas from Korthikanti et al., values computed.
| Configuration | Bytes per layer | MiB per layer | GiB for 96 layers |
|---|---|---|---|
| No parallelism | 2,736 | 256.5 | |
| TP | 552 | 51.8 | |
| TP + SP | 342 | 32.1 | |
| TP + selective recomputation | 312 | 29.3 | |
| TP + SP + selective recomputation | 102 | 9.6 | |
| Full recomputation | 48 | 4.5 |
Full activation recomputation, the default for large models, cost 30–40% of execution time. SP plus recomputing only the attention core "reduces activation memory by , while reducing execution time overhead from activation recomputation by over 90%". A 530B model on 2,240 A100s went from 42.1% MFU to 54.2% (reported) [45]. FlashAttention already recomputes the scores, so its users are already doing selective recomputation [44].
Overlap helps at the margin. PyTorch's asynchronous TP splits the all-gather and its matrix product into pieces and reports about 8% end-to-end speedups for 8B- and 70B-class Llama models, with the catch that copy kernels take streaming multiprocessors away from the matrix products (reported) [861, 862]. To do it yourself: set TP to one NVLink domain (8 on an H100 server), with one technique across 8 GPUs often enough under about 10B parameters [44], always add SP, check that heads, MLP width and vocabulary divide by , and compare the profiled collective time per layer with Table 11.7.
11.4 Pipeline parallelism and its schedules
Tensor parallelism is stuck inside a node: how do you split a 126-layer model across nodes when the network is about ten times slower, and how much idle time does that cost? Cut the stack into stages and pass activations forward and gradients backward at the cuts. Each cut carries one tensor per micro-batch, point to point, so "from a communication standpoint, pipelining is basically free" [138]. The cost is idle time, the bubble.
The bubble, derived
Split the batch into micro-batches with forward and backward times and per stage. If every stage runs all forwards then all backwards, as GPipe does [863], "the pipeline bubble consists of forward passes at the start of a batch, and backward passes at the end" [41]. Each GPU idles while working . With virtual stages per GPU (below),
Narayanan et al. and Llama 3 use the first form, which this guide follows, and GPipe the second [863, 6]. GPipe found the bubble negligible once the micro-batches number at least four times the stages (), but it holds all micro-batches' activations [863]. PipeDream's one-forward-one-backward (1F1B) order [864], in its synchronous form [865], caps the micro-batches in flight at the pipeline depth with the same bubble [41]. 1F1B fixes memory, which lets you raise . Interleaving gives each GPU non-contiguous chunks of layers, which "reduces the bubble time by ", multiplies point-to-point traffic by , requires to be a multiple of and gained up to 10% throughput (reported) [41].
1F1B: of the ideal time, 31.9% of the step. Interleaved with : , 19.0% of the step, the same as 1F1B with (computed). Llama 3 405B had 16 sequences per data-parallel group at 16,384 GPUs and 32 at 8,192 [6]. With one sequence per micro-batch and , the bubble is against (computed, illustrative , not published). Halving the batch per group doubles the bubble. The paper blames its drop from 43% to 41% MFU on that lower batch per group [6], and the bubble is the likely mechanism (our reading).
Zero bubble and DualPipe: split the backward
A linear layer's backward is two products: the input gradient, needed by the previous stage now, and the weight gradient, needed only by the optimizer. With times (forward), (input gradient) and (weight gradient), "W can be flexibly scheduled anywhere after the corresponding B of the same stage", and under a FLOP model [866]. Filling holes with W passes gives bubbles per GPU of
ZB-H1 keeps 1F1B's memory and cuts its bubble to a third when the three times are equal. An automatic scheduler gets under 1% in most settings and up to 23% more throughput than 1F1B at similar memory, though the optimizer step's synchronization "makes zero bubble impossible" unless worked around (reported) [866]. DeepSeek-V3's DualPipe feeds micro-batches from both ends, holds two parameter copies and pairs a forward chunk with a backward chunk, above, so one's expert all-to-all hides behind the other's compute. Cross-node expert parallelism had left "an inefficient computation-to-communication ratio of approximately 1:1" [2]. The report writes for the full backward, here, so check which a paper means.
With illustrative , 1F1B idles units and ZB-H1 15. DualPipe idles : 14 if overlapping a forward and a backward saves nothing, 10.5 if it saves half a unit, 7 if a whole unit (computed). The bubble gain over zero bubble is modest. The win is hiding the all-to-all of Section 11.6.
Figure 60 runs five schedules on four stages and eight micro-batches. Step through GPipe and 1F1B first: both take 33 units with 9 idle per GPU (27.3% of the step), but 1F1B holds at most 4 micro-batches against GPipe's 8. Then watch interleaving, ZB-H1 and DualPipe finish at 28.5, 27 and 26 units, 15.8, 11.1 and 7.7% idle (computed). The simulation gives DualPipe no credit for hiding communication. The calculator below the timelines computes for your own run.
Method and sources
GPipe and 1F1B leave the same 9 units of idle time per GPU, but 1F1B holds at most 4 micro-batches in flight where GPipe holds 8. Interleaving two chunks per GPU halves the bubble, ZB-H1 fills it with deferred weight-gradient work, and DualPipe runs micro-batches in both directions at the cost of a second copy of the weights. The simulation gives DualPipe no credit for hiding communication, its main purpose. The calculator applies the closed form (p-1)/(m v), and its Llama 3 405B presets use the published pipeline depth and sequences per data-parallel group with an illustrative micro-batch size and v. Schedules follow Huang et al. (2018), Harlap et al. (2018), Narayanan et al. (2020, 2021), Qi et al. (2023) and the DeepSeek-V3 report and DualPipe code (2024, 2025), and the presets follow the Llama 3 report (Grattafiori et al., 2024).Memory: the first stage holds the most
Pipelining changes how many layers' worth of activations (Section 1.5) a stage holds: under 1F1B, "the first stage must store layers worth of activations regardless of the pipeline parallel size ", and interleaving multiplies that by [45]. Pipelining divides weights, not the first stage's activations. Llama 3 found its first stage heavy from "the embedding and the warm-up micro-batches", and removed one transformer layer each from the first and last stages [6], so slots split evenly for of 1, 2, 4 or 8 (computed).
Llama 3 says it "could pre-train Llama 3 on sequences of 8K tokens without activation checkpointing" [6]. Count it. Section 1.5's per-layer formula gives a 405B layer bytes, 612 MiB per GPU at with TP 8 and SP. Under 1F1B the first stage holds 126 layers' worth, 75 GiB, and 3.17B parameters of BF16 weights add 5.9 GiB: 81 GiB, more than an H100's 74.5 GiB. Llama 3's trimmed first stage (7 layers, 16 micro-batches in flight, ) holds 112 layers' worth, 67 GiB, which barely fits. A leaner count that keeps three of SwiGLU's four -wide tensors, about , gives 56 GiB, and 10 micro-batches in flight instead of 16 would give 42 GiB (illustrative). Interleaving at multiplies the activations by 1.47, and an unsharded FP32 gradient buffer adds about 12 GiB (estimates). So the answer, about 42–75 GiB of activations, turns on details the paper does not print, such as how many micro-batches the first stage holds or early freeing of tensors. Treat it as an open question, and as practice at noticing when arithmetic does not close.
Watch for a slow stage pacing the rest, micro-batch counts that fight batch-size warmup, exposed point-to-point latency with tiny micro-batches, and drift when many micro-batches accumulate in low precision (Llama 3 accumulates in FP32 [6]). To do it yourself, keep the pipeline degree as small as memory allows, use or interleave, check the first stage's memory rather than the average, and compute the bubble before you launch.
11.5 Context parallelism for long sequences
At 128K tokens even one sequence's activations overflow a tensor-parallel group: how do you split attention, where every query needs every earlier key? Everything outside attention treats tokens independently and splits along the sequence for free. Context parallelism (CP) gives each of GPUs a slice of the sequence and either moves keys and values to the queries (Ring Attention, all-gather CP) or reshards from sequence to heads (Ulysses). Long-context recipes are in Section 7.5.
Ring Attention and all-gather CP
In Ring Attention each GPU keeps its queries while key and value blocks travel a ring, and computes blockwise attention on one block while the next arrives [867, 868]. A block of tokens costs about FLOPs and bytes, so the transfer hides when [867]. Grouped-query attention shrinks keys and values to width , so
For Llama 3 70B, , so on an H100 at peak the block must be about 275 tokens over NVLink and 2,474 over a NIC, against 2,199 and 19,790 with full multi-head attention (computed) [867, 4]. GQA makes ring CP across nodes practical. Causal masks unbalance contiguous slices, so Striped Attention spreads each GPU's tokens through the sequence for up to 1.45 times Ring Attention's throughput at 256K [869], and Llama 3's zigzag split gives rank chunks and [6].
Llama 3 skips the ring and all-gathers keys and values once per layer. All-gathers support masks such as the document mask more easily, and "the exposed all-gather latency is small as the communicated K and V tensors are much smaller than Q tensor due to the use of GQA" [6]. Each GPU receives bytes per layer, with the key-value width left after TP.
The long-context stage ran TP 8, CP 16, PP 16 and DP 8 on 16,384 GPUs at 380 TFLOP/s per GPU, 38% MFU (reported) [6]. Each GPU holds tokens and one key-value head of 128 dimensions. Full keys and values are bytes = 64 MiB per layer, 60 MiB of it received: 1.26 ms at 50 GB/s, against about 11 ms of forward layer compute at peak (6.6 ms linear, 4.4 ms attention). That is 11% at peak and 4% at the achieved 380 TFLOP/s (computed). "Small" is fair, "negligible", the paper's other word, is generous, and GQA is why.
Ulysses, and how to choose
DeepSpeed-Ulysses uses an all-to-all so each GPU trades its tokens with all heads for all tokens with heads, runs ordinary attention, and swaps back. Its per-link volume is times smaller than Megatron SP's [870]. The limit is heads: "Llama3–8B employs GQA with a KV head number of 8, which means that when using DS-Ulysses SP, the maximum SP degree is 8", and Ulysses competes with TP for the same heads [871]. USP combines Ulysses and a ring on a 2D grid and reached 47% MFU for Llama 3 8B at 208K tokens on two 8-GPU A800 nodes (reported) [871].
Table 11.9. Three context-parallel methods for Llama 3 405B at 131,072 tokens with TP 8 and CP 16 (bytes computed. Ulysses would need K and V replicated, since TP 8 leaves one key-value head per GPU).
| Method | Pattern | Per-GPU bytes per layer, forward | Limit |
|---|---|---|---|
| Ring Attention | point-to-point key-value steps, overlapped | about 60 MiB | block for full overlap |
| All-gather CP (Llama 3) | one all-gather of keys and values, exposed | about 60 MiB | full keys and values in memory, latency on the critical path |
| Ulysses | all-to-alls of queries and outputs, plus keys and values | not possible as is: about 120 MiB if K and V are replicated | degree at most the key-value heads per TP rank, here 1, so it cannot reach CP 16 with TP 8 |
With GQA, ring and all-gather CP move the same 60 MiB, and Ulysses cannot reach degree 16 at TP 8 without replicating K and V, which roughly doubles its bytes. So choose by overlap, masks and heads. Newer systems handle packed documents of mixed length with dynamic meshes, ByteScale reporting up to 7.89 times the prior state of the art on more than 12,000 GPUs [872], and the same ideas power million-token prefill at inference [873] (Chapter 13). To do it yourself, turn CP on only for long sequences, as Llama 3 did (CP 1 at 8K, 16 at 128K) [6], keep the group inside a pod, check the block condition with your , balance causal masks with zigzag or striped assignment, and pick all-gather CP for document masks and Ulysses when key-value heads are plentiful. Section 11.7 puts CP among the other axes.
11.6 Expert parallelism and the all-to-all
A mixture-of-experts layer has many expert MLPs and each token uses only of them: where do the experts live, and how do tokens reach them? Each DeepSeek-V3 MoE layer has 1 shared and 256 routed experts of width 2,048, and each token uses 8 routed experts on at most 4 nodes [2]. Routing and balancing are in Section 4.7.
The axes so far split the work of every token. Expert parallelism (EP) splits the set of experts instead: each GPU holds whole experts and tokens travel to them, so nothing inside an expert's matrix multiply needs a collective [44]. The price is an all-to-all (Section 11.1) in every MoE layer.
Table 11.10. One MoE layer under expert parallelism, forward pass. The backward pass runs the same steps in reverse.
| Step | What happens |
|---|---|
| 1. Route | each token gets top- expert ids and gate weights |
| 2. Permute | each GPU groups its tokens by destination expert |
| 3. Dispatch all-to-all | each token copy goes to the GPU that owns its expert, with uneven send sizes because routing depends on the data [49] |
| 4. Expert compute | one grouped matrix multiply over the local experts. MegaBlocks makes it block-sparse so experts take different token counts without dropping any [315] |
| 5. Combine all-to-all | outputs return to the tokens' home GPUs |
| 6. Un-permute | weight by the gates and sum |
The gradient of a dispatch is a combine, so one MoE layer costs four all-to-alls per micro-batch. EP groups are carved out of the data-parallel group: dense weights are data-parallel over the whole group, expert weights sharded across the EP sub-group. MoE Parallel Folding removes the old rule that the EP degree cannot exceed the data-parallel degree, by giving attention and experts separate meshes, at 49.3% MFU on Mixtral 8x22B [49].
How many bytes, and when EP beats TP
With GPUs, tokens per GPU, width , bytes per element and uniform routing, one dispatch sends
bytes per GPU, and the combine moves as many elements. For , , FP8 and an illustrative : MB at and 231 MB at 64 (computed). The volume barely depends on EP size, only the link it crosses does. Against TP on the same GPUs, which all-reduces every token's activation, EP's dispatch plus combine moves as much. For , and 32,768 BF16 tokens (4,096 per GPU), dispatch and combine send 103 + 103 = 206 MB per GPU, against 822 MB for TP's ring all-reduce of the 470 MB activation (computed). MegaScale-MoE switches to all-gather and reduce-scatter when , "ensuring that EP’s communication overhead remains equal to or lower than TP’s" [50].
Replicating experts with data parallelism instead multiplies the break-even of Section 11.2 by , since gradients scale with all experts and compute with :
For , that is "32 * 2475 = 79,200 across nodes, a kind of ridiculously high number" [138]. So MoE runs shard their experts.
Table 11.11. Expert-parallel systems in brief (reported).
| System | What it showed |
|---|---|
| GShard (2020) | a 600B MoE on 2,048 TPU v3 in 4 days, with dispatch and combine growing from 16 % to 36 % of time as experts went from 128 to 2,048 [308] |
| DeepSpeed-MoE | hierarchical all-to-all, hops down to for GPUs per node [874] |
| Tutel | 4.96 and 5.75 times faster MoE layers on 16 and 2,048 A100s [875] |
| MegaBlocks | never drops tokens, up to 40 % faster than Tutel. Dropping at capacity factor 1 cut the loss gain from 0.26 to 0.15 [315] |
| MegaScale-MoE (2025) | MFU from 32.48 % at 240 GPUs to 27.89 % at 1,440 at a fixed batch, as each pipeline got fewer micro-batches [50] |
| DeepEP | DeepSeek's library, whose dispatch and combine kernels occupy SMs [876] |
DeepSeek-V3: cross InfiniBand once per node
DeepSeek-V3 trained on 2,048 H800s with 16-way pipeline parallelism, 64-way EP over 8 nodes and ZeRO-1, "without using costly Tensor Parallelism (TP)" [2], so each GPU holds routed experts per layer (computed). The H800's NVLink is cut to 400 GB/s in total, 200 GB/s each way against the H100's 450 [1, 4], and DeepSeek measures 160 GB/s over NVLink against 50 GB/s over InfiniBand (IB) [2]. Each destination node gets a token once over IB and fans it out over NVLink, so IB carries copies for nodes [1], with . Dispatch goes in FP8 and the combine in BF16 [2], so IB bytes per token per MoE layer in the forward pass are .
Table 11.12. DeepSeek-V3's InfiniBand bytes per token per MoE layer against the node limit (d = 7,168, all nodes remote, so an upper bound) and expert compute at an illustrative 400 TFLOP/s (computed).
| Dispatch | Combine | Total | IB at 50 GB/s | Expert compute | |
|---|---|---|---|---|---|
| 1 | 7.2 KB | 14.3 KB | 21.5 KB | 0.43 µs | 1.98 µs |
| 4 (DeepSeek-V3) | 28.7 KB | 57.3 KB | 86.0 KB | 1.72 µs | 1.98 µs |
| 8 (no limit) | 57.3 KB | 114.7 KB | 172.0 KB | 3.44 µs | 1.98 µs |
A token's expert compute is 9 SwiGLU experts of three matrices: GFLOP, 1.98 µs at 400 TFLOP/s (illustrative). At its IB traffic takes 1.72 µs, so compute is 1.15 times the IB time, or 1.54 times at 300 TFLOP/s (computed), the "approximately 1:1" ratio DeepSeek reports [2]. NVLink is about 3.2 times faster and overlaps with IB, so each node serves about 3.2 experts per IB copy, and the report says the design could reach 13 experts at the same cost [2]: (computed).
Reduced NVLink drove every choice: no TP, 4 nodes per token, all-to-all kernels on 20 of the H800's 132 SMs (15%, computed), and DualPipe (Section 11.4) so that "both all-to-all and PP communication can be fully hidden during execution" [2]. Its multi-plane fat tree could reach 16,384 GPUs, but "just over two thousand GPUs were ultimately deployed" [1]. Kimi K2, a 1.04T-parameter MoE on the same GPU generation, chose otherwise: 16-way virtual-stage pipelining, EP 16 and ZeRO-1, rejecting DualPipe because it "doubles the memory required for parameters and gradients" [72]. With 64 heads against DeepSeek-V3's 128 it had less attention compute to hide an all-to-all behind, so it took "the smallest feasible EP parallelization strategy" [72]. Treat this as a contested design point.
Failure modes: imbalance becomes stragglers, dropped tokens cost quality silently, and communication kernels steal SMs. How to do it yourself: keep EP in the fastest domain, cross nodes only with a node limit, prefer EP to TP for experts [138], and budget SMs.
11.7 Composing the axes: meshes, real runs and rules of thumb
Given a model, a batch and a cluster, which degree do you give each axis and which GPUs share a group, and what did the largest published runs actually do? The rule from the opening holds: the chattiest axis gets the fattest pipe. This section turns it into degrees and groups.
Each GPU gets a coordinate on a grid with one dimension per axis. Llama 3 forms groups "in the order of [TP, CP, PP, DP], where DP stands for FSDP", so TP groups are consecutive ranks in one server and DP, which "can tolerate longer network latency", is outermost [6]. In code this grid is a DeviceMesh or a JAX Mesh (Section 11.9). With EP folded into DP and sequences per DP group, two checks follow:
Llama 3's mesh sits on 8-GPU NVLink servers, 3,072-GPU pods with full bisection bandwidth, and a 1:7 oversubscribed layer above the pods [6] (Section 2.6). A 16,384-GPU job spans 5.33 pods (computed), so only the outermost axis should cross that layer often.
Table 11.13. Llama 3 405B's published layouts, with tokens and MFU recomputed (MFU over a 989.5 TFLOP/s dense BF16 peak).
| GPUs | TP | CP | PP | DP | Sequence | Sequences per DP group | Tokens per step (computed) | Tokens per GPU (computed) | TFLOP/s per GPU | MFU reported (computed) |
|---|---|---|---|---|---|---|---|---|---|---|
| 8,192 | 8 | 1 | 16 | 64 | 8,192 | 32 | 16,777,216 | 2,048 | 430 | 43 % (43.5 %) |
| 16,384 | 8 | 1 | 16 | 128 | 8,192 | 16 | 16,777,216 | 1,024 | 400 | 41 % (40.4 %) |
| 16,384 | 8 | 16 | 16 | 8 | 131,072 | 16 | 16,777,216 | 1,024 | 380 | 38 % (38.4 %) |
Llama 3's three stages [6] each multiply to their GPU count, and the tokens per step agree (computed):
Doubling the GPUs halved the sequences per DP group, and the paper blames the drop from 43% to 41% on that "lower batch size per DP group" [6]: fewer micro-batches, a larger bubble. In Figure 61, hover a GPU to light up its server (TP row), its 16-server pipeline (PP column) and its FSDP peers in the other replicas, and switch to the 128K stage to watch CP 16 replace most of DP.
Method and sources
Hover a GPU or press Next to see its four groups and where they sit in the server, rack, pod and cluster on the right, under a contiguous rank-to-hardware mapping that we assume because the paper does not publish one. The cards and bars give each axis's traffic per GPU per step, computed from the published degrees with one sequence per micro-batch (illustrative), against about 6.2 seconds of compute at 16,384 GPUs (6N only, a lower bound). Degrees, throughput and the network are from the Llama 3 paper (Grattafiori et al. 2024), traffic formulas from Narayanan et al. (2021) and Korthikanti et al. (2022), and link rates from NVIDIA's H100 and DGX H100 specifications.A TP PP group is 128 GPUs, so each GPU holds B parameters. A step at 400 TFLOP/s and is s, a lower bound (computed). Per GPU per step, with one sequence per micro-batch (illustrative):
Table 11.14. Per-axis traffic per GPU per step, Llama 3 405B on 16,384 GPUs (computed, FSDP read as one weight all-gather and one gradient reduce-scatter per step).
| Axis | What moves | Bytes | Link | Time |
|---|---|---|---|---|
| TP 8 | four all-reduce equivalents of a 256 MiB activation per layer per micro-batch, 7.9 layers, 16 micro-batches | 237 GB | NVLink, 450 GB/s | 0.53 s |
| PP 16 | a 32 MiB activation slice and its gradient per micro-batch | 1.1 GB | NIC, 50 GB/s | 0.02 s |
| DP 128 | BF16 weight all-gather (6.29 GB) plus FP32 gradient reduce-scatter (12.58 GB) | 18.9 GB | NIC, across pods | 0.38 s |
| CP 16 (128K stage, DP 8) | about 63 MB of keys and values per layer per micro-batch, each way | 16 GB | NIC in a pod | 0.32 s |
The FSDP traffic is what meets the 1:7 layer: 0.38 s (6% of the step) at the full 50 GB/s, about s (43%) if all of it crossed at a seventh of that rate (computed), and overlap hides much of either. The CP row is for the 128K layout, whose step is about 11 s at 380 TFLOP/s, so CP is about 3% of it (computed).
Why not plain FSDP over all 16,384 GPUs? Pure data parallelism would need about 40.5M tokens per batch (16,384 times the 2,474 of Table 11.4, computed), the scaling book's "at least 40M" [138], and the quiz at the end works through why. The same book calls Llama 3's DP "128-way ZeRO-1" [138], but the paper's FSDP "shards optimizer states and gradients" and keeps weights between forward and backward [6]. Its weights stay sharded between steps but are not resharded after the forward pass, which is ZeRO-3 storage run like ZeRO-2 within a step (our reading). Prefer the primary source to the summary.
PP 16 leaves 128 GPUs per stage. Dense weights are data-parallel 128 ways, while each 64-GPU EP group holds 4 experts per GPU, replicated ways (computed). So the scaling book's "2-way ZeRO-1" [138] is right for the experts only. The batch of 15,360 sequences of 4,096 tokens [2] is 62,914,560 tokens, 30,720 per GPU (computed). DeepSeek-V3's utilization is worked out in Section 1.3: 385 TFLOP/s per GPU (38.94% causal MFU), or 343 counting only .
Table 11.15. When each axis stays compute-bound, with H100 numbers from this chapter (computed unless stated).
| Axis | Compute-bound when | H100 numbers | Section |
|---|---|---|---|
| DP, FSDP | tokens per GPU between syncs , 1.5 times with FP32 reduce-scatter | about 2,500 at peak across whole nodes, 7,900 at 40 % MFU on one 50 GB/s NIC | 11.2 |
| TP | small, whatever the batch | 0.36 for a Llama 3 70B layer at TP 8 on NVLink, 0.47 at TP 2 across NICs | 11.3 |
| PP | bubble small, traffic "basically free" [138] | 0.059 at , , (illustrative) | 11.4 |
| CP | ring block | 275 tokens on NVLink, 2,474 across nodes (Llama 3 70B) | 11.5 |
| EP | for replicated experts, all-to-all within a node limit | DeepSeek-V3 about 1:1 at 4 nodes (reported) | 11.6 |
Axes also trade: balancing FSDP's weight traffic against TP's activation traffic gives the optimal FSDP degree (the book's and count the hardware mesh axes each strategy spans) [856], 13.7 for , , and a ratio of 2 (computed, the book's 13.9).
Table 11.16. Published rules of thumb for composing axes.
| Source | Rule |
|---|---|
| Narayanan et al. 2021 | TP up to the server size, then PP across servers. Choose the model-parallel size so that "the model’s parameters and intermediate metadata fit in GPU memory", then scale with DP [41] |
| Ultra-Scale Playbook | under 10B, one technique on 8 GPUs. At 1,024+ GPUs, "tensor parallelism (TP=8) with data parallelism (ZeRO-2) and pipeline parallelism" [44] |
| How to Scale Your Model | "1-2 node TP + many node PP + pure DP" for large dense models, EP over TP for MoEs [138] |
Treat these as priors: in the Playbook's tests TP beat PP until the team optimized its PP code [44].
Real runs, and how they count
Figure 62 plots published runs: filled dots for reported MFU, hollow for numbers counting recomputation or masked attention. Reported MFU spans 28% (MegaScale-MoE at 1,440 GPUs) to 55% (MegaScale's 175B) [50, 47].
Method and sources
Filled points are model FLOPs utilization (MFU) as reported, the light point is MFU computed here, and hollow points count work the model did not need (recomputed forward passes or masked attention) or divide raw throughput by peak, so the same MT-NLG run reads 40.4% one way and 30.2% the other. The calculator divides a reported throughput by the A100 (312 TFLOP/s) or H100 (989.5 TFLOP/s) dense BF16 peak and removes the recomputed forward pass with a factor of 3/4. The second view walks MegaScale's ablation on 256 GPUs step by step from 47.7% to 65.3%, and overlapping communication on three axes supplies 6.2 of its 17.6 points. Data from Narayanan et al. (2021), Smith et al. (2022), Chowdhery et al. (2022), the BigScience Workshop (2022), Korthikanti et al. (2022), Jiang et al. (2024), Grattafiori et al. (2024), Zhao et al. (2025) and Jin et al. (2025), with peaks from NVIDIA's A100 and H100 datasheets.MFU and its conventions (6N or with attention, which peak, which time base) are defined in Section 1.3. Say which one a number uses. Megatron's 1T run reported "52% of theoretical peak" counting recomputation [41], about as MFU (computed). PaLM's 46.2% MFU is 57.8% as hardware FLOPs utilization [34], and DeepSeek-V3's 38.9% is 43.7% if attention counts the full matrix [1]. Publish tokens per second per GPU, FLOPs per token and the peak. In the figure's second view, MegaScale's ablation climbs from 47.7% to 65.3%, and overlapping TP, PP and DP communication buys 6.2 points, more than its two model changes together [47].
Some MegaScale hosts took about 10% longer for the same work. "After isolating and removing these problematic hosts from the cluster, we observed an approximate 0.7% improvement in MFU" [47]. The slowest rank sets every rank's step, so time each rank (Section 12.2). MegaScale's slow MFU decline and its cause are in Section 12.6.
Failure modes: a poor TP and PP split costs up to 2 times in throughput [41], too few sequences per DP replica inflate the bubble, and layouts drift numerically. How to do it yourself: make TP groups contiguous ranks in a server, check the degree product and tokens per step, and compare loss curves across layouts.
11.8 Training across data centers: low-communication methods
Can one model be trained across data centers, or over the internet, where bandwidth is 100 to 1,000 times lower than InfiniBand? Not synchronously. At 1 Gbit/s the break-even of Section 11.2 for an H100 at 40% MFU is M tokens per GPU per step (computed). INTELLECT-1 saw 500 Mb/s to 4 Gb/s between nodes [877], while data parallelism needs 100 to 300 Gbit/s for 1B to 100B models at 95% utilization (simulated) [878]. The levers are to synchronize less often, send fewer bits and overlap, starting from local SGD [879, 880, 881].
DiLoCo runs replicas, each taking inner AdamW steps with its own Adam state, then averages the parameter changes with one all-reduce and applies an outer Nesterov step [882]:
# DiLoCo, one outer round (after Douillard et al., 2023)
for r in range(R): # in parallel, no communication
theta_r = theta.copy()
for h in range(H):
theta_r = adamw_step(theta_r, next_batch(r))
delta[r] = theta - theta_r # outer gradient
theta = nesterov_step(theta, all_reduce_mean(delta)) # 1 sync / H steps
Table 11.17. DiLoCo against its baselines, 150M parameters on C4, 8 workers, H = 500 (measured, Douillard et al. 2023).
| Setting | Synchronizes | Perplexity |
|---|---|---|
| One worker | never | 16.23 |
| 8 times the batch, data parallel | every step | 15.30 |
| 8 times more sequential updates | never | 14.72 |
| DiLoCo, 8 workers | every 500 steps | 15.02 |
DiLoCo beats data parallelism at equal compute while "communicating 500 times less", but loses to 8 times more sequential updates, so it "reduces the FLOP and data efficiency of the model" [882]. Whether it beats synchronous training depends on what is held fixed. Scaling laws say the 4-replica loss penalty falls from 2% at 35M parameters to 0.26% at 2.4B [883], while a 2026 paper notes that the gap grows with replicas and local steps and narrows it with a merging-style aggregation, IsoLoCo [884].
A 10B model on 1T tokens ran FSDP inside 8-GPU nodes and DiLoCo across up to 14 nodes on three continents, with 100 inner steps of about 38 minutes and an int8 all-reduce [877], a reduction of times, as reported. Utilization is .
Table 11.18. INTELLECT-1 by geography (measured, Jaghouar et al. 2024), utilization recomputed from a 38-minute inner phase.
| Scenario | MFU | Median all-reduce | Utilization reported | Recomputed |
|---|---|---|---|---|
| No communication | 43.3 % | none | 100 % | 100 % |
| USA | 41.4 % | 103 s | 95.7 % | 95.7 % |
| USA and Europe | 37.1 % | 382 s | 85.6 % | 85.6 % |
| Global | 36.0 % | 469 s | 83.0 % | 82.9 % |
The abstract says 36.2% for the lowest MFU, the table 36.0%. The team re-solved the ring order to maximize its slowest link, evicted nodes after 6 seconds without a heartbeat, and resumed from a checkpoint after losing 4 of 12 nodes at once [877].
Table 11.19. Other low-communication methods (reported, abstract-level for the 2025–2026 rows).
| Method | Idea | Result |
|---|---|---|
| Streaming DiLoCo | staggered layer fragments, overlap, 4-bit outer gradients | 1B model: 1.10 TB exchanged and loss 2.66 against 441 TB and 2.67 for data parallelism, peak bandwidth 8 times lower [878] |
| DeMo | sync every step, send top- DCT components of the momentum | 7.5 MB instead of 637 MB per step at 300M, but "underperforms AdamW at equal update counts" against tuned AdamW [885] |
| 1-bit Adam | error-compensated 1-bit momentum | up to 5 times less traffic, 3.3 times higher throughput on BERT-Large [886] |
| SparseLoCo | sparse outer gradients | 97-99 % sparsity with lower loss than dense DiLoCo [887] |
| NoLoCo | no collective communication | up to 4 % better perplexity than DiLoCo [888] |
Two cautions. NoLoCo's claim that global synchronization "scales quadratically with group size" [888] holds for the pairwise traffic of naive averaging, not for a ring all-reduce, whose bytes per GPU are flat in (Section 11.1). And no frontier report in this chapter compresses gradients: Llama 3, DeepSeek-V3 and MegaScale reduce in BF16 or FP32 over fast fabrics [6, 2, 47].
11.9 Frameworks, compilers and choosing a configuration
Which software implements all of this, can a compiler choose the layout for you, and how do you pick a configuration without trying every one? Compilers derive collectives from a few sharding hints. GSPMD "always produces a valid partitioned graph regardless of what sharding annotations are provided" and reached 50–62% utilization on up to 2,048 TPU v3 cores [889]. Alpa picks pipeline stages by dynamic programming and sharding by an integer linear program, and matches Megatron-LM on GPT [890], after FlexFlow's earlier search [891]. JAX has both styles: jit shards automatically, while "With shard_map you take control" [892]. PyTorch stacks its axes "through DeviceMesh and DTensor" without a whole-program partitioner [893]. Pipelining fits automatic partitioners poorly [138], and DualPipe is the hand-written extreme (Section 11.4).
Table 11.20. Distributed training frameworks as of November 2026 (repositories change monthly).
| Framework | What it is for |
|---|---|
| Megatron-LM and Megatron Core | GPU building blocks with TP, PP, DP, EP and CP and FP16 to FP4 precision, the usual baseline [894] |
| Megatron Bridge | the packaging layer for the NeMo 26.06 training stack [895] |
| NeMo | split its repository after release 2.7.3 [896] |
| DeepSpeed | ZeRO, offload, DeepSpeed-MoE and Ulysses [897] |
| TorchTitan | PyTorch-native, "composing FSDP, tensor, pipeline, context, and expert parallelism without rewriting the model", 30 % faster than optimized baselines for Llama 3.1 405B on 512 GPUs [893, 48] |
| MaxText | pure Python and JAX for TPUs and GPUs [898] |
| Nanotron | minimal 3D parallelism, the Ultra-Scale Playbook's codebase [899, 44] |
| Levanter | JAX with named tensors, "merged into Marin as of November 2025" [900] |
| DeepEP, HAI-LLM | DeepSeek's expert-parallel communication library [876] and its in-house, unpublished trainer [2] |
Our opinion: learn on Nanotron or TorchTitan, whose code is short. Use Megatron Core for the largest NVIDIA runs, MaxText or Levanter on TPUs, and DeepSpeed's offload on one memory-starved node.
Predict before you search. Narayanan et al.'s estimate [41], checked against GPT-3's 34 days in Section 1.3, is the first filter. Llama 3 built "a memory consumption estimator and a performance-projection tool" [6]. The Playbook's brute force took over 4,100 experiments, and "Some jobs would hang indefinitely" [44]. Our toy search for Llama 3 70B on 1,024 H100s (illustrative: 4M-token batch, 18 bytes per parameter, 60% matmul efficiency) put the best TP 4 layouts at 49–52% model MFU and TP 8 at 48.8%. Gaps that small are why teams benchmark the finalists.
- Write down the model, sequence length, batch in tokens and the cluster's GPUs per node and link bandwidths.
- Fit memory: ZeRO-3 plus activations (Figure 59). If it does not fit, add TP with sequence parallelism up to the NVLink domain, then PP, then recomputation.
- Check tokens per GPU against the break-even for the link the DP group sees (Section 11.2).
- Pick and for a bubble of a few percent (Figure 60). Add CP for long sequences and EP with a node limit for MoEs.
- Order the mesh [TP, CP, PP, DP] and check the degree product.
- Predict step time and MFU, then benchmark two or three candidates. Section 15.4 works a full plan.
Why does ring all-reduce time barely change from 64 to 1,024 GPUs for a 1 GB message, but grow about 15-fold for 1 MB?
The bandwidth factor moves only from 1.97 to 2.00, while the latency term grows 16 times. At 50 GB/s, 1 GB costs about 40 ms of bandwidth time, 1 MB only 0.04 ms, while latency at an illustrative 5 µs grows from 0.63 to 10.2 ms (computed). Trees fix that, since ring latency "scales linearly with the number of GPUs" [852].
A 13B model with mixed-precision Adam on 32 GPUs: which ZeRO stage is the practical minimum in 80 GB?
At 16 bytes per parameter (BF16 weights and gradients, FP32 master weights and Adam moments), plain DP needs 208 GB. ZeRO-1 needs GB, leaving little for activations. ZeRO-2 needs GB at no extra communication. So ZeRO-2 is the practical minimum. ZeRO-3 needs 6.5 GB for 1.5 times the bytes (computed) [22].
Why does a bigger micro-batch not cut tensor parallelism's communication share?
TP's bytes and FLOPs both scale with [41], so the ratio depends only on the degree, the width and the hardware. Bigger micro-batches help the bubble and kernels. Only a faster link helps TP.
With 8 stages and 16 micro-batches, what bubble do 1F1B and interleaving with v = 4 give?
1F1B: of ideal time, 30% of the step. Interleaved: , 10% (computed). Interleaving multiplies point-to-point traffic by and needs to be a multiple of [41].
Why did Llama 3 405B not run plain FSDP over all 16,384 GPUs?
16M tokens is "about 1k tokens per GPU", below the roughly 2,500 needed to hide data-parallel traffic across nodes [138]. With TP 8 and PP 16 each replica processes 131,072 tokens, far above that, while each GPU holds 1/128 of the weights. The 6.49 TB of training state could not sit unsharded anyway (computed).
- A collective costs latency per step plus bytes over bandwidth. Ring bytes are flat in , ring latency grows with it.
- Data parallelism hides traffic above tokens per GPU, about 1,000 to 8,000 on H100s. ZeRO-1 and 2 cut memory for free, ZeRO-3 and FSDP cost 1.5 times the bytes.
- Tensor parallelism costs whatever the batch, so keep it on NVLink with sequence parallelism.
- Pipeline bubbles are . Zero-bubble schedules and DualPipe split the backward to fill them.
- Ring attention hides its traffic above a block size, all-gather CP exposes about 4–11%, and Ulysses is capped by the head count.
- Expert parallelism costs four all-to-alls per MoE layer. DeepSeek-V3 made it cross nodes with a 4-node limit, 20 SMs and DualPipe, without TP.
- Real runs nest [TP, CP, PP, DP] from fastest link to slowest. Llama 3 405B and DeepSeek-V3 reach 38–44% MFU, published runs 28–55%, comparable only after normalizing the FLOP count.
- Across data centers, synchronize less often: DiLoCo cuts traffic 100–500 times at a debated quality cost.
12. Running the run: reliability, observability and ML operations
A large run can lose progress by stopping, slowing down or continuing without learning what it should. Checkpoints and recovery protect the work already paid for; observability and reproducibility help establish that the work is still useful.
A run on 16,384 GPUs burns 16,384 GPU-hours every wall-clock hour and stops every few hours: how does it ever finish, and how do you know it is learning what you think? Standing still is expensive: the OPT-175B logbook warned that idle nodes cost $2,500 an hour [901], about $2.5 per GPU-hour on its 992 GPUs [345] (computed). It is also common. In a 54-day snapshot, Llama 3 405B pretraining was interrupted 466 times, 47 planned and 419 unexpected, one unexpected stop every 3.1 hours (computed). Yet the team reports "higher than 90% effective training time", with significant manual intervention only three times [6].
Think of the run as a long-lived distributed service whose mean time to failure falls as one over its size. The chapter follows the loop that keeps it up: failures (Sections 12.1 and 12.2), checkpoints and recovery (Sections 12.3 and 12.4), signals, playbooks and determinism (Sections 12.5 to 12.7), then goodput and operations (Sections 12.8 and 12.9).
Plan for a failure every few hours (Llama 3 405B: one unexpected stop every 3.1 hours on up to 16,384 GPUs). Make detection fast, checkpoints cheap, restarts short and every step replayable, then measure the result as goodput.
Llama 3 405B is the main example, DeepSeek-V3 (2,048 GPUs) and GPT-2 124M (one node) mark the ends of the scale axis, and OPT-175B and Gemini are case studies. The running examples and the notation are introduced in Section 0.3. See Chapter 11 for why every step needs every rank, Section 1.3 for MFU and Section 2.7 for the hardware that fails.
12.1 Why big runs stop
A single GPU almost never fails, so why does a 16,384-GPU job stop several times a day, and what actually breaks? Because synchronous training is a series system: every step needs every rank, so one GPU failure can force a restart of the entire job [6]. Gemini's report puts it this way: "Scaling up the number of accelerators results in a proportionate decrease in the mean time between failure of hardware in the overall system." [902]
Let each node fail independently as a Poisson process with failures per node-day (the failure rate, quoted per 1,000 node-days). A node survives time with probability , so all survive with probability . That is an exponential lifetime with rate , and the job's mean time to failure (MTTF) is
where the second form estimates the rate from a run log. Kokolis et al. use the same model [903]. Doubling the job halves .
What the measurements say
Over 11 months and 150 million A100 GPU-hours on Meta's research clusters, Kokolis et al. measured 6.50 failures per 1,000 node-days on RSC-1 and 2.34 on RSC-2, on jobs above 128 GPUs. MTTF was 47.7 days for 8-GPU jobs and 7.9 hours at 1,024 GPUs, and they project 1.8 hours at 16,384 GPUs and 0.23 hours at 131,072 (all reported) [903]. The projection is our formula: hours for 2,048 eight-GPU nodes (computed).
It is an order-of-magnitude guide: at 1,024 GPUs RSC-1's rate predicts hours (computed), not the measured 7.9. The authors say the model "matches well with observed MTTF numbers for larger jobs". The rate also moves, from near 2.5 to spikes around 17.5, and each new health check raises it by counting a failure mode that was already there [903]. Table 12.1 places the running examples on the curve. At 131,072 GPUs a 10-minute restart is 27–74% of the MTTF (computed, ), far outside the regime where the simple model holds.
Table 12.1. Job MTTF from at three failure rates per 1,000 node-days, 8 GPUs per node (computed).
| Run | GPUs | RSC-1 (6.50) | Llama 3 (3.79) | RSC-2 (2.34) |
|---|---|---|---|---|
| GPT-2 124M on one node | 8 | 154 days | 264 days | 427 days |
| DeepSeek-V3 | 2,048 | 14.4 h | 24.7 h | 40.1 h |
| Llama 3 405B | 16,384 | 1.80 h | 3.09 h | 5.01 h |
| A 131,072-GPU job | 131,072 | 13.5 min | 23.2 min | 37.6 min |
Run reports imply similar rates (computed): OPT-175B about 14, from at least 35 manual and an estimated 70+ automatic restarts in two months on 124 nodes [345], and BLOOM about 4.5, from one to two GPU failures a week on 48 nodes [401]. Figure 63 puts it all on log-log axes. Look for the slope of minus one, the mid-scale measurements below the RSC-1 line, and the band where MTTF is under ten restart costs.
Method and sources
Points are Kokolis et al.'s values for Meta's research clusters (47.7 days measured at 8 GPUs, 7.9 hours at 1,024, about 10 hours at 4,096 on RSC-1, and 1.8 and 0.23 hours projected at 16,384 and 131,072), MTTFs implied by public run reports (Llama 3 405B from Grattafiori et al. 2024, OPT-175B from Zhang et al. 2022 as an upper bound, BLOOM from the BigScience Workshop 2022 and a 128-GPU set from He et al. 2023) and Meta's estimate of a failure every 18 minutes at 100,000 GPUs (Salpekar et al. 2026). The gray band marks MTTF under ten times the restart cost, where restart speed dominates. The model overestimates MTTF at mid scale (28.8 hours predicted against 7.9 measured at 1,024 GPUs), and the Llama 3 point sits on the 3.79 line by construction, so read the lines as an order-of-magnitude guide.What breaks
Llama 3's Table 5 is the only public per-component log of a frontier run. By its counts, GPU problems (faulty GPUs, HBM3 and SRAM memory, the GPU system processor, silent corruption, thermal sensors) cause 268 of the 419 unexpected interruptions, software and dependencies 56 and the network 35 (computed from [6]). In Figure 64, note how far faulty GPUs and HBM3 stand out. Then switch to ByteRobust's platform table over 778,135 jobs, led by CUDA errors, CPU overload and memory, hangs and manual restarts [904]. These are fleet incidents, not one job's interruptions. Llama 3's response was faster startup and checkpoints plus diagnosis tools [6], the subjects of Section 12.3, Section 12.4 and Section 12.6.
Method and sources
GPU components account for 268 of 419 by count (64.0%), while the paper's text gives 58.7%, the sum of its printed shares, because the printed share for faulty GPUs (30.1%) disagrees with its count (148 of 419, 35.3%). Bar lengths therefore use counts, and every share is recomputed from them (computed). The second view shows the three-month incident table of Wan et al. (2025) across 778,135 training jobs on the ByteRobust platform, where CUDA errors, CPU overload and out-of-memory errors, job hangs and manual restarts for code or data changes dominate. Those are platform-wide incidents, not interruptions of one run, so the two views share a layout but not a scale.Over 54 days, 419 unexpected interruptions are one every hours, and all 466 one every 2.78 hours (computed). ByteRobust quotes 2.78 hours as a hardware failure interval [904], but it includes planned and software causes. If all 2,048 nodes ran throughout (an assumption, the paper says "up to 16K GPUs"), the rate is interruptions per 1,000 node-days, between RSC-2 and RSC-1, or 3.22 for the 356 hardware events alone (computed).
Per GPU the picture flips. Faulty GPUs plus HBM3 are 220 events in GPU-days, one per about 4,000 GPU-days, and the 6 silent corruptions are one per 147,456 GPU-days, one every 9 days for the job (computed). A GPU that fails once a decade still stops a 16,384-GPU job every few hours.
The 18 counts sum to exactly 419, and every printed share equals its count over 419 except one: faulty GPUs are 148 but printed as 30.1%, while 148 of 419 is 35.3% (computed). The text's 58.7% GPU share matches the printed shares, whereas counts give 268 of 419, or 64.0%. Hardware is about 78% in the text and 85.0% by counts (computed) [6]. We draw bars from the counts and call GPU issues about 59–64%.
Few jobs, most of the lost time
Failures concentrate in big jobs. At Meta they hit 0.2% of jobs but 18.7% of runtime [903]. On Shanghai AI Lab's clusters, infrastructure failures were 11% of failed jobs but over 82% of failed GPU time [905]. MegaScale restarted over 100 times in several weeks on over 10,000 GPUs, recovering over 90% of exceptions automatically [47]. Bad nodes repeat: detecting them cut failures of 512-plus-GPU jobs from 14% to 4% [903].
In practice, estimate from your cluster's history and compute for your job. If is under about ten times your restart cost, invest in restart speed first (a rule of thumb). The model breaks down under correlated failures, infant mortality and changing health checks. Earlier HPC studies [906, 907] and recent GPU-fleet studies [908, 909] give background.
Llama 3 405B had 419 unexpected interruptions in 54 days on 2,048 eight-GPU nodes. What MTTF should a 2,048-GPU job like DeepSeek-V3's expect at the same rate?
The rate is per 1,000 node-days (computed). MTTF scales as one over the node count. With 8 times fewer nodes it is hours, about a failure a day (computed). Treat it as an order of magnitude, since measured mid-scale MTTFs run lower.
12.2 Failures that do not crash: silent data corruption and stragglers
What if a GPU computes a wrong answer without reporting an error, or keeps working but slowly? Neither crashes the job, so neither trips the restart loop of Section 12.4.
Silent data corruption
Silent data corruption (SDC) is hardware returning a wrong result with no error signal, so it is "not traceable at the hardware level" [910]. In one of Meta's cases a power function "would always produce a result of 0 on core 59 of the CPU" for one input [910]. Google sees "a few mercurial cores per several thousand machines" [911], and test escapes run at least ten times above industrial targets [912].
Llama 3 saw one every 9 days (computed above). Gemini's team expected SDC "to impact training every week or two" [902]. For Gemini 2.5, around 0.25% of steps were replayed for suspected SDC and 6% of those were genuine [913], so of steps were corrupted (computed).
SDC barely shows. Comparing unhealthy and healthy nodes under deterministic execution, Ma et al. found the gradient noise is "small relative to the true gradient norm", yet parameters drift from ground-truth weights, and SDC "can silently occur without any clear indication from training loss" [914]. On DeepSeek's Fire-Flyer cluster, errors that ECC missed caused gradient-norm spikes, loss explosions and non-convergence [915]. Detection is a ladder, cheapest first:
- Fleet scans. Meta's Ripple catches 70% of covered errors within 15 days [916], and Fire-Flyer validates nodes weekly [915].
- Training signals. Watching for abrupt changes in gradients or activations is the common guard [903], but Ma et al. found SDC that perturbed gradients with no clear sign in the loss [914].
- Deterministic replay. Gemini 2.5 repeats "any step with suspicious metrics" and compares per-device checksums [913]. After unexplained NaNs, ByteRobust runs one step on fixed input everywhere and removes machines whose outputs differ bit for bit [904].
- Checksummed matrix multiplies missed most of Ma et al.'s unhealthy nodes [914], so as of November 2026 treat them as unproven [917, 918].
Severity is contested: such events "rarely warrant user complaints" on a research cluster [903], but Gemini expects one every week or two. It grows with job size and with whether anyone looks. Keep a bitwise-deterministic configuration (Section 12.7) and a golden run for suspect nodes, and replay a suspicious step on other hardware before rolling back blindly.
Stragglers
A straggler (or fail-slow) is a rank that keeps working, but slowly. A synchronous step ends when its slowest rank does, so "Even a single straggler can slow down thousands of other GPUs" [6]. Llama 3's team found culprits by ranking suspicious communications [6]. Even pure noise costs time. If ranks have independent step times with mean and standard deviation , extreme-value theory gives
which overestimates at every : by about 40% of the excess at 8 ranks and about 10% at 16,384 (computed).
Take a 1 s step with 10 ms of independent jitter per rank (illustrative). Simulation gives 1.014 s at 8 ranks, 1.031 s at 512 and 1.040 s at 16,384 (computed), against s from the formula. Noise no single node shows costs 4%, and a persistently slow rank costs its full slowdown. So synchronize the noise, for example by running garbage collection on all ranks at the same step (12.6% faster on one job [919]), and remove outliers found by per-rank timing (Section 12.5).
On a shared cluster, FALCON found communication fail-slows more frequent and persistent: 43 of 107 sampled jobs saw slow communication against 6 of 392 with slow computation, and fail-slows delayed average job completion by 1.34x [920]. On a dedicated cluster, Lin et al. found 42.5% of jobs at least 10% slower and 10.4% of GPU-hours wasted, mostly from computation: unbalanced pipeline stages, unequal sequence lengths and garbage-collection pauses [919]. The populations differ, so check the training program first, then the hardware.
Hardware stragglers exist too. Removing MegaScale's 0.5% of slow machines gained about 0.7% MFU [47]. Hot GPUs clock down and drag their neighbors [921]: in one node Guard measured 1.93 GHz at 50 °C and 1.38 GHz at 77 °C [922], a 28% drop (computed). Redundancy can hide such slowness as gray failure [923].
12.3 Checkpoints: what to save, how to save it, how often
With a failure every three hours, what must a checkpoint contain, how do you write terabytes without stopping 16,384 GPUs, and how often should you do it? Each checkpoint stalls training briefly, and each failure throws away the work since the last one. A short derivation finds the balance, and shows that once checkpoints are fast, the restart path matters more.
What goes in, and how big it is
A restartable checkpoint holds GPU state, meaning the parameters, the FP32 master weights and Adam's two moments, and CPU state: the data loader's position, the random-number-generator states, the step counter and the learning-rate scheduler [924]. Leave a piece out and the resumed run repeats data or resumes at the wrong learning rate. In FP16 training the loss-scaler state matters too: OPT-175B's logbook records a resumed run that diverged after its unsaved loss-scale state was reset [901]. Size follows from bytes per parameter, with BF16 weights (2 B), FP32 master weights (4 B) and two FP32 moments (4 B each):
Gradients are recomputed after a restart and need not be saved, so 16 B, which adds them, is an upper bound (Section 1.4). The BF16 copy can be recast from the FP32 master weights, so 12 B is the minimum and 14 B includes the copy (computed). DeepSeek-V3 keeps its moments in BF16 [2], so its minimum is 4 + 2 + 2 = 8 B per parameter, or 10 B with the BF16 copy (computed). Table 12.2 gives the sizes. Spread over 16,384 GPUs, Llama 3 405B's 5.7 TB checkpoint is about 347 MB per GPU, or 396 MB at the 16 B upper bound of 6.5 TB (computed). Llama 3's storage sustains 2 TB/s with 7 TB/s peaks, and its authors name "the highly bursty checkpoint writes that saturate the storage fabric for short durations" as a major challenge [6].
Table 12.2. Checkpoint size of the running examples (computed from the parameter counts in Section 0.3, GB = 109 bytes, TB = 1012 bytes).
| Model | Parameters | BF16 weights only | 14 B per parameter | 16 B per parameter |
|---|---|---|---|---|
| GPT-2 small | 124.4M | 0.25 GB | 1.7 GB | 2.0 GB |
| Llama 3 8B | 8.03B | 16 GB | 0.11 TB | 0.13 TB |
| Llama 3 70B | 70.6B | 0.14 TB | 0.99 TB | 1.13 TB |
| Llama 3 405B | 405.9B | 0.81 TB | 5.68 TB | 6.49 TB |
| DeepSeek-V3 (BF16 moments) | 671B | 1.34 TB | 6.71 TB with the BF16 copy (10 B), 5.37 TB without (8 B) | |
PyTorch Distributed Checkpoint writes at least one file per rank and reshards at load time, since checkpoints are often loaded on a new layout [925]. Loading is often the slow half, so MegaScale and Orbax read each shard once and broadcast it [47, 926].
The design choice that matters most is how long training stops (Table 12.3). With an asynchronous checkpoint, the blocking cost is only the copy to host memory, and the background write sets a floor on the interval. Gemini's in-memory replicas raised the largest job's goodput from 85% to 97% [902], cutting lost time by a factor of 5 (computed).
Table 12.3. Checkpoint tiers, from slowest to fastest recovery (all values reported).
| Tier | What blocks training | Reported example |
|---|---|---|
| Synchronous write to remote storage | serialize and write everything | GPT 175B on 4,096 GPUs to HDFS: 200 s [924]. PyTorch 1.13 era: up to 30 min for an 11B model [927] |
| Asynchronous, two phase (snapshot, then persist) | copy GPU state to pinned host memory | MegaScale: several seconds [47]. DCP async_save on a 7B model: 148.8 s to 6.3 s [927, 925]. Fire-Flyer every 5 min [915]. ByteRobust every step at under 0.9% overhead [904]. Idea from CheckFreq [928] |
| In-memory replicas | almost nothing, recovery copies from a healthy peer | Gemini: goodput of the largest job from 85% to 97% [902]. ByteRobust backs up across parallel groups to CPU memory and local disk [904]. Related: GEMINI, Just-In-Time Checkpointing [929, 930] |
How often: Young's interval, derived
Let be the blocking cost of one checkpoint, the compute between checkpoints, the job's mean time to failure (MTTF, Section 12.1) and the restart cost per failure. Assume Poisson failures, independent of checkpoint times, and . Checkpoints waste . A failure lands uniformly inside an interval, so it loses of work plus , at rate :
Setting gives Young's first-order interval [931], which Kokolis et al. restate in node terms [903]:
ETTR, the effective training time ratio, is productive time over wall-clock time. At the optimum, checkpoint time equals expected rework. Doubling the job halves , which shortens by a factor but doubles (computed): restart cost scales worse than checkpoint cost.
For an exact model, let failures strike during checkpoints and restarts too, with a failed restart starting over. A standard renewal argument gives the expected wall time per unit of useful work :
Minimized numerically, its optimum is a little shorter than Young's: for a 300-second checkpoint and a 3.09-hour MTTF, about 2,390 s instead of 2,580 s (computed). Daly derived a higher-order closed-form estimate of this optimum [932].
Take the 6.5 TB upper bound, written at 2 TB/s, so each checkpoint blocks training for s, and a job MTTF of 3 hours (illustrative inputs, with the bandwidth taken from Llama 3's storage fabric [6]). Young's first-order rule [931] gives s, and checkpoint stalls plus rework then waste 2.45% of the time (computed). Add a 10-minute restart per failure (illustrative) and the restart term alone costs , so the first-order ETTR is 0.920. The exact exponential model gives 0.923 at its own optimum of 262.8 s (computed). Halving buys 2.8 points, halving only 0.7 (computed, first order).
Figure 65 turns this into a calculator. Notice that the waste curve is flat near its floor, so a factor of two in costs little, and that once is a few seconds the restart band dominates whatever interval you pick.
Method and sources
The dashed line marks Young's (1974) first-order optimum τ* = √(2δM), where stalls equal rework, and the dotted line marks the exact-model optimum found by numerical search, after Daly (2006). The job MTTF follows M = 1/(n_nodes r_f) for independent node failures, first-order ETTR is defined as 1 minus the first-order waste, and the readouts give the ETTR gained by halving the blocking time, the restart cost or the failure rate. The calculator opens on the 6.5 TB, 2 TB/s, 3-hour question with a 10-minute restart (preset b) at the first of five steps. Other presets reproduce Llama 3 405B's failure rate and storage bandwidth (Grattafiori et al. 2024), the 12,000-GPU analysis of Kokolis et al. (2024), the production intervals of Kang et al. (2026) and the 100,000-GPU estimate of Salpekar et al. (2026). Restart costs and some blocking times are illustrative, as labeled.Block 5 minutes per checkpoint at Llama 3's 3.09-hour MTTF: s (43 min), and checkpoints plus rework waste 23%. With a 10-minute restart ETTR falls to about 0.71 first order, 0.74 exact, against about 0.92 with a 3-second stall (computed). That gap is why large teams went asynchronous.
Kokolis et al. give an expected ETTR for long jobs that wait little in the queue. Their , and are our , and , and :
valid when . They conclude that a job using about 12,000 GPUs, two thirds of RSC-1, reaches an ETTR of 0.9 only if checkpoint writes take on the order of 10 seconds or the failure rate falls from 6.50 to about 1 per 1,000 node-days [903]. Their formula with 5-minute restarts, at Young's interval, reproduces this: 0.740 with 5-minute writes, 0.921 with 10-second writes and 0.898 at a failure rate of 1 (computed).
BLOOM saved every three hours with 1–2 GPU failures a week [401]. If that was Young-optimal at a 112-hour MTTF, minutes (computed). Keep several checkpoints, since a divergence forces a rollback: OPT restarted from points where its loss scale was still at least 1 [345]. And save on the SIGTERM that precedes a preemption [933].
Kang et al. (2026) estimated a mean time between failures of 56.2 h and save costs of 18–31.7 s. Their 4K-sequence phase checkpointed every 133.5 min against a 44.9-min optimum, a cost of 2.20%. Shortening to 81.5 min in the 100K phase brought it to 1.82%, within 0.10 points of the 1.72% minimum [934]. The first-order formula reproduces each value, for example (computed). Restart loading, outside their cost, averaged 33 minutes (reported).
The formula breaks when failures correlate with checkpoints, when the failure rate drifts, or when is not small against . To do it yourself, measure blocking and persist times separately, compute , round to whole steps no shorter than the persist time, and test restores with the overlap test of Section 12.6.
With a 10-minute restart, a 5-second checkpoint stall and a 3-hour MTTF, is it worth more to halve the stall or the restart?
At the optimum, checkpoint waste is , and halving the stall saves about 0.9 points. The restart term is , and halving it saves 2.8 (computed). Fix the restart: waste grows as the square root of the stall but linearly in .
12.4 Getting back up: health checks, remediation and spares
A rank stops responding at 3 a.m.: what brings the job back, how long does it take, and how do you keep bad nodes out of the next launch? An automated loop brings it back: detect, localize, isolate, recover. It starts before launch, because a big job is likely to draw a bad node. If a fraction of nodes is unhealthy and a job draws ,
which at is 1.6% for 16 nodes and 87% for Llama 3's 2,048 (computed). "One bad node spoils the bunch." [903]
The health-check ladder
In Imbue's bring-up of 4,088 H100s, about 10% of machines failed to boot, a quarter needed PCIe cables reseated, and after burn-in about 3% still break each week (reported) [935]. Table 12.4 lists the checks that follow. Meta tunes its periodic checks so that under 1% of successful jobs see a failure [903].
Table 12.4. The health-check ladder (all durations and thresholds reported).
| Check | When it runs | Cost | Catches |
|---|---|---|---|
| Link bandwidth and multinode stall tests (Imbue) [935] | new or suspect nodes | about 15 min for link tests, 12-24 h for the stall test | flapping InfiniBand links, NIC and PCIe bandwidth, NCCL stalls |
| DCGM level 1 [936] | before every job | under 2.5 s | driver and CUDA access, page retirements |
| DCGM level 2 [936] | after a job fails | under 10.5 min on 8-GPU Hopper systems | adds PCIe, NVLink, memory and memory-bandwidth checks |
| DCGM levels 3 and 4 [936] | post-mortem, node in repair | under 35 min and under 2.25 h | adds stress, power, NCCL and memory tests |
| nccl-tests bus bandwidth [143, 901] | before launch, after replacing nodes | a short collective run | slow links. OPT flagged a node at 150 against a threshold of 180 |
| Loopback and neighbor NCCL tests [47] | MegaScale self-check after a fault | lightweight | PCIe misconfiguration, NIC bandwidth, routing |
| Small matrix multiply [7] | before each workload (Ai2 Beaker) | one multiply | GPUs that fail to compute, host cordoned |
| Periodic node checks [903] | every 5 min (Meta) | seconds | Xid errors, mounts, services. High-severity faults such as NVLink or uncorrectable ECC errors drain the node at once |
| Inspection threads [904] | second-level intervals during training (ByteRobust) | no GPU load | NIC and switch faults, PCIe bandwidth, row remapping, temperature, Xid |
| Full validator [915] | weekly (Fire-Flyer) | not stated | memory, full-memory GEMM, all-reduce, storage bandwidth |
These checks miss gray nodes, which pass every hard-failure test but run slow. Guard compares nodes with their peers and reports step variance cut from 20% to 1% [922]. SuperBench learns pass criteria from benchmark distributions and reports up to 22.61x longer mean time between incidents [923]. Both are single-system reports. Exclusion has a cost too, since aggressive exclusion can starve a cluster of capacity [903].
The remediation loop
Detect. MegaScale watches RDMA traffic, which repeats every step, and starts recovery when it stops [47]. ByteRobust treats a 5x jump in loss or gradient norm, or a NaN, as a fault [904]. The slowest detector is the collective timeout, the watchdog that aborts a collective that never completes: production runs have used 30 or 60 minutes [937, 904] against PyTorch's current NCCL default of 10 minutes [938].
Localize. Flight recorders find the rank that never joined (Section 12.6). Failing that, group testing works: Imbue reran a failing 48-machine job as six groups of eight, then eight groups of six [935]. Binary search over 2,048 nodes would take 11 launches (computed).
Isolate. "ByteRobust favors rapid fault isolation over exhaustive localization." [904] It evicts a whole suspect parallel group rather than hunt for one GPU while thousands idle, but tolerates two network alerts within 5 minutes, since link flaps often clear [904].
Recover. MegaScale detects and diagnoses in under 10 minutes and regains the pre-crash step within 15 [47]. Without such a loop, Unicron's plain restart took about 68 minutes [937]. Table 12.5 shows where restart time goes.
Table 12.5. Where restart time goes (all values reported).
| Component | Value | Source |
|---|---|---|
| Megatron-LM initialization, default | about 1,047 s on 2,048 GPUs | [47] |
| after replacing the TCP store with Redis | 361 s | [47] |
| after reordering barriers | under 5 s on 2,048 GPUs, under 30 s on 10,000+ | [47] |
| NCCL initialization (Meta's customized NCCL) | 17 s at 16K GPUs to about 200 s at 98K | [939] |
| First step after a restart | several minutes, against about 20 s for a normal step | [939] |
| Checkpoint loading | reached only 21.5% of the 700 GB/s storage read bandwidth, averaging 33 min | [934] |
| Container image pull with preloading | about 29x faster for a 16 GB image | [933] |
| Process-group startup at Meta | from sometimes hours to minutes | [145] |
Hot spares
A hot spare is a validated idle node kept ready. BLOOM kept 4 for 48 working nodes [401], OPT 18 for 124 [901] and Imbue 10–20% [935]. ByteRobust sizes its warm standby pool at the 99th percentile of a binomial model of simultaneous failures [904].
At Llama 3's 3.79 failures per 1,000 node-days, 2,048 nodes lose 7.8 per day. ByteRobust's rule gives 15 spares (0.7%) if failed nodes return within a day. But nodes stay out until repaired, and the number out at once is roughly Poisson:
which is 35 for 3-day repairs (1.7%), 72 for 7 days (3.5%) and 134 for 14 days (6.5%) (computed). Imbue's 3% a week is 4.3 per 1,000 node-days, close to Llama 3's rate, so its 10–20% buffer most likely reflects slow repairs and easy relaunches rather than more faults (our inference).
Beyond stop-the-world restart
The default launcher restarts everyone: "On failures or membership changes ALL surviving workers are killed immediately." [940] That works at Llama 3's scale.
Meta estimates that a 100,000-GPU job fails every 18 minutes and that synchronous recovery takes up to 10 minutes, which leaves 8 of every 18 minutes for training, an effective training time of 44% [939]. Scaling Kokolis et al.'s 1.8-hour projection at 16,384 GPUs gives 17.7 minutes (computed from [903]). Meta's fault-tolerant HSDP (FT-HSDP) takes only the failed data-parallel replica offline and cuts the full stall to 3 minutes. With replicas, a stall and minutes on 11 replicas,
the reported 80%. Gemini 2.5 reconfigures elastic slices in tens of seconds and trains at about 97% throughput while a slice recovers (reported) [913].
torchft recovers a replica by copying weights from a healthy peer, with no checkpoint load [941]. In RL post-training, RobustRL restarts only the failed role (Section 9.8) [942]. As of November 2026, public large dense runs still mostly evict and restart with spares. FT-HSDP's authors report no significant quality impact, from experiments on 256 GPUs [939]. As of November 2026 no public frontier run has confirmed it.
A 1,024-GPU job hit a node failure and was requeued 35 times, causing 548 preemptions of over 7,000 GPUs of other work. Such second-order preemptions caused 16% of the goodput RSC-1 lost to hardware failures [903]. Automatic requeue needs a health gate and a retry budget.
12.5 What to watch: signals, alerts and logbooks
Which signals tell you, within minutes, that something is wrong, and what kind of wrong? A crash is easy to notice. A drift is not, because a misconfigured network usually still trains: "Most of the time it will train but silently work a bit worse." [943] So log quantities whose healthy shape you know (Table 12.6) and alert when the shape breaks. Why loss spikes happen is explained in Section 5.5. This section is about seeing them.
Table 12.6. What to log, its healthy shape and a published or derived alert rule.
| Signal | Healthy shape | Alert rule | Source |
|---|---|---|---|
| Training loss, total and per data domain | noisy, trending down, recovers from small bumps within tens of steps | spike score, 5x jump, any NaN, one domain jumping alone | [7, 904] |
| Loss at step 0 | about | far from | [943] |
| Global gradient norm, unclipped | small, slowly varying, no upward drift | spike score, 5x jump, slow growth, over 50% of steps clipped | [7, 393, 395] |
| Per-layer gradient norm and gradient RMS | layers in a narrow band, RMS well above AdamW's | one layer far above the rest, RMS within about 10x of (derived) | [395, 270] |
| Second-moment staleness | near 1 | far above 1 in early layers | [396] |
| Update-to-weight ratio per parameter group | stable, groups similar | order-of-magnitude change or one group far from the others | [342] |
| Activation norms, maximum attention logit, attention entropy | flat or slowly varying | upward steps, logits above about 100, entropy falling toward 0 | [345, 72, 277] |
| Loss scale (FP16 only), NaN and skipped steps | scale at least 1, zero skips | scale below 1 for long, any NaN | [901, 51] |
| MoE expert load (MaxVio) | small | rising, experts with near-zero load | [313, 2] |
| Learning rate and tokens seen | matches the offline schedule exactly | any deviation, for example a jump after a resume | [943] |
| Throughput, MFU and per-rank step time | flat within the daily swing, ranks within a few percent | sustained drop above the swing, one rank about 10% slower | [6, 47] |
| Temperature, ECC, Xid events, RDMA traffic, log freshness | stable, no uncorrectable errors, traffic repeating every step, log updated every step | any uncorrectable error, zero traffic for 10 min, log stale for 15 min | [944, 904, 901] |
Loss, gradient norm and the rules that fire on them
Watch the gradient norm first. In OLMo 2 large gradient-norm spikes often preceded loss spikes [7], and in GLM-130B collapse lagged a gradient-norm spike by a few steps [395]. The norm reacts to the batch at once, while Adam's per-coordinate step stays near the learning rate, so the weights need several steps to reach the region where the loss jumps.
OLMo 2's spike score is the percentage of points at least seven standard deviations from a rolling mean of the last 1,000 values. A change of initialization moved the gradient norm's score from 0.40 to 0.03 [7]. ByteRobust fires on a 5x jump [904]. The Deep Learning Tuning Playbook logs the unclipped norm, clips at its 90th percentile and calls clipping over half of updates aggressive [393]. Such a threshold clips 10% of a steady series by construction, so a clipped fraction drifting toward 50% means the gradient scale moved (derived). Seven sigma is a relative measure. For Gaussian noise
so a Gaussian run would score 0, while heavy-tailed Student-t noise with 3 degrees of freedom and no true spikes scores about 0.11% (computed). Compare scores between runs. No public study gives these rules' precision and recall.
Figure 66 lets you inject a fault and see which rule fires first. Look at the order: in a spike the gradient norm moves a few steps before the loss, a hang trips liveness rules within minutes while a 30-minute collective timeout waits, and silent data corruption (Section 12.2) leaves every panel flat until a replay comparison drifts. The BLOOM preset replays values from the real 176B training log [945].
Method and sources
Red ticks mark where each alert rule fires, and the table under the panels gives the step, the minutes after injection and the GPU-hours spent before each alert for the chosen job size. The series are illustrative simulations at Llama 3 405B's step time of about 6.2 seconds (computed from Grattafiori et al. 2024 with 6N FLOPs per token), with fault shapes taken from the cited reports: the gradient norm leading the loss (Team OLMo 2024, Zeng et al. 2022), hosts about 10% slower and garbage-collection slowdowns (Jiang et al. 2024) and corruption that the loss does not show (Ma et al. 2025). The alert thresholds are published ones: a 7-sigma rule adapted from OLMo 2's spike score, ByteRobust's 5x, NaN and zero-traffic rules (Wan et al. 2025), OPT's 15-minute log-staleness monitor (Meta AI 2022) and a 30-minute collective timeout (He et al. 2023, Wan et al. 2025), against a current PyTorch default of 10 minutes. The step-time rule and the 200-step replay cadence are illustrative, and the replay is triggered by suspicious metrics in Gemini 2.5 (Comanici et al. 2025). The BLOOM preset plots the real 176B training log (Bekman 2022), where the 5x rule fires three iterations before the loss peaks.A correctly initialized model predicts a near-uniform distribution, so [943]: 11.76 nats for Llama 3's 128,256 tokens, 10.82 for GPT-2's 50,257 and 11.77 for DeepSeek-V3's 129,280 (computed). Far above means confidently wrong logits, usually the output layer's scale. Far below means the model can see the answer, often an off-by-one in the label shift.
Inside the optimizer and the numerics
Adam's update per unit learning rate lies between a pure-noise limit and a consistent-gradient limit (derived for ):
For Llama 3 405B at and an illustrative weight RMS of , the update-to-weight ratio is to (computed). Watch for change, not the value. Molybog et al. tie divergence to large updates uncorrelated with descent [342], which here is a layer drifting toward the upper limit. Wortsman et al. found spikes 1–8 steps after squared gradients outgrow Adam's second moment [396]. After a jump by a factor , the staleness is
which for stays above 2 for 6, 28 and 278 steps at , 0.99 and 0.999 (computed).
For numerics, OPT saw divergence coincide with its loss scale crashing and final-layer activation norms spiking [345]. In a mid-scale 53B-parameter MoE trained with plain Muon, the Kimi team saw maximum attention logits exceed 1,000. Kimi K2, trained with logits clipped at 100 (QK-Clip), reports 15.5T tokens without a loss spike [72]. A kernel that skips the row-maximum subtraction overflows above 11.09 in FP16 and 88.72 in BF16 (computed).
Performance, hardware and liveness
With 6N FLOPs per token and 400 TFLOP/s per GPU [6],
So 1% is 62 ms per step, and the reported 1–2% diurnal swing is 62–125 ms (computed). A throughput alert must sit above that swing, for example a sustained 2% excess over the time-of-day baseline (illustrative), or look for per-rank outliers.
Know your MFU formula: llm.c's 49.0% for GPT-2 counts attention FLOPs and is 42.5% with 6N alone (computed from [15], conventions in Section 1.3). Hardware speaks through Xid events (Table 12.7), and ECC errors lay behind 38.9% of faults in Minder's data [946].
Table 12.7. Xid events worth an alert, from NVIDIA's Xid catalog [944].
| Xid | Meaning |
|---|---|
| 48 | uncorrectable ECC error detected on the GPU, needs a GPU reset or reboot |
| 74 | NVLink error. Can be sympathetic: when one GPU fails, a GPU linked to it may report Xid 74 only because the link went down |
| 79 | the driver finds the GPU inaccessible over PCIe (the GPU has dropped off the bus) |
| 94, 95 | contained and uncontained memory errors, on GPUs that support error containment |
| 119, 120 | errors in code running on the GPU System Processor (GSP), such as timeouts |
| 154 | summarizes the recovery action that other Xids require |
Logging has costs. Printing a GPU scalar forces a synchronization, so OLMo 2 logs every 10 or 50 steps and does bookkeeping on a separate Gloo group [7]. Monitors fail too: at Acme many connection errors came from auxiliary metric and logging services [905]. And no single signal suffices [946, 934], so alert on several, in tiers (our synthesis of OPT, MegaScale and ByteRobust practice): page at once for no progress (a stale log, zero RDMA traffic, a missing heartbeat), a NaN loss or a crash [901, 47, 904], page in working hours for a spike, a sustained throughput drop or a loss scale pinned low, and file a ticket for slow drifts such as gradient-norm growth or rising correctable ECC on one node.
OPT-175B's two months on 992 A100s cycled over 100 hosts [345]. Its logbook [901] existed "To provide a source of truth of what we did, when, and why". On-call engineers watched TensorBoard, and a monitor fired when the log went 900 s without change, once falsely because it watched the wrong file. The team judged that "As expensive as it is, an extra idle hour is still cheaper than having to redo multiple days." Local timestamps once "made it look like the job was stuck for 5 hours at first glance." Log in UTC, and record who acted, the symptom, the action and the checkpoint resumed from.
12.6 Debugging playbooks: spikes, NaNs, resumes, hangs and slowdowns
The loss spiked, a NaN appeared, a resumed run drifted, or the job hung: what do you do, and in what order? Save the evidence before you touch anything, find the smallest thing that reproduces the problem, and change one thing at a time.
Loss spikes
Acme counts a spike only if a falling loss jumps and "does not recover over a certain period" [905]. For one that does not recover, read the leading signals (Section 12.5), keep the checkpoints on either side and inspect the batches: OLMo 2 found long repeated n-grams often behind spikes, "though we note that this relationship is not deterministic" [7]. Then rewind to a healthy checkpoint and skip the next batches [905]. PaLM's restart-and-skip fix is told in Section 5.5. If spikes recur, change the recipe, lowering the learning rate last [393].
The cause is contested: data, data combined with the parameter state, Adam's dynamics [342, 396], growing attention logits [278] or silent data corruption [914]. The views fit together: data triggers, optimizer and architecture set the sensitivity, hardware is a wildcard. Recent frontier runs self-report few spikes or none [6, 2, 72], so as of November 2026 spikes look like a recipe problem more than a scale problem.
NaNs, drifting resumes and parity
Table 12.8 covers the other numerical symptoms.
Table 12.8. Playbooks for NaNs, drift and data-loader bugs.
| Symptom | Moves, in order | Evidence |
|---|---|---|
| NaN or Inf | Skip non-finite updates and alert. Rerun the step with the same batch, and bisect the batch if it reproduces. Find the birthplace with finiteness hooks, then detect_anomaly(check_nan=True), which is slow. If it does not reproduce elsewhere, suspect the machine | NaNs come from data, code bugs or hardware corruption [904]. Anomaly mode is for debugging only [947]. Gemini replays suspicious steps and compares per-device checksums [913] |
| Resumed run drifts | Check that every piece of state was saved and restored, and that data order depends only on the step | OPT's unsaved loss-scale state [901]. PaLM's batches are a function of the step number [34] |
| Layouts or precisions disagree | Compare loss and gradients across layouts against measured noise | Llama 3 fixed numerical issues this way and moved accumulation and reduce-scatter to FP32 [6]. DeepSeek-V3 accepted FP8 at under 0.25% relative loss error [2]. A BLOOM tensor-parallel clipping bug "went undetected for 10 days", and TrainCheck caught 18 of 20 such silent errors in one iteration [948] |
| Data-loader bug | Visualize data just before the model, overfit one tiny batch, seed every worker, compare tokens seen with the step count, watch for starvation | [943, 949, 950]. Imbue's deterministic loader made giant-document crashes reproducible by step [935] |
A fused z-loss kernel and a plain PyTorch z-loss "produce the same result in the forward pass, but exhibit different behavior in the backward pass" [7], so the two z-loss curves drifted apart, although the paper reports no effect on cross-entropy loss or downstream scores. Out of caution the team abandoned the fork, re-trained from the divergence point, and now avoids switching implementations during a run [7]. Compare gradients, not only forward outputs.
The test for a clean resume is a deliberate overlap. PaLM guarantees that a restart from checkpoint 15,000 reproduces steps up to 17,000 exactly [34], and ByteRobust rolls back a few steps after manual restarts to check bitwise alignment [904]. Without bitwise determinism, compare against noise measured once (Section 12.7). Rerun a small FP32 parity test on every framework or kernel upgrade.
Hangs
A hung job logs nothing until a collective timeout fires (Section 12.4), and implicit hangs were 9.9% of incidents across ByteRobust's platform [904].
Every GPU idles until detection, so
At 16,384 GPUs a 60-minute timeout costs 16,384 GPU-hours, a 30-minute one 8,192 and a 10-minute one 2,731 (computed). Minder alerts only after a machine looks abnormal for four minutes and is called every few minutes [946], so 4 to 12 minutes, or 1,092 to 3,277 GPU-hours (computed). Restart and rework come on top.
A timeout fires on a rank that sees a collective not complete in time [903], so the healthy ranks waiting on a stuck peer are the ones that log. MegaScale's faulty nodes hung and logged nothing [47]. Look for the rank that never joined: compare flight-recorder sequence numbers, or find the odd stack out.
Figure 67 walks a 32-rank toy job through one stalled GPU. Watch 31 ranks log timeouts while the faulty one stays silent, then find it by its lagging sequence number and odd stack.
Method and sources
Click any GPU to move the fault. The bars convert detection delay into idle GPU-hours at Llama 3 405B's 16,384 GPUs as 16,384 times the minutes from fault to alert, divided by 60, and count neither restart time nor rework. Timeout settings follow the PyTorch documentation (10 minutes by default) and ByteRobust (Wan et al. 2025, 30 or 60 minutes in production). The mechanisms follow PyTorch's Flight Recorder tutorial, MegaScale (Jiang et al. 2024), Kokolis et al. (2024), Minder (Deng et al. 2024), Salpekar et al. (2026) and Llama 3 (Grattafiori et al. 2024). Rank states, sequence numbers and stack strings are illustrative.The flight recorder keeps, per rank and process group, the last collectives enqueued, started and completed [950]. The culprit sits at "the first collective where some ranks started the collective but others did not" [903]. At 16,384 ranks and 2,000 entries each that is 32.8 million entries (computed), so tooling must rank suspects.
Table 12.9. Tools for finding the rank behind a hang.
| Tool | What it gives you | Notes |
|---|---|---|
| PyTorch Flight Recorder | Per-rank collective history and an analyzer that lines up sequence numbers [950] | Recording is on with 2,000 entries, but dumping on timeout is off until you set TORCH_NCCL_DUMP_ON_TIMEOUT. Llama 3 dumped automatically on watchdog or heartbeat timeouts [6] |
| py-spy and stack aggregation | The Python stack of each live process, grouped across ranks | Safe on production processes [951]. ByteRobust assumes healthy machines share one stack and evicts the outliers' parallel group [904] |
NCCL_DEBUG=TRACE, NCCL RAS | A replayable trace of every call, and health queries on running jobs [952] | RAS is on by default since NCCL 2.24 |
TORCH_DISTRIBUTED_DEBUG=DETAIL | Consistency checks on every collective call [938] | Slow. Use it in reproductions |
| Always-on diagnosis (reported, late 2026) | ARGUS traces 10,000+ GPUs at under 2% overhead [953]. CCL-D located slow or hung ranks within 6 minutes [954]. L4 mines training logs [955] | Single-source reports |
Your 16,384-GPU job hung and rank 412 logged a collective timeout. Is rank 412 the culprit?
Probably not: waiting ranks time out and log, while the stuck rank often logs nothing [47]. Dump the flight recorder on every rank (dumping on timeout is off by default), find the rank that never joined or the odd stack, and evict its parallel group.
Timeouts are a knob, not a fix. NCCL's InfiniBand wait is
for timeout exponent (NCCL_IB_TIMEOUT) and retry count . The defaults and give 4.29 s per try and 30.1 s total, the documented "approximately 30 seconds of waiting" [952], and gives 4.0 minutes (computed). MegaScale raised timeouts to survive NIC flaps [47], but a real hang then waits longer. Pair a moderate timeout with a watchdog on log freshness and traffic.
Slowdowns
Check the per-rank step-time spread first. A wide spread means a straggler, a narrow one the program, and garbage collection is a common culprit [935, 919].
At more than 10,000 GPUs, MFU fell while forward, backward and optimizer times stayed flat. Per-rank timing of critical code segments with CUDA events traced the growth to the data-parallel reduce-scatter, then to ranks launching it at skewed times, then to forward-pass jitter: "irregular garbage collection can introduce disturbances into the training procedure" and some PyTorch operations. Fixing them stopped the decline. Removing hosts about 10% slower in forward compute added about 0.7% MFU [47].
If unsure, compare MFU with the arithmetic (Section 1.3), then work down the table.
Table 12.10. Which profiling tool answers which question.
| Question | Tool | What to know |
|---|---|---|
| Where does step time go on one rank? | PyTorch profiler | A schedule such as skip_first=10, wait=5, warmup=1, active=3 skips 15 steps, warms up for one, then records [956] |
| Where does time go across ranks? | Holistic Trace Analysis | Splits GPU idle time by cause and finds the critical path [957] |
| What is the whole node doing? | Nsight Systems | Use a capture range to profile chosen steps only [958] |
| Why did memory run out? | CUDA memory snapshot | About 2 microseconds per trace, cheap enough for production, but blind to NCCL's own allocations [69] |
12.7 Determinism and reproducibility
Same code, same seed, same data: why do two runs differ, and when is it worth paying to make them identical? Floating-point addition is not associative. In double precision
(computed), because 0.1 is lost when added to first. Summing eight numbers in 10,000 random orders, Thinking Machines found "there are 102 unique results" [848]. Rerunning the published script on Python 3.11 gives 258, and all 40,320 orders give 275 distinct sums (computed). The exact count varies with the setup. The point does not. Any change in reduction order can change the bits. Table 12.11 lists the sources in the order you remove them.
Table 12.11. Sources of run-to-run differences, in the order you remove them.
| Source | How to remove it |
|---|---|
| Unseeded randomness, including loader workers | Fix every seed [943] and seed workers with worker_init_fn and a generator [949] |
| Autotuning, which "may select different algorithms on subsequent runs, even on the same machine" | torch.backends.cudnn.benchmark = False [949] |
| Kernels with atomic adds | torch.use_deterministic_algorithms(True) and CUBLAS_WORKSPACE_CONFIG [949]. It can cost: Triton's FlashAttention backward avoids atomics at 40% more FLOPs [848] |
| Library versions and platforms | Pin containers. PyTorch promises nothing across releases or platforms [949], and OLMo 2's containers let it replay results months later [7] |
| Parallel layout and precision | Keep them fixed or pass a parity test (Section 12.6) |
| Silent data corruption | Only detectable (Section 12.2) [914] |
Thinking Machines sampled 1,000 completions from Qwen3–235B-A22B at temperature 0 and got 80 unique outputs. The forward pass has no atomic adds, so the cause was the server: its batch size varies with load, and kernels change their reduction strategy with batch size, so a request is summed differently depending on what else is in the batch. Batch-invariant kernels use one strategy for all batch sizes, with a fixed split size for attention (chunks of 256 split 1,000 cached tokens into 256, 256, 256 and 232 however the request is batched, computed). With them all 1,000 completions were identical. Their unoptimized demo on Qwen3–8B took 55 s instead of 26 s, or 42 s with a better attention kernel [848]. SGLang reports a 34.35% slowdown [959], and the CoRun authors measure batch-invariant kernels cutting serving throughput by up to 74% [960], on setups that do not compare.
Why pay? BF16 greedy decoding can vary by up to 9% in accuracy across GPU counts, types and batch sizes [402], and in RL a sampler and trainer that disagree make on-policy training partly off-policy (Section 9.6) [683]. In training, determinism speeds root-causing, hardware faults included [34, 902, 914]. Removing one source does not remove run-to-run variance, since one-bit changes send models to different solutions [961]. A practical default: deterministic settings for debugging, parity tests and evaluation, fast kernels in production unless you need bitwise replay, and one measurement of run-to-run noise.
Why does a temperature-0 API sometimes give different answers to the same prompt?
Not atomic adds. Kernels choose their reduction strategy by batch size, and batch size follows server load, so your request is summed in an order set by its neighbors. Batch-invariant kernels made 1,000 of 1,000 completions identical, at 2.1x the time in an unoptimized demo and 1.6x with a better attention kernel [848] (computed).
12.8 Goodput and scheduling: accounting for every GPU-hour
Of every 100 GPU-hours you pay for, how many turn into training progress, and who owns each loss? Google splits the answer three ways [933]. Scheduling goodput (SG) is the fraction of time all the job's resources are available, runtime goodput (RG) the fraction of that time making forward progress, and program goodput (PG) the model FLOPs utilization. Each is a fraction of the one before, so on our reading they multiply into ML Productivity Goodput (MPG):
Scheduling loses to queueing and preemption, runtime to restarts, stalls and lost work, program goodput to exposed communication and slow kernels. MFU and its conventions (6N or with attention, which peak, which time base) are defined in Section 1.3. Say which one a number uses. Since failures and the cost of idle hours both grow with cluster size, "the overall cost of failure rises quadratically with the scale of the compute cluster" [933].
Take 100 GPU-hours on a dedicated reservation, SG = 1.0 (illustrative). Higher than 90% effective training time leaves 90 making progress, and 41% MFU turns them into about 37 GPU-hours of peak-rate FLOPs [6]: (computed, approximate, since 0.90 is a lower bound). A cross-check: FLOPs over 30.84M GPU-hours at about 990 TFLOP/s dense BF16 peak is 0.35 [11, 4] (computed).
Raising runtime goodput to 0.97, the best reported, gains . One MFU point gains , five points (computed). Reliability protects the middle factor, but the largest loss is MFU.
MPG includes MFU, so frontier values sit near 0.3–0.4. Kokolis et al.'s effective training time ratio (ETTR) divides productive runtime by available wall-clock time including queueing [903]. The 85–97% figures in Table 12.12 are runtime fractions, and Pollux's goodput is a throughput rate [962]. Report the three factors separately, plus a one-hour sliding-window ETTR that shows intermittent failures [904].
Table 12.12. Reported goodput-type numbers. Definitions differ, so compare rows with care.
| Run | Metric | Value |
|---|---|---|
| Llama 3 405B, up to 16,384 H100s | Effective training time: useful training time over elapsed time [6] | Higher than 90% (lower bound) |
| MegaScale, more than 10,000 GPUs | Effective training time rate: iterations times iteration time over total time [47] | Over 90% |
| Gemini, largest job | Goodput: time computing useful new steps over elapsed time [902] | 85% to 97% after in-memory replicas, lost time cut 5x (computed) |
| Gemini 2.5 pretraining | 93.4% of time in TPU computation, about 4.5% of computed steps replays or rollbacks for debugging [913] | About 0.89 useful (computed, approximate) |
| ByteRobust, 9,600 GPUs for three months | ETTR [904] | Up to 97% |
| Meta, about 100,000 GPUs | Effective training time, synchronous restart versus fault-tolerant HSDP [939] | 44% versus 80% (estimates) |
| RobustRL, 256-GPU RL task, injected failures | ETTR [942] | Over 80% versus 60% for ByteRobust |
| Llama 3 405B, this guide | MPG [933] | About 0.37 (computed) |
MPG is 0.36 with runtime goodput 0.90 and scheduling goodput 0.98. What is the MFU, and which buys more: runtime goodput of 0.97 or 5 more MFU points?
. Runtime goodput of 0.97 gains , five MFU points (computed). MFU wins, which is why each factor needs an owner.
Scheduling: all the GPUs at once
A synchronous job needs every rank at step 1, so the scheduler starts all of it or none, which Volcano calls gang scheduling [963]. Slurm uses the same term for timeslicing [964]. Placement matters as much as admission: on an unoptimized large cluster Meta saw communication utilization "ranging from 10% to 90%" until it combined topology-aware scheduling with routing and NCCL changes [145]. Small jobs starve: Acme's evaluation jobs queued longest [905]. By 2026 Slurm versus Kubernetes is a tooling choice, and the largest operators write their own [965, 966].
Table 12.13. How common schedulers start, preempt and recover a training job.
| Scheduler | Starting the job | Failures and preemption |
|---|---|---|
| Slurm | Allocates exclusive or shared access to nodes for a duration, starts and monitors the work, runs the queue [967] | Preempted jobs are cancelled, requeued or suspended [968]. HealthCheckProgram can drain a bad node [969]. Meta's research clusters make jobs preemptible after two hours, cap them at seven days and requeue a job killed by a failed health check under the same job ID [903] |
| JobSet (Kubernetes) | Groups the jobs of one workload [970] | If any job fails, the whole set is recreated and resumes from the last checkpoint, at 290 pods per second on 15,000 nodes [970] |
| MAST (Meta) | Global scheduler across data centers, used for Llama 3 [6] | Cut the most overloaded region's high-priority demand-to-supply ratio from 2.63 to 0.98 [965] |
12.9 Lineage, data pipelines, evaluation gates and technical debt
What keeps a months-long run reproducible, fed and judged, and why does that machinery rot? A frontier run is a sequence of segments, each with its own code, configuration and data. Llama 3 changed its data mix several times during training [6], and on the ByteRobust platform 9,582 manual restarts for code or data adjustments made up 17.3% of three months' incidents [904].
Record each segment as in Table 12.14 and follow Imbue's rule to "change only one thing at a time" [935]. Otherwise a code change and a hardware swap land together, and nobody can say which moved the loss.
Table 12.14. What to record for each segment of a run, and where.
| Field | Why | Typical tool |
|---|---|---|
| Code commit, container digest, framework, CUDA and NCCL versions | Rebuild the exact program | MLflow Tracking logs parameters, code versions, metrics and files [971] |
| Fully resolved configuration | Overrides and hot patches pile up | Hydra composes and overrides configurations [972]. ByteRobust stores every hot update [904] |
| Mixture weights, shard manifest, tokenizer version | Data changes move every evaluation | W&B use_artifact links dataset versions to runs [973] |
| Per-rank loader state, tokens seen, host list, rank order, seeds | Resume exactly, reproduce crashes | Imbue's checklist asks for all of these [935] |
| Restart reason, checkpoint resumed from, metrics | Separate code effects from hardware effects | TensorBoard or a tracking server [974] |
Data pipelines
The job consumes
A 128,256-token vocabulary needs 17 bits, so IDs are 32-bit: about 10.8 MB/s, and 62 TB for 15.6T tokens (computed). The storage fabric sustains 2 TB/s [6], so checkpoints, not text, are the hard storage load (Section 12.3). Forward-only evaluation of tokens against a training step of tokens costs
so a 48M-token suite (illustrative) is steps. At 5x lower efficiency, every 1,000 steps that is about 0.5% of compute (computed).
Pipelines are built for exact resumption, not bandwidth. Sequential tar shards read "3x-10x" faster than random access [975]. StreamingDataset keeps sample order independent of GPU count [976], and StatefulDataLoader checkpoints worker state but not across ranks, so each rank saves its own [977]. Make the global order a pure function of seed and sample index, as PaLM's step-indexed pipeline does [34]. Then resuming and rewind-and-skip are arithmetic.
Evaluation pipelines and promotion gates
On Acme's Kalos cluster, evaluation was 92.9% of jobs but 0.8% of GPU time [905]. Scores are noisy: 1B models span 1.7 ARC Challenge points over their last 30 checkpoints [259]. Log per-example likelihoods [258], smooth over checkpoints before alerting, pin the harness [497, 775] and keep a held-out suite [7] (methodology in Section 10.9). A promotion gate is a rule over tracked evaluations that moves a registry alias [978]. Llama 3 advanced long-context stages only after short-context scores recovered and needle-in-a-haystack tasks were solved [6] (Chapter 7).
An evaluation step hung. Stack aggregation "isolated a specific pipeline spanning 6 machines", which were evicted and replaced by warm standbys. Days of stress tests later found "two of the machines have defective cuda cores" [904]. Evaluation is production too.
Why the machinery rots
Sculley et al.'s risk factors for ML systems [979] map onto a pretraining team as in Table 12.15 (our synthesis). The shared defense is lineage plus tests for operations code, which the ML Test Score grades [980].
Table 12.15. Hidden technical debt in a foundation-model team.
| Risk factor | How it shows up | Defense |
|---|---|---|
| Entanglement | A mid-run data-mix change moves every evaluation at once [6] | One change per segment, logged |
| Hidden feedback loops | Models judge their own future data: Llama 2's chat model labeled documents for Llama 3's quality classifiers [6] | Lineage from every model-filtered dataset to its filter model |
| Undeclared consumers | Benchmarks used for decisions become targets | Declared held-out suites [7] |
| Data dependencies | Tokenizer, filters and deduplication indexes are upstream code (Chapter 3) | Versioned, immutable shard manifests |
| Configuration debt | 17.3% of ByteRobust's platform incidents were manual restarts for code or data changes [904] | The resolved configuration in the run record |
| Glue code and auxiliary services | Metrics, logging and alerting services caused many network errors at Acme [905] | Test operations code like model code |
- A synchronous job is a series system, . Llama 3 405B stopped unexpectedly 419 times in 54 days, and automation kept it above 90% effective training time [6].
- Silent data corruption (about one per 150,000 GPU-days in Llama 3's log, computed) and slow ranks do not crash. Catch them with replay, peer comparison and per-rank timing.
- The best checkpoint interval is , with waste about . Fast checkpoints leave the restart path dominant.
- Recovery is a loop: detect early instead of at a 30-minute timeout, localize, over-evict, replace from hot spares, resume. Near 100,000 GPUs stop-the-world restart leaves too little training time, and Salpekar et al. argue fault-tolerant training such as FT-HSDP becomes necessary [939].
- Log signals whose healthy shape you know: gradient norm, loss at step 0 near , per-layer norms, attention logits, liveness.
- Debug with evidence: keep checkpoints around a spike, inspect batches, rewind and skip, checkpoint all state, and treat the rank that reports a timeout as a victim.
- Determinism is a debugging tool. Inference nondeterminism comes mostly from batch-size-dependent kernels [848].
- Goodput is scheduling runtime program goodput, about for Llama 3 405B, so MFU is the biggest loss. Say which goodput you mean and record lineage for every segment.
13. Inference: serving models fast and cheap
Serving pays repeatedly for the model that training produced. Prefill and decode have different bottlenecks, and batching trades latency against utilization. Count the weight reads, KV memory, queueing and accepted output tokens before attaching a price to a request.
On 27 and 28 February 2025, DeepSeek's V3 and R1 service ran on an average of 226.75 nodes of 8 H800s, about 1,814 GPUs (reported, GPU count computed) [14], close to the cluster of 2,048 H800 GPUs that pretrained DeepSeek-V3 [2]. That day it read 608B input tokens and wrote 168B output tokens [14]. Serving, not training, is where a successful model spends its life.
A request waits in a queue, then the server runs the whole prompt in one pass, called prefill, ending with the first output token. That delay is the time to first token (TTFT), and it includes queueing, prefill and network time [981]. Then decode runs one forward pass per new token until the answer stops. The gap between tokens is the time per output token (TPOT) [981], defined exactly in Section 13.3.
The two phases run at very different speeds on the same chips. On 64 TPU v4 chips, PaLM 540B prefilled 2,048 tokens in 0.29 s and generated 64 tokens at batch 64 in 1.82 s [33]: 0.14 ms per prompt token against 28.4 ms per decode step, so one sequence waits about 200 times longer per generated token. Each step served 64 sequences, so the chip time per generated token was 0.44 ms, about 3 times a prompt token (computed).
The anchor for every number is Llama 3 70B in BF16 on one node of 8 H100s [6], with DeepSeek-V3 for mixture of experts and GPT-2 124M on a laptop. The running examples and the notation are introduced in Section 0.3. Sections 13.1 to 13.3 do the arithmetic, 13.4 to 13.6 build the serving system and 13.7 to 13.9 make decode cheaper, building on Chapter 1 (2N and the roofline), Chapter 2 (bandwidths) and Chapter 4 (attention variants and experts).
13.1 Prefill and decode: two workloads in one request
Why does a server read a 4,000-token prompt faster than it writes 100 tokens of answer? Prefill sees every prompt token at once, so each weight read from memory serves thousands of tokens. Decode cannot start token before finishing token , so every step reads every weight to make one token per sequence. Splitwise's authors call these "a compute-intensive prompt computation phase and a memory-intensive token generation phase" [92].
Prefill runs the prompt tokens through the model, keeps every layer's keys and values (the KV cache) and samples the first token [33]. Each decode step runs one new token per sequence, attends to the cache, appends its own keys and values and samples. Without the cache, in kipply's words, "sampling would be quadratic in time complexity as we increase the number of tokens" [982].
FLOPs and bytes
The weight matmuls cost about FLOPs per token, one multiply and one add per parameter [33]. Causal attention in prefill costs about FLOPs, which equals the weight FLOPs at tokens for Llama 3 70B [6]. Attention adds 8% to the weight FLOPs at 8K, 30% at 32K and 122% at 128K (computed). So "2N per token" holds below about 32K tokens and fails at 128K.
Speed is set by arithmetic intensity, FLOPs per byte moved. The roofline and the ridge point are derived in Section 1.7. Apply them here without re-deriving. For BF16 weights,
where is a GPU's peak FLOP/s and its HBM bandwidth. Dividing the H100 SXM's dense BF16 peak, 989.5 TFLOP/s (half the 1,979 TFLOP/s the spec sheet lists with sparsity, see Section 2.1), by its 3.35 TB/s of HBM bandwidth puts the ridge at about 295 FLOP per byte (computed) [4]. Zadouri et al. use the same value of about 295 [983], while Austin et al. put the critical batch for an H100 at "about 280 tokens" [91]. Where the difference does not matter, this chapter says about 300. Quantizing weights to 8 bits halves , and 8-bit math doubles it [91].
Attention breaks the batching argument
Batching fixes the weight matmuls, since one weight read serves the whole batch, but not attention, since each sequence has its own KV cache. In decode, multi-head attention does about one FLOP per KV byte, grouped-query attention about and latent attention about [983]: 8 for Llama 3 70B, about 256 for DeepSeek-V3. In generation, Austin et al. conclude, "we are always memory bandwidth-bound" [91], which is why Llama 3 uses grouped-query attention "with 8 key-value heads to improve inference speed and to reduce the size of key-value caches during decoding" [6]. Llama 3 70B's cache is 327,680 B per token, against 70,272 B for DeepSeek-V3's latent attention (Section 4.5).
Now write one decode step for sequences at context , with bytes of weights, KV bytes per token and tensor-parallel GPUs:
Each added sequence brings FLOPs and bytes, and above its bytes take longer to read than its FLOPs take to compute. For Llama 3 70B in BF16 on 8 H100s, the batch that reaches the ridge is 295 sequences at zero context, 455 at 512 tokens and 992 at 1,024 tokens, and above about 1,460 tokens of context no batch size makes the step compute-bound (computed at 100% of peak bandwidth and FLOP/s, ignoring attention FLOPs, which would move the threshold to about 1,500 tokens) [6, 4]. Profiling agrees: Recasens et al. find large-batch decode memory-bound, "with over 50% of the attention kernel cycles stalled due to data access delays for all tested models" [984]. Both hold: Austin et al.'s critical batch concerns the weight matmuls, this threshold the whole step.
Batching shares each weight read across all sequences in the step, but every sequence brings its own KV cache. Above about 1.5K tokens of context, Llama 3 70B decode on H100s stays memory-bound at any batch size (computed).
Step through Figure 6 with its Next button to plot this request: prefill, then decode at batch 1, then at batch 64. Batch 64 moves decode right but nowhere near the ridge.
Prefill does FLOPs of matmuls plus of attention, against 141.1 GB of weights read and 1.34 GB of KV written: about 4,200 FLOP per byte, compute-bound, 76 ms at peak and about 190 ms at 40% MFU (model FLOPs utilization, the share of peak FLOP/s doing model math, Section 1.3). The first decode step does FLOPs against the same 142.4 GB, an intensity of 1.07 and a floor of 5.32 ms. Batch 64 does FLOPs against GB, an intensity of 43, far below 295 (all computed from [6, 4]).
So report input and output tokens separately, since a generated token costs several times as much as a prompt token even at large batch (Section 13.3), and check that research code uses a KV cache at all.
13.2 The decode floor: bytes over bandwidth
What is the fastest a model can generate one token, and how many users fit on one node? A decode step cannot end before every weight byte and every cached KV byte has crossed from HBM to the compute units, the memory roof of Section 1.7. Austin et al. call this the "Theoretical Min Step Time" [91], Pope et al. memory time [33]:
It assumes perfect overlap, peak bandwidth, free communication and negligible activations. For Llama 3 70B in BF16 on one node of 8 H100s with tensor parallelism of 8, every decode step streams 141.1 GB of weights over 8 × 3.35 TB/s of HBM bandwidth, so its floor is 5.27 ms per token at batch 1, about 190 tokens/s for one user, and 5.37 ms at 8K tokens of context (computed) [6, 4, 91]. Table 13.1 applies the bound to the other models [84].
Table 13.1. Decode floors at batch 1 (computed from weight and KV bytes over peak HBM bandwidth: 3.35 TB/s per H100, 4.8 TB/s per H200).
| Model and weights | GPUs | Floor at 0 context | Floor at 8K | Tokens/s per user at 8K |
|---|---|---|---|---|
| Llama 3 8B, BF16 (16.1 GB) | 1 H100 | 4.79 ms | 5.11 ms | 196 |
| Llama 3 8B, FP8 (8.0 GB) | 1 H100 | 2.40 ms | 2.72 ms | 368 |
| Llama 3 70B, BF16 (141.1 GB) | 8 H100, TP8 | 5.27 ms | 5.37 ms | 186 |
| Llama 3 70B, BF16 | 4 H100, TP4 | 10.53 ms | 10.73 ms | 93 |
| Llama 3 70B, FP8 (70.6 GB) | 8 H100 | 2.63 ms | 2.73 ms | 366 |
| Llama 3 70B, BF16 | 8 H200 | 3.67 ms | 3.74 ms | 267 |
| Llama 3 405B, FP8 (405.9 GB) | 8 H100 | 15.1 ms | 15.3 ms | 65 |
| Llama 3 405B, BF16 (811.7 GB) | 16 H100, TP8 × PP2 | 30.3 ms | 30.5 ms | 33 |
The last row shows that pipeline parallelism adds capacity, not speed. A token visits the stages in sequence, so the floor divides by , not by the GPU count. Micro-batches in flight restore throughput, which is how Meta served 405B in BF16 "across 16 GPUs on two machines" [6].
KV memory sets concurrency
Llama 3 70B's BF16 cache takes bytes (320 KiB) per token [6], 2.68 GB per 8K-token sequence. BF16 weights leave GB on 8 H100s, room for 185 such sequences if every free byte held KV. Realistic headroom shrinks the pool to about 150 sequences (Section 13.4), so say "about 150 to 185" and state the headroom. At long context the cache outgrows the model: Llama 3 8B's KV at 128K tokens is 17.2 GB, its BF16 weights 16.1 GB (computed). KV size moves throughput too. In Austin et al.'s LLaMA 2–13B example on 8 TPU v5e chips, a 5 times smaller cache raises theoretical throughput at batch 240 from 964 to 4,529 tokens/s, although neither batch fits in the chips' 128 GiB [91].
The latency-throughput frontier
Table 13.2 applies the step formula to the anchor at 4K tokens of context [6, 4].
Table 13.2. Llama 3 70B in BF16 on 8 H100s at 4K context, 100% of peak bandwidth, $2 per GPU-hour (illustrative price). All values computed.
| Batch | Step time | Tokens/s per user | Total tokens/s | $ per million output tokens |
|---|---|---|---|---|
| 1 | 5.32 ms | 188 | 188 | 23.6 |
| 16 | 6.07 ms | 165 | 2,637 | 1.69 |
| 64 | 8.47 ms | 118 | 7,556 | 0.59 |
| 128 | 11.68 ms | 86 | 10,963 | 0.41 |
| 256 | 18.09 ms | 55 | 14,155 | 0.31 |
From batch 1 to 256, total throughput rises 75 times while each user's speed falls 3.4 times. Going from 64 to 128 buys only 1.45 times more, because KV traffic grows with the batch, and even batch 256 stays memory-bound (computed). On one A100, Databricks found that "if we maximize throughput with a batch size of 64, latency increases by 4x while throughput increases by 14x" [985]. CloudMatrix-Infer, serving DeepSeek-R1 in INT8 on Ascend 910 NPUs, reports 1,943, 974 and 538 tokens/s per NPU at TPOT targets of 50, 30 and 15 ms [986]. Figure 68 turns the frontier into a calculator. Try FP8 weights (the batch-64 step falls to 5.84 ms) and a 32K context (KV traffic flattens the curve).
Method and sources
A step takes the larger of its memory time, weight bytes plus batch times context times KV bytes per token over the HBM bandwidth of the tensor-parallel GPUs, and its compute time, 2N FLOPs per sequence over peak FLOP/s, following Austin et al. (2025) and kipply (2022), for the Llama 3 shapes (Grattafiori et al. 2024) on H100 and H200 (NVIDIA specifications). Batches that overflow 90% of HBM minus 4 GB per GPU (illustrative headroom) are hatched, the price per GPU-hour defaults to $2 (DeepSeek-AI's stated assumption), and the MBU slider marks the 60% Databricks (2023) measured for a 7B model on 2 H100s at batch 1. All values are computed, not measured, at the bandwidth and compute efficiencies you set.From floor to reality
Databricks scores deployments by model bandwidth utilization, at batch 1, and measured 60% for a 7B model on 2 H100s [985]. Applied to the anchor as an illustrative assumption, 60% turns 5.27 ms into 8.8 ms, about 114 tokens/s. So expect roughly 100 to 130 tokens/s at batch 1, a computed estimate, since we found no published measurement of this setup. Tensor parallelism adds latency too: at batch 1 each all-reduce costs a fixed delay, which kipply guesses at "approximately 8 microseconds per message" from a V100 NVLink measurement [982]. Megatron-style tensor parallelism does two all-reduces per layer in the forward pass [392], 160 over 80 layers, or about 1.3 ms, a quarter of the floor (computed, assumption-sensitive). That is why, at small batch, "for Llama2–70B going from 4x to 8x GPUs only decreases latency by 0.7x" [985].
Weights are B = 141.1 GB, 17.6 GB per GPU. The floor is = 5.27 ms, plus 0.10 ms of KV at 8K. At batch 64 and 4K context a step reads GB in 8.47 ms: 7,556 tokens/s in total, 118 per user. FP8 weights halve the floor to 2.63 ms and free 70 GB for KV (computed from [6, 4]).
On chips with 275 TFLOP/s of BF16 and 1,200 GB/s of HBM each, Pope et al. reported 43% MFU for batch-1 prefill and 14% for batch-64 decode, and B FLOPs per token over each latency and TFLOP/s reproduces both (computed) [33]. With int8 weights, batch-64 decode took 28.5 ms per token against 36.9 ms in BF16 [33]. Reading 540 GB of int8 weights at 64 × 1,200 GB/s takes only 7.0 ms, so at 64-way partitioning collective latency, not HBM, set the pace (7.0 ms computed, the attribution our reading). Padding the heads from 48 to 64 "adds 18B parameters to the model, which comes at a 3% MFU cost" and bought a clean 64-way split [33]. An architecture chosen for training can be revisited for serving.
Do it yourself. Apple lists 153 GB/s of memory bandwidth for the MacBook Air (as of November 2026) [987]. GPT-2 124M's FP32 weights are B = 498 MB, a floor of 3.25 ms per token (about 308 tokens/s), and 1.63 ms in BF16. Its KV is B per token in BF16 (computed) [19]. Measure tokens/s and compute your MBU: Python and kernel launches dominate at this size.
Three mistakes recur. Leaving training-style weight sharding on during decode is "an easy and common way to have order of magnitude regressions" [91]. Sizing the batch from weights alone runs out of memory when long prompts arrive. And a floor is a bound, never a measurement.
13.3 Latency metrics, goodput and the price of a token
What should you measure, and what does a million tokens cost to produce? TTFT runs from submission to the first token and "generally includes request queuing time, prefill time, and network latency" [981]. NVIDIA's AIPerf defines inter-token latency, which this chapter calls TPOT, over the output tokens [981]:
"A TPOT of 100 milliseconds/tok would be 10 tokens per second per user, or ~450 words per minute" [985]. Goodput is "the maximum request rate that can be served adhering to the SLO attainment goal (say, 90%) for each GPU provisioned" [988], where an SLO (service-level objective) is a latency target.
Definitions disagree: "tools differ on whether TTFT is included in the average" [981], and Databricks' latency, TTFT plus TPOT times the output length, counts one more gap [985]. Tokenizers differ too: "Llama 2 tokenization is 19% longer than ChatGPT tokenization" in Anyscale's measurement [985]. Report TTFT and TPOT as p50, p90 and p99 at a stated request rate and length mix, plus goodput at a stated SLO.
Queueing inflates TTFT before throughput saturates. DistServe models a prefill instance as "the M/D/1 queue", with Poisson arrivals at rate and fixed prefill time [988]:
At 80% utilization () the queueing term is , so average TTFT is three times the bare prefill (computed). A TTFT target forces headroom.
Users feel something else. Etalon's authors say these metrics "fail to fully capture the nuances of LLM inference", and a 250-words-per-minute reader needs only about 6 tokens/s [989]. Andes adds that "generating tokens at a rate faster than the user's consumption speed should not improve QoE" (quality of experience) [990]. Fast decode matters most for agents and reasoning models that read their own output (Chapter 9, Chapter 14).
The price of a token
For GPUs at dollars per GPU-hour sustaining tokens per second,
Pope et al.'s chip-seconds per token is the same quantity without a price [33]. The $2 per GPU-hour used here is DeepSeek's own assumption [14], reused for DeepSeek-V3.2's estimates [681], not a market quote. State utilization, length mix, the batch the latency target allows and the price.
A node of 8 H100s at $2 per GPU-hour costs $16 per hour. Prefill of 8K-token prompts at an illustrative 40% MFU delivers FLOP/s over FLOPs per token, about 20,850 tokens/s: $0.21 per million input tokens, and 0.39 s of TTFT per prompt before queueing. Decode at 4K context (Table 13.2) costs $0.59 per million output tokens at batch 64 and $0.41 at batch 128, and $1.18 and $0.81 at 50% bandwidth. Output costs about 2 to 6 times as much as input on the same hardware (all computed) [6, 14].
Decode runs at low MFU, holds KV memory for the whole generation and has its batch capped by the TPOT target. Step-3's authors call decoding "the most expensive per token (because of low MFU) compared with training and prefill" [991]. Market prices show the same ratio. In February 2025, DeepSeek-R1 charged $0.14 per million input tokens on a cache hit, $0.55 on a miss and $2.19 per million output tokens [14], 4.0 times for output (computed). As of November 2026, DeepSeek's price page lists deepseek-v4-pro at $0.044, $1.32 and $3.96 at peak hours [992]: 3.0 times for output, and a cache hit 30 times cheaper than a miss (computed), because a hit skips prefill (Section 13.4). The price control of Figure 68 puts dollars on any configuration.
DeepSeek published one day of its V3 and R1 service, from noon on 27 February 2025 (UTC+8): an average of 226.75 nodes of 8 H800s, which at an assumed $2 per GPU-hour cost $87,072 (reported) [14]. Of its 608B input tokens, 56.3% hit an on-disk KV cache [14]. The node count reproduces: 168B output tokens at about 14.8k tokens/s per decode node need 131 nodes on average, and 608B input tokens at about 73.7k tokens/s per prefill node need 95.5, together 227 (computed). A node-hour costs $16, so a million output tokens cost about $0.30 and a million input tokens about $0.06 (computed). Billing every token at R1's prices gives $562,100 against the reported $562,027 (computed), and the reported 545% cost profit margin is an upper bound, because V3 is priced below R1, web and app use is free and night-time discounts apply [14].
Serving cost feeds back into training. Sardana et al. estimate that for 2 trillion tokens of inference demand, training a 7B model on more data instead of a 13B model cuts total compute by 17% [70]. Sizing a model for its serving load is Section 6.5.
Cost estimates fail in three ways. They assume full load around the clock, yet DeepSeek serves "across all nodes during peak daytime hours" and at night moves nodes to research and training [14]. They forget that reasoning models write long outputs, so output cost dominates. And they compare per-token prices across different tokenizers.
13.4 Batching and KV memory: continuous batching, paging and prefix caching
How does one GPU keep hundreds of requests in flight when they arrive and finish at random times? A serving engine is a batching machine under a memory constraint. It wants many tokens in every forward pass, since each pass streams the weights once (Section 13.2), but every request in flight holds a growing KV cache. Pass time depends on "the raw number of tokens in the forward pass", not on how many sequences they come from [993]. So the scheduler's job is to keep passes full without running out of KV memory.
Static batching wastes slots
A classic server runs a batch until every request in it finishes. A slot whose request ends early idles until the longest one ends. With independent output lengths , the share of slot-steps doing useful work is
and for lengths uniform on
With output lengths uniform on 1 to 128 tokens, the range Orca's evaluation used [994], a static batch keeps 56% of its slots busy at batch 8 and 52% at batch 32 (computed and checked by simulation). For an illustrative heavy-tailed workload (exponential, mean 200) it is 37% and 25%. Bigger batches make it worse.
Orca's fix is iteration-level scheduling, which "schedules execution at the granularity of iteration (instead of request)" [994]. A finished request leaves at once and a queued one takes its slot at the next step. This is continuous batching (in-flight batching in TensorRT-LLM [995]). At saturation it raises decode throughput by about : 1.9x at batch 32 for the uniform workload, 4.1x for the heavy-tailed one (computed). Linear layers batch every request's tokens while attention runs per request (selective batching) [994].
Paging the KV cache
Orca still reserved each request's maximum length up front. Kwon et al. measured that existing systems stored real tokens in only 20.4% to 38.2% of their KV memory. The rest went to slots reserved for future tokens, over-provisioning for lengths that never came and fragmentation [73]. PagedAttention borrows paging from operating systems:
- Cut the KV pool into fixed blocks, 16 tokens by default in vLLM [73].
- Give each request a block table that maps its logical blocks to physical blocks anywhere in the pool. Samples of one prompt can share blocks and copy one only when they write to it.
- Allocate a block only when the last one fills, so waste stays under one block per request [73]: under 5.2 MB for Llama 3 70B, 2.6 MB on average, against 2.36 GB for an 8,192-token reservation that ends at 1,000 tokens (computed).
- Gather keys and values through the table inside the attention kernel, and return blocks to a free list when the request ends.
When blocks run out, the engine preempts a request and later recomputes its KV, the vLLM V1 default [996]. vLLM raised throughput 2–4x at equal latency over FasterTransformer and Orca [73] (measured, 2023 baselines). Its paged kernel was slower, up to 2.8x against FlashAttention-2 in vAttention's measurement. vAttention instead keeps the cache virtually contiguous and allocates physical memory at runtime, which raised serving throughput by up to 1.23x over paged FlashAttention-2 and FlashInfer kernels [997] (measured). Both designs avoid reserving maximum lengths.
Llama 3 70B in BF16, tensor parallelism of 8, with illustrative headroom of 90% usable HBM and 4 GB per GPU of workspace:
or million tokens [6, 4]. If requests average 1,000 tokens and may reach 8,192, reserving the maximum admits sequences. Paging admits , counting half a block of waste each (computed). The 8x gap is the ratio of maximum to typical length.
Figure 69 runs one illustrative workload under three policies. Step it and watch the gray idle slots vanish under continuous batching, then the hatched reserved-but-empty blocks vanish under paging. Shrink the KV pool to see memory cap the batch.
Method and sources
Every policy and slider setting is simulated ahead of time (computed), and the strip below compares whole runs at the chosen settings. The policies follow Yu et al. (2022) and Kwon et al. (2023), the 16-token block and the 20.4% to 38.2% KV memory utilization of earlier systems are Kwon et al.'s, and the expected static-batch utilization is computed from Orca's output range.In 2023 LMSYS moved Chatbot Arena and the Vicuna demo from a Hugging Face Transformers backend to vLLM and cut the GPUs serving that traffic by 50%, at an average of 30K requests a day and a peak of 60K [998] (reported). The saving is consistent with the memory gains above (our reading, the post does not break it down).
Prefix caching
Under causal attention a token's keys and values depend only on earlier tokens, so requests that share a prefix can share its blocks. vLLM keys each full block by its parent's hash plus its own tokens [999], at under 1% throughput cost even with no hits [1000]. SGLang's RadixAttention keeps a radix tree of cached tokens with least-recently-used eviction and serves the longest shared prefix first, which its authors warn "can lead to starvation" [1001]. Real hit rates are high: 74.1% for Vicuna-33B on Chatbot Arena [1001] and 56.3% of DeepSeek's 608B daily input tokens in February 2025 [14]. A 4,000-token shared prefix with a 200-token question cuts linear-layer prefill work from to FLOPs, 21x (computed). Attention to the cached positions still runs.
Put stable content (system prompt, tool schemas, documents) first and volatile content last. Truncating old turns changes the prefix and can halve the hit ratio [1002]. Route requests to the replica that holds their prefix. Give each tenant its own cache salt, which vLLM provides to block timing attacks on cached content [999].
Batching also serves many LoRA adapters (Section 8.3) on one base model: computing unmerged lets batch across tenants, and S-LoRA serves 2,000 adapters at once [1003] (reported). A rank-16 adapter on Llama 3 8B's attention projections is 0.17% of the model (computed) [6].
13.5 Prefill meets decode: chunked prefill and disaggregation
When a long prompt arrives, what happens to the users already mid-answer, and should prefill and decode share GPUs at all? If the engine admits the whole prompt at once, every decoding user waits for its prefill. Prioritizing prefills favors throughput and hurts the tail of time between tokens (TBT, the individual gaps whose mean is TPOT, Section 13.3), and prioritizing decodes does the opposite [1004]. On the anchor node an 8,192-token prefill at an illustrative 40% MFU takes about 393 ms, while a decode step for 32 users at 4K context takes 6.9 ms (computed). One admission makes every user's next gap 57 times longer.
Chunked prefill
Sarathi splits the prompt into chunks and fills the rest of each batch with decodes, which ride almost free because the chunk already pays for streaming the weights. On LLaMA-13B, a decode token cost 12.49 ms alone and 1.2 ms piggybacked on a chunk [1005] (measured). Sarathi-Serve gives each iteration a token budget, filled first with every ongoing decode and then with the next prompt chunk. The budget is the largest that keeps an iteration inside the TBT target: 2,048 tokens for relaxed and 512 for strict SLOs in the paper (1,536 for Llama 2 70B, relaxed) [1004]. A few hundred tokens suffice because a pass turns compute-bound near the ridge, 295 FLOP per byte on an H100 (Section 13.1). Against vLLM of early 2024, capacity under a P99 TBT target rose 2.6x for Mistral-7B [1004] (measured). vLLM V1 now chunks by default and schedules decodes first, and its guide says smaller budgets favor inter-token latency and larger ones the time to first token [996]. A prompt of tokens needs
iterations when decodes ride along.
Thirty-two users decode at 4K context when an 8,192-token prompt arrives. With a 512-token budget each iteration takes ms and the prompt needs of them. The last is short, so the first token comes after about 395 ms and the worst gap for existing users is 22.8 ms. Counting attention to earlier chunks, as Figure 70 does, these grow to 422 ms and 26 ms. At 2,048 tokens, 5 iterations of 91.3 ms give a first token after about 372 ms and 91 ms gaps, or 400 ms and 103 ms with attention (computed, MFU illustrative). Real small chunks also run at lower MFU, which this model ignores.
Disaggregation
Chunking bounds the stall. Disaggregation removes it: prefill runs on one instance, which computes the prompt's KV and the first token, then ships the KV to a decode instance that adds the request to its batch. Each phase picks its own parallelism and batch size, and each pool scales on its own. DistServe built it to maximize per-GPU goodput (Section 13.3) and served 7.4x more requests or met 12.6x tighter SLOs than colocated systems [988] (measured).
The price is the KV transfer, a nearly fixed fraction of prefill time. Bytes moved and prefill FLOPs both grow linearly with the prompt length , so it cancels:
where is the link bandwidth per direction and attention, a small share of prefill, is ignored. Measured systems hide most of it. In DistServe the transfer was under 0.1% of total latency for OPT-175B [988]. Splitwise's layer-by-layer transfer added 0.8% to end-to-end latency but 16.5% to the second token [92]. Those shares divide by end-to-end latency, which includes every decode step, so they do not check the ratio above.
An 8,192-token prompt leaves GB of KV: 54 ms over one 400 Gb/s NIC (50 GB/s), 6.7 ms over eight. Prefill on 8 H100s at 40% MFU (illustrative) takes about 393 ms. The ratio is on one NIC and 0.02 on eight counting only per token, or 54/393 = 0.14 once attention FLOPs are counted, before any overlap (computed) [6, 4].
Figure 70 admits one long prompt into a node already decoding for 32 users. Watch the red worst-gap marker: it spans the whole prefill when colocated, one chunk when chunked and one decode step when disaggregated. Then change the link and see the green transfer block shrink.
Method and sources
The smaller panels compare time to first token and worst gap across all three policies and plot the transfer-to-prefill ratio against prompt length. Every number is computed: each iteration takes the longer of its FLOPs at an illustrative prefill MFU (40% by default) and its bytes at HBM bandwidth, chunked iterations are timed from their exact token counts including attention to earlier chunks, and links run at line rate. The policies follow Sarathi-Serve (Agrawal et al. 2024), DistServe (Zhong et al. 2024) and Splitwise (Patel et al. 2023), with model shapes from the Llama 3 paper (Grattafiori et al. 2024) and hardware figures from NVIDIA's H100 datasheet. Measured transfer overheads in those systems were under 0.1% (DistServe, OPT-175B) and 0.8% (Splitwise, layer-wise transfer) of end-to-end latency, a different denominator from the ratio plotted here.Split phases can run on different hardware: Splitwise found that token generation barely slows under a power cap from 700 to 350 W, while the prompt phase is highly sensitive [92]. Mooncake, which serves Kimi's prefill-heavy traffic (8,590 input and 182 output tokens per request on average), adds a cluster-wide KV cache in CPU memory and SSD and lets Kimi handle 75% more requests [1006] (reported).
Whether to split is still debated. DistServe's authors argue that one large prefill can inflate time per output token 2 to 30 times under bursty load even with chunking [1007]. TaiChi finds colocation best for tight first-token targets and disaggregation best for tight per-token targets [1008]. Large deployments now do both: chunking inside pools, disaggregation across them.
vLLM: PagedAttention, V1 up to 1.7x faster than V0 [1000] (reported). SGLang: RadixAttention, more than 400,000 GPUs by its own count [1009]. TensorRT-LLM: NVIDIA's kernels [995]. Text Generation Inference: in maintenance mode [1010]. llama.cpp: local hardware [1011]. Dynamo: orchestration of disaggregated pools above the engines [1012].
13.6 Serving a mixture of experts: DeepSeek-V3 at scale
DeepSeek-V3 activates 37B of its 671B parameters per token. Is it as cheap to serve as a 37B dense model? In FLOPs, nearly: about GFLOPs of weight math per token (computed) [2]. In memory, no. All 671 GB of FP8 weights must sit in HBM, and each expert sees only a slice of the batch, so its weights are read for little work. Sparse activation "shifts feed-forward networks (FFNs) from being compute-intensive to memory-intensive during inference" [1014]. The architecture is in Section 4.7.
With routed experts and active per token, a balanced step of tokens gives each expert . For every expert to reach the ridge,
DeepSeek-V3 activates 8 of 256 routed experts [2], so a step needs about tokens (computed, with perfect balance and H100 figures standing in for H800s). Austin et al. give the same factor of [91]. In practice DeepSeek sees a per-expert decode batch "usually within 256 tokens", bound by memory access [2].
The answer is expert parallelism: spread experts over many GPUs so each collects tokens from the whole group, keep attention mostly data-parallel (TP4 with DP80 in the December 2024 report [2], DP144 by February 2025 [14]), and move tokens with an all-to-all. Expert parallelism and DeepSeek-V3's node-limited routing are in Section 11.6. DeepSeek's December 2024 report gives a decoding unit of 40 nodes with EP320 [2], and its February 2025 overview, describing production then, gives 18 nodes with EP144 [14]. Both phases overlap one micro-batch's computation with another's communication [2, 14].
Even fully overlapped, the all-to-all sets a floor. DeepSeek's authors count 1 byte per element for FP8 dispatch, 2 bytes for BF16 combine, 32 tokens per GPU, 9 experts per token (8 routed and 1 shared) and a hidden size of about 7K:
Over 400 Gb/s (50 GB/s) InfiniBand that is 241.92 µs per layer with two micro-batches and 14.76 ms over 61 layers, about 67 tokens/s, against 0.82 ms on a GB200 NVL72 domain (reported, idealized) [1]. For a large mixture of experts the scale-out network, not HBM, bounds the time per token.
KV is where DeepSeek-V3 is cheap. At 70,272 B per token (Section 4.5), less than a quarter of Llama 3 70B's, a sequence at DeepSeek's average of 4,989 cached tokens [14] holds 351 MB, against 2.57 GB at Llama 3 405B's 516,096 B per token (computed).
Each token costs 74 GFLOPs and adds 70,272 B of KV. Every routed expert reaches the H100 ridge only at about 9,450 tokens per step, against the 256 or so it usually sees. The network alone costs 14.76 ms per token [1]. Users saw 20–22 tokens/s, or 45–50 ms per token [14] (reported), so most of each step is computation in batches kept large to hold down cost (our reading).
Other designs put attention and experts on separate GPU pools. MegaScale-Infer reports up to 1.90x the per-GPU decode throughput of earlier systems [1014], and Step-3's authors report 4,039 tokens/s per GPU under a 50 ms per-token target against 2,324 for DeepSeek-V3 in their setup [991]. The main failure mode is imbalance: one overloaded GPU stalls the whole group, so DeepSeek runs separate load balancers for prefill, decode and experts [14].
DeepSeek's production average, DeepSeek's own profile and SGLang's reproduction on 12 nodes of 8 H100s describe the same model [1015, 14].
Table 13.3. DeepSeek-V3 throughput per node, as published (reported).
| Source | Prefill tokens/s | Decode tokens/s | Conditions |
|---|---|---|---|
| DeepSeek production, Feb 2025 | 32,206 | 14,800 | prefill excludes cache hits, decode at 4,989 tokens of KV |
| DeepSeek profile | 62,713 | 18,598 | 4K input, decode batch 128 at 4K KV |
| SGLang, default expert placement | 50,302 | 22,282 | prefill 4K input, decode batch 256 at 2K KV |
| SGLang, simulated perfect balance | 59,337 | not reported | prefill only, 4K input |
SGLang's default placement ran 20% slower than DeepSeek's profile in prefill, and perfect balance narrowed the gap to 6% [1015]. SGLang priced its run at $0.20 per million output tokens, which is a node at $2 per GPU-hour, 16 dollars over 22,300 × 3,600 tokens (computed). The numbers differ by up to 2x. Always ask whether a throughput is a profile, a production average or a reproduction.
13.7 Speculative decoding: several tokens per pass, exactly
Can a model emit several tokens per expensive forward pass and still sample exactly from its own distribution? Yes, while the hardware has compute to spare. A small-batch decode step spends its time reading weights (Section 13.2), so scoring five positions costs about as much as scoring one. So let a cheap draft model guess tokens, score them all in one target pass, keep the guesses the target agrees with and repair the first disagreement. Blockwise parallel decoding did this for greedy decoding [1016], and speculative decoding made it exact under sampling, "without any changes to the outputs" [1017, 1018].
The algorithm and why it is exact
Write for the target's next-token distribution and for the draft's. (Here and are distributions, while below still counts GPUs, and is a cost ratio, not the price of Section 13.3.) One iteration has five steps [1017]:
- Draft from , one token at a time.
- Run the target once on the prefix plus all drafts, which gives .
- Keep with probability , stopping at the first rejection.
- Resample the rejected position from the renormalized residual . If every draft survived, sample a bonus token from .
- Emit the kept drafts plus that one token, so every iteration yields at least one.
At one position, acceptance contributes . Rejection happens with probability , where (the paper's , a symbol this guide reserves), and the residual's mass is also . The two paths sum to the target:
A Monte Carlo check with 400,000 samples matched within 0.001 per token (computed). The mean acceptance rate , averaged over contexts, is one minus the expected total variation distance between and , and it is higher at low temperature [1017].
If each draft is accepted independently with probability , and one draft step costs target steps, the expected tokens per iteration and the walltime speedup are [1017]
The tokens saturate at while the cost grows linearly in , so some draft length is best.
At : and tokens per target pass. With an iteration costs target steps, so the speedups are 1.92x and 2.80x. Scanning , the best length is 4 for (1.92x) and 8 for (3.09x). At the optima fall to 2 (1.40x) and 4 (1.87x) (all computed). The better or cheaper the draft, the longer it should guess.
Published runs calibrate the inputs. Drafts about two orders of magnitude smaller than the target had below 0.05 and from 0.5 to 0.9 [1017], and a 2026 fit puts the throughput-optimal draft about 200 times smaller than the target [1019].
Table 13.4. Measured speedups with separate draft models, against the formula.
| Setup | Inputs | Measured (reported) | Formula (computed) |
|---|---|---|---|
| T5-XXL, T5-small draft, temperature 0 [1017] | , | 3.4x | 3.60x at |
| Same, temperature 1 [1017] | , | 2.6x | 2.57x at |
| T5-XXL, bigram draft [1017] | , | 1.25x | 1.25x as grows |
| Chinchilla 70B, 4B draft with 8 layers [1018] | best draft length 3 on XSum | 2-2.5x | not given |
Draft heads and multi-token prediction
A classic 7B draft for LLaMA2-Chat 70B gave only 1.88x [1020], because the draft itself is slow. Recent methods attach a small head that reads the target's own hidden states instead (table below, self-reported speedups on each authors' setup). Medusa's usual acceptance scheme relaxes the rule above, so under sampling it is not guaranteed lossless [1021].
Table 13.5. Draft heads and draft-free methods, with self-reported speedups over plain decoding.
| Method | How it drafts | Reported speedup |
|---|---|---|
| Medusa-1, Medusa-2 [1022] | Extra heads on the last hidden state, one per position ahead, verified as a tree | over 2.2x (frozen backbone), 2.3-2.8x (joint training) |
| EAGLE [1020] | Autoregressive head over the target's features, 0.99B parameters, trained in 1-2 days | 2.7-3.5x on LLaMA2-Chat 70B |
| EAGLE-2 [1023] | Draft tree grown where the head's confidence predicts acceptance | 3.05-4.26x |
| EAGLE-3 [1021] | Fuses low, middle and high features, trained on simulated multi-step drafts | 3.0-6.5x |
| Lookahead decoding [1024] | No draft: parallel guesses and an n-gram pool | up to 1.8x on MT-bench |
| 4-token prediction [335] | Heads trained during pretraining, used for self-speculation | up to 3x |
| DeepSeek-V3 MTP [2] | The training-time multi-token prediction module drafts one token, accepted 85-90% of the time | 1.8x tokens per second |
With the ceiling is , 1.85 to 1.90 tokens per target pass at 85–90% acceptance [2] (DeepSeek's ISCA paper says 80–90% [1]). The reported 1.8x sits 3–5% below the ceiling (, ), the end-to-end cost of running the module and verifying two positions (computed).
When verification stops being free
Verification scores tokens for a batch of sequences, which is free only below the ridge of about 295 tokens on an H100 [4]. Model a target step over tokens as the larger of weight bytes over bandwidth BW and FLOPs over peak :
For Llama 3 70B in BF16 on 8 H100s at short context, with , and , the speedup is 2.80x up to batch 32, 2.62x at 64, 1.42x at 128 and 0.74x at 256, crossing 1 near batch 190 (computed). Measured curves fall earlier but less steeply, because, as EAGLE-3's authors put it, "As batch sizes increase, this redundancy decreases" [1021]. In Figure 71, move and to shift the best draft length, then watch the batch curve stay flat until crosses the dashed ridge line. The 8B target adds measured points.
Method and sources
The presets take the acceptance rate, draft length and draft cost from the papers: the T5 draft costs are Leviathan et al.'s profiler estimates, and the DeepSeek-V3 draft cost is inferred from its reported 1.8x (DeepSeek-AI 2024) and is illustrative. Panel B plots the same speedup as batch grows from a step model (computed) in which one pass takes the longer of reading the BF16 weights at 3.35 TB/s and doing 2 FLOPs per parameter per token at 989.5 TFLOP/s (NVIDIA H100 specifications), so verifying b(γ + 1) tokens costs nothing extra until about 295 tokens. Against it sit EAGLE and EAGLE-3 throughput gains measured by the SGLang team on one H100 with Llama 3.1 8B and 3 drafted tokens (Li et al. 2025), which fall earlier than the model but less steeply.In the SGLang team's runs (one H100, Llama 3.1 8B Instruct, MT-Bench, chain length 3), EAGLE gave 1.40x throughput at batch 2 but 0.93x at batch 24 and 0.88x at 48. EAGLE-3, with a better draft, gave 1.81x at batch 2 and stayed between 1.32x and 1.48x from batch 16 to 64 (reported) [1021]. Speculation spends spare compute, and a busy server has little. Gate it by load.
Long contexts are the main exception, since KV reads keep decode memory-bound at large batch: MagicDec reports up to 2.51x for Llama 3.1 8B at batch 32 to 256 [1025]. Fine-grained mixture-of-experts models gain more at low batch than predicted [1026], and drafter gaps shrink under shared conditions [1027], so treat cross-paper tables as rough. Draft and target must share a tokenizer, acceptances are not independent (measure tokens per cycle directly), and "lossless" holds only up to numerics (Section 13.9).
13.8 Fewer bytes per token: quantization, KV compression and decode kernels
How few bits can weights and KV entries use before the model changes, and how do we make the remaining bytes stream at full speed? Decode time is bytes over bandwidth, so halving the bytes halves the floor. Weight-only quantization (W4A16: 4-bit weights, 16-bit activations) dequantizes inside the matmul and speeds memory-bound decode. Weight-activation quantization (W8A8) runs the matmul itself in low precision, so it also speeds compute-bound prefill and large batches. Groups of weights share bits of scale metadata, so -bit values cost
INT4 with a 16-bit scale and zero point per 128 weights is bits, MXFP4 (an 8-bit scale per 32) is 4.25, and NVFP4 (an 8-bit scale per 16) is 4.5 [1028]. Bit layouts, ranges and block scaling are in Section 2.3.
Llama 3 70B's weights are 141.1 GB in BF16, 70.6 GB in FP8 and GB at 4.25 bits. Over 8 H100s at 3.35 TB/s each, the batch-1 floor falls from ms to 2.63 ms and then about 1.40 ms, and the freed HBM holds KV for more sequences. Llama 3 405B is 811.7 GB in BF16, more than a node's 640 GB, and 405.9 GB in FP8, which fits (computed) [6, 4].
Outliers and the methods that tame them
Naive rounding, round-to-nearest (RTN) on a shared scale, fails because of outliers. At around 6.7B parameters, large-magnitude features appear in every layer, concentrated in just 6 hidden dimensions, and zeroing them raises perplexity by 600–1000% although they are about 0.1% of the features [1029]. A per-tensor scale stretched to cover them leaves few levels for everything else. The table summarizes the main fixes and 4-bit methods.
Table 13.6. Weight and activation quantization methods and their headline results (reported).
| Method | Idea | Result |
|---|---|---|
| LLM.int8() [1029] | Outlier dimensions in 16-bit, the other 99.9% in 8-bit | 8-bit weights without the outlier collapse |
| SmoothQuant [1030] | Per-channel scale moves activation difficulty into the weights, product unchanged | W8A8, up to 1.56x faster, 2x less memory |
| QuaRot [1031] | Orthogonal rotations spread outliers across channels | 4-bit Llama-2-70B within 0.47 WikiText-2 perplexity |
| GPTQ [1032] | Per layer, minimize , updating unquantized weights with second-order information | OPT-175B in about 4 GPU hours, 8.34 to 8.37 at 4 bits (RTN 10.54, 3-bit RTN ) |
| AWQ [1033] | Scale up the 1% of channels with large activations before rounding | Llama-2-70B INT4 g128: RTN 3.46, GPTQ 3.42, AWQ 3.41 against 3.32 in FP16 |
Rankings depend on the benchmark: on Arena-Hard with Llama 3.1 8B, Kurtic et al. score BF16 25.8, a tuned GPTQ 24.0 and AWQ 22.3. Over 500,000 evaluations they found FP8 W8A8 effectively lossless, tuned INT8 within 1–3%, and W4A16 recovering 99.36% of the Open LLM Leaderboard V1 average. Their advice follows the roofline: "W4A16 is the most cost-efficient for synchronous setups, while W8A8 dominates in asynchronous continuous batching" [1034]. At large batch INT4 kernels pay 20–90% runtime overhead to dequantize [1035]. In silicon, FP8 costs at least 50% more area and energy than INT8 [1036]. FP8 training recipes (scaling granularity, accumulation precision) are in Section 5.6.
BF16 Llama 3 405B needs two 8-GPU H100 machines. For FP8, Meta quantized the feed-forward layers (about half of inference compute), kept attention and the first and last layers in BF16, and capped row-wise dynamic scales at 1200, for up to 50% more prefill throughput. Without the cap, "the model occasionally produces corrupted responses even though the benchmark performance is strong", triggered by high-perplexity tokens such as dates. So Meta compared reward-model score distributions over 100,000 BF16 and FP8 responses [6]. Judge output distributions, not benchmark deltas.
Four-bit floats and the bit-width trade
An MXFP4 element is E2M1, one of 0, 0.5, 1, 1.5, 2, 3, 4 or 6, times a power-of-two scale shared by 32 elements. NVFP4 uses blocks of 16 with E4M3 scales [121]. With standard methods MXFP4 loses about 10% relative accuracy, and a format-aware GPTQ recovers 98–99% for large models [1028], so FP4 is no automatic upgrade over INT4. gpt-oss shipped its MoE weights in MXFP4 at 4.25 bits so the 120b model fits one 80 GB GPU [28]: 114.71B weights at 4.25 bits plus 2.12B at 2 bytes give 60.7 GiB, against 60.8 GiB reported (computed).
At a fixed memory budget, serve a bigger model at fewer bits? Across more than 35,000 experiments up to 176B parameters, "4-bit precision is almost universally optimal for total model bits and zero-shot accuracy" [468]. But post-training quantization hurts more the more data a model saw [458, 469], and Llama 3 8B saw about 15T tokens, roughly 1,900 per parameter (computed) [11]. Measure such models. How training and serving precision enter the scaling law is in Section 6.6. In Figure 72, compare the small 4-bit GPTQ and AWQ gaps with RTN's 3-bit collapse, then find the 8B Arena-Hard row, where AWQ keeps 86% of the BF16 score while its Open LLM Leaderboard V1 average kept 98%.
Method and sources
The second view plots Llama 3.1 Instruct scores in FP8, INT8 and 4-bit weight-only formats as a percentage of BF16, on the Open LLM Leaderboard V1 average and on Arena-Hard, with 95% confidence intervals for the GPTQ rows (Kurtic et al. 2024). Scores are as reported, and each percentage is computed as the quantized score divided by the BF16 score. Use the stepper to walk through the results one comparison at a time.Aggregate accuracy can move by 2% or less while 5% or more of answers flip [1037]. Check (1) perplexity, (2) token-level KL divergence to the unquantized model on real prompts, (3) flip rates on multiple-choice sets, (4) open-ended outputs scored by a judge or reward model, compared as distributions [6], (5) long-context tasks [1038], (6) rare tokens such as dates, numbers, code and non-English text, and (7) the same sampler and seeds for both.
Compressing the KV cache
At long context the KV cache outweighs the weights. Quantization keeps every token at lower precision: with KIVI's 2-bit scheme (table below), one 128K-token Llama 3 70B sequence shrinks from 40 GiB in BF16 to 7.53 GiB: 2-bit values plus a 16-bit scale and zero point per 32 values, about 3 bits in all, with the most recent 128 tokens kept in BF16 (computed, group size as in KIVI), and as of its 2026–09–30 release FlashMLA's decode kernel accepts only FP8 and FP4 caches [1039]. Eviction drops tokens, and dropped tokens are gone for good.
Table 13.7. KV-cache compression by quantization and by eviction or sparsity (reported).
| Method | What it keeps | Result |
|---|---|---|
| KIVI [1040] | 2-bit keys per channel (keys have outlier channels), values per token, recent 128 tokens in full precision | 2.6x less peak memory, up to 4x larger batches, 2.35-3.47x throughput |
| KVQuant [1041] | 3-bit keys and values | under 0.1 perplexity loss |
| H2O [1042] | Heavy-hitter and recent tokens | 5-10x less KV memory |
| StreamingLLM [297] | 4 attention-sink tokens plus a sliding window | stable over endless streams, no longer usable context |
| SnapKV [1043] | Positions picked per head from a window at the end of the prompt | 3.6x faster, 8.2x less memory at 16K |
| Quest [1044] | Whole cache, but reads only the most relevant pages | up to 7.03x faster attention |
| DuoAttention [1045] | Full KV only for retrieval heads | up to 2.55x (MHA) and 1.67x (GQA) less memory |
A unified benchmark found KV quantization more reliable across tasks than dropping tokens, and compression during prefill harmful [1038]. Quantize before you evict.
Kernels that stream the bytes
Fewer bytes help only if the kernel reads them at full bandwidth. FlashAttention's tiling and online softmax are explained in Section 2.4. Training kernels parallelize over batch and query blocks, so at decode a small batch leaves most of an A100's 108 SMs idle. Flash-Decoding also splits the KV sequence into chunks and merges the partial results exactly [1046]. Chunk returns its normalized output , maximum score and normalizer , and the online-softmax identity combines them [38]:
On an A100 at batch 1 and 64K context, attention fell from 2,300.6 µs to 64.4 µs [1046]. With 2 KV heads of dimension 128 the cache is B = 67.1 MB, so achieved bandwidth rose from about 29 GB/s to 1.04 TB/s (computed): same arithmetic, more SMs reading. FlashInfer serves paged and shared-prefix layouts with 29–69% lower inter-token latency than compiler backends [1047]. FlashMLA reaches up to 660 TFLOP/s on H800, and its 2026–09–30 release "removed support for the Hopper architecture" [1039], so pin kernel versions with the model.
13.9 Sampling, structured output and reproducibility
What does the decoder do with the logits, and why can the same model score differently on the same benchmark? The model emits one logit per vocabulary entry, and a sampler turns them into a token. Temperature rescales the logits, and truncation rules such as min-p decide which tokens stay eligible:
near 0 is greedy decoding, the model's own distribution, and higher flattens it. Neither extreme suits open-ended text. Beam search degenerates into bland, repetitive text, while pure sampling over-samples an unreliable tail of tens of thousands of unlikely tokens [1048]. Truncation samplers cut that tail (table below). Applying temperature before or after truncation gives different samplers, so record your engine's order.
Table 13.8. Truncation samplers.
| Sampler | Keeps |
|---|---|
| Top-k [1049] | the most likely tokens (Fan et al. used 10) |
| Top-p, nucleus [1048] | the smallest set whose probability reaches |
| Min-p [1050] | tokens above times the top token's probability |
| Top-nσ [1051] | logits within standard deviations of the maximum, stable under temperature |
| η-sampling [1052] | tokens above an entropy-dependent threshold |
Take an illustrative 1,000-token vocabulary: 10 plausible tokens with logits 5.0, 4.2, 3.9, 2.0, 1.5, 1.0, 0.5, 0, -0.5 and -1.0, and 990 junk tokens at -3. Heating the distribution inflates the junk tail, so a cumulative-mass rule must admit hundreds of junk tokens to reach its target, while a rule scaled to the top token barely moves (computed).
Table 13.9. Tokens kept by each truncation rule in the toy vocabulary (computed, illustrative logits).
| Temperature | Junk-tail mass | top-p 0.9 keeps | top-p 0.95 keeps | min-p 0.1 keeps |
|---|---|---|---|---|
| 1.0 | 14.8% | 334 | 667 | 3 |
| 1.5 | 65.7% | 850 | 925 | 4 |
Settings move scores. Greedy decoding beats sampling on most benchmarks except AlpacaEval, with math and code the most sensitive [1053]. Long reasoning models differ: greedy decoding "results in higher repetition rates and significant variability across different checkpoints", so DeepSeek-R1's authors average pass@1 over 4 to 64 samples at temperature 0.6 and top-p 0.95 [3], and Qwen3's thinking mode adds top-k 20 [198]. On multiple-choice problems, temperature from 0 to 1 made no significant difference [1054]. Min-p's authors report Mistral 7B on GSM8K at temperature 1.5 scoring 18.42% with min-p against 0.68% with top-p [1050], but a re-examination found min-p "does not surpass baseline samplers when controlling for the number of hyperparameters" [1055]. As of November 2026 the dispute is open: compare samplers with equal tuning budgets.
Structured output
To force JSON or another grammar, the engine masks every token that would break a valid prefix. Done naively that costs time proportional to the vocabulary per token [1056]: for Llama 3's 128,256 tokens, a 16 KB bitmask per sequence per step, about 4 MB at batch 256 (computed). Engines precompute most of the mask (table below). Syntax is then guaranteed but quality is not: masking distorts the distribution [1057], grammar-token misalignment can cut accuracy [1058], and JSONSchemaBench tests engines on 10K real-world schemas [1059]. Describe the format in the prompt too, and measure accuracy with and without the constraint.
Table 13.10. How constrained-decoding engines avoid rebuilding the mask (reported).
| Engine | Trick | Result |
|---|---|---|
| Outlines [1056] | Regular expression compiled to a finite-state machine with a precomputed token index | constant time per token on average |
| SGLang [1001] | Forced multi-token strings emitted in one pass | 1.6x on JSON |
| XGrammar [1060] | Context-free grammars, context-independent tokens precomputed, context-dependent ones for JSON cut from 1,134 to 120 | under 40 µs per token, up to 80x end to end against late-2024 engines |
Reproducibility
Why identical prompts at temperature 0 give different outputs (80 distinct completions out of 1,000 in Thinking Machines' test) is in Section 12.7. In serving, kernels change reduction order with batch size, and batch size follows load [848]. Batch-invariant kernels fix this at a cost, 34.35% in SGLang with CUDA graphs [959]. In RL, "the different numerics between training and inference implicitly turns our on-policy RL into off-policy RL" [848] (Section 9.6). In evaluation, BF16 greedy decoding of DeepSeek-R1-Distill-Qwen-7B varied by up to 9% in accuracy with GPU count, type and batch size [402] (Section 10.2). So fix and report every sampler setting, seeds and sample count, follow the model card for reasoning models, and use batch-invariant modes for RL rollouts and evaluation reproduction.
Why can a server prefill a 4,000-token prompt in less time than it takes to generate 100 tokens of answer?
Prefill pushes every prompt token through the model in one pass, so each weight read from HBM does thousands of multiply-adds and the pass is compute-bound. Each decode step must read every weight again to produce one token per sequence, so at small batch it is bound by memory bandwidth. On PaLM 540B with 64 TPU v4 chips, prefill cost about 0.14 ms per prompt token and decode about 28 ms per step for each sequence (computed from Pope et al.'s Table 2), a factor of about 200 in latency. In chip time per token the gap is about 3x, because each step served 64 sequences.
What is the fastest Llama 3 70B in BF16 can generate tokens for one user on 8 H100s, and what should you expect in practice?
Every decode step streams 141 GB of weights over TB/s, so the floor is about 5.3 ms per token, about 190 tokens/s (computed). Real engines reach roughly 60% of peak bandwidth at batch 1 (Databricks' measurement) and also pay tensor-parallel all-reduce latency, so expect roughly 100 to 130 tokens/s. That range is a computed estimate, not a measurement.
You disaggregate Llama 3 70B and send an 8,192-token prompt's KV cache from the prefill node to the decode node over one 400 Gb/s NIC. Is the transfer a bottleneck?
The cache is B = 2.68 GB, about 54 ms at 50 GB/s, against roughly 390 ms of prefill on 8 H100s at 40% MFU, so about 14% (computed). The ratio barely depends on prompt length (attention makes it fall slowly), because the bytes and the prefill FLOPs both grow linearly with it. On eight NICs it is under 2%, and sending layer by layer hides most of the rest. DistServe measured under 0.1% of total latency and Splitwise 0.8%.
A draft model has acceptance rate 0.8 and each draft step costs 5% of a target step. Which draft length maximizes the speedup, and why not draft 20 tokens?
Eight, for about 3.1x (computed from ). Each extra guess adds to the cost of an iteration but only expected tokens, which shrinks geometrically. At an iteration costs 2 target steps and yields 4.95 tokens on average, about 2.5x. At large batch the best length shrinks further, because verification stops being free.
Your 4-bit model matches the BF16 model within 0.3 points on MMLU. Is it safe to ship?
Not yet. Equal averages can hide 5% or more of answers flipping between right and wrong (Dutta et al.), and Meta's FP8 Llama 3 405B produced corrupted responses on high-perplexity tokens such as dates while benchmark scores looked fine. Check token-level KL divergence against the BF16 model, flip rates, open-ended quality scored by a judge or reward model as a distribution, long-context tasks and rare tokens, with the same sampler and seeds for both models.
- Prefill is compute-bound and decode is memory-bound. A decode step must stream every weight and every sequence's KV cache from HBM, so its floor is bytes over bandwidth: about 5.3 ms per token for Llama 3 70B in BF16 on 8 H100s.
- Batching amortizes weight reads, not KV reads. With GQA and contexts above about 1.5K tokens, Llama 3 70B decode on H100s never becomes compute-bound, and KV memory, not FLOPs, caps concurrency (about 150 sequences of 8K tokens on one node).
- Measure TTFT and TPOT as distributions and goodput at a stated SLO, not average tokens/s. Output tokens cost several times more than input tokens (about 2–6x on the anchor, 3–4x in DeepSeek's prices) because decode runs at low utilization, holds KV memory and has its batch capped by the latency target.
- Continuous batching and paged KV memory are the base of every modern engine: they recover the half of decode slots that static batching idles and the 60–80% of KV memory that maximum-length reservation wasted. Prefix caching skips prefill for shared prefixes (56% of DeepSeek's input tokens).
- Prefill and decode interfere. Chunked prefill bounds the stall, disaggregation removes it, and the KV transfer costs a nearly fixed fraction of prefill time that barely depends on prompt length (about 14% on one 400 Gb/s link for Llama 3 70B, under 2% on eight).
- Mixture-of-experts models are cheap in FLOPs but expensive in memory and network. Every expert needs hundreds of tokens per step, so DeepSeek serves V3 on units of tens to hundreds of GPUs with expert parallelism, and the all-to-all alone sets a TPOT floor of about 15 ms on 400 Gb/s InfiniBand.
- Speculative decoding is exact and yields tokens per target pass, but only while verification is free. It pays most at low batch and long context and can slow a busy server, so tune or gate it by load.
- Four-bit weights with a good method (GPTQ, AWQ) and FP8 are usually safe, and quantizing KV (KIVI, KVQuant) is safer than evicting tokens, but averages hide changed answers: evaluate with flips, KL divergence, open-ended and rare-token tests. Sampling settings and batch-dependent kernels also change results, so fix and report them.
14. Sandboxes and environments: where models act
The system that executes model-written code is both a security boundary and part of the reward function. Its isolation, resource limits, state and grader determine which actions are possible and which outcomes count as success. The fleet also has to keep pace with the sampler.
Why did the program that runs a model's code, commands and clicks become core infrastructure for evaluation and RL? An evaluation runs code once per sample, so the risk is accidental damage and leakage. RL runs it millions of times against an optimizer, so anything reachable that changes the reward (tests, grader files, the harness's control channel) becomes part of what the policy optimizes. Agents add state: on DeepSeek's DSec platform, median sandbox lifetimes were 17.4 minutes for containers and 15.5 minutes for microVMs, and p99 lifetimes exceeded three hours (reported) [10].
The Codex paper behind HumanEval aimed to stop generated programs from "modifying, gaining persistence on, accessing sensitive resources on, or exfiltrating data from a host or network", using gVisor and eBPF (in-kernel packet filter) firewall rules [699]. Its public harness warns: "This function is NOT a security sandbox." [1061]. In-process patching guards the test against careless code, and only an operating-system boundary guards the host.
In practice, the AI Scientist "attempted to edit the code to extend the time limit arbitrarily" [1062], an o1 capture-the-flag (CTF) evaluation left the Docker daemon API reachable to the model [1063], and models have been seen to "examine git history to find answers to a coding test" [1064]. None of this needed intent, only an optimizer meeting a weak boundary.
A sandbox is the security boundary around unreviewed code and the body of the reward function. The optimizer finds a hole in either: a reachable daemon API, or a grader that reads only the exit code (Section 14.6). Design the two together.
Sections 14.1 to 14.3 build the boundary, 14.4 to 14.6 the grader, and 14.7 and 14.8 the fleet. The examples are the SWE-bench Verified harness [814, 16], DeepSWE (4,500 R2E-Gym tasks, six days on 64 H100 GPUs, reported) [9], and a Firecracker fleet at Kimi K2's scale of over 10,000 concurrent sandboxes [72]. The running examples and the notation are introduced in Section 0.3.
Figure 73 walks one SWE-bench Verified episode through eight steps, with the grade outside the isolation boundary. Step through the failure points (shown by default), then switch to RL mode to see which ones corrupt a reward.
Method and sources
Steps 2 to 4 repeat until the agent submits or hits a cap, and only the patch crosses from the sandbox to the grader. For each step the panel lists what happens, the failures documented in public reports (red badges count them) and the control that closes each one. Numbers are as reported by the sources, except the 5.1% false-fail rate, which this guide computes from an illustrative 0.1% per-test flake rate over 52 tests. Failure examples and controls come from the SWE-bench harness (Jimenez et al., 2023), SWE-agent (Yang et al., 2024), SWE-Gym (Pan et al., 2024), the Sandman and DSec sandbox platforms (Yan et al., 2026, and Huang et al., 2026), Inspect's sandboxing documentation (UK AI Security Institute, 2025), the Linux cgroup v2 documentation (Heo, 2015), NIST SP 800–190 (Souppaya et al., 2017), Gymnasium (Towers et al., 2024), ImpossibleBench (Zhong et al., 2025), PatchDiff (Wang et al., 2025), the o1 system card (OpenAI, 2024), Baker et al. (2025), METR (Von Arx et al., 2025), DeepSWE (Luo et al., 2025) and GLM-5 (GLM-5 Team, 2026).One default runs through the chapter: treat model-generated code as hostile when you design the boundary, and as careless when you read the logs.
14.1 What can go wrong, and what a container is made of
What exactly are we defending against, and which Linux mechanism does which job? Table 14.1 lists five threat classes, each with a public example and the controls that Section 14.3 sets.
Table 14.1. Five ways a sandbox goes wrong, with one public example each.
| Threat class | Public example | Control family |
|---|---|---|
| Resource exhaustion | In DSec, captured output from one runaway command "accumulated tens of gigabytes of data on storage" [10]. The AI Scientist saved a checkpoint every step, which "took up nearly a terabyte of storage" [1062]. | cgroup limits, output caps, disk quotas |
| Unwanted network access | Run directly on a research laptop, every SandboxEval vector for remote command-and-control or data exfiltration succeeded [1065]. | No network by default, egress allowlist |
| Persistence and host tampering | In DSec an ordinary agent command triggered a host kernel bug and crashed the kernel [10]. Kimi K3 saw "several kernel panics and deadlocks caused by unintended agent operations" in containers [1066] (case study in Section 14.3). | Read-only root, fresh sandbox per episode, a second kernel |
| Data exposure | Even on a hardened platform (Dyff), environment variables exposed "sensitive fields such as keys" [1065]. | No secrets inside, scoped tokens |
| Tampering with the grader or harness | DSec agents forged requests to the harness's command daemon [10]. | Grader outside the sandbox, protected control plane |
"The model is not a security boundary. Every control must hold if the agent is fully adversary-controlled." [1067]. An agent with private data, untrusted content and external communication (the "lethal trifecta") can be tricked into "sending it to that attacker", so remove one leg, usually egress [1068]. And "A sandbox is not a substitute for a secure architecture." [1069].
The mental model: a Linux container is an ordinary process tree that the kernel gives a private view (namespaces), meters (control groups, or cgroups) and restricts (capabilities, seccomp, Linux Security Modules). All containers on a host share one kernel, which drives Section 14.2. Table 14.2 gives each mechanism's job.
Table 14.2. The Linux mechanisms inside a container, and the defaults that matter.
| Mechanism | Job | What to know |
|---|---|---|
| Namespaces | A private mount tree, process table, network stack and user IDs. "One use of namespaces is to implement containers." [1070] | "No network" is an empty network namespace. |
| cgroups v2 | Meter memory, processes, CPU and I/O [1071] | memory.max invokes the out-of-memory (OOM) killer in the group. memory.oom.group kills the whole group "to avoid partial kills". pids.max exists because "a fork bomb is likely to exhaust the number of tasks before hitting memory restrictions" [1071]. |
| Capabilities | Split root's powers into units | Docker "drops all capabilities except those needed" [1072]. The man page calls CAP_SYS_ADMIN "the overloaded" capability, close to full root [1073]. The Kubernetes restricted profile drops ALL [1074]. |
| seccomp-bpf | A small filter program run on every system call, inherited by children | The man page calls allow-lists "more robust and simple" [1075]. Docker's default profile "disables around 44 system calls out of 300+" and returns an error for them (SCMP_ACT_ERRNO) [1076]. |
| User namespaces | Root inside maps to an unprivileged user outside. Unprivileged processes can create them since Linux 3.8 [1077]. | Kubernetes reports several HIGH or CRITICAL vulnerabilities that were not exploitable with them on [1078]. |
| Linux Security Modules (LSMs) | Path and resource rules the process cannot lift | DSec's AppArmor rules bind agent processes "even when they run as root inside the sandbox" [10]. Landlock lets a process restrict itself [1079], complementary to seccomp [1080]. |
| OCI runtime spec | One config.json holds all of the above | maskedPaths hide paths "so that they cannot be read" [1081]. runc, gVisor's runsc and Kata implement the same interface, so runtimes swap under Docker or Kubernetes [1082, 1083, 1084]. |
Two lessons sit outside the table. The runtime daemon is attack surface: "only trusted users should be allowed to control your Docker daemon" [1072], so keep its socket and API out of reach. And bespoke filters are hard to get right: seven experienced developers sandboxing one program "each came to different solutions" [1085]. Prefer a maintained profile plus a stronger boundary.
A challenge container failed to start. The model scanned the network, found that "the Docker daemon API running on the evaluation host VM was accessible due to a misconfiguration", and used it to start the challenge container in a way that revealed the flag [1063]. The infrastructure "does not rely on the Docker container-to-host isolation or the virtual machine boundary for security", so outer layers held [1063]. A runtime API is a host-root credential [1072], evaluation networks should deny by default, and in RL any reachable control plane is a path to reward. Policy-level cyber evaluations are in Section 10.8.
14.2 The isolation spectrum: containers, gVisor, microVMs and WebAssembly
If namespaces and seccomp are so flexible, why do serious deployments add gVisor or a virtual machine, and what does each option cost in start-up time, memory and compatibility? Because every container on a host shares one kernel. NIST says container isolation "is not as high as that provided by hypervisors" [1086], and "a single kernel vulnerability is sufficient for escape" [1067]. Tighter filters do not help: "A trivial Linux application requires 15 unique syscalls", but QEMU "can require up to 270" [1087], so a narrow filter breaks real workloads.
The two ways out are a second kernel in software (gVisor) or moving "the security-critical interface from the OS boundary to a boundary supported in hardware" [1087] (microVMs, Kata, full VMs). Table 14.3 is a crude proxy for how much host kernel each boundary may call.
Table 14.3. Host system calls the boundary process may make, as a share of the syscall table (computed proxy). The shares use different processes and denominators, and count is not exploitability: the Firecracker paper reports Li et al.'s finding that "only 3% of kernel bugs are found in frequently-used code paths" [1087], so which paths are reachable matters more than how many.
| Boundary | Process that calls the host | Reachable host calls | Share |
|---|---|---|---|
| Docker default seccomp | The container's own processes | About 256 of 300+ (44 blocked) [1076] | about 85% |
| gVisor (2019) | The Sentry | 55 host calls implement 211 of 319 Linux calls [1088] | 55 / 319 = 17% |
| Firecracker jailer | The VMM | 24 syscalls with argument filtering, plus 30 ioctls [1087] | 24 / 319 = 7.5% |
gVisor: a kernel in user space
gVisor "is an application kernel that implements a Linux-like interface", written in Go and run in user space, with a Gofer process that opens files for it [1083]. In 2019, simple system calls were at least 2.2 times slower on gVisor than in ordinary containers, and opening and closing files on an external tmpfs was 216 times slower [1088]. Container setup plus teardown, run one at a time, took 1.014 s with runc and 1.117 s with gVisor on KVM in the same study [1088]. CPU and memory work cost nothing extra [1089], so file-heavy test suites pay.
Three 2023 changes target the first two numbers. Systrap replaced ptrace as the default platform in mid-2023 [1090], directfs became the default in runsc and made stat(2) more than twice as fast [1091], and the rootfs overlay, also now the default, halved the sandboxing overhead of one abseil build [1092]. This guide therefore reads the 2019 system-call and file-access ratios as likely upper bounds for current gVisor (this guide's inference). No cited source re-measures the lifecycle times, so 1.117 s stays a 2019 number.
For serial, independent file operations,
Open plus close took 2.40 µs under runc, 28.4 µs on gVisor's internal tmpfs and 518 µs on an external tmpfs through the Gofer (reported, 2019) [1088]. A test run that opens and closes 50,000 files (illustrative) spends under runc. The internal tmpfs adds and the Gofer path (computed). Against a 60 s reward timeout, that separates a valid score from a spurious timeout. Since directfs, measure your own suite as .
Firecracker and microVMs
Firecracker is a virtual machine monitor (VMM) with "96% fewer lines than QEMU", confined by a jailer (Table 14.3) [1087]. Its specification promises at most 125 ms from the InstanceStart API call to the start of the guest's /sbin/init, measured with a minimal kernel and root file system and the serial console disabled [1093]. The 2020 paper reports creation of up to 150 microVMs per second per host and a measured VMM memory overhead of about 3 MB, against about 13 MB for Cloud Hypervisor and about 131 MB for QEMU [1087]. Real stacks are slower. In AWS Lambda, booting a minimal kernel with a few userspace daemons and network setup takes about 200 ms [1094], and booting Firecracker inside production frameworks such as containerd or OpenNebula took 700–1,300 ms in one 2021 measurement [1095].
Start-up matters relative to the work. With one start per life, the share of a sandbox's life spent starting is
A 125 ms boot before a 60 s agent episode is (computed). A 0.5 s code reward behind runc's 1.014 s create plus destroy (2019) is , and a 4 ms snapshot restore [1094] makes it (computed). In Figure 74, slide the work per sandbox and watch the share beside each boundary: for sub-second rewards, snapshots matter more than the boundary.
Method and sources
Hollow diamonds mark 2019 create-plus-destroy times, a longer interval than start-up alone. The group-by toggle regroups 24 per-sandbox measurements, and optionally two whole bursts, by what dominates them, and the second tab shows a computed proxy for host attack surface from reported syscall counts. Every number keeps the setting it was measured in. Sources are the Firecracker paper and specification (Agache et al., 2020), Brooker et al. (2021), Ustiugov et al. (2021), the gVisor case study (Young et al., 2019, measured before gVisor's 2023 changes), Faasm (Shillaker and Pietzuch, 2020), Slacker (Harter et al., 2016), Kimi k1.5 (2025) and Kimi K3 (2026), DeltaBox (Dong et al., 2026), Sandman (Yan et al., 2026), DSec (Huang et al., 2026), rStar2-Agent (Shang et al., 2025) and Docker's seccomp documentation.Kata, full VMs and language sandboxes
Kata Containers runs each pod in a lightweight VM "as a second layer of defence" [1084], and the Kubernetes agent-sandbox project delegates to gVisor or Kata [1096]. No source we read measures Kata end to end. Full VMs serve GUIs and computer use. At the other end, a WebAssembly (Wasm) module "starts with no ambient authority" [1097], and Faasm's Wasm-based Proto-Faaslets restore "in hundreds of microseconds" [1098], but Wasm code ran 45–55% slower in 2019 browsers [1099]. Process tools such as bubblewrap are kits, not policies: it "is not a complete, ready-made sandbox" [1100, 1101]. For short code rewards at RL scale, keep the second boundary and pay its start-up once: reuse precreated workers inside gVisor, or restore microVMs from a snapshot, with the network off. DSec runs short function calls in reusable precreated containers [10].
In Table 14.4, reference harnesses default to plain Docker for reproducibility, while teams running strong models at scale add a second boundary and a network policy [1066, 10, 1063]. DSec names the trade: "stronger isolation and more complete system functionality usually come with higher startup latency and resource overhead" [10].
Table 14.4. Isolation in public harnesses and platforms, as of November 2026. A dash means the sources read do not say.
| Harness or platform | Isolation | Network |
|---|---|---|
| HumanEval reference harness | Python subprocess, guard function and timeout, "NOT a security sandbox" [1061] | Not restricted |
| Codex runs (2021) | gVisor [699] | eBPF firewall, experiment control only |
| SWE-bench harness | Docker: about 60 environment images plus per-instance images, about 2,000 GB to cache all of them by the documentation's count (reported) [1102]. Section 14.5 compares estimates | - |
| MLE-bench | Docker with the sysbox runtime [824] | - |
| Inspect (UK AISI) | Docker by default [1103] | network_mode: none |
| Dyff (tested by SandboxEval) | gVisor runtime class [1065] | Deny-all NetworkPolicy |
| DSec (2026) | Containers and Firecracker microVMs "dominate both instance count and resource consumption" [10] | Per-sandbox eBPF allowlists |
| Sandman (2026) | Model code runs as root in runc containers that share the node's kernel, with no seccomp profile and no claim of protection against a malicious co-tenant [1104] | - |
| Kimi K3 (2026) | Moved to Firecracker microVMs after kernel panics and deadlocks in containers [1066] | - |
| claude.ai code execution | gVisor container on isolated infrastructure [1064] | - |
14.3 Hardening: limits, egress, snapshots and a checklist
Given a boundary, which settings make it safe enough for model-generated code at RL scale, and how do fast resets from snapshots go wrong? Start with limits and caps. Kubernetes enforces memory limits "with out of memory (OOM) kills" and CPU limits "by CPU throttling" [1105]. Inspect caps file reads at 100 MB and execution output at 10 MB by default [1103], and DSec's runaway output shows why the cap belongs at capture time [10].
Timeouts belong outside the sandbox, since the AI Scientist tried to extend its own [1062], and a Kubernetes Job's activeDeadlineSeconds holds "no matter how many Pods are created" [1106]. Derive it from the CPU budget. The cgroup v2 file cpu.max grants MAX microseconds of CPU per PERIOD [1071], so with cores and CPU-seconds of work,
With runnable threads the tighter bound is . A suite needing 120 CPU-seconds (illustrative) needs at least 60 s under 200000 100000 (2 cores) and 240 s under 50000 100000 (0.5 cores) (computed). Otherwise a CPU limit looks like a wrong answer, which in RL is reward noise, so record why each episode ended (Section 14.8).
The network starts closed, as in Inspect, which "sets network_mode: none" [1103]. If a task needs the network, use per-sandbox eBPF allowlists by IP address, port and protocol [10] or an outside proxy, and for RL prefer pinned local mirrors. Each allowlist entry is "a capability grant" [1064]. In one 2026 report a planted key sent workspace files out through an allowed API domain: "The sandbox worked perfectly, and yet the data was exfiltrated." [1064]. Users there approved roughly 93% of permission prompts and grew less attentive as prompts piled up, so per-action approval is a weak control [1064].
Keep the grader and control plane out of reach: "Final-output checks alone cannot reliably establish whether the agent solved the task as intended." [10]. Grade the artifact in a fresh container (Section 14.4), mask sensitive paths [1081], mount tests read-only [1107], and put LSM rules on harness logs and sockets [10]. Audit glue code, since "the weakest layer is the one you built yourself" [1064]. Log every command, exit status and network attempt, since Section 14.6 finds reward hacks in such logs. Figure 75 there maps each threat to its layer.
Snapshots: fast resets and the uniqueness pitfall
Snapshots make resets cheap. A Firecracker restore maps guest memory copy-on-write [1108] and "can take as little as 4ms" [1094]. Firecracker's documentation considers resuming execution from the same snapshot state more than once insecure, because identifiers, random numbers, seeds, the entropy pool and cryptographic tokens may no longer be unique [1108]. With the VMGenID device, guests running Linux 5.18 or later reseed their in-kernel pseudo-random number generator on resume, so user-space code that asks the kernel for randomness after resume is safe, but unique identifiers, cached random numbers and tokens already in memory are still replicated across clones [1108, 1094].
Sixteen microVMs restored from one snapshot start a GRPO group (Section 9.3), each making a version-4 UUID trace ID. Among fresh UUIDs there are about pairs, each colliding with probability , so
while for two clones drawing from a user-space generator whose state was in the snapshot
A million freshly generated version-4 UUIDs (122 random bits each) collide with probability about (computed). Clones that draw from a user-space generator whose state was captured in the snapshot produce the same UUID sequence, so they collide with certainty (computed): all 16 traces merge. Reseed after restore, or draw IDs from the kernel.
RL adds a tension no source we found addresses: a GRPO group wants identical starting environments, security wants unique clones. Keep environment state identical, reseed randomness, log seeds and never snapshot credentials. Table 14.5 collects the defaults.
Table 14.5. A hardening checklist, roughly in order of impact.
| # | Control | Source |
|---|---|---|
| 1 | Choose the boundary by risk: "Only group containers with the same purpose, sensitivity, and threat posture on a single host OS kernel". For model-generated code at RL scale, gVisor or a microVM. | [1086] |
| 2 | No network by default, then allowlists reviewed as capability grants | [1103, 1064] |
| 3 | Read-only root filesystem | [1086] |
| 4 | Non-root, ALL capabilities dropped, user namespaces on | [1074, 1078] |
| 5 | At least the runtime's default seccomp profile | [1086] |
| 6 | Limits on memory (with memory.oom.group), processes, CPU, I/O and captured output | [1071, 1103] |
| 7 | Wall-clock timeouts enforced from outside, killing the whole sandbox | [1106] |
| 8 | No secrets inside (SandboxEval found keys in environment variables even on hardened Dyff) | [1065] |
| 9 | Runtime API unreachable, LSM rules on harness logs and sockets | [1072, 10] |
| 10 | A separate grader that reads only the artifact (Section 14.4 and Section 14.6) | [10] |
| 11 | Fresh state per episode, or snapshot restores with reseeding | [1108] |
| 12 | Test the sandbox itself, as SandboxEval's 51 properties do, and re-test after every runtime or image change | [1065] |
At over 380,000 concurrent sandboxes (reported), agents searched platform files, forged requests to the harness's command daemon and read its logs. An ordinary recursive search read a /proc file that triggered a kernel bug and crashed the kernel, and one command's captured output filled storage with tens of gigabytes [10]. DSec added AppArmor rules on logs and control sockets and per-sandbox eBPF allowlists [10]. The fixes: mask /proc paths, cap captured output, and use a separate kernel where one crash would hit co-tenants. Kimi K3 moved to microVMs after "several kernel panics and deadlocks caused by unintended agent operations" [1066].
14.4 Inside a harness: SWE-bench as the reference design
How do you turn "fix this GitHub issue" into a reward a machine can compute, and which design decisions make that reward hard to fake? A harness owns the sandbox, runs the model's actions and computes the score. SWE-Gym, SWE-smith and SWE-rebench all grade with SWE-bench-style fail-to-pass tests (Section 14.5), so we take SWE-bench apart [723, 1109, 1110].
The environment interface
Gym gave every environment two methods, reset() and step(action) [1111]. Gymnasium split its done flag into terminated (the task ended) and truncated, which also covers an environment that "crashes or times out for reasons unrelated to the agent's behaviour" [1112]. An image-pull timeout is a truncation, not a failed task. Score it 0 and you punish the policy for the fleet's bugs. Inspect marks such samples as errors instead [1103]. Keep them out of the gradient and alert on their rate.
The agent runs a ReAct loop of reasoning, action and observation [720], and OpenHands runs each session in its own Docker sandbox [1113]. The Model Context Protocol (MCP) standardizes tool calls over JSON-RPC 2.0 and warns that tools "represent arbitrary code execution" [1114, 1115]. It is an interface, not an isolation layer (Section 14.2).
How SWE-bench builds and grades a task
SWE-bench keeps merged pull requests from 12 Python repositories that have at least one test flipping from fail to pass under the reference fix, 2,294 tasks in all. FAIL_TO_PASS tests fail before the fix and pass after it. PASS_TO_PASS tests, a median of 51 per task, pass both times. A task is resolved only if every listed test passes, so fixing the issue while breaking an old test ("Breaking Resolved") fails [814]. The Docker harness stacks a base image, about 60 environment images and one image per task, about 2,000 GB cached by the documentation's count [1102] (Section 14.5 compares estimates). Grading runs in six steps [814, 1116]:
- Start a fresh container from the task image at the base commit.
- Run the install command.
- Apply the model's patch.
- Reset the test files to the base commit and apply the hidden test patch, so any edits the patch made to those tests are overwritten.
- Run the tests and parse a status for each one.
- Compare with both lists. "If a test is missing or has a non-pass status, it is considered a fail status" [814].
Three decisions make this reward hard to fake, and Section 14.6 meets the hack each one blocks. The agent never sees the tests [16]. Grading runs in a fresh container, so only the patch survives [1116]. And the grader reads per-test status, never the exit code.
The scaffold (the tools and prompts between model and shell) is part of the environment. SWE-agent's interface resolved 12.47% of SWE-bench against 3.8% for the best earlier system [1117], and across leaderboard submissions GPT-4's SWE-bench Lite score ranged from 2.7% with an early retrieval-based scaffold to 28.3% with CodeR [16]. Report the scaffold with every score.
Cleaning the signal: SWE-bench Verified
Automatic construction lets unfair tasks in. For SWE-bench Verified, developers labeled each sampled task three times and kept the highest-severity label, so one flag removed a task. The authors call this "likely to be overzealous" [16].
Table 14.6. How SWE-bench Verified was built, and what it still is (reported).
| Step or property | Value |
|---|---|
| Annotators, tasks annotated out of the test set [16, 814] | 93, 1,699 of 2,294 |
| Flagged underspecified, flagged for tests that may reject valid solutions [16] | 38.3%, 61.1% |
| Filtered in total, tasks kept [16] | 68.3%, 500 |
| GPT-4o, original SWE-bench vs Verified [16] | 16% vs 33.2% |
| Share of issues from Django, tasks rated under an hour (39% + 52%) [1118] | nearly half, 91% |
| Tasks still flawed, Epoch's estimate [1118] | 5-10% |
tasks survive and 500 are kept, 29.4% of those annotated and 21.8% of the test set (computed). If each annotator flags a fine task with probability , it survives only if all three decline, so
27.1% at and 48.8% at (illustrative , computed), hence overzealous. A 50% score on 500 tasks has standard error , or 2.24 points, a 95% interval of about (computed), so single-run gaps of 2–3 points are noise. Error bars and paired comparisons for benchmark scores are derived in Section 10.4. If Epoch's 5–10% is unsolvable, the ceiling is 90–95% (computed).
14.5 Environments at training scale: gyms, synthetic tasks and computer-use worlds
RL needs thousands of executable tasks with a reward. Where do they come from, what does each pipeline trade away, and how do you reset a world that is not a git repository? A benchmark is not a gym. SWE-bench's training split has patches but lacks "executable environments and reward signals" [723]. Each pipeline below adds them at a different price.
Table 14.7. Five ways to build software-engineering training environments, each with its main trade-off (reported).
| Pipeline | Tasks | Build cost and storage | Trade-off |
|---|---|---|---|
| SWE-Gym (2024): real issues, one image per task [723] | 2,438 from 11 repos | about 200 human hours, 10,000 CPU-core hours, 6 TB of images | high fidelity, storage grows with every task |
| SWE-smith (2025): synthetic bugs, one image per repo [1109] | 50k from 128 repos | 125 images, 290.54 GB, tests capped at two minutes | no hidden tests, so SWE-bench stays the evaluation set |
| R2E-Gym (2025): mined commits, back-translated issues [725, 1109] | more than 8.1K | a 4.6k-task subset needs 4 TB | generated tests are weakly discriminative |
| SWE-rebench (2025): an LLM automates installs [1110] | 21,336 from 3,468 repos | works in 31% of repos, versions pinned at build time | automated labels, no human screen |
| SWE-RL (2025): no execution [724] | - | reward is difflib similarity to the oracle patch, -1 for bad format | cheap and immune to test tampering, but rewards resemblance. 41.0% on Verified |
Two findings carry into Section 14.6. Used to pick the best of many SWE-bench Verified trajectories, execution-based and execution-free verifiers each saturate around 42–43% while a hybrid reaches 51%, and for most problems fewer than 20% of generated tests tell correct patches from incorrect ones [725]. And flawed tasks produce trajectories that "appear as failures but are actually due to task imperfections" [1110].
Published footprints for the SWE-bench images disagree. The harness documentation says about 2,000 GB [1102] and SWE-smith counts 1.2 TB for the released images [1109]. Epoch sums 3,129 GiB image by image, 684 GiB with shared layers stored once, and 67 GiB after rebuilding the images to share more layers [1119]. Taking SWE-smith's 1.2 TB, that is 0.52 GB per task. SWE-smith's 290.54 GB is 2.32 GB per image but 5.8 MB per task, and its "500x" saving is the top of a 172x-516x range (computed from its 50–150 TB estimate for per-task images, against 290.54 GB. Its Table 2 rounds the total to 295 GB, which gives 169x-508x). With its rebuilt images Epoch ran Verified in 62 minutes on one 32-core VM [1119]. Per-repository images save about 100x but tie tasks to one snapshot. Section 14.7 moves the bytes.
Defaults: share images per repository snapshot, require a passing reference and a failing empty patch for every task, pin versions at build time [1110], and keep a held-out set with hidden tests for evaluation.
Worlds that are not repositories
Web, desktop and API worlds need their own isolation, reset and grading, as Table 14.8 shows.
Table 14.8. Non-repository environments: how each is isolated, reset and graded (reported).
| Environment | Isolation and reset | Grader | Scale and results |
|---|---|---|---|
| WebArena (2023) [822] | self-hosted web apps in Docker, reset scripts | programmatic checks | 812 tasks, GPT-4 agent 14.41% vs humans 78.24% |
| OSWorld (2024) [821] | full Ubuntu VMs reset from snapshots | 134 evaluation functions | 369 tasks, best model 12.24% vs humans over 72.36%, 15-step cap |
| BrowserGym (2024) [1120] | one harness over many web benchmarks | per benchmark | shared backends cap (Visual)WebArena at 2-4 parallel tasks |
| AppWorld (2024) [1121] | 9 apps and 457 APIs over a controlled database | state-based tests, 8 per task on average | 750 tasks |
| tau-bench (2024) [779] | retail and airline databases behind API tools | final database against the goal | 115 retail and 50 airline tasks, a language model plays the user |
| Terminal-Bench 2.0 (2025) [815] | one container per task | tests on the final container state | 89 tasks kept from 229, 32-100 containers in parallel |
A git checkout resets with one command. Other worlds need snapshots, which restore a whole machine, or scripts, which rebuild what a task touched. Shared backends cap parallelism, so give each episode its own. Pin the clock with the data, or dated tasks expire. Live websites rot fastest: changed pages caused a 28% underestimate on OSWorld's Chrome tasks [818], and fixing 300+ reported issues took about ten people two months. Their lesson: "providing reliable rewards consumes more human resources than we imagined" [1122].
Terminal-Bench publishes the clearest public recipe. Tests pass if and only if the end state is acceptable, an oracle solution passes, and no shortcut exists that real work lacks. CI rejects images that contain tests or oracles, a no-op agent must fail, and an exploit agent hunts for cheats, at about three reviewer-hours per task [815]. Even so, of the 125 Terminal-Bench 3 tasks no agent solved honestly, only 78 survived as certified-unsolved candidates. The other 47 included 14 with broken oracles, 8 dominated by infrastructure failures, 4 passable only through a verifier bypass and 21 whose solvability could not be certified [1123].
14.6 Verifiers and reward hacking: when the grader is the attack surface
The grader is the reward function. How does it fail, how do policies exploit it, and which controls close each hole? In evaluation a grader bug misstates one score. In RL an optimizer applies it millions of times and searches for exactly the cases where grader and intent disagree.
Three ways a grader is wrong
False negatives score correct work 0. False positives score wrong work 1. Tampering, where the agent changes the grader or its inputs, is the third kind. Audits find the first two everywhere, misstating capability by up to 100% in relative terms [818].
Table 14.9. Measured grader errors (reported).
| Error | Benchmark | Finding |
|---|---|---|
| False negative | SWE-bench [16] | 61.1% of annotated tasks flagged for tests that may reject valid fixes |
| False negative | OSWorld [818] | website drift, 28% underestimate on Chrome tasks |
| False positive | SWE-bench [1124] | 7.8% of plausible patches wrong (4.5 points of resolution rate), 29.6% behave differently from the reference |
| False positive | SWE-bench, an earlier model's passes [1125] | solution in the issue text for 32.67%, wrong or incomplete changes for 31.08% |
| False positive | tau-bench [818] | listing every answer inflates by 40%, a do-nothing agent passes 38% of airline tasks |
| False positive | SWE-Lancer, WebArena, KernelBench [818] | 100% possible without solving, string matching inflates by 5.2%, answers left in GPU memory |
Grader noise, in numbers
A flaky test passes and fails on the same code [1126]. If each of tests flakes to failure independently with probability , a correct patch passes with probability , so it is graded wrong with probability
With one FAIL_TO_PASS test plus SWE-bench's median 51 others, [814]. At that gives 5.07%, at it gives 40.7% (illustrative , computed). Ten clean reruns of the reference expose a 0.1% flake with probability (computed), so reruns catch only frequent flakes.
Table 14.10. With 52 tests, a 1% per-test flake rate fails 41% of correct patches and, with no false positives, cuts the learning signal by 41%. Share of correct patches graded wrong, by flake rate and tests per task (illustrative flake rates, computed).
| Flake rate per test | 1 test | 8 tests | 52 tests | 200 tests | 500 tests |
|---|---|---|---|---|---|
| 0.01% | 0.01% | 0.08% | 0.52% | 1.98% | 4.88% |
| 0.1% | 0.10% | 0.80% | 5.07% | 18.1% | 39.4% |
| 1% | 1.00% | 7.73% | 40.7% | 86.6% | 99.3% |
How does noise reach the gradient? Let be the policy's true success probability and the binary reward. The grader outputs 1 with probability on correct work and on wrong work, so
At , and this gives 0.520, against 0.5195 in a 200,000-sample simulation, with slope 0.70 (illustrative, computed). Noise that ignores the policy rescales the expected signal and adds variance. It slows learning but does not change which policy is best. A false-positive rate the policy can raise is reward hacking. If a share of truly failed episodes pass by hacking, measured success is
tau-bench's pass^k is "the chance that all i.i.d. task trials are successful, averaged across tasks". GPT-4o fell from about 61% at pass^1 to about 25% at pass^8 on retail [779], not the identical tasks would give (computed), so reliability is set by which tasks are always solved. pass@k is Section 10.3.
With , the 52-test false-fail rates give a slope of about 0.95 at 0.1% flakes per test, so learning barely slows, and about 0.59 at 1% (illustrative , computed). In group-relative methods a correct but unlucky trajectory then gets a negative advantage (Section 9.3). If 5% of truly failed episodes pass by hacking, a true 20% is measured as (illustrative, computed). Re-grading a random sample with hidden tests estimates that bias cheaply.
The public record of reward hacking
Specification gaming "satisfies the literal specification of an objective without achieving the intended outcome" [730]. Reward hacking is its RL form [1127, 1128], and it can appear abruptly as capability grows [731].
Table 14.11. Documented reward hacks in sandboxed tasks, the hole each used, and the control that closes it (category level).
| Behavior | Where documented | Hole | Control |
|---|---|---|---|
| Exit early so tests never run | frontier RL run [733] | exit code read as success | per-test status, missing counts as fail [814] |
| Raise exceptions outside the test framework to skip evaluation | same run [733] | grader shares the agent's process | grader in its own fresh container [1116] |
| Modify tests | ImpossibleBench: more than 79% of cheating by Claude models and Qwen3-Coder [1107] | writable tests | read-only or restored tests, flag test-file edits [1129] |
| Special-case the test inputs | Claude 3.7 Sonnet, attributed to reward hacking in RL [1129] | tests visible or guessable | hidden or held-out tests |
| Overload operators, record state | ImpossibleBench: GPT-5 and o3 used each of four strategies more than 14% of the time [1107] | comparison runs in the agent's interpreter | compare serialized outputs in the grader |
| Replace the evaluator or the timer | METR, o3: 12 of 28 and 6 of 24 runs on two tasks [732], also found by Terminal-Bench's exploit agent [815] | grader importable or writable, time measured inside | grader out of reach, time measured outside the sandbox |
| Pre-compute and cache the answer | METR, o3: 21 of 21 runs on one task [732] | score times a script the agent controls | measure from outside and check the work |
| Read leaked ground truth | reference solutions left as compiled files [733], answers left in GPU memory [818] | artifacts left in the image | no tests, oracles or compiled files in the image [815] |
| Edit upstream libraries the tests import | frontier RL run [733] | environment writable beyond test files | reinstall dependencies for grading |
| Bypass tests with a test-configuration file | Sandman [1104] | config files travel with the patch | exclude them from the patch, restore official tests |
| Do nothing, or list every answer | tau-bench airline 38%, listing inflates by 40% [818] | weak ground truth | a no-op agent must fail [815] |
Figure 75 sets these hacks beside the threats of Section 14.1 and links each to the layer whose control closes it. Pick a chip and follow its line. In this guide's mapping, 9 of the 15 OS-level threats, including every kernel-level one, end inside the sandbox stack (layers 5 to 7), and all 11 reward hacks end above it, in the grader or the task build. The sandbox protects the host. The grader and the task build protect the reward.
Method and sources
A line joins each chip to the layer whose control closes it (solid for the primary layer, dashed for a secondary one), and the count bars tally primary layers: 9 hacks close in the grader and 2 in the task build, while 13 of 15 threats close in the harness or the stack (layers 4 to 6) and 9 inside the stack itself (layers 5 to 7). The layer assignment is this guide's judgment, not a classification taken from the sources, and the frequencies in the detail card are as reported, each in its own setting (model, task, benchmark), so they are not comparable across chips. Sources include NIST SP 800–190 (Souppaya et al., 2017), the Linux, Docker, Kubernetes, OCI, gVisor and Firecracker documentation, DSec (Huang et al., 2026), Baker et al. (2025), METR (2025), ImpossibleBench (Zhong et al., 2025), the Claude 3.7 Sonnet system card (Anthropic, 2025), Terminal-Bench (Merrill et al., 2026), Sandman (Yan et al., 2026) and the Agentic Benchmark Checklist (Zhu et al., 2025).While training a frontier reasoning model, OpenAI researchers saw two hacks spread to nearly every environment: exiting early without running all unit tests, and raising an exception outside the test framework to skip evaluation. The team patched the environments, and smaller spikes exposed leaks such as compiled reference solutions [733]. Per-test grading in a fresh container defeats both hacks. Baker et al.'s monitoring and obfuscation results are told in Section 9.9. At RL scale every leak is found, so find it first.
Table 14.12. Reward-hacking frequencies, each in its own setting and not comparable across rows (reported).
| Setting | Measure | Value |
|---|---|---|
| METR, o3, HCAST tasks [732] | runs with reward hacking | 8 of 1,087 (0.7%) |
| METR, o3, RE-Bench tasks [732] | runs with reward hacking | 39 of 128 (30.4%) |
| ImpossibleBench, GPT-5 [1107] | cheating, Oneoff-SWEbench vs Oneoff-LiveCodeBench | 76% vs 2.9% |
| ImpossibleBench, GPT-5 [1107] | cheating, Conflicting-SWEbench | 54% |
| Hack-Verifiable Terminal Bench, Gemini 3.1 Pro (the outlier: the other four models hacked less when warned) [1130] | hacking with a warning vs without | 59.8% vs 47.7% |
| Four 2026 models [1130] | hacking, ImpossibleBench vs EvilGenie | 78-100% vs at most 2% |
METR's "more than 43x" divides rounded percentages. Raw counts give (computed). Why the spread? On RE-Bench "the model was able to see the entire scoring function" [732]. ImpossibleBench found more cheating on repository tasks, with multiple submissions (33% to 38%) and with complex scaffolds [1107]. So remove three conditions: a visible grader, a writable filesystem around it, and repeated failure.
Hacking also changes the model. Training on harmless hacks generalized to "preferring less knowledgeable graders" [1131], and a model that learned to hack in production coding environments tried 12% of the time to sabotage code in ways that would hide hacking [1132, 610]. Section 9.9 covers the training-time side.
Controls that close the holes
Controls fall into three groups, strongest first. Use monitors to find exploits, not as a reward term: OpenAI advises against strong optimization pressure on chains of thought [1133], and METR says to "patch the exploit in the scoring function rather than punishing the model" [732].
Table 14.13. Controls against reward hacking and what they achieved (reported).
| Group | Control | Evidence |
|---|---|---|
| Structural | read-only tests | "restores legitimate performance while preventing test modification attempts", but not special-casing [1107] |
| Structural | no oracles in the image, oracle-pass and no-op-fail CI, an exploit agent before release | Terminal-Bench's standard [815] |
| Structural | planted, detectable hacks | hack rates measured automatically [1130] |
| Behavioral | an abort option | cheating 54% to 9% (GPT-5), 49% to 12% (o3) [1107] |
| Behavioral | "do not cheat" prompts | "a nearly negligible effect" (METR) [732]. In Hack-Verifiable Terminal Bench, more explicit warnings cut hacking steadily for four of five models, while Gemini 3.1 Pro hacked more under the first warning [1130] |
| Monitoring | a model reads the trajectory | 86-89% caught on self-contained problems, 42-65% on repository tasks [1107] |
| Monitoring | flag unexpected test-file edits | used in product monitoring [1129] |
A checklist for an RL coding environment, roughly by cost (this guide's inference):
- Grade in a fresh container, per test, with missing tests as failures.
- Ship no tests, oracles, compiled artifacts or caches in the image.
- Make tests read-only, exclude test-configuration files, reinstall dependencies.
- Require in CI that the oracle passes and a no-op agent fails, and rerun the reference.
- Report evaluation numbers on hidden or held-out tests only.
- Keep the network off by default, cap steps and time, and mark infrastructure errors as truncations.
- Run a trajectory monitor to find and patch exploits, never as a reward.
- Give agents an abort action, red-team each environment, and track the hack rate.
14.7 Fleet arithmetic: how many sandboxes, and who waits for whom
You have 64 GPUs and 4,500 SWE tasks. How many sandboxes must run at once, how many trajectories per hour come out, where does start-up time go, and when does the environment rather than the GPU set the pace? An agentic rollout is a relay. The GPU generates an action, the sandbox runs it, and the observation goes back. A sandbox is occupied for the whole trajectory, including every second it waits for the model, so the sandbox count follows how long trajectories live, not how much CPU they burn.
Little's law for sandboxes
In a stable system, mean occupancy equals arrival rate times mean time inside. With the creation rate and the mean lifetime,
where is episodes per hour from a fixed fleet. The law needs the mean lifetime, not the median. Take an illustrative SWE episode of 30 s start-up, 50 turns of 20 s generation plus 2 s tools, and 120 s grading: s. Start-up is 2.4% of the life, tools 8.0%, waiting for the model 80.0% and grading 9.6%, and 512 sandboxes give about 1,475 episodes per hour (computed).
Who waits for whom
The inference engine wants trajectories in generation at all times (its decode batch, Section 13.4). If a sandbox waits for the model a share of its life,
For the illustrative episode , so 256 trajectories in generation need 320 live sandboxes (computed). Measured lives lean harder toward the model. Sandman's rollout sandboxes spent "74–91% of sandbox lifetime" waiting for the next action [1104], and Kimi K3 reports up to 98% [1066], so is only 1.02 to 1.35 (computed). The fleet is mostly idle, stateful machines.
An "environment share" means nothing without its denominator. Over sandbox lifetime, waiting for the model is 74–98%. Over learner-step time, Sandman's learners waited for data 65–78% of the time, yet rollout-sandbox acquisition was at most 0.9% [1104]. Over GPU time, SkyRL-Agent ran near 90% utilization in generation [718].
Figure 76 puts these formulas on sliders. Drag start-up from 30 s to 4 ms and see how little the episode rate moves while the gray waiting band dominates.
Method and sources
The method is Little's law (n = λT), 1 − q^n for stragglers, the harmonic number H_n for the slowest of n exponential durations (a lower estimate for heavy tails) and the cost ratio k_sb c_s / c_g, all derived in Section 14.7, and the stepper walks them in order with live values. Presets use reported figures from DeepSWE (Luo et al., 2025), Sandman (Yan et al., 2026, including a preset at its list prices), Kimi K2 (Kimi Team, 2025), DSec (Huang et al., 2026) and rStar2-Agent (Shang et al., 2025), with start-up quick-sets from Firecracker (Agache et al., 2020), microVM snapshots (Brooker et al., 2021) and Sandman, a GPU price computed from MiniMax-M1 (2025), the straggler check from Brooker et al. (2023) and pod limits from the Kubernetes documentation (2026). Other inputs are illustrative and labeled in every tooltip and in the table view.Tails and bursts
A synchronous step waits for its slowest member. If each of independent operations finishes inside its -quantile with probability ,
with and the second result exact for exponential durations of mean . Check: a container start that fetches 1,000 chunks hits the cache's p99.9 latency on 63% of tasks [1134], and . A 512-trajectory step contains a p99 straggler with probability 99.4% and waits about times the mean (computed), a lower estimate for heavy-tailed lifetimes. Hence partial rollouts: Kimi K2 pauses long-tail tasks and resumes them next iteration [72], and Kimi K3 pauses generation once a set fraction of trajectories finishes [1066], at the price of off-policy data (Section 9.8).
Bursts size the warm pool, . Firecracker's authors use it for warm pools: at 125 ms creation time, "one pooled MicroVM is required for every 8 creations per second" [1087], and . Sandman saw a campaign mean of 1.8 creates per second and 132 in one second when two runs started together [1104]. With 4.1 s creates that is 7 warm sandboxes for the mean and 541 for the burst (computed). DSec serves about 3 million sandboxes a day per scale unit, peaking near 380,000 concurrent [10]. The daily mean of 34.7 creates per second times the 17.4-minute median lifetime gives about 36,000 (computed), a lower bound since the mean exceeds the median. Sandman's burst was about 73 times its mean creation rate, and DSec's peak concurrency about 10 times its mean-rate estimate (computed), so plan for bursts 10 to 100 times the mean.
Where start-up time goes
Start-up is small in long episodes but dominates sub-second code rewards. An illustrative GRPO step of 512 prompts times 16 samples spends about 8,300 sandbox-seconds on 1.014 s container lifecycles [1088] and about 33 on 4 ms snapshot restores [1094] (computed). So DSec runs short function calls in reusable precreated containers [10].
A slow start is mostly moving bytes. Slacker found that "pulling packages accounts for 76% of container start time, but only 6.4% of that data is read" [1135]. A decade later DSec's agent images are 4.1 to 12.1 GB with 4.2% to 13.3% read, and the median image serves only three sandboxes, so node caches help little [10]. Each remedy below removes a different slice. Figure 74 plots the per-sandbox latencies.
Table 14.14. Start-up remedies, what each removes and the published evidence (reported).
| Remedy | Removes | Evidence |
|---|---|---|
| Node image cache | The pull | Sandman median pod create 17.4 s with a pull, 4.1 s cached [1104]. DeepSWE preloaded images on over 6 TB of NVMe per node [9] |
| Lazy loading | Unread bytes | Lambda: 67% of chunks from the worker cache, 32% from the zone cache, 0.06% from the origin [1134]. DSec: an 8,192-container burst in about 35 min against over 60 min eager [10]. Sandman did not adopt it because it needs another snapshotter on every node [1104] |
| Warm pool | Create latency on the critical path | Sandman grading 6.2 s to 0.12 s, but 2.46x reserved vCPU-hours and no established training speedup [1104]. On a full cluster prewarming "merely shifts this overhead earlier" [10] |
| Snapshot restore | Boot and set-up | AgentENV resume as low as 49 ms [1066], CubeSandbox 0.08 s [1104], DeltaBox rollback 1.86 ms [1136] |
| Lighter runtime | Runtime overhead | Kimi k1.5's optimized sandbox (crun, reused cgroups) 0.04 s against Docker's 0.12 s [648] |
Reported: Qwen3–32B trained on 4,500 R2E-Gym tasks for six days on 64 H100 GPUs, 512 Docker containers per RL iteration, a reward for passing a selected sample of tests within 5 minutes (30 in the official evaluation), and masked loss for timed-out or truncated trajectories [9]. Computed: GPU-hours, against 9,180 in SkyRL-Agent's table [718]. If the run took about 200 steps (an assumption), a step averages 43 minutes and the fleet delivers trajectories per hour, at 8 sandboxes per GPU. The cap bounds grading at sandbox-hours per step (core-hours if each test run uses one core, an assumption). What broke: thousands of containers ended up "overloading Docker's API server and eventually crashing the Docker daemon (dockerd)" [9]. The fix was Kubernetes, where Section 14.8 starts.
14.8 Operating the fleet: orchestration, failures, reproducibility and cost
How do you turn "create 10,000 sandboxes now" into 10,000 working shells without breaking a shared cluster, keep infrastructure failures out of the reward, make the same patch earn the same reward twice, and what does the fleet cost next to its GPUs? The control plane fails before the CPUs do.
The control plane
In Kubernetes a pod's requests decide its placement and its limits are enforced, memory by out-of-memory kills and CPU by throttling [1105]. A Job retries a failed pod six times by default [1106]. The documented limits are 110 pods per node and 150,000 per cluster [1137], so DSec's 380,000 peak would need about 2.5 clusters (computed). Sandman, which sets requests equal to limits at 2 vCPU and 8 GiB, reports five lessons [1104]:
- Pace creates with a token bucket. In a 10,000-request burst a default open-source controller delivered 1,124 usable sandboxes, and pacing plus retries all 10,000.
- Spread placement: 0 failed first IP assignments against 254 by default.
- Address pods directly: 0.05 s to the first command against 2.3 s through Services.
- Own cleanup after cancellation, or retried creates leave orphan pods.
- Kill the whole process group on timeout.
DSec skips Kubernetes: its engine picks the least loaded of sampled nodes, bursts to cloud VMs above 80% utilization, and keeps rollout state alive across preemptible GPU jobs [10]. rStar2-Agent runs its tools on its 64-MI300X training cluster's CPUs [1138], sharing a failure domain.
Density and overcommit
In Sandman CPU use averaged 10.5% of requests and memory 1.9% [1104]. In DSec about 90% of sandboxes use at most 5% of their CPU request, and nodes ran stably with at least 3,200 containers or 800 microVMs [10]. Kimi K3 overcommits memory up to 6.5x, and a paused sandbox holds no memory or CPU [1066]. Firecracker has run memory and CPU oversubscription of up to 10x in production, and its authors explain why packing pays: the ratio of peak to mean use falls roughly as for uncorrelated workloads [1087]. But an RL batch starts together, so its workloads are correlated and that benefit is weakest in bursts (this guide's inference).
Keep infrastructure out of the reward
Classify every failed trajectory as model, environment or infrastructure, and never score the last two as zero. GLM-5 excludes samples that fail from environment collapse [1139], Sandman retries them and never scores them zero [1104], and Inspect marks an error state [1103]. Failures compound. With per-sandbox success , a synchronous batch of is clean with probability
only (computed). One retry lifts Sandman's lowest per-attempt availability, 91.16% in campaign C (reported), to if retries fail independently (computed), consistent with its reported at least 96.69% per trajectory with one retry [1104].
Same patch, same reward
Of 500 SWE-bench Verified reference patches, 15 got different verdicts across Sandman's execution conditions, 11 with outbound traffic denied [1104]. On Terminal-Bench 2.0 the most and least resourced setups differed by 6 points (p < 0.01), and 3x resource headroom cut infrastructure errors from 5.8% to 2.1% with scores within noise [1140]. Its author advises a separate request and limit per task, unlike Sandman's equal values, and doubting gaps below 3 points until configurations match [1140]. Pin and declare, in order [1104]:
- Images by digest (registry expiry still bites).
- Execution conditions, checked by an in-pod probe: network, CPU, memory, user, time limit, hash seed and time zone.
- A preflight per task (reference passes, empty patch fails) at 0.06–0.14 pod-hours, or 275–641 pod-hours for 4,578 tasks (computed).
- Grading in a fresh sandbox from the same image, because git reset and git clean do not restore everything.
- Seeds and snapshot reseeding (Section 14.3).
Unpaced creates from one evaluation disrupted admission for other jobs. After pacing and a larger webhook, none of 38,377 creates saw an admission error. Canceled creates leaked pods, leaving at least 4,181 more live pods than agent slots at peak. Another fleet's Services made Kubernetes inject about 23,400 environment variables into each new container. Six pods labeled egress-denied reached the internet because only one provider installed the guard [1104]. The lesson: verify every isolation and cleanup claim inside the pod, at grading time.
Table 14.15. Publicly reported sandbox scale for agentic RL (reported, as of November 2026).
| Report | Scale | Runtime |
|---|---|---|
| DeepSWE (2025) | 512 containers per iteration [9] | Docker, then Kubernetes |
| Kimi K2 (2025) | Over 10,000 concurrent sandboxes [72] | Kubernetes |
| Qwen3-Coder (2025) | 20,000 parallel environments [1141] | Cloud, unspecified |
| rStar2-Agent (2025) | 45K concurrent tool calls, 0.3 s mean [1138] | Tool service on GPU-cluster CPUs |
| GLM-5 (2026) | Over 1k concurrent rollouts [1139] | Multi-task orchestrator |
| MiniMax-M1 (2025) | RL on 512 H800 GPUs for three weeks [656] | Containerized sandbox |
| Sandman (2026) | 3.1M sandboxes in two weeks, peak 11,858 [1104] | runc pods, shared Kubernetes |
| DSec (2026) | About 380K concurrent, over 5,000 creates per second [10] | Containers, microVMs, VMs |
| Kimi K3 (2026) | 51.2M sandboxes [1066] | Firecracker microVMs |
What the fleet costs next to its GPUs
Hold sandboxes per GPU for the whole run, priced per sandbox-hour at their reserved size against per GPU-hour:
DeepSWE and Sandman's study runs (128 trajectories, 16 B200 GPUs) have [9, 1104]. MiniMax-M1's rental of 534,700 USD for 512 H800s over three weeks [656] is 2.07 USD per GPU-hour, assuming 21 days (computed). At an illustrative 0.03 USD per sandbox-hour the fleet costs of the GPUs, and 1.7% against 14 USD GPUs. At 0.12 USD it is 46%. Sandman reports 1.7–4.0% at on-demand list prices, depending on how CPU-node cost is split [1104], a different price basis from the 2.07 USD case. Its estimate also uses 3.30–3.75 sandbox-hours per GPU-hour rather than 8, and B200s at about 20 USD per GPU-hour list price [1104]. At 10,000 sandboxes on 64 GPUs () the fleet costs more than the GPUs. The cost panel of Figure 76 shows the ratio.
Target: Kimi K2's 10,000 concurrent sandboxes [72] at 2 vCPU and 8 GiB. Node: DSec's average of 187 cores and 1,455 GiB [10], treating a core as a vCPU (an assumption). Without overcommit CPU binds at 93 per node, so 108 nodes. With CPU overcommit memory binds at 181 per node, so 56 nodes. At up to 150 microVMs per second per host [1087] the VMM part of the burst takes s. Image bytes dominate: reading 6.0% of a 6.0 GB image moves 3.6 TB, whole pulls 60 TB. With Sandman's 4.1 s pod creates the warm pool would be 7 at the 1.8/s mean and 541 at the 132/s burst. At Firecracker's 125 ms boot it is under 1 and about 17 (computed: and ), so here image bytes, not boot time, set the pool. At 8 per GPU the fleet feeds about 1,250 GPUs and costs 300–1,200 USD per hour (illustrative prices). Size the fleet to the GPUs, not the other way round.
HumanEval's harness sets os.system, os.fork and similar functions to None before running a completion. Why do its authors still say it is not a security sandbox?
The guard is Python-level patching inside the same process, user and kernel. Other modules or C extensions reach the same functions, and nothing limits the network or the filesystem. It protects the test from careless code, not the host from hostile code, which is why the Codex team ran their evaluations under gVisor with an eBPF firewall [1061, 699]. A real boundary sits below the process (Section 14.1).
You restore 16 microVMs from one snapshot to start a GRPO group, and each generates a UUID for its trace ID. What happens, and how much does VMGenID fix?
If the UUID library's random state was in the snapshot, all 16 draw the same "random" ID, so traces collide with probability 1, against about for a million fresh IDs (computed). VMGenID makes Linux 5.18 and later reseed the kernel's generator on resume, but user-space state is still copied, so libraries must reseed or draw from the kernel after restore [1108, 1094] (Section 14.3).
SWE-bench counts a test missing from the test log as a failure. Which reward hacks does that rule defeat, and what else must hold for it to work?
It defeats exiting early and raising exceptions to skip tests, the two hacks that became systemic in a frontier RL run: a test that never ran cannot count as a pass. It works only if grading happens in a fresh container the agent never touched and reads per-test status, not the exit code [814, 733] (Section 14.4).
A grader has a 10% false-negative rate and a 5% false-positive rate, both independent of the policy. Does RL still optimize the right thing?
In expectation, yes. Observed reward is , which still rises with the true success rate , with slope . The best policy is unchanged, but the expected signal is 15% weaker and the noise adds variance, so learning is slower. It breaks when false positives depend on the policy: a policy that learns which wrong answers pass raises its own false-positive rate, and that is reward hacking (Section 14.6).
Your SWE agent's sandboxes spend 90% of their lives waiting for the model, and the inference engine wants 256 trajectories in generation. How many sandboxes must be live, and why do fleets overcommit CPU?
(computed). Almost all of them are idle at any moment. Sandman measured 74–91% waiting and mean CPU use of 10.5% of requests, and DSec found 90% of sandboxes using at most 5% of their CPU request [1104, 10]. Packing by requests wastes most of the fleet, so platforms overcommit CPU and reclaim memory from paused sandboxes, and memory becomes what binds.
- A sandbox has two jobs: it is the security boundary around untrusted, optimizer-driven code and the body of the reward function. Anything reachable from it that changes the score becomes part of what RL optimizes.
- Containers are processes sharing one kernel. For model-generated code at scale add a second boundary (gVisor or a microVM), nearly free for compute-bound work and costlier for syscall- and file-heavy suites. Always say which interval a start-up number measures.
- Default deny: no network, read-only root, non-root with capabilities dropped, cgroup limits, timeouts enforced from outside, no secrets inside. An egress allowlist is a capability grant, and snapshot clones share user-space randomness until you reseed.
- Grade outside the agent's reach: a fresh container, hidden tests applied after the patch, per-test status with a missing test counted as a failure, and no tests, oracles or future history in the image. Require that the oracle passes and the no-op fails for every task.
- Policy-independent grader noise scales the learning signal by . Policy-dependent false positives are reward hacking, which rises when the grader is visible, the filesystem is writable and failures repeat. Patch the environment rather than training against a monitor.
- Size fleets with Little's law on lifetimes: rollout sandboxes spend 74–98% of their lives waiting for the model, and creation arrives in bursts 10–100 times the mean.
- Start-up is mostly bytes and the control plane: DSec's agent images are 4–12 GB and only 4–13% of each is read. Snapshots, lighter runtimes, node caches, lazy loading, pacing and spreading each remove a different part.
- Never turn infrastructure errors into zero rewards. Pin images by digest, declare and verify execution conditions, preflight every task, and expect resource settings alone to move agentic scores by several points.
15. The research engineer's playbook
A run plan joins the earlier chapters into one set of decisions. Choose a hypothesis, define the comparison, budget the experiment and decide how to respond when the evidence disagrees. The worked plan follows 2,048 H100s for 30 days through that accounting.
Model development is lab work. The Smol Training Playbook calls machine learning "very much an experimental science" [13], and Karpathy warns that a buggy network will usually "train but silently work a bit worse" [943]. The costly bugs do not crash, and habits exist to catch them.
The running hook is a reservation of 2,048 H100s for 30 days, the same GPU count as the cluster of 2,048 H800 GPUs that trained DeepSeek-V3 [2]. Sections 15.1 to 15.3 cover method, loss curves and debugging. Section 15.4 plans the run, and Sections 15.5 to 15.7 collect the planning formulas, what to study next and the open problems. The running examples and the notation are introduced in Section 0.3.
Measure the noise before you trust a difference, read the instruments before you guess, change one thing at a time, and write the plan down as a chain of formulas.
15.1 The experimental method
How do teams decide what goes into a run they can afford only once, and how do they know a small experiment is telling the truth? The method guards against two errors: believing noise, and believing a small-scale result that does not survive scale.
Start from a proven baseline, as Llama 3 did from Llama 2 and Kimi K2 from DeepSeek-V3, and change one thing at a time: "Never change anything unless you’ve tested that it helps" [13]. Sort the hyperparameters into scientific ones (being measured), nuisance ones (re-tuned for each scientific value so the comparison is fair) and fixed ones [393]. In an optimizer comparison the learning rate is a nuisance hyperparameter, since one optimizer's best settings can be poor for another [418].
SmolLM3's workhorse proxy was a 1B model on 45B tokens (45 tokens per parameter, against the compute-optimal 20 of Section 6.2) at 42k tokens per second per GPU on eight H100s (reported) [13], so a run takes s, or 1.55 days (computed). A good ablation metric rises monotonically, beats random at the proxy's scale, ranks models consistently and has low seed noise. Format matters: a 1.7B model beat random on multiple-choice MMLU only after 6T tokens [13], and continuous scores lift decision accuracy on two code tasks "from trivial to 80%", though not on math [258].
When is a difference real?
Seed-to-seed noise in benchmark scores is measured in Section 10.9. For ten 7B models that differ only in initialization seed, with a fixed data order, Madaan et al. report seed standard deviations , averaged over 21 checkpoints from 10B to 210B tokens, of 0.21 accuracy points on HellaSwag, 1.11 on HumanEval and 2.15 on COPA [745]. With data order also varied, DataDecide finds seed standard deviations as high as 2 points at 1B for some recipes [258].
If arms A and B each average independent seeds with Gaussian noise, their difference has standard deviation . A two-sided 95% test then calls a gap real when it exceeds the minimum detectable difference (MDD):
For 80% power against a true gain , the gain must clear the MDD by another , so each arm needs
Both treat as known. Estimating it from three seeds per arm with a t-test cuts the power from 83% to about 60% (computed by simulation). For comparisons use , which is 3.02 at (Bonferroni, computed).
Table 15.1. Seed noise and minimum detectable differences for ten 7B models trained to 210B tokens. Means are at the final checkpoint. Seed σ is averaged over 21 checkpoints with a fixed data order. Items, means, seed σ and the item-sampling half-width are reported by Madaan et al. The MDD columns are computed as 1.96σ√(2/n) for n seeds per arm.
| Benchmark | Items | Mean (%) | Seed σ (points) | MDD, 1 seed | MDD, 3 seeds | MDD, 5 seeds | Item 95% half-width |
|---|---|---|---|---|---|---|---|
| HellaSwag | 10,042 | 70.08 | 0.21 | 0.58 | 0.34 | 0.26 | 0.93 |
| MMLU-Cloze | 14,042 | 37.47 | 0.22 | 0.61 | 0.35 | 0.27 | 0.79 |
| MMLU (multiple choice) | 14,042 | 25.86 | 0.57 | 1.58 | 0.91 | 0.71 | 0.72 |
| ARC-C | 1,165 | 39.71 | 0.80 | 2.22 | 1.28 | 0.99 | 2.74 |
| PIQA | 1,838 | 76.93 | 0.41 | 1.14 | 0.66 | 0.51 | 1.99 |
| GSM8k | 1,319 | 4.10 | 0.41 | 1.14 | 0.66 | 0.51 | 0.87 |
| HumanEval | 164 | 11.89 | 1.11 | 3.08 | 1.78 | 1.38 | 3.98 |
| COPA | 100 | 78.80 | 2.15 | 5.96 | 3.44 | 2.67 | 8.30 |
In Table 15.1, MMLU's cloze form is about 2.6 times less noisy than its near-chance multiple-choice form (, computed) [745]. The last column, the item-sampling half-width (0.90 points for HellaSwag, computed, 0.93 reported), describes one model on the population of questions, not whether retraining would change a comparison. Error bars and paired comparisons for benchmark scores are derived in Section 10.4.
Arm B beats arm A by 0.5 HellaSwag points with one seed each (illustrative). The MDD is , so the win is not significant. With three seeds per arm it is , and the gap passes. For 80% power, , so three seeds, and Monte Carlo gives 0.83 power. On HumanEval () the same gap stays invisible even at five seeds (MDD 1.38). If B was the best of 20 variants, the one-seed bar is . All computed.
Decide with a rule, and know what transfers
Adopt a change only "based on strong evidence" [393]. The NanoGPT speedrun requires p<0.01 that a record's mean validation loss reaches the 3.28 target, except for systems-only changes [415]. Transfer is mixed. Ranking data recipes at 150M picks the 1B winner in about 80% of comparisons [258]. OLMo's ladders, at 1% of the target compute, land within 2 points on four tasks but miss by 4 on average [473]. Re-examining 46 tasks from one earlier study, Lourie et al. find smooth, predictable downstream scaling for only 18, "39% of the time" [474]. How to run small-scale ablations and when to trust them is Section 3.9. How to fit a scaling law and how far to trust its extrapolation is Section 6.4. Compare after the decay, since optimizer rankings "can flip during training due to learning rate decay" [418].
Practitioner experience, not a measured rate: "if something hurts performance at small scale, you can confidently rule it out for large scale" [13]. Gains need a proxy close to the target. With tuned baselines, matrix-optimizer speedups over AdamW shrink from 1.4 times at 0.1B parameters to 1.1 times at 1.2B [418].
Budget the research too, as Section 15.4 does with SmolLM3's 58% ablation share. The usual traps are single-seed wins below the MDD, reporting only the best of many variants (one lab tested 27 private Arena variants before a release [805]), undertuned baselines [413] and an untested "seemingly innocent library upgrade" [13].
How to do it yourself. Measure your own with five or more baseline seeds that vary initialization and data order, or pool a published estimate. Three seeds per arm detect an effect of about with 80% power, and smaller effects need seeds per arm (computed). Compare after the decay, and log each decision with its seeds, noise and commit.
15.2 Reading loss curves
You are watching a loss plot and a gradient-norm plot at 3 a.m. Which wiggles matter, and what does each one suggest? The data sets the loss level, so a mixture change shifts it. The learning-rate schedule sets the slope, so a decay bends it. Sudden departures come from a batch meeting the current parameters and optimizer state.
At step 0 the loss should be near (11.76 nats for Llama 3, computed) [943]. The ln V check at step 0 is in Section 12.5.
Table 15.2. Loss-curve patterns: signature, likely cause and action. The first four are expected. The rest are warnings.
| Pattern | Signature | Likely cause | Action | Sources |
|---|---|---|---|---|
| Healthy | steep drop, then slow decline | none | none, and compare only like schedules | [1142] |
| Decay drop | sharp fall when the learning rate decays | the schedule | expected | [354, 353] |
| Early bump | brief non-convex stretch at about 2.5-5B tokens | induction heads forming | expected | [424] |
| Level shift | the level jumps at a stage boundary | a change in data, sequence length or batch size | judge progress on a fixed held-out set | [7, 6] |
| Recoverable spike | a jump that returns to trend | a bad or repetitive batch, or a batch meeting a particular state | log batch ids, skip the batches if recovery is slow | [13, 7, 34] |
| Non-recoverable spike | the loss stays higher or keeps rising | logit growth, Adam state, learning rate too high | rewind, lower the learning rate, stabilize the logits | [13, 345, 342, 396] |
| Slow divergence | no spike, but worse final loss at high learning rates | logit growth at high learning rates | learning-rate sweep, QK-norm, z-loss | [270] |
| Plateau | a long flat stretch | learning rate too low or decayed early, or repeated data | check the schedule and the epoch count | [943, 209] |
| Noisy | variance above the reference run | the loader reads in document order | pre-shuffle the tokenized sequences | [13] |
In Table 15.2 the first four rows are expected. The loss "Decreases Dramatically in Decay Stage" [354] and tracks the schedule [1142], so never compare a constant-rate run with a cosine run halfway through. Cosine, WSD and constant-with-cooldown schedules are compared in Section 5.2. Induction heads, attention heads that complete a sequence [A][B] … [A] with [B], form at roughly 2.5 to 5B tokens, the only non-convex stretch of the loss in the models studied [424]. Level shifts follow changes in data, batch and sequence length [7, 6]. Why loss spikes happen is explained in Section 5.5, which also defines QK-norm and z-loss.
Leading indicators
The loss lags. In the run before OLMo 2 (OLMo-0424), gradient-norm spikes "often preceded training loss spikes" [7]. Kimi K2 caps the maximum attention logit at 100 with QK-Clip after seeing it pass 1,000 in an earlier run [72]. AdamW's update RMS, with gradient and second-moment estimate ,
should stay near 1. In Wortsman et al.'s CLIP ViT runs (vision-language, not LLM pretraining) it spiked "1–8 iterations before a loss spike" [396]. What to monitor during a run is in Section 12.5.
A simple detector (illustrative) keeps a moving mean and variance of the step loss with weight , about a 199-step window (), and scores each step against the previous statistics so a spike cannot dilute its own score:
Flag when the gradient norm is also above its 99.9th percentile, and log the batch ids.
Then act by type. On a recoverable spike, continue. On slow recovery, rewind about 100 steps and skip a few hundred batches [34]. PaLM's restart-and-skip fix is told in Section 5.5. On divergence, rewind further and lower the learning rate, as OPT-175B did, where cutting gradient clipping from 1.0 to 0.3 also helped [345]. Structural fixes belong to Chapter 5.
15.3 Debugging from symptom to cause
Something looks wrong. Where in the stack do you look first? Six layers can produce the same symptom: data, model, optimizer, numerics, parallelism and hardware. So start from the symptom, list the layers that can produce it, and order the checks by cost.
Silent bugs are cheapest to catch before the run:
- The step-0 loss is close to [943].
- The model can "overfit a single batch of only a few examples" [943].
- The token ids, masks and document boundaries decoded right before the model call look right [943].
- A loss on one position gives zero gradient to later positions and other batch elements, which rules out mask and reshape bugs [943].
- Your harness reproduces published scores for reference models [13].
- The GPUs pass a stress test (SmolLM3's preflight found two throttling), and checkpoint saving and auto-resume work [13].
- Seeds follow the parallelism rules in the box below.
Data-parallel replicas hold identical parameters, so their initialization seeds must match and their data seeds must differ [393]. Tensor-parallel ranks hold different slices of each weight matrix and need different initialization randomness, or the shards become correlated copies. SmolLM3 used "identical random seeds across all TP ranks" and fixed it with set_random_seed(self.config.general.seed + tp_rank) [13].
Table 15.3. The symptom map: most likely layers, the cheapest first checks, the typical fix, the chapter that explains each and the sources.
| Symptom | Most likely layers and causes | First checks | Typical fix | Chapter | Sources |
|---|---|---|---|---|---|
| Spike that recovers | data batch, batch meeting a state, stale Adam second moment | batch contents at the spike, gradient-norm history, update RMS | skip batches or rewind, filter repeated n-grams | 3, 5, 12 | [7, 34, 396] |
| Spike without recovery, or divergence | learning rate too high, attention or output logit growth, Adam state, low-precision overflow | small-scale learning-rate sweep, max attention logit, output-logit norm, loss scale | lower the learning rate and rewind, QK-norm or QK-Clip, z-loss, smaller AdamW ε | 4, 5 | [345, 270, 72, 7] |
| Gradient norm creeping up, then spikes | initialization scale, parameter-norm growth, weight decay on embeddings | gradient-norm trend, per-layer norms | 0.02-std initialization, no weight decay on embeddings, reordered norm | 5 | [7] |
| Loss noisier than the baseline | document-order reading, smaller batch, mixture change | shuffling at the sequence level, comparison with the prior run | pre-shuffle tokenized sequences | 3, 12 | [13] |
| Loss fine, evaluations lag | parallelism bug (identical TP seeds), tokenizer or evaluation-prompt bug | small model with and without TP, a predecessor's intermediate checkpoints, read samples | fix seeding, validate the evaluation suite | 10, 11 | [13] |
| Throughput drops or sharp dips | storage eviction, loader index growth, straggler, throttling | disk latency, single-node reproduction, step-count dependence, per-rank step time | node-local data, a proven loader, drain the slow node | 2, 12 | [13, 6] |
| Diurnal 1-2% throughput wave | temperature-driven frequency scaling | correlate tokens per second with time of day | usually accept it | 2, 12 | [6] |
| Hang with no error | NVLink or NIC fault stalling a collective, one stuck rank | NCCL flight recorder, collective timeouts, stack dumps | timeouts, auto-restart, cordon the node | 11, 12 | [6] |
| Frequent restarts | hardware (GPU, HBM, host), MTTF shrinking with scale | failure taxonomy, health checks | auto-resume, faster checkpoints, a spare node | 12 | [6, 903] |
| NaN in the loss | fp16 overflow, bad data, silent data corruption in hardware | first layer to produce a NaN, rerun the step on another node, loss-scale log | BF16, z-loss, isolate the node | 5, 12 | [401, 6] |
| Ablation winner fails at scale | effect below the noise, benchmark below random at small scale, ranking flip during the decay | seed σ and MDD, benchmark signal-to-noise, compare at the end of the decay | more seeds, continuous metrics, a ladder | 6, 10 | [745, 258, 418] |
The systems rows of Table 15.3 need a word of mechanism. "Even a single straggler can slow down thousands of other GPUs" [6], and at MegaScale's size "Failures and stragglers are the norm rather than the exception" [47]. NVLink faults stall kernels "without returning a clear error code". Llama 3 diagnosed such hangs with its NCCLX library and PyTorch's NCCL flight recorder, which keeps collective metadata and stack traces in a ring buffer. Its 405B run also swung 1–2% in throughput with the time of day, as daytime heat throttled GPU clocks [6]. NaNs point to numerics or hardware: BLOOM's team hypothesizes that float16's narrow range caused the irreversible divergence of its 104B prototypes [401], and Llama 3 suspects silent data corruption among its hardware faults [6]. Hangs, NaNs and slowdowns have full playbooks in Section 12.6, and stragglers and silent data corruption in Section 12.2.
Every hunt ends in bisection. List what differs between a known-good configuration and the failing one, then test each difference on the cheapest setup that reproduces the symptom. Because SmolLM3's team had derisked everything else, they could "pinpoint TP as the only plausible cause and fix the bug within a single day", a bug they caught because "downstream evaluations were lagging behind expectations" while the loss looked fine [13]. For instabilities, the tuning playbook adds a probe: run about 500 steps at twice the best learning rate, "but evaluate every step" [393].
SmolLM3 trained on 384 H100s for nearly a month on 11T tokens [13]. (a) Shared storage evicted dataset shards and throughput collapsed. Node-local data and a preloaded spare node fixed it. (b) A loader index "grew with each training step", and a proven loader fixed it. (c) Document-order reading let one long file fill a batch and spike the loss. Offline pre-shuffling fixed it. (d) The loss looked fine, but evaluations trailed SmolLM2's checkpoints at about 1T tokens. A small run with and without TP exposed identical seeds on every rank. The team restarted rather than finish a model that "performed the same but cost almost twice as much to train", and spent 7 days recovering [13].
How to do it yourself. Run the preflight list on every new configuration and keep a known-good one to return to. When a symptom appears, find its row in Table 15.3, run the cheapest check, and bisect only what differs from known-good.
15.4 Planning a run: 2,048 H100s for 30 days
You have 2,048 H100s for 30 days. What do you train, how do you lay it out, and what should you expect to go wrong? A run plan is a chain of formulas: budget, size, tokens, layout, failures, checkpoints, evaluations and a research reserve. Each link has one uncertain input, and the plan should show it. Step 0 is the Smol Training Playbook's first question, "Should we even be training this model?" Pretrain only for novel research, specific production needs or a gap in open models [13]. We assume the answer is yes.
Step 1: the compute budget
The budget multiplies five inputs:
Here ETTR, the effective training time ratio, is "the ratio of productive runtime to available wallclock time of a job run" [903], and MFU is measured over productive time. For this plan (computed),
The peak is dense BF16, half the 1,979 TFLOP/s NVIDIA lists with sparsity [4]. MFU 0.40 and ETTR 0.90 follow Llama 3's reported 38–43% MFU and over 90% effective training time [6]. That is 1,474,560 GPU-hours and one twentieth of Llama 3 405B's compute. MFU 0.30 or 0.55 would give or (computed). MFU conventions are in Section 1.3, ETTR in Section 12.8.
Figure 77 walks the nine steps with live numbers. Drag MFU and every output moves. Change the model and its excess-loss marker barely moves along the flat curve. Shorten the checkpoint write and the overhead falls.
Method and sources
Every value is computed from cited inputs: the H100 datasheet (NVIDIA 2024), the Chinchilla fit and its replication (Hoffmann et al. 2022, Besiroglu et al. 2024), the Llama 3 token fit, MFU, layout and interruption counts (Grattafiori et al. 2024), the PaLM MFU definition (Chowdhery et al. 2022), serving-aware sizing (Sardana et al. 2023), ZeRO and activation-memory formulas (Rajbhandari et al. 2019, Korthikanti et al. 2022, illustrative for activations), the 1F1B bubble (Narayanan et al. 2021), research-cluster failure rates and the ETTR model (Kokolis et al. 2024), Young's interval (Young 1974) and SmolLM3's evaluation cadence and ablation share (Allal et al. 2025). The loss gap between a 70B and a 133B model at this budget is a few thousandths of a nat, so serving cost, not the fit, should decide the size.Step 2: the compute-optimal size
Compute-optimal sizing is derived in Section 6.2. For with , where and are the Chinchilla exponents,
At FLOPs the answer depends on the fit: 55.1B with Hoffmann et al.'s printed constants, 69.4B unrounded, 125.5B at 20 tokens per parameter, 132.9B with Besiroglu et al.'s refit and 147.7B with Llama 3's token fit (Table 15.4, computed) [40, 446, 473, 6].
Table 15.4. Compute-optimal size at FLOPs under five fits (computed).
| Fit | Constants | Tokens per parameter | ||
|---|---|---|---|---|
| Hoffmann et al., as printed | A 406.4, B 410.7, E 1.69, 0.34, 0.28 | 55.1B | 5.7T | 104 |
| Hoffmann et al., unrounded | A 406.4, B 410.7, E 1.6934, 0.3392, 0.2849 | 69.4B | 4.5T | 65 |
| 20 tokens per parameter | 125.5B | 2.5T | 20 | |
| Besiroglu et al. refit | A 482.01, B 2085.43, E 1.8172, 0.3478, 0.3658 | 132.9B | 2.4T | 18 |
| Llama 3 token fit | 147.7B | 2.1T | 14 |
The fits disagree by 2.7 times, but "IsoFLOPs curves become flatter around the minimum as the compute budget increases" [6]. Under the Besiroglu fit a 70.6B model on 4.47T tokens loses only 0.0032 nats against the 132.9B optimum. Under the unrounded Hoffmann fit a 133B model loses 0.0038 against its 69.4B optimum (computed). Decide on serving cost, memory and time, not on the fit.
Do not extrapolate from printed coefficients. Llama 3 fits in its own symbols with and reports 402B parameters on 16.55T tokens at FLOPs [6]. The printed pair gives 10.46T tokens and 605B parameters, and no pair that rounds to it reaches 14.3T (computed). Quote 402B and 16.55T as reported.
Step 3: the inference-aware size
Sizing a model for its serving load is Section 6.5. Training costs FLOPs per token and serving about , so at the compute-optimal Besiroglu loss we solve
Sardana et al. advise "smaller and longer than Chinchilla-optimal" under heavy demand (Table 15.5) [70], as Llama 3 does for its small models [6]. Memory-bound decode makes serving FLOPs dearer than the table assumes (Section 13.2). From served tokens on, the inference-aware model needs more than the 30 days reserved, so the reservation caps how far you can trade size for tokens.
Table 15.5. Inference-aware size at the same target loss, Besiroglu fit (computed).
| Tokens served over the model's life | Tokens per parameter | Training share of lifetime FLOPs | Days on this cluster | ||
|---|---|---|---|---|---|
| 0 | 133B | 2.4T | 18 | 1.00 | 30 |
| 114B | 2.8T | 24 | 0.89 | 30 | |
| 72B | 5.2T | 72 | 0.61 | 36 | |
| 43B | 16.5T | 387 | 0.33 | 67 | |
| 30B | 70T | 2,313 | 0.17 | 200 |
Step 4: the model and the tokens
The Llama 3 70B shape (80 layers, width 8,192, 8 key/value heads, vocabulary 128,256) has 70.55B parameters (computed) [6]. At 40% MFU counting FLOPs per token, that is 935 tokens per second per GPU and 4.47T tokens in 30 days. Llama 3 70B's 15T tokens would take 101 days here (computed).
PaLM's MFU counts attention too, FLOPs per token [34], and Llama 3's 38–43% uses that definition. At the attention term adds 15% for this shape, so the like-for-like reading of 40% is 811 tokens per second per GPU and 3.88T tokens (computed). The 6N-only 4.47T assumes 15% more efficiency than Llama 3 reported. Plan with 3.9 to 4.5T and state the convention next to every MFU number.
Step 5: the layout and the memory
The Ultra-Scale Playbook says "At 1024+ GPU scale, a recommended setup may be tensor parallelism (TP=8) with data parallelism (ZeRO-2) and pipeline parallelism." [44] With and , 2,048 GPUs form 64 data-parallel replicas, each a full copy of the model on 32 GPUs. A 16,777,216-token batch is 32 sequences per replica, so and the bubble of the one-forward-one-backward (1F1B) pipeline schedule (Section 11.4) is (computed) [41]. The gradient all-reduce sends 8.68 GB per GPU [851], 0.17 s at 50 GB/s [137] against an 8.76 s step (computed).
Activation memory is derived in Section 1.5, and here we only divide:
We use ZeRO-1 rather than the quoted ZeRO-2, as DeepSeek-V3 did with pipeline parallelism [44]. ZeRO-2 would only shrink the 4.11 GiB of gradients. The terms are BF16 weights and gradients, ZeRO-1 optimizer states (sharded across the replicas, Section 11.2) [22] and Korthikanti et al.'s activations with sequence parallelism and selective recomputation [45], a GPT-style formula and so illustrative here. The total is about 29.9 of 74.5 GiB (Table 15.6).
Table 15.6. Per-GPU memory for the 70B shape at TP 8, PP 4, DP 64, , (computed, activations illustrative).
| Item | Formula | GiB |
|---|---|---|
| Weights, BF16 | 2 bytes 2.205B parameters per GPU | 4.11 |
| Gradients, BF16 | 2 bytes 2.205B | 4.11 |
| Optimizer states, ZeRO-1 | 12 bytes 2.205B / 64 | 0.39 |
| Activations, first stage | 20 layers 4 micro-batches in flight | 21.25 |
| Total | of 74.5 GiB | 29.85 |
Step 6: expected failures
Failure rates are in Section 12.1, and we only scale them. Llama 3 reports 419 unexpected interruptions in 54 days on up to 16K GPUs [6]. Assuming 16,384 GPUs throughout, 2,048 GPUs see a job mean time to failure (MTTF) of 24.7 hours and about 29 interruptions in 30 days (computed). Meta's RSC-1 and RSC-2 rates, 6.50 and 2.34 failures per 1,000 node-days [903], give of 14.4 and 40.1 hours, or about 50 and 18 interruptions (computed). The sets count different failures, so plan for 18 to 50.
Step 7: the checkpoint interval
Checkpoint size and the Young interval are in Section 12.3. With blocking write stall and restart cost , Young's interval and Kokolis et al.'s expected ETTR are [931, 903]
At hours, 5-minute writes give minutes, 8.9% overhead with a 10-minute restart and an ETTR of 0.915, which matches Step 1's 0.90. Fifteen-second writes give 27 minutes and 2.5% (computed). The optimum is flat, Daly refines it for slow writes [932], and Apertus set its cadence this way [1143]. A full checkpoint of 70.55B parameters at 14 bytes each (BF16 weights, FP32 master weights and two Adam moments) is 0.99 TB, so a 15-second write needs about 66 GB/s (computed).
Steps 8 and 9: evaluations and the research reserve
SmolLM3 evaluated every 10B tokens at about 1.5 GPU-hours for 3B parameters [13]. Here that is 447 evaluations, about 1.1% of the reservation if cost scales with size (illustrative). Evaluations are many jobs but little compute, 92.9% of jobs and 0.8% of resources in one trace [905]. Keep a predecessor's checkpoints as references (Section 15.3).
Then budget the research. SmolLM3's ablations and debugging cost 161,280 GPU-hours against 276,480 for its main run [13]. That 58% ratio adds 860,160 GPU-hours, 17.5 days of this cluster (computed). Reused recipes cost less, since Olmo 3's 32B "recipe was developed on 7B or smaller" [12]. New precision costs more: DeepSeek-V3 derisked FP8 at about 16B and 230B parameters [2]. Report final-run and all-in GPU-hours and the wall-clock path, as Olmo 3 does: about 56 days on 1,024 H100s, crash resumptions included [12].
The preflight checklist [13]:
- a GPU stress test (SmolLM3's found two throttling GPUs),
- storage that will not evict data shards,
- checkpoint save and automatic resume, tested,
- live loss, gradient norm, throughput, GPU health and evaluations,
- a spare node with the data preloaded,
- expected throughput written down. SmolLM3 expected 13,500 to 14,000 tokens per second, read here as per GPU (11T tokens on 384 GPUs in 30 days averages about 11,000, computed).
| Step | Result (all computed) |
|---|---|
| Budget | FLOPs, 1,474,560 GPU-hours |
| Size | 55B to 148B by fit, 133B Besiroglu. A 70B model costs 0.003 nats |
| Model and tokens | Llama 3 70B shape, 935 tokens/s per GPU, 4.47T tokens at 6N accounting, 3.88T like-for-like with Llama 3's MFU |
| Layout | TP 8, PP 4, DP 64, 16.8M-token () batch, , 9.4% bubble, about 30 GiB per GPU |
| Failures | MTTF 14 to 40 h, 18 to 50 interruptions (29 at the Llama 3 rate) |
| Checkpoints | 122 min at 5-min writes (about 9% lost), 27 min at 15-s writes (about 2.5%) |
| Evaluations and reserve | 447 evaluations, about 1% of GPU-hours. 0.86M GPU-hours for ablations |
15.5 Ten formulas for planning a run
Which formulas should you be able to write from memory, and where in this guide is each one derived? Start with the planning chain of Section 15.4. Each card links the section that derives it.
Compute budget
for this plan (computed) [4, 6]. Section 1.3
Training FLOPs
The second form holds when attention is small. Llama 3 405B: (computed) [25, 34]. Section 1.2
Compute-optimal size
Chinchilla exponents. 132.9B under the Besiroglu refit (computed) [40, 446]. Section 6.2
Inference-aware size
At fixed loss. Serving tokens moves 133B to 72B (computed) [70]. Section 6.5
Throughput
PaLM-style. 811 per GPU for the 70B shape, 935 with only (computed) [34]. Section 1.3
Model-state memory
Mixed-precision Adam. 1.13 TB for 70.55B (computed) [22]. Section 1.4
Activations per layer
Bytes, GPT-style, with sequence parallelism and selective recomputation. 0.27 GiB at 8K and TP 8 (computed) [45]. Section 1.5
Pipeline bubble
1F1B and interleaved. 3/32 = 9.4% (computed) [41]. Section 11.4
Ring all-reduce
Bytes sent per GPU in a group of . 8.68 GB for 4.41 GB over 64 (computed) [851]. Section 11.1
MTTF and checkpoint interval
24.7 h and 122 min at 5-minute writes (computed) [903, 931]. Section 12.3
Every other formula is collected in Section 16.1, and every term, this chapter's included, in Section 16.2. The ones you will reach for next are the KV cache and decode floor (Section 13.2), the collective cost model (Section 11.1), the DPO loss (Section 8.7), the GRPO advantage (Section 9.3), unbiased pass@k (Section 10.3) and the minimum detectable difference (Section 15.1).
15.6 Where to go next: courses, codebases and the speedrun
After this guide, what should you work through, in what order, and what does the NanoGPT speedrun teach about how improvements compound? Reading builds a map, but skill comes from writing the code and hitting the bugs. Table 15.7 pairs public resources with chapters.
Table 15.7. Public curricula and codebases, as of November 2026.
| Resource | What it covers | Use it with |
|---|---|---|
| Stanford CS336, Spring 2026 [1144] | Five assignments: basics, systems (a Triton FlashAttention2), scaling ("Query a training API to fit a scaling law"), data from raw Common Crawl, and SFT plus RL for math. Students get "minimal scaffolding". | Chapters 1, 3, 4, 6, 8, 9 |
| The Ultra-Scale Playbook [44] | Parallelism from one GPU to thousands, from over 4,000 experiments on up to 512 GPUs. "Reading time: 2-4 days." | Chapter 11 |
| How to Scale Your Model [1145] | "compute, communication, and memory" as the three bounds, with Llama 3 tutorials and exercises on parallelism and run time. | Chapters 1, 2, 11, 13 |
| The Smol Training Playbook [13] | SmolLM3, 3B on 11T tokens with 384 H100s, from when not to train to post-training and infrastructure. | This chapter |
| nanoGPT and llm.c [1146, 1147, 15] | Minimal PyTorch and C/CUDA GPTs. GPT-2 124M on one 8xA100 node over 10B tokens in 90 minutes for $20. | Chapter 1, Chapter 5 |
| modded-nanogpt [415] | The speedrun below. | Chapters 4, 5, 11 |
| nanochat [1148] | A single-node pipeline from tokenizer to chat, ranked by "time to GPT-2" on 8 H100s. | Chapters 8, 10 |
| Mindset references [943, 393, 1149] | Karpathy's training recipe, the Deep Learning Tuning Playbook, and Bekman's ML Engineering Open Book. | Chapter 12 |
A suggested path (this guide's advice):
- Reproduce GPT-2 124M and pass the loss-at-initialization and overfit-one-batch checks.
- Re-derive one speedrun record's gain with seeds and a minimum detectable difference.
- Do CS336 assignments 1 to 3.
- Reproduce the Ultra-Scale Playbook's memory numbers on a multi-GPU node.
- Work the How to Scale Your Model exercises.
- Read the Smol Training Playbook and write your own Section 15.4 plan.
- Run nanochat end to end.
The speedrun: how gains compound
The speedrun asks how fast 8 H100s can reach 3.28 validation loss on FineWeb, which llm.c's GPT-2 replication reached in 45 minutes on the same 8 H100s (90 minutes on 8 A100s). Records must show p < 0.01 that they hit the target, except changes that only speed up the systems [415]. The record fell from 45 minutes on 28 May 2024 to 0.665 minutes with record 92 on 30 August 2026, using under 330M tokens against 10B [415]. With halving time
that is 67.7 times faster in 27.1 months, a halving every 4.45 months. Records 1 to 21 halved the time every 2.0 months, records 21 to 92 every 8.9 months, or 13.2 without record 92 (computed from the README as of November 2026). In 2024, 16 records after the baseline gave 12.6 times. In 2025, 39 gave 1.9 times (computed). In Figure 78, look for the steep first eight months, the long flat stretch, and the drop at record 92, which cut 41% by bundling sampled softmax, an FP8 MLP, a hashed n-gram table, a new optimizer stack and CUDA graphs [415]. Returns shrink on average, but bundles can still break the trend.
Method and sources
Records must show p < 0.01 that mean validation loss is at most 3.28, except changes that only speed up the systems, and no record may change the training or validation data. Halving time, computed as months × ln 2 / ln(speedup), was 2.0 months through record 21 in January 2025 and 8.9 months after (13.2 months without the August 2026 record, and 8.8 months if the later era starts from record 21's re-timed 3.014 minutes). The toggles add these segments, the GPT-2 Medium track (2.92 loss, 348 down to 17.35 minutes) and each category's share of the total log-speedup, and the stepper walks the eras. Data: the modded-nanogpt README (Jordan and contributors, 2024), read on 3 November 2026. The category labels are this guide's judgment.Labeling each record with one category (this guide's judgment) and summing log-speedups gives architecture 34.5%, several changes at once 26.0%, attention and context 12.5%, optimizer 10.2%, systems 8.7%, precision 3.8%, framework upgrades 2.9%, schedule and batch 1.3%, data pipeline 0.8% and evaluation 0.1%, with two re-timings of record 21 at −0.6% (computed).
Data earns 0.8% because records must "Not modify the train or validation data pipelines." [415] nanochat allows data changes, and its biggest step was a dataset swap, 2.76 to 2.02 hours (minus 26.8%, computed). Its last two entries, as of the March 2026 leaderboard, are labeled autoresearch rounds [1148]. Category shares tell you what a benchmark's rules allow, not what matters in general.
Do speedrun tricks transfer? Muon claims "~1.5x better sample-efficiency" there [415], and competitive tasks "solve the undertuned baseline problem" [413]. The README concedes some methods "are unlikely to scale" [415]. Moonlight reports Muon matching AdamW with about 52% of the FLOPs [409], yet with tuned baselines the gains shrink with scale (Section 15.1) [418]. SmolLM3 saw "more frequent divergence with Muon and AdeMAMix" at 3B and kept AdamW, though its team suspects a parallelism bug [13]. And agents recover under 20% of human speedups without hints. The best, o3-mini, reaches about 40–46% with detailed hints [1150].
15.7 Open problems as of late 2026
What does nobody know how to do yet, according to the people who train these models? Six problems recur in public reports as of November 2026.
Data. Villalobos et al. expect training sets to match the stock of public human text "between 2026 and 2032" [457]. Repetition buys time: four epochs cost an 8.7B model only 0.5% [209], and Section 3.6 derives what repeated data is worth. Kimi K2 calls token efficiency "a critical coefficient in the scaling of large language models" [72]. Open: how far synthetic text can replace human text, and how to measure data quality without training.
Evaluation. Small-scale decisions rest on noisy benchmarks [745, 259], and in one re-examination of 46 tasks downstream scaling was predictable "39% of the time" [474]. Arena scores are biased by selective disclosure [805]. Open: benchmarks with high signal-to-noise at small scale that still matter at the frontier.
RL scaling. ScaleRL finds "the field lacks predictive scaling methodologies comparable to those established for pre-training", after more than 400,000 GPU-hours of study [483]. Olmo 3 writes that RL theory "is less developed", and its final RL run lost at least a day to instability [12]. Open: what sets RL's ceiling, and how to derisk an RL recipe (Chapter 9, Chapter 14).
Reliability. Kokolis et al. project an MTTF of 0.23 hours at 131,072 GPUs [903], and Llama 3 saw power swings "on the order of tens of megawatts" [6]. Open: training that survives failures without global restarts, and cheap detection of silent data corruption (Chapter 12).
Efficiency and limits. Frontier compute grew 4–5 times a year to May 2024 [101], and the amortized cost of frontier runs grew 2.4 times a year since 2016 [100]. Epoch judges FLOP runs feasible by 2030, with power binding first [103]. Data movement may cut utilization above FLOPs [1151]. Open: larger critical batches, lower precision without loss, and optimizer gains that survive scale.
Automating research. Agents recover a minority of known speedrun gains [1150], yet leaderboards now list AI-credited and autoresearch entries [415, 1148]. Open: holding agent claims to the standards of Section 15.1.
An ablation shows +0.4 HellaSwag points with one seed per arm. Ship it?
No. With seed standard deviation 0.21 points (Madaan et al., 7B), the one-seed minimum detectable difference is , so 0.4 is noise. Three seeds per arm lower it to 0.34, or use a continuous metric with better signal-to-noise. If this was the best of 20 variants, Bonferroni raises the bar to about 0.90 (computed).
Your step-0 loss with the Llama 3 tokenizer reads 13.5 nats. What do you suspect?
A near-uniform softmax over 128,256 tokens gives nats. Higher means confidently wrong predictions: an output layer initialized too large, or a loss summed or normalized over the wrong axis. Check those first. (13.5 is illustrative.)
The loss looks normal, but at 1T tokens your evaluations trail a predecessor's checkpoints at the same token count. What do you test first?
The untested differences from the known-good setup, on the cheapest reproduction. In SmolLM3 that was tensor parallelism: a small model with and without TP showed every TP rank used the same initialization seed. Seeding with seed + tp_rank fixed it, and only the reference checkpoints revealed it.
Checkpoint writes block for 5 minutes and the job's MTTF is 24.7 hours. How often should you checkpoint, and what does a 15-second asynchronous write buy?
minutes, losing about 9% to writes, recomputation and restarts. A 15-second stall gives 27 minutes and about 2.5%. The 6.4-point gap over 720 hours is about 46 hours, two days of all 2,048 GPUs (computed).
Muon gave about 1.5x sample efficiency in the 124M speedrun. Should you expect 1.5x at 70B?
Not without evidence. Moonlight reports about 52% of AdamW's FLOPs, but tuned-baseline benchmarks show speedups falling from 1.4x at 0.1B to 1.1x at 1.2B, and SmolLM3 saw more divergence at 3B. Run a ladder with tuned baselines for both and compare at the end of the learning-rate decay.
- Treat model development as an experimental science. Derisk one change at a time and measure seed noise before trusting a difference: .
- Small-scale decisions often transfer, but not always. Ranking at 150M picks the better data recipe at 1B about 80% of the time, and ladders cost about 1% of target compute.
- Read loss curves with instruments: at step 0, gradient norm, max attention logit and update RMS as leading indicators.
- Debug from symptom to layer, cheapest check first, against a known-good configuration. Evaluations, not the loss, caught SmolLM3's seed bug.
- A run plan is a chain: budget, , tokens per second, layout and memory, MTTF and . For 2,048 H100s over 30 days that is about FLOPs, a 70B-class model on 3.9 to 4.5T tokens, and 18 to 50 interruptions.
- The compute-optimal size depends on the fit (55B to 148B), but the optimum is flat, so choose by serving cost.
- Budget the research: SmolLM3's ablations cost 58% of its main run.
- Practice with CS336, the Ultra-Scale Playbook, How to Scale Your Model, the Smol Training Playbook and the nanoGPT family. The speedrun compounded 68 times with shrinking returns.
16. Appendix: cheat sheet, glossary and reading list
The formulas, terms and reading list belong close to the work. Each entry below links back to the derivation or explanation, so a remembered rule can be checked against its assumptions before it goes into a plan.
The appendix has three parts. Section 16.1 collects 160 formulas in 15 groups, one group per chapter, each with its meaning, an example value and a link to its home section. Section 16.2 defines 527 terms the guide uses, in alphabetical order. Section 16.3 lists fifty primary sources, grouped by the parts of the guide. When a card is too terse, follow its link to the derivation, the assumptions and the failure modes.
16.1 Cheat sheet: the key formulas by chapter
Which formula do I need, what does it mean, and what number does it give on a model I know? Find the chapter, find the card, then follow its link when you need the derivation. Notation is the guide's (Section 0.3). FLOPs is a count and FLOP/s a rate. GB means 109 bytes and GiB means 230 bytes. Each example carries its label: (reported) for a value a paper or vendor states, (computed) for arithmetic done in this guide from cited inputs and (illustrative) for a made-up input chosen to show the scale.
Chapter 1. FLOPs and memory: the arithmetic of training
Parameters of a Llama-style decoder
Embedding and untied head and the final norm, then per layer the Q and O projections, the grouped K and V projections, three SwiGLU matrices and two norm gains. [6, 17]
Example: Llama 3 8B (32 layers, d 4,096, dff 14,336, 32 heads and 8 KV heads of 128, V 128,256, untied): 8,030,261,248 (computed).
FLOPs of a matrix multiply
Each of the mn outputs is a k-long dot product: k multiplies and k adds. [32]
Example: Llama 3 8B's query projection on 8,192 tokens: 2 × 8,192 × 4,096 × 4,096 = 2.75 × 1011 FLOPs (computed).
Training FLOPs per token
2N forward and 4N backward for the weights, plus the two attention matmuls over the average context. [6, 25]
Example: Llama 3 8B, causal: 51.5 GFLOPs per token at 8K and 148.1 at 128K counting its 7.50B matmul parameters, 2.88x (computed).
Training compute
Total training FLOPs, attention neglected, with N activated parameters for a mixture of experts. [25, 34, 6]
Example: Llama 3 405B: 6 × 405.85B × 15.6T = 3.80 × 1025 FLOPs against 3.8 × 1025 reported (computed).
Time to train and GPU-hours
Wall-clock time from compute, accelerator count, dense peak F and utilization. GPU-hours do not depend on p. [6, 11, 4]
Example: Llama 3 405B at 41% MFU on 16,384 H100s: 66 days and 26.0M GPU-hours (computed), against 30.84M reported.
Model FLOPs utilization
Achieved model FLOP/s over aggregate dense peak, recomputation not counted. This guide counts causal attention, half the full count. PaLM's definition and its 46.2% use the full sequence length, as in Section 15.4's card. [34]
Example: PaLM 540B: 238.3K tokens/s × 6 × 540B over 6,144 chips × 275 TFLOP/s is 45.7% before attention FLOPs (computed), 46.2% reported with them.
Utilization implied by reported GPU-hours
End-to-end utilization, including restarts and slow stages, to compare with steady-state MFU. [11]
Example: Llama 3.1 405B: 3.8 × 1025 / (30.84M × 3,600 × 989.5 TFLOP/s) = 34.6% against 41% MFU (computed).
Model-state bytes, mixed-precision AdamW
BF16 weights and gradients plus an FP32 master copy and two FP32 Adam moments, before sharding. [22]
Example: Llama 3 70B: 16 × 70.55B = 1,128.9 GB (computed).
Activation bytes per token per layer (Llama-style)
Saved activations of a GQA plus SwiGLU layer with FlashAttention, BF16, no dropout and no recomputation. [45, 63]
Example: Llama 3 8B: 167,936 bytes per token per layer, 41.0 GiB for one 8K sequence over 32 layers (computed).
Logits memory before a fused loss
FP32 logits for the loss, 4sbV as Korthikanti et al. count them [45], plus a 2sbV BF16 copy when the framework keeps the unfused output (our assumption).
Example: Llama 3 8B at 8,192 tokens: 1.96 + 3.91 = 5.9 GiB (computed).
FLOPs per generated token
Weights once per token plus attention over every cached position, with query heads h, not hkv. [6]
Example: Llama 3 70B at 128K context: 139 + 344 = 483 GFLOPs per token, 71% attention (computed).
Roofline and ridge point
An operation runs at the lower of peak FLOP/s and its intensity I times bandwidth W. [79, 4]
Example: H100 dense BF16: 989.5 TFLOP/s / 3.35 TB/s = 295 FLOP per byte (computed).
Intensity of a weight matmul
With e bytes per element, a weight matmul over T tokens does about T FLOPs per byte in BF16. [32]
Example: Decode at batch b reads each weight once for about b FLOPs per byte, so weight matmuls turn compute-bound near b = 295 on an H100 (computed).
Training energy and energy per FLOP
Energy from GPU-hours, per-GPU power and facility overhead. The method must be stated. [11]
Example: Llama 3.1 405B: 30.84M h × 700 W = 21.6 GWh of GPU energy, 2.05 pJ per model FLOP before PUE (computed).
Chapter 2. Hardware: accelerators, interconnects and clusters
Peak FLOP/s from the die
Streaming multiprocessors (or CUs, or MXUs) times the FLOPs each completes per clock in a format times the boost clock. [104, 4]
Example: H100 SXM: 132 SMs × 4,096 dense BF16 FLOP per clock × 1.83 GHz = 989.4 TFLOP/s, the spec sheet's 1,979 halved (computed).
Kernel time and per-level ridge
A kernel is compute-bound at a memory level when its intensity from that level exceeds the level's ridge. [104, 4]
Example: H100 dense BF16: ridges of 295 FLOP per byte from HBM, 82 from L2 and 32 from shared memory (computed).
Value of a binary float
Exponent field E, nm mantissa bits. Subnormals use 21 - bias times frac/2nm. [117, 116]
Example: FP8 E4M3 tops out at 448, E5M2 at 57,344 and FP4 E2M1 at 6 (computed from the bit layouts).
Bits per element of a block-scaled format
Element bits plus the shared scale spread over its block. [116]
Example: MXFP4: 4 + 8/32 = 4.25 bits. NVFP4: 4 + 8/16 = 4.5 bits (computed).
Online softmax merge
Two blocks' running maxima and sums combine into the exact statistics of the whole row, which lets FlashAttention tile attention. [63, 82]
Example: Exact by the identity . FlashAttention-3 reaches 740 TFLOP/s, 75% of an H100, in FP16 (reported).
Exponential bottleneck in attention
Per attention score, 4 dh tensor-core FLOPs against one exponential on the special-function unit. [82, 110]
Example: At dh = 128: 0.50 on H100 in BF16 and 1.00 on B200, where the exponential can no longer hide (computed).
Bandwidth per direction
Convert vendor totals and line rates to bytes per second per direction before comparing tiers. [104, 137]
Example: NVLink 4: 18 × 25 = 450 GB/s per direction. A 400 Gb/s NIC: 50 GB/s (computed).
Bandwidth across an oversubscribed layer
Worst-case per-GPU bandwidth through a layer oversubscribed ρ:1 when every GPU below it sends across. [141, 6]
Example: Llama 3's 1:7 layer above each 3,072-GPU pod: 50/7 = 7.1 GB/s per GPU (computed).
Hash collisions under ECMP
f equal flows hashed onto u equal-cost uplinks: a synchronous collective runs at about the mean load over the busiest link's load. [141]
Example: 16 flows on 16 uplinks: 5.7 idle links and about 32% of line rate (computed).
Facility power of a cluster
Accelerator TDP times a multiplier for CPUs, network and storage, times power usage effectiveness. [153]
Example: Llama 3's 16,384 H100s at 700 W and PUE 1.12: 26.1 MW (computed).
Chapter 3. Data: from the raw web to training tokens
GPT-3's soft quality threshold
Keep probability of a document with classifier score q, from NumPy's Pareto draw (a Lomax variable). [36]
Example: A score of 0.9 survives 42% of the time, 0.5 about 1 in 38 (computed).
MinHash estimates Jaccard similarity
Two sets' minima under a random permutation agree with probability equal to their Jaccard similarity. [188]
Example: 112 hashes estimate J = 0.6 with a standard deviation of about 0.046 (computed).
LSH banding curve
With nb bands of nr hashes, a pair is flagged when every hash in some band matches. [5, 188]
Example: FineWeb's 14 bands of 8 flag 77% of pairs at J = 0.75 and 92% at 0.8 (computed).
Bloom filter size
Bits and hash functions needed for n items at false-positive rate ε. [167]
Example: 1012 items at ε = 10−12: 7.2 TB (6.5 TiB) and 40 hash functions (computed). DCLM's quoted 6.5TB matches the TiB figure.
Epochs per domain
Passes over domain i when it has token share wi of a D-token run and Ui unique tokens. [196]
Example: phi-4's synthetic slice: 13.8 epochs, as its own table shows (computed).
Effective data under repetition
Fresh-equivalent tokens after nep epochs of UD unique tokens. [209]
Example: With RD* = 15.39, four epochs are worth 3.73 unique passes (93%) and sixteen 10.6 (66%) (computed).
What a vocabulary costs
Vocabulary parameters, output-layer FLOPs and logits memory. [6, 17]
Example: Llama 3 8B: 1.05B vocabulary parameters (13.1% of the model) and 3.91 GiB of FP32 logits per 8K sequence (computed).
Bits per byte
Loss in nats per token converted to bits per UTF-8 byte, comparable across tokenizers. [189, 6]
Example: 1.80 nats per token at 3.94 bytes per token (Llama 3 on English text, about one byte per character) is 0.659 bits per byte (computed).
Noise of a gap between two recipes
Standard deviation of the observed gap with nseed seeds per arm, and the chance it has the right sign for a true gap Δ. [258]
Example: Seed noise of 2 points with one seed per arm: a true 1-point gap is ordered correctly 64% of the time (computed).
Chapter 4. Architecture and the pretraining objective
Next-token loss
Mean negative log probability of the true next token, in nats per token. [19]
Example: e1.8 = 6.05: a loss of 1.80 nats is a perplexity of 6.05 (computed).
Loss at initialization
Uniform predictions over the vocabulary. Section 4.1 introduces it and Section 12.5 uses it as a health check at step 0. [6, 19]
Example: 11.76 nats for Llama 3's 128,256 tokens, 10.82 for GPT-2's 50,257 (computed).
Forward FLOPs per token by context
Weight matmuls plus causal attention scores and value mixing, the average token attending to s/2 keys. [6]
Example: Llama 3 8B: attention is 3.5% of forward FLOPs at 2K, 12.5% at 8K and about 70% at 128K (computed).
SwiGLU width with MLP parity
A three-matrix gated MLP with the parameters of a two-matrix 4d MLP. [26, 46]
Example: d = 4,096 gives 10,923 (computed), which OLMo 2 7B rounds to 11,008. Llama 3 8B uses 3.5d = 14,336 (reported).
z-loss
Penalizes the log of the output softmax normalizer, pushing every logit down in proportion to its probability. [34]
Example: Standard normal logits shifted by +20 over 128,256 classes: log Z = 32.3 and a penalty of 0.104 at λz = 10−4 (computed).
Logit soft-capping
A smooth bound on logits that also shrinks the gradient of saturated ones. [268]
Example: Cap 30: 60 maps to 28.92 with a local gradient of 0.07 (computed).
KV-cache bytes with multi-head latent attention
MLA caches one latent of width dc and one shared rotary key of width dhR per layer, at e bytes per element. [282, 2]
Example: DeepSeek-V3: 61 × 576 × 2 = 70,272 bytes per token (computed), against 327,680 for Llama 3 70B with GQA-8.
Cache of an interleaved local and global stack
KV cache relative to an all-global stack, with a share fg of global layers and windows of w tokens. [265]
Example: Gemma 3's pattern (fg = 1/6, w = 1,024): 0.173 of an all-global cache at 128K (computed).
RoPE frequency and wavelength
Rotation frequency and wavelength in tokens of rotary pair j. Scores depend only on relative position. [299, 6]
Example: dh = 128 with θbase = 500,000: wavelengths from 6.3 to 2,559,196 tokens (computed).
Activated parameters of a mixture of experts
Parameters one token's forward pass uses: attention A, dense layers, k routed and Es shared experts of width de, router and embeddings. [2]
Example: DeepSeek-V3: 37.55B activated of 671.03B stored (computed), 37B and 671B reported.
Auxiliary load-balancing loss
fi is the share of tokens sent to expert i and Pi its mean router probability. [30]
Example: Uniform routing gives exactly α: 0.0100 at α = 0.01 over 8 experts (computed).
Expert capacity
Slots per expert in a routing group of T tokens. Tokens beyond capacity are dropped. [30]
Example: T = 4,096, E = 64, top-1: capacity factor 1.0 drops 4.9% of tokens by chance, 1.25 drops 0.13% (simulated).
Experts read per decode step
Under uniform routing, the share of a layer's routed experts a decode step of T tokens reads. [2]
Example: DeepSeek-V3 (8 of 256): 3.1% at T = 1 and 86.9% at T = 64 (computed).
Chapter 5. Optimization and training dynamics
One AdamW step
Moment averages, bias-corrected ratio and decoupled weight decay multiplied by the learning rate. [337, 338]
Example: Bias correction at step 10 with β2 = 0.95: 1 − 0.9510 = 0.40 (computed).
AdamW's averaging timescale
AdamW's weights are an exponential average of updates over about 1/(ηλ) steps. [7]
Example: OLMo 2 7B: 33,333 steps, 3.5% of its 953,674-step run (computed).
Untuned warmup length
Steps for Adam's second moment to settle at initialization. [349, 6, 7]
Example: 40 steps for β2 = 0.95 and 2,000 for 0.999. Llama 3 405B warms up for 8,000 steps and OLMo 2 for 2,000 (reported), 50–200x the rule at 0.95 (computed).
Cosine schedule
Half a cosine from peak to floor over the post-warmup fraction x. [40]
Example: The mean learning rate is 0.550 of peak with a 10% floor and 0.500 to zero (computed).
Steps and data against batch size
Below the critical batch, bigger batches save steps almost free. Above it, they trade data for time. [360, 341]
Example: Llama 3 405B's 16,777,216-token batch against an extrapolated critical batch of 118M tokens: 1.14x the minimum data and 8.0x the minimum steps (illustrative).
Rescaling Adam when the batch changes
The square-root rule. Malladi et al.'s full SDE rule also changes the betas and epsilon. [367]
Example: Quadrupling the batch doubles the learning rate. Llama 3 and DeepSeek-V3 kept (0.9, 0.95) through their batch ramps (reported).
μP multipliers
Hidden-matrix learning rate and initial variance divided by the width multiplier, embedding learning rate unchanged. [372]
Example: Llama 3 8B from a width-256 proxy: mwidth = 16, so hidden learning rates are 1/16 of the proxy's (computed).
Attention logit bound under QK-norm
With per-head RMSNorm on queries and keys, Cauchy-Schwarz bounds every logit. [278, 270]
Example: dh = 128 at unit gains: 11.3, far below the 103 where loss degrades (computed).
Spike score
Share of points at least 7 rolling standard deviations from the mean of the previous 1,000. [7]
Example: OLMo 2's gradient spike score fell from 0.108 to 0.069 with output norms and QK-norm (reported).
Swamping threshold
An update smaller than half a unit in the last place rounds away. M is the mantissa width. [51]
Example: BF16: 256. Llama 3 405B's final learning rate of 8 × 10−7 against weights near 0.02 is a ratio of 25,000 (computed).
Muon update
Momentum orthogonalized by five Newton-Schulz steps, scaled to match AdamW's update RMS. [413, 409]
Example: The update RMS is 0.200 for any matrix shape after scaling. Newton-Schulz adds about 0.4% to Llama 3 8B's training FLOPs at 4M-token batches (computed).
Edge of stability
Stability thresholds on the top Hessian eigenvalue for gradient descent and Adam-style momentum. [422]
Example: Adam with β1 = 0.9 holds sharpness near 38/η (reported).
Chapter 6. Scaling laws: predicting loss, sizing runs and spending compute
Kaplan's loss against parameters
Loss against non-embedding parameters when nothing else limits training. [25]
Example: Doubling N multiplies the loss by 0.95, and halving it would take about 9,100x more parameters (computed).
Chinchilla's parametric loss
Entropy of text plus a finite-model and a finite-data term. B and β here are fit constants. [40, 446]
Example: Printed: E 1.69, A 406.4, B 410.7, α 0.34, β 0.28. Besiroglu refit: 1.8172, 482.01, 2085.43, 0.3478, 0.3658 (reported).
Compute-optimal frontier
Minimizing the law at fixed C = 6ND. [446]
Example: Refit constants at 1024 FLOPs: 95.9B parameters on 1.74T tokens (computed).
The 20 tokens per parameter rule
Chinchilla's shorthand for the compute-optimal split. [40]
Example: 1024 FLOPs: about 91B parameters on 1.8T tokens (computed).
Compute wasted by mis-sizing
Training ρ times the optimal size at fixed compute: the compute a compute-optimal model would need for the same loss. [446]
Example: Refit constants: 2x off wastes about 16% of the compute, 10x off about 82%, at every budget (computed).
Sensitivity to the fitted exponent
An error in the frontier exponent a moves the extrapolated size by a factor eerror × ln C. [6]
Example: An error of 0.005 at 3.8 × 1025 FLOPs moves the predicted size 1.34x (computed).
Compute multiplier for overtraining
Extra compute for a given loss when training κ times more tokens per parameter than optimal. [456]
Example: With α/2 = 0.15: 1.04x at κ = 2, 1.5x at 10 and 4.4x at 100 (computed).
Inference-aware sizing
The cheapest lifetime compute, training plus serving Dinf tokens, that reaches a target loss. [70]
Example: 30B-quality model serving 1013 tokens: 13.9B parameters on 2.74x the data, 26.5% of lifetime FLOPs saved (computed), against 13.6B and 28% reported.
Break-even serving volume
Tokens served after which an overtrained model's cheaper inference repays its extra training. [70, 6]
Example: Llama 3 8B against its equal-loss compute-optimal model: about 1013 served tokens (computed, order of magnitude).
Coverage under heavy-tailed difficulty
Exact pass@k over a benchmark whose per-problem success q follows a Beta law. Failure falls as k−λ. [480, 479]
Example: Beta(0.3, 3): 9% at k = 1, 67% at k = 100 and 92% at k = 10,000 (computed).
Exchange rate between test-time and training compute
How many times its normal inference compute a model g times smaller may spend before matching the larger model's total cost. [71]
Example: g = 14 and Dinf/Dpre = 0.79: K = 63 (computed).
Sigmoidal RL scaling
Expected reward against RL compute with a ceiling Rmax, a midpoint and a steepness. [483]
Example: Cmid = 2,542 GPU-hours and ω = 1.92: half the gain at Cmid and 93% at 104 GPU-hours (computed).
Extrapolating a doubling trend
Time to reach a target under a constant doubling time Td. [486]
Example: 110 minutes to a 167-hour work-month is 6.5 doublings: 3.7 years at 207 days per doubling (computed).
Chapter 7. Midtraining: annealing, long context and continued pretraining
Share of compute in a training stage
For a fixed model, a stage's share of FLOPs equals its share of tokens, attention ignored. [7]
Example: OLMo 2 7B's midtraining: 150B of 4.05T tokens, 3.7% (computed).
Annealing law
Loss falls with the area under the learning-rate curve and with the momentum-weighted amount of decay. [359]
Example: Tissue et al.'s 594M fit over 20K steps: WSD with a 20% linear decay predicts 2.778 nats, cosine to zero 2.840 (computed).
What averaging k anneals keeps
Share of the noise part of the excess loss left after averaging k ingredients with pairwise correlation ρ. [7, 1152]
Example: Three independent anneals keep a third. Ten checkpoints from one run (ρ near 0.9) keep 91% (computed).
Position Interpolation and NTK-aware scaling
PI slows every rotary pair by the extension factor. NTK-aware keeps the fastest pair and slows the slowest by exactly kext. [509, 507]
Example: Llama 2 (θbase 10,000, dh 128) extended 8x: the NTK-aware base is 82,685 (computed).
YaRN attention temperature
YaRN interpolates only pairs that never turned in the trained window and sharpens attention logits. [507]
Example: kext = 16: 1.28, so logits are multiplied by 1.63 (computed).
Compute share of a long-context stage
A long-context stage's FLOP share exceeds its token share by the ratio of per-token costs. [6]
Example: Llama 3 405B's 800B long-context tokens: 5.1% of tokens and 5.3–8.2% of FLOPs, depending on unreported stage lengths (computed).
Compute-equivalent replay
Replayed old tokens replace new ones, so continued pretraining costs the same. [358]
Example: 5% replay in a 300B-token run: 285B new and 15B old tokens (computed).
Cost of distillation
Student training plus teacher forward passes for the logits, per distillation token. [471]
Example: A 1.2B student of a 70.55B teacher: the teacher is 95% of the FLOPs (computed).
Chapter 8. Post-training I: instruction tuning, preferences and RLHF
SFT loss with a global token normalizer
Next-token loss on assistant tokens (mask mt = 1), normalized by the token count of the whole batch. [550]
Example: Averaging per example instead gives a 10-token example 50% of the gradient against a 1,000-token one, not 1% (computed).
LoRA update and adapter size
A frozen weight plus a rank-r update. Here r is the LoRA rank, not a reward. [565]
Example: Rank 16 on all seven linear layers of Llama 3 8B: 41.9M trainable parameters, 0.52% (computed).
LoRA training FLOPs
Frozen weights skip their weight gradient, adapters add 6 PLoRA FLOPs per token. [566]
Example: Llama 3 8B at rank 16: 0.672 of full fine-tuning's linear-layer FLOPs (computed).
QLoRA base storage
4-bit NormalFloat codes plus double-quantized block constants. [76]
Example: Llama 3 70B base: 33.9 GiB, so a 70B fine-tune fits one 80 GB GPU (computed).
Bradley-Terry reward-model loss
A comparison as a logistic function of the reward margin Δr. [8]
Example: A margin of 0.96 gives 72% preference, the typical margin of a 72.4%-accurate reward model (computed).
Ceiling set by labeler agreement
Under symmetric noise, agreement a between labelers implies a flip probability q. [8]
Example: InstructGPT's 72.6% agreement: about 16% flipped labels and an 84% ceiling (computed).
KL-regularized objective
Reward minus a KL leash to the reference policy, with KL coefficient β. [8, 586]
Example: Its optimum is πref(y|x) er/β / Z(x), the starting point of DPO (Section 8.7).
KL spent by best-of-n
An upper bound, exact for continuous rewards with distinct samples. [575, 6]
Example: n = 30, Llama 3's largest rejection-sampling K: at most ln 30 − 29/30 = 2.43 nats per round (computed).
PPO clipped surrogate
PPO's pessimistic objective with probability ratio ρt, its clipped copy ρ̄t and clip range ε. [591]
Example: ε = 0.2 in every RLHF system the chapter surveys (reported).
Generalized advantage estimation
Advantages from the value model's temporal-difference errors. [592]
Example: With γ = 1 and λ = 0.95, a reward 100 tokens away reaches the first token with weight 0.006 (computed).
PPO FLOPs per generated token
Generation, reference, reward and value forwards (2N each) plus nep epochs of policy and value updates (6N each). [8]
Example: Llama 3 8B with one epoch: 20N = 1.6 × 1011 FLOPs per token (computed).
Gao et al.'s gold reward for best-of-n
Gold reward rises then falls with distance from the initial policy. The coefficients are fits, not the KL coefficient. [575]
Example: An 85M reward model peaks at 7.9 nats of KL (n near 7,100) for best-of-n (computed from digitized coefficients).
DPO loss
Bradley-Terry likelihood of the preferences under the implicit reward β log(πθ/πref), with Δ the chosen-minus-rejected log-ratio margin. [586]
Example: ln 2 = 0.693 at the start. A log-ratio margin of 8 nats at β = 0.1 gives 0.371 (computed).
Margin needed for a preference
Log-ratio margin at which DPO's implied preference reaches p. [586]
Example: β = 0.1: 11.0, 22.0 and 46.0 nats for p = 0.75, 0.9 and 0.99 (computed).
Model-state memory by method
One trained model, a trained policy plus a frozen reference, or trained policy and value plus frozen reference and reward model. [22, 6]
Example: Llama 3 8B: 128.5, 144.5 and 289.1 GB. 70B: 1,128.9, 1,270.0 and 2,539.9 GB (computed).
FLOPs of one rejection-sampling prompt
K responses decoded after one shared prefill, then scored by a reward model. [6]
Example: Llama 3 405B, K = 30, a same-size reward model: 2.9 × 1016 FLOPs per prompt, so a million prompts is 0.075% of pretraining (computed upper bound).
Chapter 9. Post-training II: reinforcement learning for reasoning and agents
Product scoring with a process reward model
The probability that every step is correct, which falls with the number of steps. [642]
Example: 0.95 per step: 0.77 at 5 steps and 0.13 at 40 (computed).
Policy gradient with a baseline
The score-function estimator needs only log-probabilities of sampled tokens. A sample-independent baseline b adds no bias. [650]
Example: On a 5-way softmax, a baseline cuts the estimator's variance from 0.280 to 0.137 (computed, illustrative).
GRPO advantage
Every token of answer i gets its group z-score. [207]
Example: G = 8 with one correct answer: +2.65 for it and −0.38 for each wrong one, population standard deviation (computed).
Leave-one-out baseline
RLOO's advantage equals Dr. GRPO's mean-centered advantage times G/(G − 1). [652]
Example: G = 8: exactly 8/7 of Dr. GRPO's value (computed).
GRPO's difficulty weighting
GRPO's standard-deviation division up-weights very easy and very hard prompts relative to Dr. GRPO. [662]
Example: Pass rate 1/16: 4.1x the weight Dr. GRPO gives the same prompt (computed).
Groups that teach nothing
Probability that all G answers to a prompt with pass rate p get the same reward, so every advantage is zero. [640]
Example: p = 0.1, G = 8: 43% of such prompts give no gradient (computed).
FLOPs of an RL run
About 2N to generate, 2N for old-policy and reference log-probabilities and 6N to train, per rollout token. [3]
Example: R1-Zero's 5.32M rollouts at an illustrative 8K tokens: 1.6 × 1022 FLOPs, about 4% of its GPUs' dense capacity (computed).
GSPO's sequence ratio
A length-normalized geometric mean of token ratios, clipped per response. [678]
Example: A token log-ratio spread of 0.05 shrinks to 0.0016 over 1,000 tokens (computed, illustrative).
Single-sample KL estimators
As loss terms, k2 gives the reverse-KL gradient, k3 the forward-KL gradient and k1 zero in expectation. [590]
Example: On a random 20-way softmax, E[k3] equals the true reverse KL, 2.1343 (computed).
Whole-response importance weights
With per-token log-ratios of spread s, a sequence weight's variance grows exponentially in length. [686]
Example: s = 0.03 over 8,000 tokens: variance 1.3 × 103 and a median weight of 0.027 (computed).
FLOPs of a reasoning trace
Matmuls grow linearly with trace length T and attention over the growing context quadratically. [3]
Example: DeepSeek-R1 on 8,793 thinking tokens: 8.4 × 1014 FLOPs per problem (computed).
Lower bound on weight synchronization
BF16 weights must reach the inference engine after every update. [712]
Example: Llama 3 405B over eight 50 GB/s links: at least 2.03 s, against 2.31 s measured by LlamaRL (computed).
Chapter 10. Evaluation: measuring what a model can do
Unbiased pass@k
From K samples per question with ci correct. The plug-in 1 − (1 − c/K)k is biased low. [699]
Example: K = 200 and c = 3: pass@100 is 0.877, against 0.779 for the plug-in (computed).
passk
Unbiased probability that all k independent trials succeed. [779]
Example: True success rate 0.6 and K = 8: the estimator averages 0.64 = 0.13 for pass4, while the plug-in (c/K)4 averages 0.20 (computed).
Standard error and Wald interval
Binomial error of an accuracy on n questions, the interval Llama 3 reports. [6, 777]
Example: Llama 3 8B's HumanEval 37.2% on 164 problems: ±7.4 points (reported and recomputed).
Wilson interval
An interval that keeps nominal coverage on small benchmarks. [781]
Example: 18 of 30 correct: [0.42, 0.75] (computed).
Clustered questions
Questions in groups of size g with intra-cluster correlation ρICC carry less information. [777]
Example: DROP: an implied ICC of 0.54 makes 9,622 questions worth about 1,034 (computed).
Questions needed for a paired comparison
Sample size to detect a true difference δ with paired per-question differences di. [777]
Example: 71% against 69% at per-question correlation 0.8: about 1,650 questions, against 8,240 unpaired (computed).
Elo win probability
Bradley-Terry strengths, as Chatbot Arena fits them, rescaled to the Elo convention of 400 points per factor of ten in odds. [803]
Example: A 10-point gap is a 51.4% win rate, and about 4,640 head-to-head votes resolve it (computed).
Horizon at reliability q
METR's logistic in log task length, with slope γ per doubling. [486, 780]
Example: γ = 0.6 per doubling: the 80% horizon is 5x shorter than the 50% horizon (computed).
Doubling-time fit
An exponential trend in release date τ with doubling time Td. [780]
Example: METR's data as of September 2026: 187.8 days over all years and 128.7 days since 2023 (computed by refitting the published data).
Chapter 11. Distributed training: from one GPU to a hundred thousand
Ring all-reduce time
2(p − 1) latency-bound steps plus 2(p − 1)/p of the message over per-rank bandwidth W. [851, 143]
Example: Llama 3 70B's 141.1 GB of BF16 gradients over 1,024 GPUs at 50 GB/s: 5.64 s of bandwidth time (computed).
Bus bandwidth
nccl-tests' rescaling so a measurement can be compared with the link rate whatever the rank count. [143]
Example: An algorithm bandwidth of 200 GB/s on 8 GPUs is 350 GB/s of bus bandwidth (computed).
Hierarchical all-reduce
Inside each node of G GPUs over NVLink, then across q nodes, each NIC carrying 1/G of the message. [138]
Example: The same 70B gradients on 128 nodes of 8: 1.25 s instead of 5.64 s (computed).
Per-GPU model states under ZeRO
Stage 1 shards the optimizer states, stage 2 also the gradients, stage 3 also the weights. The paper writes Ψ and Nd. [22]
Example: 7.5B parameters on 64 GPUs: 120 GB unsharded, then 31.4, 16.6 and 1.9 GB (reported and recomputed).
Tokens per replica to hide gradient traffic
Achieved FLOP/s per GPU over the bandwidth the data-parallel group sees, independent of model size. [138]
Example: H100 at 40% MFU over a 50 GB/s NIC: about 7,900 tokens per replica per step (computed).
Tensor-parallel communication over compute
With no overlap, for a standard layer. Batch and sequence length cancel. [41]
Example: d = 8,192 at TP 8 over NVLink at H100 peak: 0.42 for a standard layer and 0.36 for Llama 3 70B's actual layer at 8K (computed).
Activations with tensor and sequence parallelism
Sequence parallelism divides the replicated part by ptp and selective recomputation drops the attention matrix. Korthikanti et al. write h for width. [45]
Example: GPT-3 175B at TP 8 and 2,048 tokens: 102 MiB per layer instead of 2,736 MiB (computed).
Pipeline bubble
Idle share of a synchronous pipeline with m micro-batches and v virtual stages per device. [41]
Example: 16 stages and 32 micro-batches: 0.469 of ideal time at v = 1 and 0.234 at v = 2 (computed).
Block size that hides ring-attention traffic
Tokens per device for K and V transfers to hide behind blockwise attention, with GQA shrinking dkv. [867]
Example: Llama 3 70B (dkv/d = 1/8) at H100 peak: 275 tokens over 450 GB/s NVLink, 2,474 over a 50 GB/s NIC (computed).
InfiniBand bytes of an expert-parallel token
FP8 dispatch plus BF16 combine to each of the M nodes a token's experts span. [2]
Example: DeepSeek-V3 (d = 7,168) at 4 nodes: 86 KB, 1.72 µs at 50 GB/s (computed).
Degrees and the global batch
The parallel degrees multiply to the GPU count, with expert parallelism folded into data parallelism. [6]
Example: Llama 3 405B: 8 × 1 × 16 × 128 = 16,384 GPUs and 128 × 16 × 8,192 = 16,777,216 tokens per step (computed).
Communication saved by infrequent syncs
Syncing every H steps with b-bit values instead of FP32 every step. [877]
Example: INTELLECT-1 synced every 100 steps in int8: 400x less traffic (reported).
Chapter 12. Running the run: reliability, observability and ML operations
Job mean time to failure
A synchronous job fails as soon as any node does. [6, 903]
Example: 2,048 nodes at 3.79 failures per 1,000 node-days: 3.1 hours, Llama 3 405B's observed rate (computed).
Checkpoint size
BF16 weights, FP32 master weights and two FP32 Adam moments. Gradients need not be saved. [6]
Example: Llama 3 405B: 5.68 TB, or 6.49 TB at 16 bytes per parameter (computed).
Wasted time and the Young interval
Checkpoint stalls, half an interval of rework per failure and the restart cost, to first order. [931, 903]
Example: δ = 3.25 s and M = 3 h: τ* = 265 s and 2.45% waste. A 10-minute restart adds 5.6% (computed).
Expected effective training time
Kokolis et al.'s estimate for a long job with little queueing. [903]
Example: 1,500 nodes at 6.5 failures per 1,000 node-days and a 5-minute restart: 0.74 with 5-minute writes, 0.92 with 10-second writes (computed).
Chance a job lands on a bad node
A fraction q of unhealthy nodes and a job drawing n nodes. [903]
Example: q = 0.1% and 2,048 nodes: 87% (computed).
Step time
Model FLOPs per step over the cluster's achieved FLOP/s. [6]
Example: Llama 3 405B: 6.2 s per 16,777,216-token step at 400 TFLOP/s per GPU, so 1% is 62 ms (computed).
Idle cost of a hang
Detection delay times job size, before restart and rework. [6]
Example: 16,384 GPUs and a 30-minute collective timeout: 8,192 GPU-hours per hang (computed).
ML Productivity Goodput
Scheduling goodput times runtime goodput times program goodput, which is MFU. [933, 6]
Example: Llama 3 405B: 1.0 (illustrative) × 0.90 × 0.41 = 0.37, so MFU is the largest loss (computed).
Cost of a forward-only evaluation
Deval evaluation tokens against one training step of B tokens. [6]
Example: 48M evaluation tokens cost about one 16.8M-token training step (computed).
Chapter 13. Inference: serving models fast and cheap
Decode step time and the context limit
A decode step reads the weight bytes W once and every sequence's KV cache. Above context s*, no batch makes it compute-bound. [33, 4]
Example: Llama 3 70B in BF16 on 8 H100s: s* = 1,458 tokens (computed).
Decode floor and KV bytes per token
Weight bytes plus the batch's KV bytes over the tensor-parallel group's HBM bandwidth. [6, 4]
Example: Llama 3 70B in BF16 on 8 H100s: mkv = 327,680 bytes and a floor of 5.27 ms per token at batch 1 (computed).
Model bandwidth utilization
The fraction of peak HBM bandwidth a deployment achieves at batch 1. [985]
Example: At 60% MBU the 5.27 ms floor becomes 8.8 ms, about 114 tokens/s (computed).
Cost per million tokens
p GPUs at c dollars per GPU-hour sustaining X tokens per second. [14]
Example: Llama 3 70B in BF16 on 8 H100s at batch 64 and 4K context decodes about 7,556 tokens/s (computed, Section 13.2). At an illustrative $2 per GPU-hour that is $0.59 per million output tokens (computed).
KV pool and concurrency
Sequences that fit with paged KV memory at average context s-bar, with this guide's illustrative headroom. [73]
Example: Llama 3 70B on 8 H100s: a 402.9 GB pool holds 1.23M tokens, about 150 sequences that each reserve 8,192 tokens or 1,220 paged sequences of 1,000 tokens in 16-token blocks (computed).
KV transfer as a share of prefill
Prompt length cancels while attention is a small share of prefill. [988]
Example: Llama 3 70B at 40% MFU: 0.147 over one 400 Gb/s NIC and 0.018 over eight (computed).
Decode batch an MoE needs
Tokens per decode step for every routed expert to reach the ridge under perfect balance. [2]
Example: DeepSeek-V3 on H100s: 295.4 × 256 / 8 = 9,452 tokens per step (computed).
All-to-all floor on time per output token
FP8 dispatch plus BF16 combine per layer, counted twice for dual micro-batch overlap. [1]
Example: DeepSeek-V3 with 32 tokens per device, 9 experts per token (8 routed, 1 shared), d about 7K, 61 layers and 400 Gb/s InfiniBand: 241.92 µs per layer and a 14.76 ms floor, about 67 tokens/s (reported by Zhao et al., recomputed).
Speculative decoding yield and speedup
Acceptance rate α, draft length γ and draft cost c in target steps. [1017]
Example: α = 0.8, γ = 4, c = 0.05: 3.36 tokens per pass and a 2.80x speedup (computed).
Stored bits per weight
k-bit values plus m bits of scale and zero point shared by a group of G weights. [1032]
Example: INT4 with 32 bits per 128 weights: 4.25 bits (computed).
Temperature and min-p
Temperature-scaled softmax and min-p's truncation, which scales with the model's confidence. [1050]
Example: An illustrative vocabulary at T = 1: top-p 0.9 keeps 334 tokens and min-p 0.1 keeps 3 (computed).
Chapter 14. Sandboxes and environments: where models act
Start-up share of a sandbox's life
Small for minute-long agent episodes, large for sub-second code rewards. [1087]
Example: A 125 ms microVM boot against 60 s of work: 0.21% (computed).
Wall time under a CPU limit
cgroup v2's cpu.max grants MAX microseconds per PERIOD. Set timeouts from this plus margin. [1071]
Example: 120 CPU-seconds at two cores: at least 60 s (computed).
False fails from flaky tests
Chance a correct patch is graded wrong when each of ntests tests flakes with probability f. [814]
Example: 52 tests at 0.1% per test: 5.07%. At 1%: 40.7% (computed).
What a noisy grader does to the learning signal
Expected reward for true success μ and the slope that sets the learning signal. [814]
Example: μ = 0.6, εFN = 0.2, εFP = 0.1: expected reward 0.52 and a slope of 0.70 (computed).
Little's law for sandboxes
Concurrency equals creation rate times lifetime. Episodes per hour follow from episode wall time. [10]
Example: DSec's 3 million sandboxes a day (34.7 per second) and a 17.4-minute median container life give about 36,000 concurrent sandboxes (computed). That is a lower estimate, since the mean life exceeds the median, against an observed peak of about 380,000 (reported).
Sandboxes needed per generator slot
Sandboxes in flight that keep ngen trajectories in generation, with S turns of tgen seconds in an episode of Tep. [1104]
Example: 256 trajectories, 50 turns of 20 s in a 1,250 s episode: 320 sandboxes (computed, illustrative episode).
Warm pool size
Warm sandboxes that hide creation latency. Size it for the burst rate. [1104]
Example: 132 creations per second × 4.1 s: 541 (computed).
Chapter 15. The research engineer's playbook
Minimum detectable difference
Smallest difference between two arms of n seeds each that a two-sided 95% test calls real. [745]
Example: HellaSwag with seed noise 0.21 points: 0.58 with one seed per arm and 0.34 with three (computed).
Seeds needed for a target gain
Seeds per arm to detect a true gain δ with the chosen power. [745]
Example: A 0.5-point HellaSwag gain at 80% power: 3 seeds per arm (computed).
Compute a reservation delivers
GPUs, dense peak, utilization, wall time and effective training time. [4]
Example: 2,048 H100s for 30 days at 40% MFU and 0.90 ETTR: 1.89 × 1024 FLOPs (computed).
Throughput under PaLM-style MFU
MFU that counts attention FLOPs, as PaLM defines it. Drop the second term for 6N accounting. [34]
Example: Llama 3 70B's shape at 8K and 40% MFU: 811 tokens/s per GPU, or 935 counting 6N only (computed).
Halving time of a record
Average time for a benchmark record to halve over an interval. [415]
Example: The NanoGPT speedrun, 45 minutes (May 28, 2024) to 0.665 minutes (August 30, 2026), 67.7x in 27.1 months: 4.45 months per halving (computed).
16.2 Glossary
What does this term mean, and where is it explained? The glossary lists 527 terms in alphabetical order, and each entry ends with a link to the section that explains it.
- (1-sqrt) cooldown
- A decay shape that falls fast at first and slowly at the end, which beat linear decay in Hagele et al. at short decay lengths. Section 7.1
- 1F1B
- A pipeline schedule (PipeDream-Flush) that alternates one forward and one backward pass, capping in-flight micro-batches near the pipeline depth. Section 11.4
- 2:4 structured sparsity
- At most two nonzeros in every four values. Tensor cores skip the zeros for twice the throughput, and spec sheets often quote that sparse rate. Section 2.1
- 20%-overhead batch
- The batch that needs 20% more data than the minimum. One fifth of the critical batch on McCandlish et al.'s trade-off curve. Section 5.3
- 6ND
- Training compute estimate: 6 FLOPs per parameter per token (2 forward, 4 backward) times tokens. Section 1.2
- ABF (adjusted base frequency)
- Raising the RoPE base and continuing pretraining at the longer length. Section 7.4
- Ablation
- An experiment that changes one component against a baseline to measure its effect. Section 15.1
- Acceptance length ()
- Measured mean number of tokens produced per draft-and-verify cycle. Section 13.7
- Acceptance rate, draft length and draft cost ratio
- In speculative decoding, is the mean probability a drafted token is accepted, the tokens drafted per iteration and the time of a draft step over a target step. Section 13.7
- Accumulation precision
- The precision of the running sum inside a matmul. FP8 matmuls need FP32 accumulation. Section 2.3
- Activated parameters
- In a mixture of experts, the parameters that do work for a given token. They set FLOPs, while total parameters set memory. Section 1.1
- Activation recomputation
- Storing fewer activations in the forward pass and recomputing them in the backward pass, also called rematerialization or gradient checkpointing. Full recomputation reruns every layer and turns 6N into 8N hardware FLOPs per token. Section 1.5
- Activations
- Intermediate tensors saved in the forward pass for use in the backward pass. Section 1.5
- Adam epsilon
- A constant added to the root of the second moment. When gradients are smaller than epsilon it silently shrinks updates. Section 5.1
- AdamW
- Adam with weight decay applied directly to the weights, outside the adaptive division by the root of the second moment. Section 5.1
- AdamW timescale
- steps, the window over which AdamW's weights average recent updates. is that window as a fraction of the run. Section 5.1
- Agent-computer interface (ACI)
- The commands an agent can use and the format of the feedback it gets from the computer. Section 14.4
- Algorithm and bus bandwidth (algbw, busbw)
- Algorithm bandwidth is message size over time. Bus bandwidth multiplies it by a collective-specific factor, for all-reduce, so it can be compared with the link rate. Section 11.1
- ALiBi
- A fixed per-head linear distance penalty added to attention logits. Section 4.6
- All-gather
- Every rank contributes a 1/p slice and every rank ends with the concatenation. Section 11.1
- All-reduce
- Sum arrays across ranks and give every rank the sum. Implemented as a reduce-scatter followed by an all-gather. Section 11.1
- All-to-all
- Every rank sends a different slice to every other rank. The expert-parallel and Ulysses shuffle. Section 11.6
- Alpha-beta model
- The time of an -byte message is : a fixed latency per message plus bytes over link bandwidth. Section 11.1
- Annealing (decay phase, cooldown)
- The final phase of a run, also called the decay phase or cooldown: the learning rate falls to zero or near zero and the loss drops sharply. Labs that switch to a curated data mix during it also call it midtraining. Section 7.1
- Annealing probe
- A short learning-rate decay on a mix that contains candidate data, used to measure what the data adds. Section 3.9
- Approaches 1, 2 and 3
- Chinchilla's three estimators: envelope of training curves, IsoFLOP minima, parametric fit. Section 6.2
- Arithmetic intensity
- FLOPs performed per byte moved to or from a memory level, usually HBM. An operation is memory-bound when its intensity is below the chip's ridge point. Section 1.7
- Aspect ratio
- Model width divided by the number of layers. Section 4.4
- Associative recall
- Retrieving a value given a key that appeared earlier in the context. Section 4.8
- Asynchronous checkpoint
- A short blocking copy of state to host memory followed by a background write to storage. Section 12.3
- Attention-FFN disaggregation (AFD)
- Running attention and mixture-of-experts FFN layers of the decode phase on separate GPU pools. Section 13.6
- Attention logit growth (attention entropy collapse)
- Attention scores growing until the attention weights become nearly one-hot. Section 4.3
- Attention sink
- An early token that absorbs attention mass a head does not need. Section 4.5
- Auxiliary load-balancing loss
- A penalty , where is the share of tokens sent to expert and its mean router probability. Uniform routing minimizes it. Section 4.7
- Auxiliary-loss-free (bias) balancing
- Per-expert routing biases nudged by observed load and used only to choose experts. Section 4.7
- Base model
- A pretrained model before any post-training. Section 8.1
- Baseline and advantage
- A number subtracted from the reward that does not depend on the sample, and the reward minus that baseline. Section 9.2
- Batch invariance
- A kernel property: each row's result is bitwise independent of how many other rows share the batch and how a sequence is split. Without it, temperature-0 serving can answer differently under different load. Section 12.7
- Batch ramp
- Starting with a small batch and growing it as the critical batch grows during training (batch-size warmup). Section 5.3
- Best-of-n
- Sampling responses and returning the one with the highest reward. It moves the policy at most nats of KL from the sampler. Section 8.5
- Best-of-N selection bias
- Inflation from publishing the maximum of several noisy measurements of equally good variants. Section 10.6
- BF16
- A 16-bit float with FP32's 8-bit exponent and 7 mantissa bits: FP32's range at lower precision, the default training format. Section 2.3
- Bias correction
- Dividing Adam's moments by to undo their zero initialization in early steps. Section 5.1
- Binade
- One power of two of range. A format's dynamic range is counted in binades. Section 2.3
- Bits per byte (BPB)
- Total negative log-likelihood in bits divided by the UTF-8 bytes of the evaluated text, . Unlike loss per token or perplexity, it is comparable across tokenizers. Section 3.8
- Bitwise determinism
- Identical bits on every rerun from the same checkpoint and configuration. Section 12.7
- Bloom filter
- A bit array with several hash functions that answers 'seen before?' with no false negatives and a tunable false-positive rate. Section 3.3
- Boilerplate
- Menus, footers, cookie notices and ads around a page's main content. Section 3.1
- Bootstrap
- Refitting on resampled runs to estimate the uncertainty of a fitted quantity. Section 6.4
- Bradley-Terry model
- The paired-comparison model behind reward-model training and arena rankings. Section 8.4
- Break-even tokens per replica
- , the tokens each data-parallel replica must process per step for its communication to hide behind compute. Section 11.2
- Bubble
- Idle device time in a pipeline step: of the ideal time for GPipe, 1F1B and interleaved schedules. Section 11.4
- Budget forcing
- Controlling thinking length at decode time by forcing or suppressing the end-of-thinking delimiter. Section 9.7
- Burn-in
- Stress testing at cluster bring-up to flush out weak components. Section 12.4
- Byte-level BPE
- BPE whose base alphabet is the 256 byte values, so any string can be encoded. Section 3.7
- Byte-pair encoding (BPE)
- Building a vocabulary by repeatedly merging the most frequent adjacent pair of symbols. Section 3.7
- Cache salt
- A per-tenant value mixed into block hashes so tenants cannot share, or probe, each other's cached prefixes. Section 13.4
- Caching allocator
- PyTorch's GPU allocator, which keeps freed memory reserved for reuse, so nvidia-smi shows it as used. Section 1.5
- Canary string
- A unique marker placed in benchmark files so that corpus builders can filter them out and auditors can detect their use. Section 10.5
- Capability
- One slice of root's privileges, such as CAP_SYS_ADMIN, that a process can hold or drop. Section 14.1
- Capability threshold
- A framework's capability level that requires stronger safeguards: High and Critical (OpenAI), Capability Thresholds and AI Safety Levels (Anthropic), Critical Capability Levels (Google DeepMind). Section 10.8
- Capacity factor and token dropping
- Expert slots per step as a multiple of the even share. Tokens beyond capacity skip the expert. Section 4.7
- Capacity gap
- The finding that a teacher too strong relative to the student eventually yields a worse student. Section 7.7
- Catastrophic forgetting
- Loss of earlier capabilities when training on a new distribution. Section 7.6
- Causal attention count
- Counting only the lower triangle of the attention matrix, half of the full count. Section 1.2
- Causal language modeling
- Predicting each token from all previous tokens under a causal attention mask. Section 4.1
- cgroup v2
- The unified kernel hierarchy that accounts for and limits CPU, memory, I/O and process counts for a group of processes. Section 14.1
- Chain of thought
- The reasoning text a model writes before its final answer. Reasoning models such as DeepSeek-R1 learn to make it long and useful through RL on verifiable rewards. Section 9.4
- Character training
- Post-training for stable traits and manner, not only harm avoidance. Section 8.9
- Chat template
- The exact token format (roles, headers, end-of-turn tokens) that turns a list of messages into one sequence. A chat model must be trained and served with the same one. Section 8.2
- Checkpoint
- A persistent snapshot of weights, optimizer state, data-loader position, RNG states, step counter and scheduler state, enough to resume exactly. Section 12.3
- Checkpoint averaging
- Averaging weights across steps (Polyak, EMA) or across runs from one start (soups). Averaging spaced checkpoints approximates learning-rate decay. Section 5.7
- Chip-seconds per token
- Pope et al.'s cost metric: number of chips times time, divided by tokens. It is proportional to cost. Section 13.3
- Chosen and rejected
- The preferred and dispreferred responses of a comparison. Section 8.4
- Chunked prefill, token budget
- Processing a prompt in chunks over several iterations, with a cap on tokens per iteration that keeps each iteration within the TBT target. Section 13.5
- CISPO
- Clipped IS-weight Policy Optimization: REINFORCE with a stop-gradient importance weight capped above, so no token is ever dropped. Section 9.5
- Clip-higher
- Using a larger upper clip range than lower one so rare tokens can grow. Section 9.5
- Cloze formulation (CF)
- Scoring each answer option as a continuation of the question and picking the most probable. Section 10.2
- Cold start (reasoning RL)
- A small supervised set of readable long chain-of-thought examples trained before reasoning RL, as in DeepSeek-R1. Section 9.4
- Cold start (serving)
- Time from no running replica to the first served token, dominated by loading weights and warming kernels. Section 13.5
- Collective
- A communication operation that every rank in a group calls together, such as all-reduce, all-gather, reduce-scatter, broadcast or all-to-all. Section 11.1
- Collective timeout
- The watchdog time after which a rank aborts a collective that has not completed. It is a symptom, not a cause. Section 12.6
- Colocated and disaggregated
- Training and generation sharing the same GPUs in turn, or running on separate GPU pools. Section 9.8
- Common Crawl
- A nonprofit web archive that has released a crawl of a few hundred TiB every month or two since 2007. Section 3.1
- CompleteP
- A depth extension of μP that scales each residual branch by , with matching learning-rate, weight-decay and epsilon rules. Section 5.4
- Compute-efficient frontier
- The curves and : the best model size and token count for each compute budget. Section 6.1
- Compute-equivalent gain (CEG)
- The training-compute multiplier that would buy the same improvement as a post-training enhancement such as a scaffold. Section 10.7
- Compute-, memory-, overhead-bound
- Whether math, data movement or everything else (Python, dispatch, kernel launches) sets an operation's runtime. Section 1.7
- Compute-optimal (Chinchilla-optimal)
- The parameter count and token count that minimize pretraining loss for a fixed training compute, with unlimited unique data. Section 6.2
- Compute-optimal precision
- The training bit width that minimizes loss at fixed compute when cost grows with bits. Section 6.6
- Compute unit (CU), XCD
- AMD's equivalent of an SM, and the die that holds 38 of them on MI300X. Section 2.8
- Constitutional AI
- Self-critique and AI preference labels guided by a written list of principles. Section 8.4
- Constrained decoding
- Masking tokens that would leave a grammar or schema, so output stays a valid prefix at every step. Section 13.9
- Contamination and exploitation
- Test items or close variants in training data, and contamination that actually raises the score. Section 10.5
- Context extension
- A late training stage that raises the trained context length, for example from 8K to 128K tokens, by adjusting RoPE and training on long documents. Section 7.5
- Context parallelism (CP)
- Split one sequence across GPUs through attention as well, exchanging keys and values (ring or all-gather) or re-sharding by heads (Ulysses). Section 11.5
- Continued pretraining (CPT)
- Further next-token training of a pretrained model on new or reweighted data at pretraining-like scale. Section 7.6
- Continuous (iteration-level, in-flight) batching
- Re-forming the batch at every forward pass, so finished requests leave and waiting ones join immediately. Section 13.4
- Cooldown
- Another name for the decay phase, see Annealing. Schedules that end in one are compared in Section 5.2
- Coordinate check
- Plotting each layer's activation size after a few steps against width. Flat lines mean a parameterization is implemented correctly. Section 5.4
- Copy-on-write
- Sharing KV blocks between sequences until one writes to a block, which is then copied. Section 13.4
- Core (DCLM)
- DataComp-LM's centered accuracy averaged over 22 low-variance tasks, 0 for chance and 1 for perfect. Section 3.2
- Cosine schedule
- The learning rate follows half a cosine from its peak to a floor, often 10% of peak, over the planned run. Section 5.2
- CoT monitor
- A model that reads another model's chain of thought to flag misbehavior. Section 9.9
- Coupled versus independent weight decay
- Coupled (PyTorch) decay shrinks weights by per step. Independent decay's shrink is not multiplied by the learning rate. Section 5.1
- Coverage
- The fraction of problems solved by at least one of samples. It equals the success rate only with a perfect verifier. Section 6.8
- Critical batch
- The batch that needs twice the minimum steps and twice the minimum data to reach a target loss. Below it, larger batches save steps almost for free. Section 5.3
- Cross-entropy (nats per token)
- The average negative natural-log probability the model assigns to the true next token. Section 4.1
- CUDA graph
- A recorded sequence of kernel launches replayed with a single launch to remove CPU overhead. Section 2.4
- Dangerous-capability and alignment evaluations
- Evaluations of whether a model can do serious harm, and of whether it would. Section 10.8
- Data ablation
- Identical models that differ only in their training data, compared on benchmarks. Section 3.9
- Data-constrained regime
- Training whose token budget exceeds the unique data available, so data repeats. Section 3.6
- Data mixture
- The sampling distribution over data domains, chosen independently of how large each domain is. Section 3.5
- Data parallelism (DP), DDP
- Replicate the model, split the batch, average the gradients. DDP is PyTorch's implementation with bucketed all-reduce overlapped with the backward pass. Section 11.2
- Data wall
- The point at which training sets match the stock of public human text. Section 6.6
- Decay to zero (D2Z)
- A schedule whose learning rate ends at zero, usually by linear decay. Section 5.2
- Decision accuracy
- The share of pairwise choices, such as two data recipes, whose small-scale ordering matches their order at the target scale. Section 3.9
- Decision log
- The written record of each experiment's hypothesis, setup, result, noise estimate and decision. Section 15.1
- Decode
- The sequential loop that produces one token per sequence per forward pass, each step reading all weights and the sequence's KV cache. Section 13.1
- Decode floor
- The lower bound on a decode step: weight bytes plus the batch's KV bytes, divided by aggregate HBM bandwidth. Section 13.2
- Decoder-only transformer
- An embedding table, a stack of identical blocks (causal self-attention, then an MLP, each adding to a residual stream) and an output head, trained to predict the next token. Every running example in this guide is one. Section 4.2
- Decontamination
- Removing training examples that overlap evaluation items, for example by 8-gram matching on prompts. Section 8.2
- Decoupled RoPE
- MLA's small separate rotary query and key path beside the absorbed content path. Section 4.5
- Deduplication
- Removing exact and near-duplicate documents or passages from a corpus, with hashes, Bloom filters, MinHash with LSH, or suffix arrays. Section 3.3
- Deliberative alignment
- Training a reasoning model to recall and reason over a written safety specification, rewarded by a judge that does not see the chain of thought. Section 9.9
- Delta rule
- A state update that writes the correction between a key's target value and its current read-out. Section 4.8
- Dense versus sparse peak
- Spec sheets often quote 2:4 structured-sparsity throughput, twice the dense figure that training and MFU use: 1,979 against 989.5 TFLOP/s for an H100 in BF16. Section 2.1
- Derisking
- Testing a change at small scale until it is shown to help, or to be neutral within a stated tolerance, before it enters the main run. Section 15.1
- Design effect
- Variance inflation from correlated questions in clusters of size : . Section 10.4
- Development and held-out evaluations
- Benchmarks used for training decisions, and benchmarks reserved to measure how much those decisions overfit. Section 10.9
- Device mesh
- The grid of ranks with one dimension per parallel axis, which decides which GPUs share each group. Section 11.7
- DiLoCo
- Low-communication training in which replicas take inner AdamW steps, then average their parameter change (the outer gradient) and apply an outer Nesterov-momentum step. Section 11.8
- Direct preference optimization (DPO)
- A logistic loss on log-probability ratios that reaches the KL-regularized RLHF optimum from fixed preference pairs. Section 8.7
- Document masking
- Blocking attention between different documents packed into one training sequence. Section 7.5
- Domain upsampling
- Raising the share of small, high-quality domain datasets at the end of training. Section 7.2
- Double binary tree
- Two complementary binary trees that each carry half the data, giving logarithmic latency at near-ring bandwidth (NCCL 2.4). Section 11.1
- Double descent
- Test error that peaks near the interpolation threshold, where a model can just fit its training set, before falling again. Section 5.8
- Dr. GRPO
- GRPO without the per-response length normalization and the std division, which removes its length and difficulty biases. Section 9.3
- Draft head
- A small trained module on the target's hidden states that proposes tokens (Medusa, EAGLE). Section 13.7
- Dropless MoE
- Expert computation with no capacity limit, using block-sparse or grouped matrix multiplies. Section 4.7
- DualPipe
- DeepSeek-V3's bidirectional pipeline that pairs forward and backward chunks so one's communication hides behind the other's compute, at the cost of two copies of the weights. Section 11.4
- Dynamic sampling
- Over-sampling prompts and keeping only groups with mixed rewards. Section 9.5
- E4M3 and E5M2
- The two FP8 encodings: 4 exponent and 3 mantissa bits (maximum 448) for precision, or 5 and 2 (maximum 57,344) for range. Section 2.3
- ECMP, hash polarization
- Equal-cost multi-path routing that hashes each flow onto one path, and the correlated hashing across tiers that amplifies imbalance. Section 2.6
- Edge of stability
- Training in which the top Hessian eigenvalue rises to and hovers at the stability limit ( for Adam with ) while the loss keeps falling over long timescales. Section 5.8
- Effective compute
- Physical compute multiplied by algorithmic efficiency gains. Section 6.9
- Effective context length
- The longest length at which a model still passes a stated quality threshold on a long-context benchmark, as opposed to the claimed window. Section 7.5
- Effective data
- The number of fresh tokens a multi-epoch run is worth. With Muennighoff et al.'s decay constant , four epochs are worth about 93% of fresh data. Section 3.6
- Effective parameter count
- A dense-equivalent size for a routed or low-precision model. Section 6.6
- Effective sample size
- for importance weights : 1 on-policy, near 0 when a few weights dominate. Section 9.6
- Effective training time ratio (ETTR)
- Productive training time divided by the wall-clock time of a job run. Meta's definition includes time queued while the job is eligible to run. Section 12.8
- Elastic training
- Continuing on fewer (or more) resources after a failure instead of waiting for replacements. Section 12.4
- Elicitation and sandbagging
- Effort to draw out a model's full capability, and strategic underperformance on an evaluation. Section 10.8
- Elo scale
- Bradley-Terry strengths rescaled to 400 points per factor of ten in odds: a 10-point gap is a 51.4% expected win rate. Section 10.6
- Embedding
- The learned vector of width for each token id, looked up in a table at the input. The output head maps the last hidden state back to logits. Section 1.1
- Emergent ability
- Wei et al.: absent in smaller models, present in larger ones. Du et al.: absent above a pretraining-loss threshold, present below it. Section 6.7
- Entropy collapse (RL)
- Token entropy falling early and staying low, so answers stop varying and learning stalls. Not the attention failure of the same name, see Attention logit growth. Section 9.6
- Environment
- The world side of the RL loop: reset() and step(action), which returns observation, reward, terminated, truncated and info. Section 14.5
- Environment-token masking
- Giving no policy-gradient loss to tool outputs, retrieved text and other environment tokens. Section 9.9
- Epochs per domain
- Passes over a domain implied by a mixture: its token share times the budget divided by its unique tokens. Section 3.5
- Execution conditions
- The declared network access, CPU, memory, user, time limit, hash seed and time zone of a grading run. Section 14.8
- Expert parallelism (EP)
- Placing different experts of a mixture-of-experts layer on different GPUs and moving tokens to them and back with two all-to-alls, dispatch and combine. Section 11.6
- Extension factor (RoPE)
- Target context length divided by trained context length, . Papers write , which this guide reserves for sequence length. Section 7.4
- Extrapolation ratio
- Target compute divided by the largest compute in the ladder. Section 6.4
- FAIL_TO_PASS / PASS_TO_PASS
- Tests that the reference fix turns from failing to passing, and tests that pass both before and after it. Section 14.4
- Failure rate
- : failures per node-day, usually quoted per 1,000 node-days. Section 12.1
- Fat tree (folded Clos), radix
- A multi-tier switch network with equal bandwidth up and down at each tier. Radix is the number of ports per switch. Section 2.6
- Fault-tolerant HSDP
- Hybrid sharded data parallelism in which each data-parallel replica is its own fault domain, so a failed replica drops out and rejoins without a global restart. Section 12.4
- Fill-in-the-middle (FIM)
- Reordering a document into prefix, suffix, then middle so the model learns to infill. Section 3.5
- Fine-grained experts and granularity
- Many small experts instead of a few large ones. Granularity compares dense and expert widths, with conventions that differ by paper. Section 4.7
- Fine-grained scaling
- Giving each small tile or block of a tensor its own FP8 scale, computed online, so one outlier cannot crush the rest. Section 5.6
- Flaky test
- A test whose outcome changes between runs on the same code. Section 14.6
- FlashAttention, online softmax
- A tiled attention kernel that never writes the score matrix to HBM, using a softmax computed block by block with a running maximum and sum. Section 2.4
- Flight recorder
- PyTorch's per-rank ring buffer of recent collectives (sequence numbers, sizes, states, stacks), dumped on timeout. Section 12.6
- Flips
- Answers that change between correct and incorrect when a model is compressed, even if average accuracy is unchanged. Section 13.8
- FLOP / FLOPs
- One floating-point add or multiply. FLOPs (plural) is a count. Section 1.2
- FLOP/s
- FLOPs per second, a rate. TFLOP/s is FLOP/s and PFLOP/s . Section 1.3
- Format spread
- Maximum minus minimum accuracy over meaning-preserving prompt formats. Section 10.2
- Forward area S1 and annealing area S2
- The two terms of Tissue et al.'s annealing law: the sum of learning rates , and the momentum-weighted sum of learning-rate decreases . Section 7.1
- Foundation model
- A large model pretrained on broad data that later stages adapt to many tasks. This guide treats decoder-only language models. Section 0.1
- FP32 promotion
- Periodically moving low-precision partial sums of a long dot product into FP32 registers to stop accumulation error from growing. Section 5.6
- FP8
- An 8-bit floating-point format, E4M3 or E5M2, used for matmuls in training and serving with FP32 accumulation and fine-grained scales. Section 2.3
- Fraction of speedup recovered
- An agent's share of a human record's speedup when it tries to reproduce that record. Section 15.6
- FSDP and FSDP2
- PyTorch's fully sharded data parallelism, an implementation of ZeRO-3: gather each unit's parameters just in time and reduce-scatter its gradients. FSDP2 shards each parameter as a DTensor. Section 11.2
- Gang scheduling
- Starting all tasks of a job together or none of them (Slurm's page uses the term for timeslicing). Section 12.8
- Generalized advantage estimation (GAE)
- An advantage estimate that sums a learned value model's temporal-difference errors with weights . With it reduces to the return minus the value. Section 8.5
- Generation stall
- A pause in a decoding request's token stream caused by another request's prefill scheduled ahead of it. Section 13.5
- Global batch and micro-batch
- The global batch is the tokens in one optimizer step across all replicas. A micro-batch of sequences is the slice one replica or pipeline stage processes at a time. Section 0.3
- Goodhart's law
- When a measure becomes a target, it ceases to be a good measure. Section 10.9
- Goodput (serving)
- The highest request rate per GPU at which a target fraction of requests (for example 90%) meet their TTFT and TPOT objectives. Section 13.3
- GPU-hours
- Number of accelerators times wall-clock hours. Section 1.3
- Gradient accumulation
- Sum gradients over several micro-batches before one optimizer step, communicating once. Section 11.2
- Gradient noise scale
- , the batch size at which gradient noise and gradient signal are comparable. Section 5.3
- Gray node
- A machine that passes hard-failure checks but runs slow on real workloads. Section 12.4
- Grokking
- Generalization that appears long after the training set has been fit, seen on small algorithmic datasets. Section 5.8
- Group and group size
- The answers sampled for one prompt, which share a baseline. Section 9.3
- Group (block) quantization
- One scale per block of consecutive values. MXFP4 uses 32-element blocks with a power-of-two scale, NVFP4 16-element blocks with an FP8 scale. Section 13.8
- Grouped-query attention (GQA)
- Groups of query heads share one key-value head (). It shrinks the KV cache by without changing attention FLOPs: 8x for Llama 3 70B. Section 4.5
- GRPO
- Group Relative Policy Optimization: advantage = the answer's z-score within its group, per-response token mean, k3 KL term in the loss. Section 9.3
- GSM*
- OLMo 2's 200-question development subset of GSM8K, used for mix decisions so the rest of the test set stays unseen. Section 7.3
- GSPO
- Group Sequence Policy Optimization: a clipped, length-normalized ratio for the whole response. Section 9.5
- gVisor (Sentry, Gofer)
- A user-space application kernel written in Go: the Sentry implements system calls, the Gofer opens files on its behalf. Section 14.2
- Hack-verifiable environment
- A task with planted, detectable exploits so that hacking can be measured exactly. Section 14.6
- Hang
- A job that makes no progress and reports no error until a timeout or watchdog fires. Section 12.6
- Hardware FLOPs utilization (HFU)
- Executed FLOP/s, including recomputation, divided by peak. Section 1.3
- Harness
- The code that builds a task's environment, runs the agent or applies its output, runs the grader and records results. Section 14.4
- HBM (high-bandwidth memory)
- DRAM stacked beside the compute die. H100: 80 GB at 3.35 TB/s. Section 2.2
- Health check
- A periodic node test whose failure drains the node from scheduling. Section 12.4
- Heuristic filter
- A threshold on a simple document statistic such as length, punctuation, symbol ratio or stop-word count. Section 3.2
- Hierarchical collective
- A collective done inside each node over NVLink first and across nodes second, so each network card carries only its GPU's share. Section 11.1
- Hot spare
- A pre-validated idle node kept ready to replace a failed one. Section 12.4
- HSDP
- Hybrid sharded data parallelism: shard within a group of GPUs and replicate across groups. Section 11.2
- Huber loss
- A robust regression loss, quadratic below a threshold and linear above. Section 6.4
- Hybrid model
- A stack mixing a few attention layers with many recurrent or SSM layers. Section 4.8
- ICI, OCS
- A TPU's direct inter-chip links, and the optical circuit switches (MEMS mirrors) that join TPU cubes into pods. Section 2.6
- Image fanout
- The number of sandboxes created from one image. Section 14.7
- Implicit reward
- , the reward for which a DPO-trained policy is optimal. Section 8.7
- In-memory checkpoint
- A copy of model state held in other machines' memory, so recovery skips remote storage. Section 12.3
- Induction head
- An attention circuit that completes the pattern [A][B] … [A] → [B]. Its formation shows as a bump in the early loss curve. Section 5.8
- Inference-aware sizing
- Choosing model size and training tokens to minimize training plus serving cost at a target quality, which favors smaller models trained longer. Section 6.5
- InfiniBand, RoCE v2
- A lossless, credit-based RDMA fabric, and RDMA carried in UDP/IP packets over Ethernet. Section 2.6
- Inoculation prompting
- Framing hacking as acceptable in the RL prompt so that hacking does not generalize into broader misalignment. Section 9.9
- Interleaved local/global attention
- A stack that mixes sliding-window layers and full-attention layers at a fixed ratio. Section 4.5
- Interleaved schedule
- Each device holds v non-contiguous chunks of layers, dividing the bubble by v at v times the point-to-point traffic. Section 11.4
- IO complexity
- The number of HBM accesses an algorithm needs. Section 2.4
- Irreducible loss (E)
- The fitted floor of the loss, read as the entropy of the data under the tokenizer. Section 6.1
- IsoFLOP profile
- Loss against model size for runs that all use the same compute. Its minimum is the compute-optimal size. Section 6.2
- Jaccard similarity
- The size of the intersection of two sets divided by the size of their union. Section 3.3
- Jailer
- Firecracker's wrapper that confines the VMM process with chroot, namespaces, dropped privileges and a seccomp profile. Section 14.2
- Kernel fusion
- Combining several operations into one kernel so the data is read from HBM once (also called operator fusion). Section 2.4
- KL coefficient
- The weight β of the penalty that keeps the policy near the reference policy. In DPO it is the temperature of the implicit classifier. Section 8.5
- KL divergence
- , in nats: how far a policy has moved from its reference. RLHF penalizes it, weighted by the KL coefficient. Section 8.5
- KL estimators k1, k2, k3
- Schulman's single-sample estimates of KL divergence. As losses, k2 gives the reverse-KL gradient and k3 the forward-KL gradient. Section 9.6
- Knowledge distillation
- Training a student to match a teacher's output distribution (soft targets) instead of, or as well as, the observed next token. Section 7.7
- KV cache
- The stored keys and values of all earlier tokens in every attention layer, re-read at each decode step instead of recomputed. A token costs times the bytes per element: 128 KiB for Llama 3 8B in BF16. Section 13.2
- KV-cache quantization and eviction
- Storing the cache in fewer bits, or dropping tokens judged unimportant (heavy hitters and attention sinks are kept). Section 13.8
- Label error
- A benchmark item whose key is wrong, ambiguous, or has several correct answers. Section 10.1
- Language identification (LID)
- A classifier that predicts each document's language, applied with a probability threshold. Section 3.1
- Latency wall
- A cap on training compute set by the minimum time per optimizer step and the critical batch size. Section 6.9
- Lazy (on-demand) image loading
- Fetching image blocks or files when first read instead of pulling the whole image before start. Section 14.7
- Learning rate
- The step size that scales each optimizer update. Its peak, warmup and decay make up the schedule. Section 5.2
- Lemon node
- A node that repeatedly fails jobs without failing any single health check, found from history. Section 12.4
- Length and PMI normalization
- Corrections to cloze scores for answer length (per token or per character) and for the answer's probability without the question. Section 10.2
- Length bias
- A reward model's preference for longer outputs regardless of quality. Section 8.6
- Lethal trifecta
- An agent that combines private data, exposure to untrusted content and the ability to communicate externally. Section 14.1
- Likelihood displacement
- The chosen response becoming less likely during preference training while the margin over the rejected response grows. Section 8.7
- Lineage
- Recorded links from a model version to the code, configuration, data state and run segments that produced it. Section 12.9
- Linear attention
- Attention with a feature-map kernel, computable as a recurrence with a fixed-size state. Section 4.8
- Linux Security Module (LSM)
- Kernel hooks for mandatory access control, for example AppArmor, SELinux and Landlock. Section 14.1
- Little's law
- In a stable system, the mean number of items equals arrival rate times mean time in the system. Section 14.7
- Live benchmark
- A benchmark that keeps adding items dated after models' training cutoffs. Section 10.5
- LLM-as-a-judge
- A model that grades or compares outputs, with measurable position, verbosity and self-preference biases. Section 10.6
- Logit soft-capping
- Passing logits through , a smooth bound that also shrinks the gradient of saturated logits. Gemma 2 caps attention logits at 50 and output logits at 30. Section 4.3
- Logits
- The unnormalized scores, one per vocabulary entry, that the output head produces. A softmax turns them into next-token probabilities. Section 4.1
- LoRA
- Low-rank adaptation: a frozen weight plus a trained low-rank update , where the rank is the inner dimension of and . Section 8.3
- Loss aggregation
- How token losses are combined (global token mean, per-example mean or sum). The choice sets how much each example counts. Section 8.2
- Loss masking
- Zeroing the loss on tokens the model should not learn to produce, such as system and user turns. Section 8.2
- Loss scaling
- Multiplying the loss by a constant so FP16 gradients stay above the smallest representable value, then dividing it out before the update. Dynamic schemes halve the scale on overflow. Section 5.6
- Loss spike
- A sudden jump in training loss. Some runs recover on their own, others need a rewind to an earlier checkpoint and a data skip. Section 5.5
- LR sensitivity
- The average gap to the best final loss over a wide learning-rate sweep (Wortsman et al.). A flat curve means a robust recipe. Section 5.5
- LSH banding
- Grouping MinHash values into bands so a pair becomes a candidate duplicate when every value in some band matches. Section 3.3
- Majority vote (maj@k, cons@k)
- Accuracy of the most common final answer among k samples. Section 10.3
- Masked diffusion language model
- A bidirectional model trained to fill randomly masked text and sampled by iterative unmasking. Section 4.8
- Master weights
- An FP32 copy of the weights that receives the optimizer's updates while the forward and backward passes run in lower precision. Section 5.6
- Maximum attention logit
- The largest pre-softmax attention score per head in a batch. Its growth signals attention collapse. Section 12.5
- MaxVio
- The relative overload of a mixture-of-experts layer's busiest expert: maximum load minus mean load, divided by mean load. Section 4.7
- McNemar's test
- A paired test for 0/1 scores that uses only the questions where the two models disagree. Section 10.4
- Mean time to failure (MTTF)
- Expected time between failures of a job. With independent node failures at per node-day, : about 3.1 hours for Llama 3 405B on 16,384 GPUs. Section 12.1
- Membership inference (Min-K% Prob)
- Guessing whether a text was in training from its token probabilities, for example the mean log-probability of its least likely 20% of tokens. Section 10.5
- Microanneal
- A short anneal (about 5–10B tokens) on a candidate dataset mixed with web data, compared against a web-only anneal, to measure the dataset's value. Section 7.3
- Microscaling (MX)
- OCP formats in which each block of 32 elements shares one 8-bit power-of-two (E8M0) scale: MXFP8, MXFP6 and MXFP4. Section 2.3
- microVM
- A VM with a minimal device model and kernel that boots in about a hundred milliseconds. Section 14.2
- Midtraining
- A training stage between bulk pretraining and post-training with its own curated data mix, usually during or right before the final learning-rate decay. Also used for capability stages on a finished base and for long-context stages. Section 7.2
- MinHash
- The minimum of a random hash over a set. Two sets' MinHashes match with probability equal to their Jaccard similarity. Section 3.3
- Minimum detectable difference (MDD)
- The smallest gap a test calls real at a chosen significance. For seed noise and seeds per arm, a two-sided 95% test needs . With a power requirement added it is also called the minimum detectable effect (Section 10.4). Section 15.1
- Mixed precision
- Computing in BF16 or FP16 while the optimizer keeps an FP32 master copy of the weights. Section 5.6
- Mixture of experts (MoE)
- A layer of many MLP experts with a router that sends each token to a few of them. Section 4.7
- ML Productivity Goodput
- Google's product of scheduling goodput, runtime goodput and program goodput (MFU). Section 12.8
- MLP width and the 2/3 correction
- gives a three-matrix SwiGLU MLP the parameters of a two-matrix MLP of width . Llama 3 uses . Section 4.2
- MMLU, GSM8K and HumanEval
- Widely reported benchmarks: multiple-choice questions on 57 subjects, grade-school math word problems, and Python functions graded by unit tests. Section 10.1
- Model bandwidth utilization (MBU)
- Achieved bytes per second (weights plus KV per output token over TPOT) divided by peak memory bandwidth. Section 13.2
- Model-based quality filter
- A classifier or language-model score used to decide which documents to keep. Section 3.2
- Model collapse
- Degradation from training on model output, unbounded when synthetic data replaces real data and bounded when it accumulates alongside it. Section 3.6
- Model Context Protocol (MCP)
- A JSON-RPC 2.0 protocol through which applications expose tools, resources and prompts to models. It is an interface, not an isolation layer. Section 14.4
- Model FLOPs utilization (MFU)
- Achieved model FLOP/s, excluding recomputation, divided by the hardware's dense peak. State the peak, the attention convention and the time base with every value. Section 1.3
- Model ladder
- A set of small training runs over sizes and token budgets, used to fit a scaling law and extrapolate to a larger target. Section 6.4
- Model soup
- The average of the weights of several models that share an initialization, such as anneals on different data orders. Section 7.3
- Model states
- Weights, gradients and optimizer states. Section 1.4
- Moment horizon
- An exponential moving average with coefficient averages over about steps: 20 for , 1,000 for 0.999. Section 5.1
- Monitorability tax
- The capability or efficiency given up by keeping optimization pressure off the chain of thought. Section 9.9
- MUFU (multi-function unit)
- The unit for exponentials, logarithms and reciprocals: 16 operations per clock per SM on H100 and B200, 32 on B300. Section 2.4
- Multi-head attention (MHA)
- One key-value head per query head, the original Transformer attention. Section 4.5
- Multi-head latent attention (MLA)
- Caching one low-rank latent per token and layer, plus a small rotary key, and absorbing the up-projections into the query and output projections. DeepSeek-V3 caches 70,272 bytes per token. Section 4.5
- Multi-query attention (MQA)
- All query heads share a single key-value head, the extreme case of GQA. Section 4.5
- Multi-token prediction (MTP)
- An auxiliary objective that predicts tokens beyond the next one. DeepSeek-V3's extra module can also serve as a speculative-decoding draft. Section 4.8
- Multiple-choice formulation (MCF)
- Showing lettered options and scoring only the letter the model predicts. Section 10.2
- Multiply-add (MAC, FMA)
- A multiply followed by an add, counted as 2 FLOPs. Section 1.2
- Muon
- SGD with momentum whose update matrix is orthogonalized by a few Newton-Schulz steps. Used for hidden weight matrices, with AdamW for the rest. Section 5.7
- μP (muP, Maximal Update Parameterization)
- Per-layer initialization, learning-rate and output multipliers chosen so every layer's features change by a width-independent amount per step. Section 5.4
- μTransfer (muTransfer)
- Tuning hyperparameters on a small μP proxy model and reusing them unchanged on the large target. Section 5.4
- n-gram overlap audit
- Flagging test items that share long token sequences with the training data and comparing flagged and clean scores. Section 10.5
- Namespace
- Kernel feature that gives a process its own view of a global resource such as mounts, process IDs, the network or user IDs. Section 14.1
- Natural and stratified mixtures
- Weights proportional to domain size, and equal weight per domain. Section 3.5
- NCCL
- NVIDIA's collective communication library, with ring, tree, NVLS and PAT algorithms and Simple, LL and LL128 protocols. Section 11.1
- Needle in a haystack (NIAH)
- A retrieval test that hides one sentence in filler text and sweeps context length against insertion depth. Section 7.5
- Newton-Schulz iteration
- A matrix-multiply-only polynomial iteration that pushes all singular values of a matrix toward 1 without changing its singular vectors. Section 5.7
- NF4
- 4-bit NormalFloat: 16 code values at quantiles of a normal distribution, scaled per block of 64 weights. Section 8.3
- Node-limited routing
- A cap on how many nodes one token's experts may span (4 in DeepSeek-V3), so each node receives the token once over the network. Section 11.6
- Noise floor
- The excess loss SGD keeps at a constant learning rate, proportional to the learning rate. Section 7.1
- Non-embedding parameters
- Parameters excluding the token and position embedding tables. Kaplan et al.'s counts only these. Section 1.1
- NoPE
- No explicit positional encoding. The causal mask still carries order. Section 4.6
- NTK-aware scaling
- Raising the RoPE base to so the fastest pair is unchanged and the slowest is slowed by exactly . Section 7.4
- NVFP4
- NVIDIA's 4-bit float with 16-element blocks, E4M3 block scales and an FP32 per-tensor scale: 4.5 bits per value. Section 2.3
- NVLink domain (scale-up domain)
- The accelerators fully connected by the fast fabric: 8 on HGX, 72 on GB200 NVL72, a whole pod on TPU ICI. Section 2.5
- NVLink, NVSwitch
- NVIDIA's GPU-to-GPU link, and the switch chip that makes a node all-to-all. Section 2.5
- NVLS (NVLink SHARP)
- Reductions computed inside NVSwitch instead of on the GPUs. Section 2.5
- Obfuscated reward hacking
- Reward hacking that continues while the chain of thought stops revealing it. Section 9.9
- Observational scaling law
- A law fit across many existing models through a low-dimensional capability space instead of a ladder. Section 6.7
- Occupancy
- Resident warps per SM divided by the maximum (64 on H100). Modern kernels often trade it for large register tiles. Section 2.1
- OCI runtime spec
- The standard for a container's configuration and lifecycle, implemented by runc, gVisor's runsc and Kata. Section 14.1
- On-policy and off-policy
- Responses generated by the policy being trained versus by some other model. Section 8.8
- On-policy distillation
- The student generates and the teacher's token probabilities supervise each of its tokens. Section 9.4
- Online and offline
- Fresh labels during training versus a dataset fixed before training. Section 8.8
- Oracle solution
- A reference solution that must pass a task's tests, used to check the task is solvable. Section 14.4
- Outcome validity and task validity
- Whether the grader truly indicates success, and whether a task is solvable exactly when the target capability is present. Section 10.7
- Outlier features
- A few hidden dimensions with very large activations that make per-tensor 8-bit or 4-bit scales inaccurate. Section 13.8
- Output (reordered) norm
- Normalizing a sublayer's output before adding it to the stream, as in OLMo 2. Section 4.3
- Over-eviction
- Evicting a whole suspect parallel group instead of pinpointing one machine while thousands of GPUs wait. Section 12.4
- Overcommit
- Allocating more virtual CPU or memory than physically exists, betting on low average use. Section 14.8
- Overlong shaping
- Masking truncated answers (overlong filtering) or penalizing length linearly just before the cap (soft overlong punishment). Section 9.5
- Oversubscription
- The ratio of downlink to uplink capacity at a switch tier (Llama 3: 1:7 above each 3,072-GPU pod). Section 2.6
- Overtraining
- Training past the compute-optimal tokens per parameter. It is not overfitting, since data is not repeated. Section 6.5
- Packet spraying
- Choosing a path per packet and reordering at the receiver, which removes flow collisions. Section 2.6
- Packing
- Concatenating several examples into one fixed-length row, with masks and position ids that keep them independent. Section 8.2
- PagedAttention, KV block, block table
- KV memory split into fixed-size blocks allocated on demand, with a per-request table mapping logical to physical blocks. Section 13.4
- Paired difference
- The per-question score difference between two models on the same questions. It removes shared question difficulty. Section 10.4
- Parallel block
- Computing attention and the MLP from the same normalized input and adding both to the stream. Section 4.4
- Partial rollout
- Capping the tokens generated per RL iteration and resuming unfinished answers in the next one, so a step does not wait for the longest answer. Section 9.8
- pass@k
- The probability that at least one of sampled answers passes the checker, averaged over problems. With samples of which are correct, estimates it without bias. Section 10.3
- pass^k
- The probability that all independent trials of a task succeed, averaged over tasks and estimated by . It measures reliability where pass@k measures coverage. Section 10.3
- Patch
- In byte-level models, a group of bytes processed as one step by the large global network. Section 3.8
- Perplexity
- raised to the mean loss in nats per token: the effective number of equally likely next tokens. It depends on the tokenizer. Section 4.1
- PF-day
- One petaFLOP/s sustained for a day, also written PF/s-day: FLOPs. Section 1.2
- PFC, DCQCN
- Priority flow control sends per-class pause frames that make Ethernet lossless. DCQCN is ECN-driven sender rate control for RoCE. Section 2.6
- Pipeline parallelism (PP)
- Split the layer stack into stages on different GPUs and stream micro-batches through them. Section 11.4
- Position Interpolation (PI)
- Dividing every rotary frequency by the extension factor , which squeezes new positions into the trained range. Section 7.4
- Post-training
- Any training after pretraining: SFT, preference tuning and RL. Section 8.1
- Power law
- , a straight line of slope on log-log axes. Section 6.1
- PPO clipped surrogate
- An objective that stops a token's gradient once its probability ratio leaves 1 plus or minus epsilon in the helpful direction. Section 8.5
- Pre-decay checkpoint
- A checkpoint saved before the final learning-rate decay, the preferred start for continued pretraining. Section 7.6
- Pre-norm / post-norm
- Normalizing a sublayer's input (pre-norm) or the stream after the residual add (post-norm). Section 4.3
- Pre-tokenizer
- The regex that splits text into chunks before BPE, so merges never cross chunk boundaries. Section 3.7
- Preconditioned sharpness
- The top eigenvalue of the Hessian after Adam's per-coordinate rescaling. Training is unstable once the step size exceeds about 2 divided by it. Section 5.8
- Prediction-powered inference (PPI)
- An estimator that corrects a judge's labels with a small human-labelled sample and keeps valid confidence intervals. Section 10.6
- Preemption (swap or recompute)
- Evicting a running request's KV under memory pressure and later restoring it from CPU memory or by recomputing it. Section 13.4
- Prefill
- The parallel forward pass over the prompt that fills the KV cache and produces the first output token. Section 13.1
- Prefill-decode disaggregation
- Running prefill and decode on separate GPU pools and moving each request's KV cache between them. Section 13.5
- Prefix caching
- Reusing the KV cache of a shared prompt prefix across requests. The hit rate is cached prompt tokens over prompt tokens. Section 13.4
- Preflight
- Checking before training that each task's reference passes and an empty patch fails under the job's exact conditions. Section 14.8
- Pretraining
- The first and most expensive stage: next-token prediction on trillions of tokens of mostly web text. It sets most of what the model knows. Section 0.1
- Promotion gate
- A rule over tracked evaluations that decides whether a checkpoint moves to the next stage. Section 12.9
- Proxy and gold reward
- The learned reward being optimized, versus the true objective it stands in for. Section 8.6
- Proxy model
- A smaller or shorter run used to make a decision, such as a data mix, for a larger one. Section 3.9
- PUE
- Power usage effectiveness: total facility power divided by the power drawn by the IT hardware. 1.0 is ideal. Section 2.7
- QK-Clip
- Kimi K2's fix for exploding attention logits under Muon: after an optimizer step, shrink the query and key weights of any head whose maximum logit exceeded a threshold. It is part of MuonClip. Section 5.7
- QK-norm
- Normalizing queries and keys per head before their dot product, which bounds every attention logit near times two gains. Section 4.3
- QLoRA
- LoRA on a frozen 4-bit NormalFloat (NF4) base with double quantization and paged optimizer states. A 70B fine-tune fits one 80 GB GPU. Section 8.3
- Queue pair (QP)
- An RDMA connection endpoint. Extra queue pairs per GPU pair give ECMP more flows to spread. Section 2.6
- RadixAttention
- SGLang's prefix cache kept as a radix tree with least-recently-used leaf eviction and cache-aware scheduling. Section 13.4
- Rail
- All GPUs with the same local index across nodes, wired to the same leaf switches. Section 2.6
- Rashomon effect
- Many near-equally good fits that extrapolate very differently. Section 6.4
- RDMA, GPUDirect RDMA
- NIC-driven memory-to-memory transfer that bypasses the operating system, and its form that reads and writes GPU memory directly. Section 2.6
- Re-warming
- Raising the learning rate again at the start of continued pretraining, which restores plasticity and costs some old-data loss. Section 7.6
- Reasoning boundary
- The set of problems a model solves with nonzero probability, measured by pass@k at large k. Section 9.7
- Reasoning model
- A model trained, usually with RL on verifiable rewards, to write a long chain of thought before its answer, as DeepSeek-R1 does. Section 9.4
- Recoverable and non-recoverable spike
- A loss spike that returns to trend, versus one after which the model diverges or plateaus higher. Section 15.2
- Reduce-scatter
- Sum arrays across ranks and leave each rank with only its 1/p slice of the sum. Section 11.1
- Reducible loss
- Loss minus the floor, read as the KL divergence from model to data. It is the part that falls with scale. Section 6.1
- Reference policy
- The frozen model, usually the SFT model, that KL and log-ratios are measured against. Section 8.5
- Reference (positive) set
- The text a quality classifier is trained to recognize as good. Section 3.2
- Reference reset
- Replacing the KL reference policy with the current policy during training. Section 9.6
- Rehydration
- Upsampling documents by their stored duplicate-cluster size after global deduplication, as in FineWeb2. Section 3.3
- Reinforcement learning from human feedback (RLHF)
- Fine-tuning with reinforcement learning against a reward model trained on human preference comparisons, usually with a KL penalty to a reference policy. Section 8.5
- Rejection sampling
- Sampling several responses, keeping the best by a reward model or verifier, and fine-tuning on it. Section 8.5
- Replay
- Mixing a share of old (or similar) data into every batch during continued pretraining to limit forgetting. Compute-equivalent replay keeps the total token count fixed. Section 7.6
- Request vs limit
- Kubernetes's guaranteed allocation used for scheduling versus the enforced ceiling (CPU throttling, memory OOM kill). Section 14.8
- Resharding
- Loading a checkpoint into a different parallel layout than the one that saved it. Section 12.3
- Residual states
- Activations, temporary buffers and fragmented memory. Section 1.4
- Residual stream
- The running sum that every block reads from and adds its output to. Section 4.2
- Restart cost
- : time per failure to detect, diagnose, reschedule, initialize, load the checkpoint and warm up. Section 12.3
- Reward hacking
- Raising the measured reward without doing the intended task, a form of specification gaming. Reward tampering changes the reward mechanism itself. Section 14.6
- Reward model
- A network that maps a prompt and response to a scalar, trained so that score differences predict human preferences. Section 8.4
- Reward over-optimization
- True quality falling while the proxy reward keeps rising (Goodhart's law). Section 8.6
- Rewind-and-skip
- Restarting from a checkpoint shortly before a loss spike and skipping the data batches seen around it. Section 5.5
- Ridge point
- Peak FLOP/s divided by bandwidth: about 295 FLOP per byte for an H100 in dense BF16. For decode it is also the batch at which weight matmuls turn compute-bound. Section 1.7
- Ring all-reduce
- Reduce-scatter then all-gather around a logical ring: steps, with of the data sent per rank. Section 11.1
- Ring Attention
- Context parallelism that passes key and value blocks around a ring of GPUs while each computes blockwise attention, hiding the transfer when blocks are large enough. Section 11.5
- River-valley landscape
- A picture of the loss as a steep valley with a slowly descending floor: a high learning rate moves along the floor while bouncing on the walls, and decay removes the bounce. Section 5.2
- RL readiness
- How well a base model improves under reinforcement learning, which midtraining data can shape. Section 7.2
- RLAIF
- Reinforcement learning from AI feedback: preference labels produced by a model instead of people. Section 8.4
- RLOO
- REINFORCE leave-one-out: advantage = reward minus the mean reward of the other G - 1 answers. Section 9.3
- RLVR
- Reinforcement learning with verifiable rewards: RL where a program, not a learned model, computes the reward. Section 9.1
- RMSNorm
- Normalization by the root mean square of the features with a learned gain and no mean subtraction. Section 4.3
- Rollout
- A response sampled from the current policy during RL and then scored by a reward. Generating rollouts is decode-bound inference. Section 9.2
- Rollout routing replay (R3)
- Reusing the inference engine's mixture-of-experts routing when the trainer recomputes probabilities. Section 9.6
- Roofline model
- Attainable FLOP/s equals the minimum of peak FLOP/s and bandwidth times arithmetic intensity. Section 1.7
- RoPE (rotary position embedding)
- Rotating each query and key pair by an angle proportional to position, so attention scores depend only on the relative offset. The base sets the rotation frequencies: Llama 3 uses 500,000. Section 4.6
- Round-to-nearest (RTN), post-training quantization (PTQ)
- The naive quantizer, and quantizing a trained model with a small calibration set and no retraining. Section 13.8
- Router and gate value
- The small linear layer that scores experts, and the weight applied to a chosen expert's output. Section 4.7
- Router z-loss
- The squared log-sum-exp of router logits, added to keep them small (ST-MoE). Section 4.7
- Running example
- One of the published models (Llama 3 8B, 70B and 405B, DeepSeek-V3 and R1, GPT-2 small, OLMo 2) whose numbers this guide reuses in every chapter. Section 0.3
- RuntimeClass
- Kubernetes object that selects the container runtime (for example runc, gVisor or Kata) per pod. Section 14.2
- Sandbox
- An isolated environment, such as a container, a gVisor sandbox or a microVM, where model-written code or agent actions run during RL, evaluation or deployment. Section 14.2
- Sandwich norm (Peri-LN)
- Normalizing both the input and the output of each sublayer, as in Gemma 2 and 3. Section 4.3
- Saturation (benchmark)
- Loss of reliable discrimination among the top models. Akhtar et al.'s index is , with the top-five spread in standard errors. Section 10.1
- Scaffold
- The program around the model in an agent: prompts, tools, history management and retries. An agent's score belongs to the model and its scaffold together. Section 10.7
- Scaling factor
- A higher-precision multiplier that maps a tensor, row or block into a narrow format's range. Section 2.3
- Scaling law
- A fitted relation, usually a power law, between loss or accuracy and parameters, data or compute, used to size runs before training them. Section 6.1
- Schedule-free optimizer
- An optimizer that removes the decay by evaluating a running average of iterates and taking gradients at an interpolation. Section 5.7
- Scientific, nuisance and fixed hyperparameters
- The hyperparameter under study, those re-tuned for each of its values so the comparison is fair, and those held constant. Section 15.1
- Score-function estimator
- The identity , which gives a policy gradient without differentiating the reward. It is also called the log-derivative trick. Section 9.2
- seccomp-bpf
- A system-call filter written as a small BPF program, inherited by child processes. Section 14.1
- Seed variance
- Run-to-run spread of a metric at fixed hyperparameters, from initialization, data order and nondeterminism. Section 10.9
- Selective batching
- Running token-wise operations on the flattened tokens of all requests and attention per request. Section 13.4
- Selective recomputation
- Recomputing only the memory-heavy, cheap-to-recompute parts of a layer, such as the attention matrix. Section 1.5
- Separability
- Share of model pairs whose benchmark confidence intervals do not overlap. Section 10.6
- Sequence parallelism (SP)
- The companion of TP that splits layer norms and dropout along the sequence, turning each all-reduce into a reduce-scatter and an all-gather of the same total size. Section 11.3
- Service-level objective (SLO)
- A latency target such as TTFT under 2 s and TPOT under 50 ms at the 99th percentile. Section 13.3
- Shampoo
- A preconditioner built from left and right Kronecker factors of accumulated gradient outer products. Section 5.7
- An expert that every token always uses, beside its routed experts. Section 4.7
- Per-SM, software-managed on-chip memory: up to 228 KB per SM on an H100, read at 128 bytes per clock. Section 2.2
- Shingle
- A word n-gram used to represent a document as a set (word 5-grams in FineWeb). Section 3.3
- Sigmoidal RL scaling
- Expected reward against RL compute fitted with a bounded curve with a ceiling, a steepness and a midpoint. Section 6.8
- Signal-to-noise ratio (evaluation)
- The spread of a metric across candidate models trained at the same compute, divided by one model's checkpoint-to-checkpoint noise. High-SNR metrics give better small-scale decisions. Section 10.9
- Silent data corruption (SDC)
- Hardware returning a wrong result without any error signal. A CPU core that does this is called a mercurial core. Section 12.2
- Sliding-window attention
- Each token attends only to the previous w tokens. A rolling buffer stores just w cache slots. Section 4.5
- Slow divergence
- An instability that worsens final loss at high learning rates without a visible spike. Section 15.2
- Snapshot and restore
- Saving a running sandbox's memory and device state and resuming it later, possibly as many clones. Section 14.3
- SOAP
- Adam run in the eigenbasis of Shampoo's preconditioner, refreshed every few steps. Section 5.7
- Sparse upcycling
- Initializing an MoE from a dense checkpoint by copying its MLP into every expert. Section 4.7
- Special tokens
- Reserved token ids for control strings such as end-of-text or chat headers. Section 3.7
- Speculative decoding
- A cheap draft proposes several tokens, the target model scores them in one pass, and an accept-or-resample rule keeps the output distribution exactly the target's. Section 13.7
- Spike score
- OLMo 2's stability metric: the percentage of values at least 7 standard deviations from the rolling mean of the previous 1,000. Section 5.5
- Split-KV decoding (Flash-Decoding)
- Parallelizing decode attention over the cached sequence and merging partial softmaxes exactly with their log-sum-exp. Section 13.8
- Spurious reward
- A reward unrelated to correctness, such as a random or format-only reward. Section 9.7
- Square-root scaling rule
- When the batch grows by , multiply Adam's learning rate by . SGD's linear rule multiplies it by . Section 5.3
- Stack aggregation
- Grouping the stacks of all ranks during a hang so the odd one out identifies the culprit. Section 12.6
- Stale second moment
- Adam's second-moment estimate lagging behind a sudden rise in squared gradients, which produces an oversized update. Section 5.5
- Staleness
- The number of policy updates between the policy that sampled a token and the policy being trained. Section 9.8
- Stall-free batching
- Sarathi-Serve's policy: fill each iteration with all ongoing decodes first, then prefill chunks up to the token budget. Section 13.5
- Standard error (SE)
- Standard deviation of an estimate over hypothetical resamples of the questions. Section 10.4
- Standard parameterization (SP)
- Fan-in initialization and one global learning rate, the default in deep-learning frameworks. Section 5.4
- State space model (SSM)
- A sequence layer from a discretized linear dynamical system. Mamba makes its parameters input-dependent. Section 4.8
- Statistical power
- The probability that a test detects a true effect of a given size. Section 10.4
- Stochastic rounding
- Rounding up or down at random with probabilities that make the rounded value equal the true value on average. Section 5.6
- Straggler (fail-slow)
- A rank that keeps working but slowly, so every synchronous step waits for it. Section 12.2
- Streaming multiprocessor (SM)
- The repeated processor of an NVIDIA GPU, with its own tensor cores, registers, shared memory and warp schedulers. H100 SXM has 132. Section 2.1
- Structured pruning (width, depth)
- Removing whole heads, MLP neurons, embedding channels (width) or layers (depth), so the result is a smaller dense model. Section 7.7
- Suffix array
- The sorted list of all suffixes of a text, used to find repeated substrings for exact-substring deduplication. Section 3.3
- Superficial alignment hypothesis
- The claim that alignment mostly teaches format while knowledge and capabilities come from pretraining. Section 8.1
- Supervised fine-tuning (SFT)
- Next-token training on curated prompt and response pairs with loss on the responses only. Also called instruction tuning. Section 8.2
- Swamping
- An update smaller than half the spacing of representable numbers at the weight's magnitude rounds away and is lost. Section 5.6
- SWE-bench
- Tasks built from real GitHub issues in Python repositories. An agent's patch counts only if it applies and the repository's tests pass. Section 10.7
- SwiGLU
- A gated MLP, , with three weight matrices. Section 4.2
- Sycophancy
- Telling users what they want to hear rather than what is true. Section 8.6
- Synthetic data
- Model-written training text, either generated from prompts or rephrased from real documents. Section 3.6
- Systolic array, MXU
- A grid of multiply-accumulate cells that pass operands to neighbors without memory access. The MXU is a TPU's systolic matrix unit. Section 2.8
- Task loss (bits per byte)
- Negative log-likelihood of the correct answer divided by its length in bytes. Section 6.7
- Task vector
- The difference between fine-tuned and pretrained weights. Adding it adds a skill, negating it removes one. Section 8.3
- TDP
- Thermal design power: the sustained power a chip's cooling is designed for (700 W for an H100 SXM), not its average draw. Section 2.7
- Teacher correction
- Briefly fine-tuning the teacher on the distillation data before distilling, when the original pretraining data is unavailable. Section 7.7
- Temperature, top-k, nucleus (top-p), min-p
- Logit scaling, and truncation to the k likeliest tokens, to the smallest set with cumulative probability p, or to tokens above a fraction of the top probability. Section 13.9
- Tensor core
- A matrix unit that performs a small matrix multiply-accumulate per instruction. Tensor cores supply about 94% of an H100's arithmetic. Section 2.1
- Tensor memory (TMEM)
- Blackwell's 256 KB per-SM memory that holds tensor-core accumulators. Section 2.2
- Tensor parallelism (TP)
- Split each weight matrix across GPUs (column-parallel then row-parallel), with collectives inside every layer. Section 11.3
- Terminated vs truncated
- An episode that ended from the task's own state versus one stopped by an outside limit, crash or timeout. Section 14.4
- Text extraction
- Selecting a page's main content from its HTML, with tools such as trafilatura, resiliparse or jusText. Section 3.1
- Thread block (CTA), thread-block cluster
- Threads scheduled on one SM that share its shared memory. A cluster is a set of blocks co-scheduled on SMs of one GPC that can read each other's shared memory. Section 2.1
- Tied embeddings
- One matrix used both as the input embedding and as the output projection. GPT-2 ties them and Llama 3 does not. Section 1.1
- Tile and wave quantization
- Wasted work when a matrix dimension is not a multiple of the tile size, or the tile count not a multiple of the number of SMs. Section 1.7
- Time between tokens (TBT)
- The gap between two consecutive tokens of one stream. Its tail (p99) is what users notice as a stall. Section 13.5
- Time horizon (50%, 80%)
- The human task length at which an agent's fitted success probability is 50% (or 80%), a measure of task difficulty rather than of the agent's working time (METR). Section 10.7
- Time per output token (TPOT), inter-token latency (ITL)
- Average gap between output tokens after the first. Tools differ on whether the first token is included. Section 13.3
- Time to first token (TTFT)
- Time from request submission to the first output token: queueing, prefill and network. Section 13.3
- TMA (Tensor Memory Accelerator)
- Hopper's asynchronous engine that copies tensor tiles between HBM and shared memory. Section 2.2
- Token and tokenizer
- A token is one integer id from the vocabulary, often a piece of a word. The tokenizer, usually byte-level BPE, maps text to tokens and back. Section 3.7
- Token boundary bias
- Distortion when a prompt ends partway through what training would have tokenized as a single token. Section 3.7
- Token choice / expert choice
- Tokens pick their top-k experts, or experts pick their top tokens from the batch. Section 4.7
- Token-level loss aggregation
- Averaging the loss over all tokens in a group instead of per response. Section 9.5
- The ratio of token counts for the same content in two languages. Section 3.7
- Tokens per parameter (D/N)
- Training tokens divided by parameters: about 20 at Chinchilla's compute optimum and about 1,870 for Llama 3 8B. Section 6.2
- Total / active parameters
- All stored weights, and the weights one token's forward pass uses. Section 4.7
- Training-inference mismatch
- Different token probabilities from the inference engine and the trainer for the same weights. Section 9.6
- Training on the test task
- Using a benchmark's format or training split during training. Not malpractice, but a confound when comparing models. Section 7.3
- Training pipeline
- The ordered stages that turn raw data into a served model: data, pretraining, midtraining, post-training, evaluation and serving. Section 0.1
- Triton, torch.compile
- Triton is a Python-embedded, tile-based kernel language. torch.compile is PyTorch's compiler, which fuses operations and emits Triton. Section 2.4
- Truncated importance sampling
- Capping an importance weight at a constant to bound its variance, at the cost of bias. Section 9.6
- Under-trained token
- A token in the vocabulary that was nearly or entirely absent from the model's training data. Section 3.7
- Unigram-normalized loss
- Per-token loss relative to a context-free unigram model, comparable across vocabulary sizes. Section 3.8
- Update RMS
- for Adam, with its second-moment estimate. It is near 1 when the estimate is current and far from 1 when it is stale, which often precedes a loss spike. Section 12.5
- User namespace
- A namespace that maps user IDs so that root inside a container is an unprivileged user on the host. Section 14.1
- Value model
- A network that predicts the expected future reward at each token, used by PPO to compute advantages. Also called the critic. Section 8.5
- Verifiable instruction
- A constraint in a prompt whose satisfaction a program can check, as in IFEval. Section 10.6
- Verification gap
- The difference between coverage and the accuracy a real selection method (voting, reward model) achieves. Section 6.8
- Violation rate and false refusal rate
- The share of responses that break a safety policy, and the share of harmless prompts the model refuses. Section 8.9
- VMGenID
- A virtual device that tells a guest it was restored from a snapshot so its kernel can reseed randomness. Section 14.3
- VMM
- Virtual machine monitor: the user-space program that sets up a VM and emulates its devices, for example QEMU, Firecracker or Cloud Hypervisor. Section 14.2
- Vocabulary size
- , the number of distinct tokens: 128,256 for Llama 3 and 50,257 for GPT-2. It sets the embedding and output-head sizes and the loss at initialization, . Section 3.8
- WARC, WAT, WET
- Common Crawl's raw HTTP responses with HTML, its computed metadata (headers, links), and its own extracted plain text. Section 3.1
- Warm pool
- Started but unused sandboxes held ready to hide creation latency. Section 14.7
- Warmup
- A ramp of the learning rate from zero to its peak over the first steps of training. Section 5.2
- Warmup-stable-decay (WSD)
- A warmup, a long constant learning rate, then a short cooldown. Any constant-phase checkpoint can be branched into a finished model. Section 5.2
- Warp specialization
- A kernel design in which some warps only move data while others only compute. Section 2.4
- Warp, warpgroup
- 32 threads that execute the same instruction together (SIMT). A warpgroup is 4 warps (128 threads) that issue Hopper's WGMMA together. Section 2.1
- WASI
- The WebAssembly System Interface, which gives a module only the capabilities its host explicitly grants. Section 14.2
- Wavelength
- The tokens a rotary pair needs to complete one full rotation, . Section 7.4
- Weight-only and weight-activation quantization
- W4A16 stores weights in low precision and computes in 16-bit. W8A8 also quantizes activations, so the matmul runs in 8 bits. Section 13.8
- Weight sync
- Copying new policy weights from the trainer into the inference engine, including any resharding. Section 9.8
- WGMMA, tcgen05
- Hopper's asynchronous warpgroup matrix-multiply instruction, and Blackwell's single-thread tensor-core instruction family that writes to tensor memory. Section 2.4
- Wilson interval
- A binomial confidence interval that keeps close to nominal coverage on small benchmarks. Section 10.4
- Xid
- An NVIDIA driver error code in the kernel log with a catalogued meaning and recovery action. Section 12.5
- YaRN
- Per-pair interpolation by turns per training window (NTK-by-parts) plus an attention temperature . Section 7.4
- Young interval
- The first-order optimal checkpoint interval for blocking checkpoint cost and job MTTF . At the optimum, checkpoint time equals expected rework. Section 12.3
- z-loss
- An auxiliary loss on the output softmax normalizer that keeps logits from drifting in the one direction cross-entropy cannot see. Section 4.3
- Zero-bubble schedule
- A pipeline schedule that splits the backward pass into input-gradient and weight-gradient work and uses the latter to fill the bubble. Section 11.4
- ZeRO stages 1, 2 and 3
- Sharding the optimizer states (stage 1), then also the gradients (stage 2), then also the parameters (stage 3) across the data-parallel group. Section 11.2
- Zero-variance group
- A group whose answers all get the same reward, so every advantage and the gradient are zero. Section 9.3
16.3 Reading list: fifty sources to read in full
If you can read only fifty things, which ones, and why each? The 50 sources below are grouped by the parts of this guide, with the reports behind the running examples first. Each entry gives the title and year, one line on why it is worth your time, and the chapters that lean on it, so you can pick what to read next by the part you are working in.
Running examples
- The Llama 3 Herd of Models (2024) [6]. The most complete public account of a frontier run: data, scaling-law sizing, 4D parallelism on 16,384 GPUs, the failure log and six rounds of post-training. Used in Chapters 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15.
- DeepSeek-V3 Technical Report (2024) [2]. A mixture of experts with multi-head latent attention, FP8 training and overlapped expert parallelism, with GPU-hours reported by stage. Used in Chapters 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15.
- DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning (2025) [3]. Reasoning from reinforcement learning on verifiable rewards: R1-Zero without supervised data, then the multi-stage R1 recipe and its GPU-hours. Used in Chapters 2, 4, 6, 7, 8, 9, 10, 13.
- 2 OLMo 2 Furious (2024) [7]. A fully open run with data, code and checkpoints: stability fixes, a curated midtraining mix and averaged anneals. Used in Chapters 1, 3, 4, 5, 6, 7, 8, 10, 12, 15.
- Tülu 3: Pushing Frontiers in Open Language Model Post-Training (2024) [550]. An open post-training recipe from start to finish: SFT mixes, DPO and RL with verifiable rewards, with ablations at each stage. Used in Chapters 8, 9, 10.
Part I. Compute
- Roofline: An Insightful Visual Performance Model for Floating-Point Programs and Multicore Architectures (2008) [79]. The roofline model: one plot that says whether a kernel is limited by compute or by memory bandwidth. Used in Chapters 1, 2, 15.
- PaLM: Scaling Language Modeling with Pathways (2022) [34]. Defines model FLOPs utilization, documents loss spikes and the restart-and-skip fix, and trains 540B parameters on 6,144 TPU v4 chips. Used in Chapters 1, 2, 3, 4, 5, 11, 12, 15.
- FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness (2022) [63]. IO-aware attention: tiling and an online softmax keep the attention matrix out of HBM, the pattern behind modern fused kernels. Used in Chapters 1, 2, 7.
- How to Think About GPUs (2025) [138]. A worked tour of GPU hardware, from streaming multiprocessors and the memory hierarchy to NVLink and collectives, with the arithmetic for each. Used in Chapters 2, 11.
Part II. Pretraining
- The FineWeb Datasets: Decanting the Web for the Finest Text Data at Scale (2024) [5]. How a 15T-token web dataset is built and tested: extraction, filtering, deduplication and the ablations that justify each step. Used in Chapter 3.
- DataComp-LM: In search of the next generation of training sets for language models (2024) [167]. A controlled benchmark for data curation, where a model-based quality filter beats hand-written heuristics at fixed compute. Used in Chapter 3.
- Scaling Data-Constrained Language Models (2023) [209]. What repeated data is worth: up to about four epochs is nearly as good as fresh tokens, with a fitted law for the decay. Used in Chapters 3, 6, 15.
- LLaMA: Open and Efficient Foundation Language Models (2023) [46]. The reference recipe for the modern dense decoder: RMSNorm pre-normalization, SwiGLU and RoPE, trained on public data. Used in Chapters 1, 3, 4, 6.
- DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Model (2024) [282]. Introduces multi-head latent attention and the DeepSeekMoE layer with fine-grained and shared experts. Used in Chapters 1, 4, 5, 7, 11, 13.
- Tensor Programs V: Tuning Large Neural Networks via Zero-Shot Hyperparameter Transfer (2022) [372]. Maximal update parametrization: tune hyperparameters on a narrow proxy and transfer them unchanged to a wide model. Used in Chapter 5.
- Small-scale proxies for large-scale Transformer training instabilities (2023) [270]. Reproduces large-model instabilities in small models and shows which fixes, such as QK-norm and z-loss, prevent them. Used in Chapters 4, 5, 12, 15.
Part III. Scaling laws
- Scaling Laws for Neural Language Models (2020) [25]. The first systematic power laws for loss against parameters, data and compute, and the 6N FLOPs-per-token accounting. Used in Chapters 1, 3, 4, 5, 6, 15.
- Training Compute-Optimal Large Language Models (2022) [40]. Chinchilla: scale parameters and tokens in equal proportion, about 20 tokens per parameter, from three independent fitting approaches. Used in Chapters 1, 5, 6, 15.
- Resolving Discrepancies in Compute-Optimal Scaling of Language Models (2024) [27]. Explains why Kaplan and Chinchilla disagreed by tracing the gap to head FLOPs, warmup and hyperparameter tuning. Used in Chapters 1, 5, 6.
- Beyond Chinchilla-Optimal: Accounting for Inference in Language Model Scaling Laws (2023) [70]. Adds inference to the sizing problem and shows why a model that will serve many tokens should be smaller and trained longer. Used in Chapters 1, 6, 13, 15.
- Scaling LLM Test-Time Compute Optimally can be More Effective than Scaling Model Parameters (2024) [71]. When extra test-time compute beats a larger model, and how to split it between parallel sampling and sequential revision. Used in Chapters 1, 6, 9.
Part IV. Midtraining
- Scaling Laws and Compute-Optimal Training Beyond Fixed Training Durations (2024) [353]. A constant learning rate with a short cooldown matches cosine and makes one run reusable for many token budgets. Used in Chapters 5, 6, 7, 15.
- YaRN: Efficient Context Window Extension of Large Language Models (2023) [507]. YaRN: context extension that interpolates only the slow RoPE frequencies and adds an attention temperature. Used in Chapter 7.
- Simple and Scalable Strategies to Continually Pre-train Large Language Models (2024) [358]. Continued pretraining without forgetting: rewarm and re-decay the learning rate and replay a few percent of the old data. Used in Chapters 5, 7.
- LLM Pruning and Distillation in Practice: The Minitron Approach (2024) [544]. Minitron: prune a trained model and recover it with distillation for a fraction of the cost of training from scratch. Used in Chapter 7.
Part V. Post-training
- Training language models to follow instructions with human feedback (2022) [8]. InstructGPT: the SFT, reward model and PPO recipe, with a 1.3B model preferred to the 175B base model. Used in Chapter 8.
- Direct Preference Optimization: Your Language Model is Secretly a Reward Model (2023) [586]. DPO: preference tuning as a classification loss on log-probability ratios, with no reward model and no sampling loop. Used in Chapters 8, 15.
- Scaling Laws for Reward Model Overoptimization (2022) [575]. Measures how optimizing a learned reward model first raises and then lowers the true reward, with fitted laws for both. Used in Chapters 6, 8, 10.
- LoRA: Low-Rank Adaptation of Large Language Models (2021) [565]. Low-rank adapters: fine-tune a large model by training two small matrices beside each frozen weight. Used in Chapters 1, 8.
- DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models (2024) [207]. Introduces GRPO, the critic-free group-baseline algorithm behind most reasoning RL recipes. Used in Chapters 3, 7, 9, 15.
- DAPO: An Open-Source LLM Reinforcement Learning System at Scale (2025) [640]. An open and ablated large-scale RL recipe: asymmetric clipping, dynamic sampling and a token-level loss. Used in Chapter 9.
- Monitoring Reasoning Models for Misbehavior and the Risks of Promoting Obfuscation (2025) [733]. Chain-of-thought monitors catch reward hacking in coding agents, and optimizing against the monitor teaches models to hide it. Used in Chapters 9, 14.
Part VI. Evaluation
- Evaluating Large Language Models Trained on Code (2021) [699]. HumanEval and the unbiased pass@k estimator, the basis of sampling-based code evaluation. Used in Chapters 6, 9, 10, 14, 15.
- Adding Error Bars to Evals: A Statistical Approach to Language Model Evaluations (2024) [777]. Error bars for evals: standard errors, clustered questions and paired comparisons for benchmark scores. Used in Chapters 10, 15.
- Lessons from the Trenches on Reproducible Evaluation of Language Models (2024) [775]. Practical lessons on reproducible evaluation: prompt and format sensitivity, and what to report with every score. Used in Chapters 10, 12.
- Measuring AI Ability to Complete Long Software Tasks (2025) [486]. Measures agents by the length of the tasks they can finish and finds that this horizon doubled about every seven months. Used in Chapters 6, 10.
Part VII. Systems at scale
- ZeRO: Memory Optimizations Toward Training Trillion Parameter Models (2019) [22]. ZeRO: shard optimizer states, gradients and weights across data-parallel ranks to cut memory per GPU. Used in Chapters 1, 11, 15.
- Efficient Large-Scale Language Model Training on GPU Clusters Using Megatron-LM (2021) [41]. Megatron-LM at scale: tensor, pipeline and data parallelism composed, with the interleaved pipeline schedule. Used in Chapters 1, 2, 11, 15.
- Reducing Activation Recomputation in Large Transformer Models (2022) [45]. Sequence parallelism and selective recomputation, with the activation-memory formulas this guide uses. Used in Chapters 1, 11, 15.
- MegaScale: Scaling Large Language Model Training to More Than 10,000 GPUs (2024) [47]. Training on more than 10,000 GPUs in production: communication overlap, diagnostics and fault tolerance. Used in Chapters 1, 2, 11, 12, 15.
- Revisiting Reliability in Large-Scale Machine Learning Research Clusters (2024) [903]. Failure statistics from two large research clusters and a model of effective training time. Used in Chapters 2, 12, 15.
Part VIII. Deployment
- Efficiently Scaling Transformer Inference (2022) [33]. The analytical model of transformer inference: prefill against decode, memory-bound latency and how to partition a model. Used in Chapters 1, 13, 15.
- Efficient Memory Management for Large Language Model Serving with PagedAttention (2023) [73]. PagedAttention and vLLM: KV-cache memory managed in blocks, which multiplies how many requests fit on a GPU. Used in Chapters 1, 13.
- Fast Inference from Transformers via Speculative Decoding (2022) [1017]. Speculative decoding: a small draft model proposes tokens that the large model checks in one pass, with unchanged outputs. Used in Chapters 13, 15.
- SWE-bench: Can Language Models Resolve Real-World GitHub Issues? (2023) [814]. SWE-bench: real GitHub issues graded by the repository's own tests inside a container. Used in Chapters 10, 14.
- Firecracker: Lightweight Virtualization for Serverless Applications (2020) [1087]. The microVM design behind fast, strongly isolated sandboxes. Used in Chapter 14.
Part IX. Practice
- A Recipe for Training Neural Networks (2019) [943]. A practitioner's checklist for training neural networks: start simple, check every step and expect silent bugs. Used in Chapters 12, 15.
- The Ultra-Scale Playbook: Training LLMs on GPU Clusters (2025) [44]. An interactive, benchmarked guide to every parallelism strategy, from one GPU to thousands. Used in Chapters 1, 11, 15.
- How To Scale Your Model (2025) [1145]. A short textbook on scaling models across accelerators, with the roofline and communication arithmetic worked out. Used in Chapter 15.
- The Smol Training Playbook: The Secrets to Building World-Class LLMs (2025) [13]. A candid account of building SmolLM3, including its ablations, failures and the compute they consumed. Used in Chapters 3, 4, 5, 6, 7, 15.
Notes
- The first version of the R1 report, from January 2025, gave 71.0% for an earlier checkpoint. This guide uses the later version's 77.9%. ↩
- Plugging Table 6 into gives at every budget, because assumes training at the critical batch size, where (computed) [25, 360] ↩
- The fits add an offset, . With the published constants (, , , , , ), maximizing gives 7.0 bits (computed) [458] ↩
References
- Chenggang Zhao, Chengqi Deng, Chong Ruan et al. (2025). Insights into DeepSeek-V3: Scaling Challenges and Reflections on Hardware for AI Architectures. arXiv:2505.09343.
- DeepSeek-AI, Aixin Liu, Bei Feng et al. (2024). DeepSeek-V3 Technical Report. arXiv:2412.19437.
- DeepSeek-AI, Daya Guo, Dejian Yang et al. (2025). DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning. arXiv:2501.12948.
- NVIDIA (2024). H100 GPU. NVIDIA product page and specifications.
- Guilherme Penedo, Hynek Kydlíček, Loubna Ben allal et al. (2024). The FineWeb Datasets: Decanting the Web for the Finest Text Data at Scale. arXiv:2406.17557.
- Aaron Grattafiori, Abhimanyu Dubey, Abhinav Jauhri et al. (2024). The Llama 3 Herd of Models. arXiv:2407.21783.
- Team OLMo, Pete Walsh, Luca Soldaini et al. (2024). 2 OLMo 2 Furious. arXiv:2501.00656.
- Long Ouyang, Jeff Wu, Xu Jiang et al. (2022). Training language models to follow instructions with human feedback. arXiv:2203.02155.
- Michael Luo, Naman Jain, Jaskirat Singh et al. (2025). DeepSWE: Training a Fully Open-sourced, State-of-the-Art Coding Agent by Scaling RL. Blog post (Agentica and Together AI).
- Jialiang Huang, Hongxuan Tang, Jingchang Chen et al. (2026). DeepSeek Elastic Compute (DSec): A Sandbox Infrastructure for Effective Agentic Training at Scale. arXiv:2609.22978.
- Meta (2024). Llama 3.1 Model Card. GitHub, meta-llama/llama-models.
- Team Olmo, Allyson Ettinger, Amanda Bertsch et al. (2025). Olmo 3. arXiv:2512.13961.
- Loubna Ben Allal, Lewis Tunstall, Nouamane Tazi et al. (2025). The Smol Training Playbook: The Secrets to Building World-Class LLMs. Hugging Face.
- DeepSeek-AI (2025). Day 6: One More Thing, DeepSeek-V3/R1 Inference System Overview. GitHub, deepseek-ai/open-infra-index.
- Andrej Karpathy (2024). Reproducing GPT-2 (124M) in llm.c in 90 minutes for $20. GitHub discussion, karpathy/llm.c.
- Neil Chowdhury, James Aung, Chan Jun Shern et al. (2024). Introducing SWE-bench Verified. OpenAI blog (archived copy).
- Unsloth AI (2024). config.json · unsloth/Meta-Llama-3.1–8B. Hugging Face model repository (public mirror of Meta Llama 3.1 8B config).
- DeepSeek-AI (2024). DeepSeek-V3 config.json. Hugging Face model repository.
- Alec Radford, Jeffrey Wu, Rewon Child et al. (2019). Language Models are Unsupervised Multitask Learners. OpenAI technical report.
- OpenAI (2019). config.json · openai-community/gpt2. Hugging Face model repository.
- Allen Institute for AI (2024). config.json · allenai/OLMo-2–1124–7B. Hugging Face model repository.
- Samyam Rajbhandari, Jeff Rasley, Olatunji Ruwase and Yuxiong He (2019). ZeRO: Memory Optimizations Toward Training Trillion Parameter Models. arXiv:1910.02054.
- Quentin Anthony, Stella Biderman and Hailey Schoelkopf (2023). Transformer Math 101. EleutherAI Blog.
- Meta Llama (2024). llama3/llama/tokenizer.py at main · meta-llama/llama3. GitHub repository (source file).
- Jared Kaplan, Sam McCandlish, Tom Henighan et al. (2020). Scaling Laws for Neural Language Models. arXiv:2001.08361.
- Noam Shazeer (2020). GLU Variants Improve Transformer. arXiv:2002.05202.
- Tomer Porian, Mitchell Wortsman, Jenia Jitsev, Ludwig Schmidt and Yair Carmon (2024). Resolving Discrepancies in Compute-Optimal Scaling of Language Models. arXiv:2406.19146.
- OpenAI, Sandhini Agarwal, Lama Ahmad et al. (2025). gpt-oss-120b & gpt-oss-20b Model Card. arXiv:2508.10925.
- Quentin Anthony, Jacob Hatef, Deepak Narayanan et al. (2024). The Case for Co-Designing Model Architectures with Hardware. arXiv:2401.14489.
- William Fedus, Barret Zoph and Noam Shazeer (2021). Switch Transformers: Scaling to Trillion Parameter Models with Simple and Efficient Sparsity. arXiv:2101.03961.
- DeepSeek-AI (2024). deepseek-ai/DeepSeek-V3 · Hugging Face. Hugging Face model card.
- NVIDIA (2023). Matrix Multiplication Background User's Guide. NVIDIA Deep Learning Performance Documentation.
- Reiner Pope, Sholto Douglas, Aakanksha Chowdhery et al. (2022). Efficiently Scaling Transformer Inference. arXiv:2211.05102.
- Aakanksha Chowdhery, Sharan Narang, Jacob Devlin et al. (2022). PaLM: Scaling Language Modeling with Pathways. arXiv:2204.02311.
- Jaime Sevilla, Lennart Heim, Marius Hobbhahn et al. (2022). Estimating training compute of deep learning models. Epoch AI report.
- Tom B. Brown, Benjamin Mann, Nick Ryder et al. (2020). Language Models are Few-Shot Learners. arXiv:2005.14165.
- Andrej Karpathy (2023). nanoGPT/model.py at master · karpathy/nanoGPT. GitHub repository (source file).
- Tri Dao (2023). FlashAttention-2: Faster Attention with Better Parallelism and Work Partitioning. arXiv:2307.08691.
- Jacob Austin, Sholto Douglas, Roy Frostig et al. (2025). All the Transformer Math You Need to Know. How To Scale Your Model (online book), Part 4.
- Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch et al. (2022). Training Compute-Optimal Large Language Models. arXiv:2203.15556.
- Deepak Narayanan, Mohammad Shoeybi, Jared Casper et al. (2021). Efficient Large-Scale Language Model Training on GPU Clusters Using Megatron-LM. arXiv:2104.04473.
- DeepSeek-AI, Xiao Bi, Deli Chen et al. (2024). DeepSeek LLM: Scaling Open-Source Language Models with Longtermism. arXiv:2401.02954.
- Tim Pearce and Jinyeop Song (2024). Reconciling Kaplan and Chinchilla Scaling Laws. arXiv:2406.12907.
- Nouamane Tazi, Ferdinand Mom, Haojun Zhao et al. (2025). The Ultra-Scale Playbook: Training LLMs on GPU Clusters. Hugging Face.
- Vijay Korthikanti, Jared Casper, Sangkug Lym et al. (2022). Reducing Activation Recomputation in Large Transformer Models. arXiv:2205.05198.
- Hugo Touvron, Thibaut Lavril, Gautier Izacard et al. (2023). LLaMA: Open and Efficient Foundation Language Models. arXiv:2302.13971.
- Ziheng Jiang, Haibin Lin, Yinmin Zhong et al. (2024). MegaScale: Scaling Large Language Model Training to More Than 10,000 GPUs. arXiv:2402.15627.
- Wanchao Liang, Tianyu Liu, Less Wright et al. (2024). TorchTitan: One-stop PyTorch native solution for production ready LLM pre-training. arXiv:2410.06511.
- Dennis Liu, Zijie Yan, Xin Yao et al. (2025). MoE Parallel Folding: Heterogeneous Parallelism Mappings for Efficient Large-Scale MoE Model Training with Megatron Core. arXiv:2504.14960.
- Chao Jin, Ziheng Jiang, Zhihao Bai et al. (2025). MegaScale-MoE: Large-Scale Communication-Efficient Training of Mixture-of-Experts Models in Production. arXiv:2505.11432.
- Paulius Micikevicius, Sharan Narang, Jonah Alben et al. (2017). Mixed Precision Training. arXiv:1710.03740.
- Dhiraj Kalamkar, Dheevatsa Mudigere, Naveen Mellempudi et al. (2019). A Study of BFLOAT16 for Deep Learning Training. arXiv:1905.12322.
- Tim Dettmers, Mike Lewis, Sam Shleifer and Luke Zettlemoyer (2021). 8-bit Optimizers via Block-wise Quantization. arXiv:2110.02861.
- Noam Shazeer and Mitchell Stern (2018). Adafactor: Adaptive Learning Rates with Sublinear Memory Cost. arXiv:1804.04235.
- Bingrui Li, Jianfei Chen and Jun Zhu (2023). Memory Efficient Optimizers with 4-bit States. arXiv:2309.01507.
- Jiawei Zhao, Zhenyu Zhang, Beidi Chen et al. (2024). GaLore: Memory-Efficient LLM Training by Gradient Low-Rank Projection. arXiv:2403.03507.
- Houwen Peng, Kan Wu, Yixuan Wei et al. (2023). FP8-LM: Training FP8 Large Language Models. arXiv:2310.18313.
- Haocheng Xi, Han Cai, Ligeng Zhu et al. (2024). COAT: Compressing Optimizer states and Activation for Memory-Efficient FP8 Training. arXiv:2410.19313.
- Mahdi Nikdan, Amir Zandieh, Dan Alistarh and Vahab Mirrokni (2026). ECO: Quantized Training without Full-Precision Master Weights. arXiv:2601.22101.
- Kristi Topollai and Anna Choromanska (2026). Understanding Quantization of Optimizer States in LLM Pre-training: Dynamics of State Staleness and Effectiveness of State Resets. arXiv:2603.16731.
- Jie Ren, Samyam Rajbhandari, Reza Yazdani Aminabadi et al. (2021). ZeRO-Offload: Democratizing Billion-Scale Model Training. arXiv:2101.06840.
- Samyam Rajbhandari, Olatunji Ruwase, Jeff Rasley, Shaden Smith and Yuxiong He (2021). ZeRO-Infinity: Breaking the GPU Memory Wall for Extreme Scale Deep Learning. arXiv:2104.07857.
- Tri Dao, Daniel Y. Fu, Stefano Ermon, Atri Rudra and Christopher Ré (2022). FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness. arXiv:2205.14135.
- Tianqi Chen, Bing Xu, Chiyuan Zhang and Carlos Guestrin (2016). Training Deep Nets with Sublinear Memory Cost. arXiv:1604.06174.
- Erik Wijmans, Brody Huval, Alexander Hertzberg, Vladlen Koltun and Philipp Krähenbühl (2024). Cut Your Losses in Large-Vocabulary Language Models. arXiv:2411.09009.
- Pin-Lun Hsu, Yun Dai, Vignesh Kothapalli et al. (2024). Liger Kernel: Efficient Triton Kernels for LLM Training. arXiv:2410.10989.
- Kazuki Fujii, Kohei Watanabe and Rio Yokota (2024). Accelerating Large Language Model Training with 4D Parallelism and Memory Consumption Estimator. arXiv:2411.06465.
- PyTorch Contributors (2025). CUDA semantics. PyTorch 2.9 documentation.
- PyTorch Contributors (2025). Understanding CUDA Memory Usage. PyTorch 2.9 documentation.
- Nikhil Sardana, Jacob Portes, Sasha Doubov and Jonathan Frankle (2023). Beyond Chinchilla-Optimal: Accounting for Inference in Language Model Scaling Laws. arXiv:2401.00448.
- Charlie Snell, Jaehoon Lee, Kelvin Xu and Aviral Kumar (2024). Scaling LLM Test-Time Compute Optimally can be More Effective than Scaling Model Parameters. arXiv:2408.03314.
- Kimi Team, Yifan Bai, Yiping Bao et al. (2025). Kimi K2: Open Agentic Intelligence. arXiv:2507.20534.
- Woosuk Kwon, Zhuohan Li, Siyuan Zhuang et al. (2023). Efficient Memory Management for Large Language Model Serving with PagedAttention. arXiv:2309.06180.
- Noam Shazeer (2019). Fast Transformer Decoding: One Write-Head is All You Need. arXiv:1911.02150.
- Joshua Ainslie, James Lee-Thorp, Michiel de Jong et al. (2023). GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpoints. arXiv:2305.13245.
- Tim Dettmers, Artidoro Pagnoni, Ari Holtzman and Luke Zettlemoyer (2023). QLoRA: Efficient Finetuning of Quantized LLMs. arXiv:2305.14314.
- Horace He (2022). Making Deep Learning go Brrrr From First Principles. Blog post.
- Samuel Williams, Andrew Waterman and David Patterson (2009). Roofline: an insightful visual performance model for multicore architectures. Communications of the ACM.
- Samuel Webb Williams, Andrew Waterman and David A. Patterson (2008). Roofline: An Insightful Visual Performance Model for Floating-Point Programs and Multicore Architectures. Technical Report UCB/EECS-2008–134, University of California at Berkeley.
- NVIDIA (2023). GPU Performance Background User's Guide. NVIDIA Deep Learning Performance Documentation.
- Weile Luo, Ruibo Fan, Zeyu Li et al. (2024). Benchmarking and Dissecting the Nvidia Hopper GPU Architecture. arXiv:2402.13499.
- Jay Shah, Ganesh Bikshandi, Ying Zhang et al. (2024). FlashAttention-3: Fast and Accurate Attention with Asynchrony and Low-precision. arXiv:2407.08608.
- NVIDIA (2020). NVIDIA A100. NVIDIA product page and specifications.
- NVIDIA (2024). H200 GPU. NVIDIA product page and specifications.
- NVIDIA (2026). NVIDIA HGX Platform. NVIDIA product page and specifications.
- NVIDIA (2024). DGX B200. NVIDIA product page and specifications.
- AMD (2023). AMD Instinct MI300X Accelerators. AMD product page and specifications.
- Google Cloud (2026). TPU v5p | Google Cloud Documentation. Google Cloud documentation.
- Amir Gholami, Zhewei Yao, Sehoon Kim et al. (2024). AI and Memory Wall. arXiv:2403.14123.
- Zhihang Yuan, Yuzhang Shang, Yang Zhou et al. (2024). LLM Inference Unveiled: Survey and Roofline Model Insights. arXiv:2402.16363.
- Jacob Austin, Sholto Douglas, Roy Frostig et al. (2025). All About Transformer Inference. How To Scale Your Model (online book), Part 7.
- Pratyush Patel, Esha Choukse, Chaojie Zhang et al. (2023). Splitwise: Efficient generative LLM inference using phase splitting. arXiv:2311.18677.
- David Patterson, Joseph Gonzalez, Quoc Le et al. (2021). Carbon Emissions and Large Neural Network Training. arXiv:2104.10350.
- Cooper Elsworth, Keguo Huang, David Patterson et al. (2025). Measuring the environmental impact of delivering AI at Google Scale. arXiv:2508.15734.
- Jacob Morrison, Clara Na, Jared Fernandez et al. (2025). Holistically Evaluating the Environmental Impact of Creating Language Models. arXiv:2503.05804.
- Jae-Won Chung, Jeff J. Ma, Ruofan Wu et al. (2025). The ML.ENERGY Benchmark: Toward Automated Inference Energy Measurement and Optimization. arXiv:2505.06371.
- Alexandra Sasha Luccioni, Sylvain Viguier and Anne-Laure Ligozat (2022). Estimating the Carbon Footprint of BLOOM, a 176B Parameter Language Model. arXiv:2211.02001.
- Epoch AI (2026). Data on AI models. Epoch AI dataset (notable_ai_models.csv, accessed 2026-11-03).
- Lambda (2026). GPU cloud pricing: rent NVIDIA H100, H200, and B200. Vendor pricing page (accessed 2026-11-03).
- Ben Cottier, Robi Rahman, Loredana Fattorini et al. (2024). The rising costs of training frontier AI models. arXiv:2405.21015.
- Jaime Sevilla and Edu Roldán (2024). Training compute of frontier AI models grows by 4–5x per year. Epoch AI report.
- Anson Ho, Tamay Besiroglu, Ege Erdil et al. (2024). Algorithmic progress in language models. arXiv:2403.05812.
- Jaime Sevilla, Tamay Besiroglu, Ben Cottier et al. (2024). Can AI scaling continue through 2030?. Epoch AI report.
- Michael Andersch, Greg Palmer, Ronny Krashinsky et al. (2022). NVIDIA Hopper Architecture In-Depth. NVIDIA Technical Blog.
- Benjamin Spector, Aaryan Singhal, Simran Arora and Chris Re (2024). GPUs Go Brrr. Hazy Research blog.
- NVIDIA (2026). Programming Model - CUDA Programming Guide. CUDA Programming Guide.
- NVIDIA (2026). NVIDIA Hopper Tuning Guide. CUDA Toolkit documentation.
- NVIDIA (2017). NVIDIA Tesla V100 GPU Architecture. NVIDIA whitepaper WP-08608–001_v1.1.
- NVIDIA (2020). NVIDIA A100 Tensor Core GPU Architecture. NVIDIA whitepaper.
- Ted Zadouri, Markus Hoehnerbach, Jay Shah et al. (2026). FlashAttention-4: Algorithm and Kernel Pipelining Co-Design for Asymmetric Hardware Scaling. arXiv:2603.05451.
- Google Cloud (2026). TPU architecture. Google Cloud documentation.
- Norman P. Jouppi, George Kurian, Sheng Li et al. (2023). TPU v4: An Optically Reconfigurable Supercomputer for Machine Learning with Hardware Support for Embeddings. arXiv:2304.01433.
- AMD (2023). AMD Instinct MI300X Accelerator. AMD data sheet.
- AMD (2025). AMD Instinct MI355X GPUs. AMD product page.
- AMD (2023). AMD CDNA 3 Architecture. AMD whitepaper.
- Bita Darvish Rouhani, Nitin Garegrat, Tom Savell et al. (2023). OCP Microscaling Formats (MX) Specification Version 1.0. Open Compute Project.
- Paulius Micikevicius, Dusan Stosic, Neil Burgess et al. (2022). FP8 Formats for Deep Learning. arXiv:2209.05433.
- Norman P. Jouppi, Sridhar Lakshmanamurthy, Cliff Young and David Patterson (2026). Google's Training Supercomputers from TPU v2 to Ironwood: Architectural Stability, Scale, Resilience, Power Efficiency, and Sustainability Across Five Generations. arXiv:2606.15870.
- Asit Mishra, Dusan Stosic, Simon Layton and Paulius Micikevicius (2025). Recipes for Pre-training LLMs with MXFP8. arXiv:2506.08027.
- Eduardo Alvarez, Omri Almog, Eric Chung et al. (2025). Introducing NVFP4 for Efficient and Accurate Low-Precision Inference. NVIDIA Technical Blog.
- NVIDIA, Felix Abecassis, Anjulie Agrusa et al. (2025). Pretraining Large Language Models with NVFP4. arXiv:2509.25149.
- Brian Chmiel, Maxim Fishman, Ron Banner and Daniel Soudry (2025). FP4 All the Way: Fully Quantized Training of LLMs. arXiv:2505.19115.
- Albert Tseng, Tao Yu and Youngsuk Park (2025). Training LLMs with MXFP4. arXiv:2502.20586.
- Roberto L. Castro, Andrei Panferov, Soroush Tabesh et al. (2025). Quartet: Native FP4 Training Can Be Optimal for Large Language Models. arXiv:2505.14669.
- Yubo Wang, Xueguang Ma, Ge Zhang et al. (2024). MMLU-Pro: A More Robust and Challenging Multi-Task Language Understanding Benchmark. arXiv:2406.01574.
- Maxim Fishman, Brian Chmiel, Ron Banner and Daniel Soudry (2024). Scaling FP8 training to trillion-token LLMs. arXiv:2409.12517.
- Andrei Ivanov, Nikoli Dryden, Tal Ben-Nun, Shigang Li and Torsten Hoefler (2020). Data Movement Is All You Need: A Case Study on Optimizing Transformers. arXiv:2007.00072.
- Maxim Milakov and Natalia Gimelshein (2018). Online normalizer calculation for softmax. arXiv:1805.02867.
- Benjamin F. Spector, Simran Arora, Aaryan Singhal, Daniel Y. Fu and Christopher Ré (2024). ThunderKittens: Simple, Fast, and Adorable AI Kernels. arXiv:2410.20399.
- Quentin Anthony, Yury Tokpanov, Skyler Szot et al. (2025). Training Foundation Models on a Full-Stack AMD Platform: Compute, Networking, and System Design. arXiv:2511.17127.
- Juechu Dong, Boyuan Feng, Driss Guessous, Yanbo Liang and Horace He (2024). Flex Attention: A Programming Model for Generating Optimized Attention Kernels. arXiv:2412.05496.
- Philippe Tillet, H. T. Kung and David Cox (2019). Triton: an intermediate language and compiler for tiled neural network computations. Proceedings of the 3rd ACM SIGPLAN International Workshop on Machine Learning and Programming Languages.
- Jason Ansel, Edward Yang, Horace He et al. (2024). PyTorch 2: Faster Machine Learning Through Dynamic Python Bytecode Transformation and Graph Compilation. Proceedings of the 29th ACM International Conference on Architectural Support for Programming Languages and Operating Systems, Volume 2.
- Alan Gray (2019). Getting Started with CUDA Graphs. NVIDIA Technical Blog.
- NVIDIA (2025). NVIDIA/cutlass: CUDA Templates and Python DSLs for High-Performance Linear Algebra. GitHub repository.
- Lei Wang, Yu Cheng, Yining Shi et al. (2025). TileLang: A Composable Tiled Programming Model for AI Systems. arXiv:2504.17577.
- NVIDIA (2026). Introduction to NVIDIA DGX H100/H200 Systems. NVIDIA DGX H100/H200 User Guide.
- Jacob Austin, Sholto Douglas, Roy Frostig et al. (2025). How to Think About GPUs. How To Scale Your Model (online book).
- NVIDIA (2025). GB200 NVL72. NVIDIA product page.
- NVIDIA (2026). NVLink & NVLink Switch for Advanced Multi-GPU Communication. NVIDIA product page.
- Adithya Gangidi, Rui Miao, Shengbao Zheng et al. (2024). RDMA over Ethernet for Distributed Training at Meta Scale. Proceedings of the ACM SIGCOMM 2024 Conference.
- NVIDIA (2026). 1. Overview — GPUDirect RDMA 13.4 documentation. CUDA documentation.
- NVIDIA (2024). Performance reported by NCCL tests. GitHub (NVIDIA/nccl-tests/blob/master/doc/PERFORMANCE.md).
- Chuanxiong Guo, Haitao Wu, Zhong Deng et al. (2016). RDMA over Commodity Ethernet at Scale. Proceedings of the 2016 ACM SIGCOMM Conference.
- Kevin Lee, Adi Gangidi and Mathew Oldham (2024). Building Meta’s GenAI Infrastructure. Engineering at Meta blog.
- Mohammad Al-Fares, Alexander Loukissas and Amin Vahdat (2008). A scalable, commodity data center network architecture. Proceedings of the ACM SIGCOMM 2008 conference on Data communication.
- Joao Araujo, Alex Chow, Mark Handley et al. (2026). Resilient AI Supercomputer Networking using MRC and SRv6. arXiv:2605.04333.
- Min Si, Pavan Balaji, Yongzhou Chen et al. (2025). Collective Communication for 100k+ GPUs. arXiv:2510.20171.
- Kun Qian, Yongqing Xi, Jiamin Cao et al. (2024). Alibaba HPN: A Data Center Network for Large Language Model Training. Proceedings of the ACM SIGCOMM 2024 Conference.
- xAI (2025). Colossus: The World's Largest AI Supercomputer. Company page (x.ai; footer '© 2026 SpaceX Super Intelligence LLC', title suffix 'SpaceXSI' as of 2026–11).
- NVIDIA (2026). Hardware - NVIDIA DGX GB Rack Scale Systems User Guide. NVIDIA documentation.
- Amin Vahdat (2025). Ironwood: The first Google TPU for the age of inference. Google blog.
- Konstantin F. Pilz, James Sanders, Robi Rahman and Lennart Heim (2025). Trends in AI Supercomputers. arXiv:2504.16026.
- Google (2026). Power usage effectiveness - Google Data Centers. Google data centers page.
- Esha Choukse, Brijesh Warrier, Scot Heath et al. (2025). Power Stabilization for AI Training Datacenters. arXiv:2508.14318.
- Google Cloud (2026). TPU7x (Ironwood) | Google Cloud Documentation. Google Cloud documentation.
- Alicia Golden, Carole-Jean Wu, Gu-Yeon Wei and David Brooks (2026). The xPU-athalon: Quantifying the Competition of AI Acceleration. arXiv:2604.10852.
- Epoch AI (2026). Data on machine learning hardware. Epoch AI dataset.
- AMD (2024). AMD Instinct MI325X Accelerators. AMD product page.
- Google Cloud (2026). TPU v5e | Google Cloud Documentation. Google Cloud documentation.
- Google Cloud (2026). TPU v6e | Google Cloud Documentation. Google Cloud documentation.
- AWS (2025). Trainium2 Architecture - AWS Neuron Documentation. AWS Neuron documentation.
- AWS (2025). Amazon EC2 Trn2 Architecture - AWS Neuron Documentation. AWS Neuron documentation.
- Intel (2025). Intel Gaudi 3 AI Accelerator Technical Paper. Intel white paper.
- Cerebras Systems (2024). Cerebras Systems Unveils World's Fastest AI Chip with Whopping 4 Trillion Transistors. Press release.
- Guilherme Penedo, Hynek Kydlicek, Loubna Ben Allal et al. (2024). FineWeb: decanting the web for the finest text data at scale. Hugging Face blog.
- Jeffrey Li, Alex Fang, Georgios Smyrnis et al. (2024). DataComp-LM: In search of the next generation of training sets for language models. arXiv:2406.11794.
- Guilherme Penedo, Quentin Malartic, Daniel Hesslow et al. (2023). The RefinedWeb Dataset for Falcon LLM: Outperforming Curated Corpora with Web Data, and Web Data Only. arXiv:2306.01116.
- Anton Lozhkov, Loubna Ben Allal, Leandro von Werra and Thomas Wolf (2024). FineWeb-Edu: the Finest Collection of Educational Content. Dataset card.
- Common Crawl Foundation (2025). Get Started - Common Crawl. Common Crawl documentation.
- Adrien Barbaresi (2021). Trafilatura: A Web Scraping Library and Command-Line Tool for Text Discovery and Extraction. Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing: System Demonstrations.
- Janek Bevendorff (2024). Resiliparse documentation. Software documentation.
- Jeffrey Li, Josh Gardner, Doug Kang et al. (2026). Beyond a Single Extractor: Re-thinking HTML-to-Text Extraction for LLM Pretraining. arXiv:2602.19548.
- Dan Su, Kezhi Kong, Ying Lin et al. (2024). Nemotron-CC: Transforming Common Crawl into a Refined Long-Horizon Pretraining Dataset. arXiv:2412.02595.
- Armand Joulin, Edouard Grave, Piotr Bojanowski and Tomas Mikolov (2016). Bag of Tricks for Efficient Text Classification. arXiv:1607.01759.
- Edouard Grave, Piotr Bojanowski, Prakhar Gupta, Armand Joulin and Tomas Mikolov (2018). Learning Word Vectors for 157 Languages. arXiv:1802.06893.
- Colin Raffel, Noam Shazeer, Adam Roberts et al. (2019). Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer. arXiv:1910.10683.
- Luca Soldaini, Rodney Kinney, Akshita Bhagia et al. (2024). Dolma: an Open Corpus of Three Trillion Tokens for Language Model Pretraining Research. arXiv:2402.00159.
- Guilherme Penedo, Hynek Kydlíček, Vinko Sabolčec et al. (2025). FineWeb2: One Pipeline to Scale Them All -- Adapting Pre-Training Data Processing to Every Language. arXiv:2506.20920.
- Amir Hossein Kargaran, Ayyoob Imani, François Yvon and Hinrich Schütze (2023). GlotLID: Language Identification for Low-Resource Languages. arXiv:2310.16248.
- Jesse Dodge, Maarten Sap, Ana Marasović et al. (2021). Documenting Large Webtext Corpora: A Case Study on the Colossal Clean Crawled Corpus. arXiv:2104.08758.
- Jack W. Rae, Sebastian Borgeaud, Trevor Cai et al. (2021). Scaling Language Models: Methods, Analysis & Insights from Training Gopher. arXiv:2112.11446.
- Johannes Welbl, Amelia Glaese, Jonathan Uesato et al. (2021). Challenges in Detoxifying Language Models. arXiv:2109.07445.
- Shayne Longpre, Gregory Yauney, Emily Reif et al. (2023). A Pretrainer's Guide to Training Data: Measuring the Effects of Data Age, Domain Coverage, Quality, & Toxicity. arXiv:2305.13169.
- Katherine Lee, Daphne Ippolito, Andrew Nystrom et al. (2021). Deduplicating Training Data Makes Language Models Better. arXiv:2107.06499.
- Nikhil Kandpal, Eric Wallace and Colin Raffel (2022). Deduplicating Training Data Mitigates Privacy Risks in Language Models. arXiv:2202.06539.
- A.Z. Broder (1997). On the resemblance and containment of documents. Proceedings. Compression and Complexity of SEQUENCES 1997 (Cat. No.97TB100171).
- Jure Leskovec, Anand Rajaraman and Jeffrey D. Ullman (2020). Mining of Massive Datasets. Cambridge University Press (3rd ed., free online).
- Leo Gao, Stella Biderman, Sid Black et al. (2020). The Pile: An 800GB Dataset of Diverse Text for Language Modeling. arXiv:2101.00027.
- Maurice Weber, Daniel Fu, Quentin Anthony et al. (2024). RedPajama: an Open Dataset for Training Large Language Models. arXiv:2411.12372.
- Essential AI, Andrew Hojel, Michael Pust et al. (2025). Essential-Web v1.0: 24T tokens of organized web data. arXiv:2506.14111.
- Nikhil Kandpal, Brian Lester, Colin Raffel et al. (2025). The Common Pile v0.1: An 8TB Dataset of Public Domain and Openly Licensed Text. arXiv:2506.05209.
- Ren Ma, Jiantao Qiu, Chao Xu et al. (2025). AICC: Parse HTML Finer, Make Models Better -- A 7.3T AI-Ready Corpus Built by a Model-Based HTML Parser. arXiv:2511.16397.
- Jenna Russell, Ben Glickenhaus, Katherine Thai et al. (2026). How Much Is an AI Token Worth? Scaling Laws for Wild AI-Generated Web Text. arXiv:2609.40295.
- Sang Michael Xie, Hieu Pham, Xuanyi Dong et al. (2023). DoReMi: Optimizing Data Mixtures Speeds Up Language Model Pretraining. arXiv:2305.10429.
- Marah Abdin, Jyoti Aneja, Harkirat Behl et al. (2024). Phi-4 Technical Report. arXiv:2412.08905.
- Loubna Ben Allal, Anton Lozhkov, Elie Bakouch et al. (2025). SmolLM2: When Smol Goes Big -- Data-Centric Training of a Small Language Model. arXiv:2502.02737.
- An Yang, Anfeng Li, Baosong Yang et al. (2025). Qwen3 Technical Report. arXiv:2505.09388.
- Anton Lozhkov, Raymond Li, Loubna Ben Allal et al. (2024). StarCoder 2 and The Stack v2: The Next Generation. arXiv:2402.19173.
- Jiasheng Ye, Peiju Liu, Tianxiang Sun et al. (2024). Data Mixing Laws: Optimizing Data Mixtures by Predicting Language Modeling Performance. arXiv:2403.16952.
- Qian Liu, Xiaosen Zheng, Niklas Muennighoff et al. (2024). RegMix: Data Mixture as Regression for Language Model Pre-training. arXiv:2407.01492.
- Mayee F. Chen, Tyler Murray, David Heineman et al. (2026). Olmix: A Framework for Data Mixing Throughout LM Development. arXiv:2602.12237.
- Mayee F. Chen, Michael Y. Hu, Nicholas Lourie, Kyunghyun Cho and Christopher Ré (2024). Aioli: A Unified Optimization Framework for Language Model Data Mixing. arXiv:2411.05735.
- Mustafa Shukor, Louis Bethune, Dan Busbridge et al. (2025). Scaling Laws for Optimal Data Mixtures. arXiv:2507.09404.
- Viraat Aryabumi, Yixuan Su, Raymond Ma et al. (2024). To Code, or Not To Code? Exploring Impact of Code in Pre-training. arXiv:2408.10914.
- Keiran Paster, Marco Dos Santos, Zhangir Azerbayev and Jimmy Ba (2023). OpenWebMath: An Open Dataset of High-Quality Mathematical Web Text. arXiv:2310.06786.
- Zhihong Shao, Peiyi Wang, Qihao Zhu et al. (2024). DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Models. arXiv:2402.03300.
- Cody Blakeney, Mansheej Paul, Brett W. Larsen, Sean Owen and Jonathan Frankle (2024). Does your data spark joy? Performance gains from domain upsampling at the end of training. arXiv:2406.03476.
- Niklas Muennighoff, Alexander M. Rush, Boaz Barak et al. (2023). Scaling Data-Constrained Language Models. arXiv:2305.16264.
- Danny Hernandez, Tom Brown, Tom Conerly et al. (2022). Scaling Laws and Interpretability of Learning from Repeated Data. arXiv:2205.10487.
- Fuzhao Xue, Yao Fu, Wangchunshu Zhou, Zangwei Zheng and Yang You (2023). To Repeat or Not To Repeat: Insights from Scaling LLM under Token-Crisis. arXiv:2305.13230.
- Konwoo Kim, Suhas Kotha, Percy Liang and Tatsunori Hashimoto (2025). Pre-training under infinite compute. arXiv:2509.14786.
- Mihir Prabhudesai, Mengning Wu, Amir Zadeh, Katerina Fragkiadaki and Deepak Pathak (2025). Diffusion Beats Autoregressive in Data-Constrained Settings. arXiv:2507.15857.
- Suriya Gunasekar, Yi Zhang, Jyoti Aneja et al. (2023). Textbooks Are All You Need. arXiv:2306.11644.
- Pratyush Maini, Skyler Seto, He Bai et al. (2024). Rephrasing the Web: A Recipe for Compute and Data-Efficient Language Modeling. arXiv:2401.16380.
- Ilia Shumailov, Zakhar Shumaylov, Yiren Zhao et al. (2024). AI models collapse when trained on recursively generated data. Nature.
- Matthias Gerstgrasser, Rylan Schaeffer, Apratim Dey et al. (2024). Is Model Collapse Inevitable? Breaking the Curse of Recursion by Accumulating Real and Synthetic Data. arXiv:2404.01413.
- Elvis Dohmatob, Yunzhen Feng, Arjun Subramonian and Julia Kempe (2024). Strong Model Collapse. arXiv:2410.04840.
- Shayne Longpre, Robert Mahari, Ariel Lee et al. (2024). Consent in Crisis: The Rapid Decline of the AI Data Commons. arXiv:2407.14933.
- Shayne Longpre, Robert Mahari, Anthony Chen et al. (2023). The Data Provenance Initiative: A Large Scale Audit of Dataset Licensing & Attribution in AI. arXiv:2310.16787.
- OpenAI (2022). tiktoken. GitHub repository.
- Rico Sennrich, Barry Haddow and Alexandra Birch (2015). Neural Machine Translation of Rare Words with Subword Units. arXiv:1508.07909.
- OpenAI (2024). tiktoken/tiktoken_ext/openai_public.py at main · openai/tiktoken. GitHub repository (source file).
- Hugging Face (2025). Tokenization algorithms. Transformers documentation.
- Sander Land and Max Bartolo (2024). Fishing for Magikarp: Automatically Detecting Under-trained Tokens in Large Language Models. arXiv:2405.05417.
- Preston Firestone, Shubham Ugare, Gagandeep Singh and Sasa Misailovic (2025). UTF-8 Plumbing: Byte-level Tokenizers Unavoidably Enable LLMs to Generate Ill-formed UTF-8. arXiv:2511.05578.
- Kaj Bostrom and Greg Durrett (2020). Byte Pair Encoding is Suboptimal for Language Model Pretraining. arXiv:2004.03720.
- Taku Kudo and John Richardson (2018). SentencePiece: A simple and language independent subword tokenizer and detokenizer for Neural Text Processing. arXiv:1808.06226.
- Hugo Touvron, Louis Martin, Kevin Stone et al. (2023). Llama 2: Open Foundation and Fine-Tuned Chat Models. arXiv:2307.09288.
- Gemma Team, Thomas Mesnard, Cassidy Hardin et al. (2024). Gemma: Open Models Based on Gemini Research and Technology. arXiv:2403.08295.
- Taku Kudo (2018). Subword Regularization: Improving Neural Network Translation Models with Multiple Subword Candidates. arXiv:1804.10959.
- Mike Schuster and Kaisuke Nakajima (2012). Japanese and Korean voice search. 2012 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP).
- Hugging Face (2024). WordPiece tokenization. Hugging Face LLM Course, Chapter 6.
- Ivan Provilkov, Dmitrii Emelianenko and Elena Voita (2019). BPE-Dropout: Simple and Effective Subword Regularization. arXiv:1910.13267.
- Jonathan Hayase, Alisa Liu, Yejin Choi, Sewoong Oh and Noah A. Smith (2024). Data Mixture Inference: What do BPE Tokenizers Reveal about their Training Data?. arXiv:2407.16607.
- Meta AI (2024). Introducing Meta Llama 3: The most capable openly available LLM to date. Blog post.
- Artidoro Pagnoni, Ram Pasunuru, Pedro Rodriguez et al. (2024). Byte Latent Transformer: Patches Scale Better Than Tokens. arXiv:2412.09871.
- OpenAI (2024). tiktoken/tiktoken/core.py at main · openai/tiktoken. GitHub repository (source file).
- Hugging Face (2025). Chat templates. Transformers documentation.
- Buu Phan, Brandon Amos, Itai Gat et al. (2024). Exact Byte-Level Probabilities from Tokenized Language Models for FIM-Tasks and Model Ensembles. arXiv:2410.09303.
- Alisa Liu, Jonathan Hayase, Valentin Hofmann et al. (2025). SuperBPE: Space Travel for Language Models. arXiv:2503.13423.
- Gautier Dagan, Gabriel Synnaeve and Baptiste Rozière (2024). Getting the most out of your tokenizer for pre-training and domain adaptation. arXiv:2402.01035.
- Aleksandar Petrov, Emanuele La Malfa, Philip H. S. Torr and Adel Bibi (2023). Language Model Tokenizers Introduce Unfairness Between Languages. arXiv:2305.15425.
- Orevaoghene Ahia, Sachin Kumar, Hila Gonen et al. (2023). Do All Languages Cost the Same? Tokenization in the Era of Commercial Language Models. arXiv:2305.13707.
- Mehdi Ali, Michael Fromm, Klaudia Thellmann et al. (2023). Tokenizer Choice For LLM Training: Negligible or Crucial?. arXiv:2310.08754.
- Aaditya K. Singh and DJ Strouse (2024). Tokenization counts: the impact of tokenization on arithmetic in frontier LLMs. arXiv:2402.14903.
- Jessica Rumbelow and Matthew Watkins (2023). SolidGoldMagikarp (plus, prompt generation). LessWrong.
- Woojin Chung and Jeonghoon Kim (2025). Exploiting Vocabulary Frequency Imbalance in Language Model Pre-training. arXiv:2508.15390.
- Chaofan Tao, Qian Liu, Longxu Dou et al. (2024). Scaling Laws with Vocabulary: Larger Models Deserve Larger Vocabularies. arXiv:2407.13623.
- Craig W. Schmidt, Varshini Reddy, Haoran Zhang et al. (2024). Tokenization Is More Than Compression. arXiv:2402.18376.
- Hongzhi Huang, Defa Zhu, Banggu Wu et al. (2025). Over-Tokenized Transformer: Vocabulary is Generally Worth Scaling. arXiv:2501.16975.
- Théo Gigant, Bowen Peng and Jeffrey Quesnelle (2026). Decoupling the Benefits of Subword Tokenization for Language Model Training via Byte-level Simulation. arXiv:2604.27263.
- Linting Xue, Aditya Barua, Noah Constant et al. (2021). ByT5: Towards a token-free future with pre-trained byte-to-byte models. arXiv:2105.13626.
- Lili Yu, Dániel Simig, Colin Flaherty et al. (2023). MEGABYTE: Predicting Million-byte Sequences with Multiscale Transformers. arXiv:2305.07185.
- Sukjun Hwang, Brandon Wang and Albert Gu (2025). Dynamic Chunking for End-to-End Hierarchical Sequence Modeling. arXiv:2507.07955.
- Junxiong Wang, Tushaar Gangavarapu, Jing Nathan Yan and Alexander M. Rush (2024). MambaByte: Token-free Selective State Space Model. arXiv:2401.13660.
- Mathurin Videau, Badr Youbi Idrissi, Alessandro Leite et al. (2025). From Bytes to Ideas: Language Modeling with Autoregressive U-Nets. arXiv:2506.14761.
- Ian Magnusson, Nguyen Tai, Ben Bogin et al. (2025). DataDecide: How to Predict Best Pretraining Data with Small Experiments. arXiv:2504.11393.
- David Heineman, Valentin Hofmann, Ian Magnusson et al. (2025). Signal and Noise: A Framework for Reducing Uncertainty in Language Model Evaluation. arXiv:2508.13144.
- Andrej Karpathy (2024). karpathy/build-nanogpt: Video+code lecture on building nanoGPT from scratch. GitHub repository.
- Alec Radford, Karthik Narasimhan, Tim Salimans and Ilya Sutskever (2018). Improving Language Understanding by Generative Pre-Training. OpenAI technical report.
- Thomas Wang, Adam Roberts, Daniel Hesslow et al. (2022). What Language Model Architecture and Pretraining Objective Work Best for Zero-Shot Generalization?. arXiv:2204.05832.
- Yi Tay, Mostafa Dehghani, Vinh Q. Tran et al. (2022). UL2: Unifying Language Learning Paradigms. arXiv:2205.05131.
- Biao Zhang, Fedor Moiseev, Joshua Ainslie et al. (2025). Encoder-Decoder Gemma: Improving the Quality-Efficiency Trade-Off via Adaptation. arXiv:2504.06225.
- Gemma Team, Aishwarya Kamath, Johan Ferret et al. (2025). Gemma 3 Technical Report. arXiv:2503.19786.
- Ashish Vaswani, Noam Shazeer, Niki Parmar et al. (2017). Attention Is All You Need. arXiv:1706.03762.
- Yann N. Dauphin, Angela Fan, Michael Auli and David Grangier (2016). Language Modeling with Gated Convolutional Networks. arXiv:1612.08083.
- Gemma Team, Morgane Riviere, Shreya Pathak et al. (2024). Gemma 2: Improving Open Language Models at a Practical Size. arXiv:2408.00118.
- Ofir Press and Lior Wolf (2016). Using the Output Embedding to Improve Language Models. arXiv:1608.05859.
- Mitchell Wortsman, Peter J. Liu, Lechao Xiao et al. (2023). Small-scale proxies for large-scale Transformer training instabilities. arXiv:2309.14322.
- Chameleon Team (2024). Chameleon: Mixed-Modal Early-Fusion Foundation Models. arXiv:2405.09818.
- Ruibin Xiong, Yunchang Yang, Di He et al. (2020). On Layer Normalization in the Transformer Architecture. arXiv:2002.04745.
- Wenfang Sun, Xinyuan Song, Pengxiang Li et al. (2025). The Curse of Depth in Large Language Models. arXiv:2502.05795.
- Andrey Gromov, Kushal Tirumala, Hassan Shapourian, Paolo Glorioso and Daniel A. Roberts (2024). The Unreasonable Ineffectiveness of the Deeper Layers. arXiv:2403.17887.
- Jimmy Lei Ba, Jamie Ryan Kiros and Geoffrey E. Hinton (2016). Layer Normalization. arXiv:1607.06450.
- Biao Zhang and Rico Sennrich (2019). Root Mean Square Layer Normalization. arXiv:1910.07467.
- Shuangfei Zhai, Tatiana Likhomanenko, Etai Littwin et al. (2023). Stabilizing Transformer Training by Preventing Attention Entropy Collapse. arXiv:2303.06296.
- Mostafa Dehghani, Josip Djolonga, Basil Mustafa et al. (2023). Scaling Vision Transformers to 22 Billion Parameters. arXiv:2302.05442.
- Alex Henry, Prudhvi Raj Dachapally, Shubham Pawar and Yuxuan Chen (2020). Query-Key Normalization for Transformers. arXiv:2010.04245.
- Niklas Muennighoff, Luca Soldaini, Dirk Groeneveld et al. (2024). OLMoE: Open Mixture-of-Experts Language Models. arXiv:2409.02060.
- Bowen Yang, Bharat Venkitesh, Dwarak Talupuru et al. (2025). Rope to Nope and Back Again: A New Hybrid Attention Strategy. arXiv:2501.18795.
- DeepSeek-AI, Aixin Liu, Bei Feng et al. (2024). DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Model. arXiv:2405.04434.
- Ebtesam Almazrouei, Hamza Alobeidli, Abdulaziz Alshamsi et al. (2023). The Falcon Series of Open Language Models. arXiv:2311.16867.
- Oleg Rybakov, Mike Chrzanowski, Peter Dykas, Jinze Xue and Ben Lanir (2024). Methods of improving LLM training stability. arXiv:2410.16682.
- Jeonghoon Kim, Byeongchan Lee, Cheonbok Park et al. (2025). Peri-LN: Revisiting Normalization Layer in the Transformer Architecture. arXiv:2502.02732.
- Qwen, An Yang, Baosong Yang et al. (2024). Qwen2.5 Technical Report. arXiv:2412.15115.
- Zihan Qiu, Zekun Wang, Bo Zheng et al. (2025). Gated Attention for Large Language Models: Non-linearity, Sparsity, and Attention-Sink-Free. arXiv:2505.06708.
- Sharan Narang, Hyung Won Chung, Yi Tay et al. (2021). Do Transformer Modifications Transfer Across Implementations and Applications?. arXiv:2102.11972.
- Yi Tay, Mostafa Dehghani, Samira Abnar et al. (2022). Scaling Laws vs Model Architectures: How does Inductive Bias Influence Scaling?. arXiv:2207.10551.
- David R. So, Wojciech Mańke, Hanxiao Liu et al. (2021). Primer: Searching for Efficient Transformers for Language Modeling. arXiv:2109.08668.
- Nvidia, Bo Adler, Niket Agarwal et al. (2024). Nemotron-4 340B Technical Report. arXiv:2406.11704.
- NVIDIA, Aaron Blakeman, Aarti Basant et al. (2025). Nemotron-H: A Family of Accurate and Efficient Hybrid Mamba-Transformer Models. arXiv:2504.03624.
- Yi Tay, Mostafa Dehghani, Jinfeng Rao et al. (2021). Scale Efficiently: Insights from Pre-training and Fine-tuning Transformers. arXiv:2109.10686.
- Zechun Liu, Changsheng Zhao, Forrest Iandola et al. (2024). MobileLLM: Optimizing Sub-billion Parameter Language Models for On-Device Use Cases. arXiv:2402.14905.
- 5 Team, Aohan Zeng, Xin Lv et al. (2025). GLM-4.5: Agentic, Reasoning, and Coding (ARC) Foundation Models. arXiv:2508.06471.
- Albert Q. Jiang, Alexandre Sablayrolles, Arthur Mensch et al. (2023). Mistral 7B. arXiv:2310.06825.
- Guangxuan Xiao, Yuandong Tian, Beidi Chen, Song Han and Mike Lewis (2023). Efficient Streaming Language Models with Attention Sinks. arXiv:2309.17453.
- Ofir Press, Noah A. Smith and Mike Lewis (2021). Train Short, Test Long: Attention with Linear Biases Enables Input Length Extrapolation. arXiv:2108.12409.
- Jianlin Su, Yu Lu, Shengfeng Pan et al. (2021). RoFormer: Enhanced Transformer with Rotary Position Embedding. arXiv:2104.09864.
- Federico Barbero, Alex Vitvitskyi, Christos Perivolaropoulos, Razvan Pascanu and Petar Veličković (2024). Round and Round We Go! What makes Rotary Positional Encodings useful?. arXiv:2410.06205.
- MiniMax, Aonian Li, Bangwei Gong et al. (2025). MiniMax-01: Scaling Foundation Models with Lightning Attention. arXiv:2501.08313.
- Adi Haviv, Ori Ram, Ofir Press, Peter Izsak and Omer Levy (2022). Transformer Language Models without Positional Encodings Still Learn Positional Information. arXiv:2203.16634.
- Meta AI (2025). The Llama 4 herd: The beginning of a new era of natively multimodal AI innovation. Meta AI blog.
- Opher Lieber, Barak Lenz, Hofit Bata et al. (2024). Jamba: A Hybrid Transformer-Mamba Language Model. arXiv:2403.19887.
- Robert A. Jacobs, Michael I. Jordan, Steven J. Nowlan and Geoffrey E. Hinton (1991). Adaptive Mixtures of Local Experts. Neural Computation.
- Michael I. Jordan and Robert A. Jacobs (1994). Hierarchical Mixtures of Experts and the EM Algorithm. Neural Computation.
- Noam Shazeer, Azalia Mirhoseini, Krzysztof Maziarz et al. (2017). Outrageously Large Neural Networks: The Sparsely-Gated Mixture-of-Experts Layer. arXiv:1701.06538.
- Dmitry Lepikhin, HyoukJoong Lee, Yuanzhong Xu et al. (2020). GShard: Scaling Giant Models with Conditional Computation and Automatic Sharding. arXiv:2006.16668.
- Nan Du, Yanping Huang, Andrew M. Dai et al. (2021). GLaM: Efficient Scaling of Language Models with Mixture-of-Experts. arXiv:2112.06905.
- Albert Q. Jiang, Alexandre Sablayrolles, Antoine Roux et al. (2024). Mixtral of Experts. arXiv:2401.04088.
- Yanqi Zhou, Tao Lei, Hanxiao Liu et al. (2022). Mixture-of-Experts with Expert Choice Routing. arXiv:2202.09368.
- Samira Abnar, Harshay Shah, Dan Busbridge et al. (2025). Parameters vs FLOPs: Scaling Laws for Optimal Sparsity for Mixture-of-Experts Language Models. arXiv:2501.12370.
- Lean Wang, Huazuo Gao, Chenggang Zhao, Xu Sun and Damai Dai (2024). Auxiliary-Loss-Free Load Balancing Strategy for Mixture-of-Experts. arXiv:2408.15664.
- Barret Zoph, Irwan Bello, Sameer Kumar et al. (2022). ST-MoE: Designing Stable and Transferable Sparse Expert Models. arXiv:2202.08906.
- Trevor Gale, Deepak Narayanan, Cliff Young and Matei Zaharia (2022). MegaBlocks: Efficient Sparse Training with Mixture-of-Experts. arXiv:2211.15841.
- Zihan Qiu, Zeyu Huang, Bo Zheng et al. (2025). Demons in the Detail: On Implementing Load Balancing Loss for Training Specialized Mixture-of-Expert Models. arXiv:2501.11873.
- Damai Dai, Chengqi Deng, Chenggang Zhao et al. (2024). DeepSeekMoE: Towards Ultimate Expert Specialization in Mixture-of-Experts Language Models. arXiv:2401.06066.
- Jakub Krajewski, Jan Ludziejewski, Kamil Adamczewski et al. (2024). Scaling Laws for Fine-Grained Mixture of Experts. arXiv:2402.07871.
- Aran Komatsuzaki, Joan Puigcerver, James Lee-Thorp et al. (2022). Sparse Upcycling: Training Mixture-of-Experts from Dense Checkpoints. arXiv:2212.05055.
- Tianwen Wei, Bo Zhu, Liang Zhao et al. (2024). Skywork-MoE: A Deep Dive into Training Techniques for Mixture-of-Experts Language Models. arXiv:2406.06563.
- Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas and François Fleuret (2020). Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention. arXiv:2006.16236.
- Imanol Schlag, Kazuki Irie and Jürgen Schmidhuber (2021). Linear Transformers Are Secretly Fast Weight Programmers. arXiv:2102.11174.
- Songlin Yang, Bailin Wang, Yu Zhang, Yikang Shen and Yoon Kim (2024). Parallelizing Linear Transformers with the Delta Rule over Sequence Length. arXiv:2406.06484.
- Yutao Sun, Li Dong, Shaohan Huang et al. (2023). Retentive Network: A Successor to Transformer for Large Language Models. arXiv:2307.08621.
- Songlin Yang, Bailin Wang, Yikang Shen, Rameswar Panda and Yoon Kim (2023). Gated Linear Attention Transformers with Hardware-Efficient Training. arXiv:2312.06635.
- Tri Dao and Albert Gu (2024). Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality. arXiv:2405.21060.
- Albert Gu and Tri Dao (2023). Mamba: Linear-Time Sequence Modeling with Selective State Spaces. arXiv:2312.00752.
- Songlin Yang, Jan Kautz and Ali Hatamizadeh (2024). Gated Delta Networks: Improving Mamba2 with Delta Rule. arXiv:2412.06464.
- Simran Arora, Sabri Eyuboglu, Aman Timalsina et al. (2023). Zoology: Measuring and Improving Recall in Efficient Language Models. arXiv:2312.04927.
- Samy Jelassi, David Brandfonbrener, Sham M. Kakade and Eran Malach (2024). Repeat After Me: Transformers are Better than State Space Models at Copying. arXiv:2402.01032.
- Roger Waleffe, Wonmin Byeon, Duncan Riach et al. (2024). An Empirical Study of Mamba-based Language Models. arXiv:2406.07887.
- Dustin Wang, Rui-Jie Zhu, Steven Abreu et al. (2025). A Systematic Analysis of Hybrid Linear Attention. arXiv:2507.06457.
- Kimi Team, Yu Zhang, Zongyu Lin et al. (2025). Kimi Linear: An Expressive, Efficient Attention Architecture. arXiv:2510.26692.
- Liliang Ren, Yang Liu, Yadong Lu et al. (2024). Samba: Simple Hybrid State Space Models for Efficient Unlimited Context Language Modeling. arXiv:2406.07522.
- Fabian Gloeckle, Badr Youbi Idrissi, Baptiste Rozière, David Lopez-Paz and Gabriel Synnaeve (2024). Better & Faster Large Language Models via Multi-token Prediction. arXiv:2404.19737.
- Shen Nie, Fengqi Zhu, Zebin You et al. (2025). Large Language Diffusion Models. arXiv:2502.09992.
- Diederik P. Kingma and Jimmy Ba (2014). Adam: A Method for Stochastic Optimization. arXiv:1412.6980.
- Ilya Loshchilov and Frank Hutter (2017). Decoupled Weight Decay Regularization. arXiv:1711.05101.
- Shane Bergsma, Nolan Dey, Gurpreet Gosal et al. (2025). Straight to Zero: Why Linearly Decaying the Learning Rate to Zero Works Best for LLMs. arXiv:2502.15938.
- Xi Wang and Laurence Aitchison (2024). How to set AdamW's weight decay as you scale model and dataset size. arXiv:2405.13698.
- Shane Bergsma, Nolan Dey, Gurpreet Gosal et al. (2025). Power Lines: Scaling Laws for Weight Decay and Batch Size in LLM Pre-training. arXiv:2505.13738.
- Igor Molybog, Peter Albert, Moya Chen et al. (2023). A Theory on Adam Instability in Large-Scale Machine Learning. arXiv:2304.09871.
- Martin Marek, Sanae Lotfi, Aditya Somasundaram, Andrew Gordon Wilson and Micah Goldblum (2025). Small Batch Size Training for Language Models: When Vanilla SGD Works, and Why Gradient Accumulation Is Wasteful. arXiv:2507.07101.
- Razvan Pascanu, Tomas Mikolov and Yoshua Bengio (2012). On the difficulty of training Recurrent Neural Networks. arXiv:1211.5063.
- Susan Zhang, Stephen Roller, Naman Goyal et al. (2022). OPT: Open Pre-trained Transformer Language Models. arXiv:2205.01068.
- Aaron Defazio (2025). Why Gradients Rapidly Increase Near the End of Training. arXiv:2506.02285.
- Rosie Zhao, Depen Morwani, David Brandfonbrener, Nikhil Vyas and Sham Kakade (2024). Deconstructing What Makes a Good Optimizer for Language Models. arXiv:2407.07972.
- Liyuan Liu, Haoming Jiang, Pengcheng He et al. (2019). On the Variance of the Adaptive Learning Rate and Beyond. arXiv:1908.03265.
- Jerry Ma and Denis Yarats (2019). On the adequacy of untuned warmup for adaptive optimization. arXiv:1910.04209.
- Dayal Singh Kalra and Maissam Barkeshli (2024). Why Warmup the Learning Rate? Underlying Mechanisms and Improvements. arXiv:2406.09405.
- Justin Gilmer, Behrooz Ghorbani, Ankush Garg et al. (2021). A Loss Curvature Perspective on Training Instability in Deep Learning. arXiv:2110.04369.
- Ilya Loshchilov and Frank Hutter (2016). SGDR: Stochastic Gradient Descent with Warm Restarts. arXiv:1608.03983.
- Alexander Hägele, Elie Bakouch, Atli Kosson et al. (2024). Scaling Laws and Compute-Optimal Training Beyond Fixed Training Durations. arXiv:2405.18392.
- Shengding Hu, Yuge Tu, Xu Han et al. (2024). MiniCPM: Unveiling the Potential of Small Language Models with Scalable Training Strategies. arXiv:2404.06395.
- Aaron Defazio, Xingyu Alice Yang, Harsh Mehta et al. (2024). The Road Less Scheduled. arXiv:2405.15682.
- Priya Kasimbeg, Frank Schneider, Runa Eschenhagen et al. (2025). Accelerating Neural Network Training: An Analysis of the AlgoPerf Competition. arXiv:2502.15015.
- Kaiyue Wen, Zhiyuan Li, Jason Wang et al. (2024). Understanding Warmup-Stable-Decay Learning Rates: A River Valley Loss Landscape Perspective. arXiv:2410.05192.
- Adam Ibrahim, Benjamin Thérien, Kshitij Gupta et al. (2024). Simple and Scalable Strategies to Continually Pre-train Large Language Models. arXiv:2403.08763.
- Howe Tissue, Venus Wang and Lu Wang (2024). Scaling Law with Learning Rate Annealing. arXiv:2408.11029.
- Sam McCandlish, Jared Kaplan, Dario Amodei and OpenAI Dota Team (2018). An Empirical Model of Large-Batch Training. arXiv:1812.06162.
- Hanlin Zhang, Depen Morwani, Nikhil Vyas et al. (2024). How Does Critical Batch Size Scale in Pre-training?. arXiv:2410.21676.
- Houyi Li, Wenzhen Zheng, Qiufeng Wang et al. (2025). Predictable Scale: Part I, Step Law -- Optimal Hyperparameter Scaling Law in Large Language Model Pretraining. arXiv:2503.04715.
- William Merrill, Shane Arora, Dirk Groeneveld and Hannaneh Hajishirzi (2025). Critical Batch Size Revisited: A Simple Empirical Approach to Large-Batch Language Model Training. arXiv:2505.23971.
- Alexandru Meterez, Depen Morwani, Jingfeng Wu et al. (2025). Seesaw: Accelerating Training by Balancing Learning Rate and Batch Size Scheduling. arXiv:2510.14717.
- Samuel L. Smith, Pieter-Jan Kindermans, Chris Ying and Quoc V. Le (2017). Don't Decay the Learning Rate, Increase the Batch Size. arXiv:1711.00489.
- Priya Goyal, Piotr Dollár, Ross Girshick et al. (2017). Accurate, Large Minibatch SGD: Training ImageNet in 1 Hour. arXiv:1706.02677.
- Sadhika Malladi, Kaifeng Lyu, Abhishek Panigrahi and Sanjeev Arora (2022). On the SDEs and Scaling Rules for Adaptive Gradient Algorithms. arXiv:2205.10287.
- Shuaipeng Li, Penghao Zhao, Hailin Zhang et al. (2024). Surge Phenomenon in Optimal Learning Rate and Batch Size Scaling. arXiv:2405.14578.
- Bruno Mlodozeniec, Pierre Ablin, Louis Béthune et al. (2025). Completed Hyperparameter Transfer across Modules, Width, Depth, Batch and Duration. arXiv:2512.22382.
- Xingyu Dang, Kaiyue Wen and Sadhika Malladi (2026). The Best Optimizer Depends on Batch Size. arXiv:2610.08975.
- Christopher J. Shallue, Jaehoon Lee, Joseph Antognini et al. (2018). Measuring the Effects of Data Parallelism on Neural Network Training. arXiv:1811.03600.
- Greg Yang, Edward J. Hu, Igor Babuschkin et al. (2022). Tensor Programs V: Tuning Large Neural Networks via Zero-Shot Hyperparameter Transfer. arXiv:2203.03466.
- Greg Yang and Edward J. Hu (2020). Feature Learning in Infinite-Width Neural Networks. arXiv:2011.14522.
- Arthur Jacot, Franck Gabriel and Clément Hongler (2018). Neural Tangent Kernel: Convergence and Generalization in Neural Networks. arXiv:1806.07572.
- Lenaic Chizat, Edouard Oyallon and Francis Bach (2018). On Lazy Training in Differentiable Programming. arXiv:1812.07956.
- Greg Yang, James B. Simon and Jeremy Bernstein (2023). A Spectral Condition for Feature Learning. arXiv:2310.17813.
- Nolan Dey, Gurpreet Gosal, Zhiming et al. (2023). Cerebras-GPT: Open Compute-Optimal Language Models Trained on the Cerebras Wafer-Scale Cluster. arXiv:2304.03208.
- Nolan Dey, Quentin Anthony and Joel Hestness (2024). The Practitioner's Guide to the Maximal Update Parameterization. Cerebras blog.
- Microsoft (2022). mup: maximal update parametrization (muP). GitHub repository.
- Nolan Dey, Daria Soboleva, Faisal Al-Khateeb et al. (2023). BTLM-3B-8K: 7B Parameter Performance in a 3B Parameter Model. arXiv:2309.11568.
- Lucas Lingle (2024). An Empirical Study of μP Learning Rate Transfer. arXiv:2404.05728.
- Charlie Blake, Constantin Eichenberg, Josef Dean et al. (2024). u-μP: The Unit-Scaled Maximal Update Parametrization. arXiv:2407.17465.
- Jingwei Zuo, Maksim Velikanov, Ilyas Chahed et al. (2025). Falcon-H1: A Family of Hybrid-Head Language Models Redefining Efficiency and Performance. arXiv:2507.22448.
- Team Cohere, Aakanksha, Arash Ahmadian et al. (2025). Command A: An Enterprise-Ready Large Language Model. arXiv:2504.00698.
- Atli Kosson, Jeremy Welborn, Yang Liu, Martin Jaggi and Xi Chen (2025). Weight Decay may matter more than muP for Learning Rate Transfer in Practice. arXiv:2510.19093.
- Katie Everett, Lechao Xiao, Mitchell Wortsman et al. (2024). Scaling Exponents Across Parameterizations and Optimizers. arXiv:2407.05872.
- Dayal Singh Kalra and Maissam Barkeshli (2026). Quantifying Hyperparameter Transfer and the Importance of Embedding Layer Learning Rate. arXiv:2605.21486.
- Greg Yang, Dingli Yu, Chen Zhu and Soufiane Hayou (2023). Tensor Programs VI: Feature Learning in Infinite-Depth Neural Networks. arXiv:2310.02244.
- Blake Bordelon, Lorenzo Noci, Mufan Bill Li, Boris Hanin and Cengiz Pehlevan (2023). Depthwise Hyperparameter Transfer in Residual Networks: Dynamics and Scaling Limit. arXiv:2309.16620.
- Nolan Dey, Bin Claire Zhang, Lorenzo Noci et al. (2025). Don't be lazy: CompleteP enables compute-efficient deep transformers. arXiv:2505.01618.
- Kaiming He, Xiangyu Zhang, Shaoqing Ren and Jian Sun (2015). Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification. arXiv:1502.01852.
- Mohammad Shoeybi, Mostofa Patwary, Raul Puri et al. (2019). Megatron-LM: Training Multi-Billion Parameter Language Models Using Model Parallelism. arXiv:1909.08053.
- Varun Godbole, George E. Dahl, Justin Gilmer, Christopher J. Shallue and Zachary Nado (2023). Deep Learning Tuning Playbook. GitHub repository.
- Johan Bjorck, Alon Benhaim, Vishrav Chaudhary, Furu Wei and Xia Song (2024). Scaling Optimal LR Across Token Horizons. arXiv:2409.19913.
- Aohan Zeng, Xiao Liu, Zhengxiao Du et al. (2022). GLM-130B: An Open Bilingual Pre-trained Model. arXiv:2210.02414.
- Mitchell Wortsman, Tim Dettmers, Luke Zettlemoyer et al. (2023). Stable and low-precision training for large-scale vision-language models. arXiv:2304.13013.
- Sho Takase, Shun Kiyono, Sosuke Kobayashi and Jun Suzuki (2023). Spike No More: Stabilizing the Pre-training of Large Language Models. arXiv:2312.16903.
- Zaiqian Chen, Aditya Somasundaram, Sophie Li et al. (2026). The Role of Quantization in Loss Spikes. arXiv:2610.38277.
- Teven Le Scao, Thomas Wang, Daniel Hesslow et al. (2022). What Language Model to Train if You Have One Million GPU Hours?. arXiv:2210.15424.
- Yunshui Li, Yiyuan Ma, Shen Yan et al. (2025). Model Merging in Pre-training of Large Language Models. arXiv:2505.12082.
- BigScience Workshop, Teven Le Scao, Angela Fan et al. (2022). BLOOM: A 176B-Parameter Open-Access Multilingual Language Model. arXiv:2211.05100.
- Jiayi Yuan, Hao Li, Xinheng Ding et al. (2025). Understanding and Mitigating Numerical Sources of Nondeterminism in LLM Inference. arXiv:2506.09501.
- Bita Darvish Rouhani, Ritchie Zhao, Ankit More et al. (2023). Microscaling Data Formats for Deep Learning. arXiv:2310.10537.
- Mingjie Sun, Xinlei Chen, J. Zico Kolter and Zhuang Liu (2024). Massive Activations in Large Language Models. arXiv:2402.17762.
- Kazuki Fujii, Taishi Nakamura and Rio Yokota (2024). Balancing Speed and Stability: The Trade-offs of FP8 vs. BF16 Training in LLMs. arXiv:2411.08719.
- Alejandro Hernández-Cano, Dhia Garbaya, Imanol Schlag and Martin Jaggi (2025). Towards Fully FP8 GEMM LLM Training at Scale. arXiv:2505.20524.
- Musa Cim, Sarthak Arora, Poovaiah Palangappa et al. (2026). Pretraining large language models with MXFP4 on Native FP4 Hardware. arXiv:2605.09825.
- Jeremy Bernstein and Laker Newhouse (2024). Old Optimizer, New Norm: An Anthology. arXiv:2409.20325.
- Jingyuan Liu, Jianlin Su, Xingcheng Yao et al. (2025). Muon is Scalable for LLM Training. arXiv:2502.16982.
- Vineet Gupta, Tomer Koren and Yoram Singer (2018). Shampoo: Preconditioned Stochastic Tensor Optimization. arXiv:1802.09568.
- Hao-Jun Michael Shi, Tsung-Hsien Lee, Shintaro Iwasaki et al. (2023). A Distributed Data-Parallel PyTorch Implementation of the Distributed Shampoo Optimizer for Training Neural Networks At-Scale. arXiv:2309.06497.
- Nikhil Vyas, Depen Morwani, Rosie Zhao et al. (2024). SOAP: Improving and Stabilizing Shampoo using Adam. arXiv:2409.11321.
- Keller Jordan, Yuchen Jin, Vlado Boza et al. (2024). Muon: An optimizer for hidden layers in neural networks. Blog post.
- Mushir Akhtar, Hazem N. Nounou, Majdi Mansouri and Mohamed N. Nounou (2026). When Does Muon Actually Win? A Paired Data-, Time-, and Tuning-Budget Benchmark. arXiv:2610.21555.
- Keller Jordan, Jeremy Bernstein, Brendan Rappazzo et al. (2024). modded-nanogpt: Speedrunning the NanoGPT baseline. GitHub repository README.
- Hong Liu, Zhiyuan Li, David Hall, Percy Liang and Tengyu Ma (2023). Sophia: A Scalable Stochastic Second-order Optimizer for Language Model Pre-training. arXiv:2305.14342.
- Jean Kaddour, Oscar Key, Piotr Nawrot, Pasquale Minervini and Matt J. Kusner (2023). No Train No Gain: Revisiting Efficient Training Algorithms For Transformer-based Language Models. arXiv:2307.06440.
- Kaiyue Wen, David Hall, Tengyu Ma and Percy Liang (2025). Fantastic Pretraining Optimizers and Where to Find Them. arXiv:2509.02046.
- George E. Dahl, Frank Schneider, Zachary Nado et al. (2023). Benchmarking Neural Network Training Algorithms. arXiv:2306.07179.
- Sunny Sanyal, Atula Neerkaje, Jean Kaddour, Abhishek Kumar and Sujay Sanghavi (2023). Early Weight Averaging meets High Learning Rates for LLM Pre-training. arXiv:2306.03241.
- Changxin Tian, Jiapeng Wang, Qian Zhao et al. (2025). WSM: Decay-Free Learning Rate Schedule via Checkpoint Merging for LLM Pre-training. arXiv:2507.17634.
- Jeremy M. Cohen, Behrooz Ghorbani, Shankar Krishnan et al. (2022). Adaptive Gradient Methods at the Edge of Stability. arXiv:2207.14484.
- Jeremy M. Cohen, Simran Kaur, Yuanzhi Li, J. Zico Kolter and Ameet Talwalkar (2021). Gradient Descent on Neural Networks Typically Occurs at the Edge of Stability. arXiv:2103.00065.
- Catherine Olsson, Nelson Elhage, Neel Nanda et al. (2022). In-context Learning and Induction Heads. arXiv:2209.11895.
- Pulkit Gopalani and Wei Hu (2025). What Happens During the Loss Plateau? Understanding Abrupt Learning in Transformers. arXiv:2506.13688.
- Alethea Power, Yuri Burda, Harri Edwards, Igor Babuschkin and Vedant Misra (2022). Grokking: Generalization Beyond Overfitting on Small Algorithmic Datasets. arXiv:2201.02177.
- Preetum Nakkiran, Gal Kaplun, Yamini Bansal et al. (2019). Deep Double Descent: Where Bigger Models and More Data Hurt. arXiv:1912.02292.
- Tom Henighan, Jared Kaplan, Mor Katz et al. (2020). Scaling Laws for Autoregressive Generative Modeling. arXiv:2010.14701.
- Joel Hestness, Sharan Narang, Newsha Ardalani et al. (2017). Deep Learning Scaling is Predictable, Empirically. arXiv:1712.00409.
- Jonathan S. Rosenfeld, Amir Rosenfeld, Yonatan Belinkov and Nir Shavit (2019). A Constructive Prediction of the Generalization Error Across Scales. arXiv:1909.12673.
- Utkarsh Sharma and Jared Kaplan (2020). A Neural Scaling Law from the Dimension of the Data Manifold. arXiv:2004.10802.
- Eric J. Michaud, Ziming Liu, Uzay Girit and Max Tegmark (2023). The Quantization Model of Neural Scaling. arXiv:2303.13506.
- Yasaman Bahri, Ethan Dyer, Jared Kaplan, Jaehoon Lee and Utkarsh Sharma (2021). Explaining Neural Scaling Laws. arXiv:2102.06701.
- Marcus Hutter (2021). Learning Curve Theory. arXiv:2102.04074.
- Alexander Maloney, Daniel A. Roberts and James Sully (2022). A Solvable Model of Neural Scaling Laws. arXiv:2210.16859.
- Blake Bordelon, Alexander Atanasov and Cengiz Pehlevan (2024). A Dynamical Model of Neural Scaling Laws. arXiv:2402.01092.
- Elliot Paquette, Courtney Paquette, Lechao Xiao and Jeffrey Pennington (2024). 4+3 Phases of Compute-Optimal Neural Scaling Laws. arXiv:2405.15074.
- Francesco Cagnetta, Allan Raventós, Surya Ganguli and Matthieu Wyart (2026). Deriving Neural Scaling Laws from the statistics of natural language. arXiv:2602.07488.
- Marc Finzi, Sanyam Kapoor, Diego Granziol et al. (2025). Compute-Optimal LLMs Provably Generalize Better With Scale. arXiv:2504.15208.
- Yizhou Liu and Jeff Gore (2026). Neural Scaling Universality: If Exponents Are Fixed, Time to Understand Coefficients. arXiv:2606.25008.
- Xing Han, Liu Ziyin, Suchi Saria and Paul Pu Liang (2026). On the Invariance and Generality of Neural Scaling Laws. arXiv:2605.07546.
- Ethan Caballero, Kshitij Gupta, Irina Rish and David Krueger (2022). Broken Neural Scaling Laws. arXiv:2210.14891.
- Ethan Caballero, Priyank Jaini, David Krueger and Irina Rish (2026). Unified Neural Scaling Laws. arXiv:2605.26248.
- Ibrahim Alabdulmohsin, Behnam Neyshabur and Xiaohua Zhai (2022). Revisiting Neural Scaling Laws in Language and Vision. arXiv:2209.06640.
- Ben Sorscher, Robert Geirhos, Shashank Shekhar, Surya Ganguli and Ari S. Morcos (2022). Beyond neural scaling laws: beating power law scaling via data pruning. arXiv:2206.14486.
- Tamay Besiroglu, Ege Erdil, Matthew Barnett and Josh You (2024). Chinchilla Scaling: A replication attempt. arXiv:2404.10102.
- Rylan Schaeffer, Noam Levi, Andreas Kirsch et al. (2025). Evaluating the Robustness of Chinchilla Compute-Optimal Scaling. arXiv:2509.23963.
- Joshua Shay Kricheli, Alexander Lawrence Reid, Soumajyoti Sarkar, Venkata Gandikota and Paulo Shakarian (2026). Tokens-per-Parameter Coverage Is Critical for Robust LLM Scaling Law Extrapolation. arXiv:2605.08541.
- Sean McLeish, John Kirchenbauer, David Yu Miller et al. (2025). Gemstones: A Model Suite for Multi-Faceted Scaling Laws. arXiv:2502.06857.
- Leshem Choshen, Yang Zhang and Jacob Andreas (2024). A Hitchhiker's Guide to Scaling Law Estimation. arXiv:2410.11840.
- Margaret Li, Sneha Kudugunta and Luke Zettlemoyer (2025). (Mis)Fitting: A Survey of Scaling Laws. arXiv:2502.18969.
- Bruno Mlodozeniec and Spencer Frei (2026). Ambiguous Fits: The Rashomon Effect and Challenges in Scaling Law Estimation. arXiv:2610.34514.
- Vansh Ramani and Shourya Vir Jain (2026). On the Optimizer Dependence of Neural Scaling Laws. arXiv:2605.29387.
- Sijie Li, Shanda Li, Haowei Lin et al. (2026). Spend Less, Fit Better: Budget-Efficient Scaling Law Fitting via Active Experiment Selection. arXiv:2604.22753.
- Houyi Li, Wenzhen Zheng, Qiufeng Wang et al. (2025). Predictable Scale: Part II, Farseer: A Refined Scaling Law in Large Language Models. arXiv:2506.10972.
- Samir Yitzhak Gadre, Georgios Smyrnis, Vaishaal Shankar et al. (2024). Language models scale reliably with over-training and on downstream tasks. arXiv:2403.08540.
- Pablo Villalobos, Anson Ho, Jaime Sevilla et al. (2022). Will we run out of data? Limits of LLM scaling based on human-generated data. arXiv:2211.04325.
- Tanishq Kumar, Zachary Ankner, Benjamin F. Spector et al. (2024). Scaling Laws for Precision. arXiv:2411.04330.
- Song Bian, Minghao Yan and Shivaram Venkataraman (2025). Scaling Inference-Efficient Language Models. arXiv:2501.18107.
- Justin Lovelace, Christian Belardi, Srivatsa Kundurthy, Shriya Sudhakar and Kilian Q. Weinberger (2026). Prescriptive Scaling Laws for Data Constrained Training. arXiv:2605.01640.
- Aidan Clark, Diego de las Casas, Aurelia Guy et al. (2022). Unified Scaling Laws for Routed Language Models. arXiv:2202.01169.
- Jan Ludziejewski, Maciej Pióro, Jakub Krajewski et al. (2025). Joint MoE Scaling Laws: Mixture of Experts Can Be Memory Efficient. arXiv:2502.05172.
- Guoliang Zhao, Yuhan Fu, Shuaipeng Li et al. (2025). Towards a Comprehensive Scaling Law of Mixture-of-Experts. arXiv:2509.23678.
- Changxin Tian, Kunlong Chen, Jia Liu et al. (2025). Towards Greater Leverage: Scaling Laws for Efficient Mixture-of-Experts Language Models. arXiv:2507.17702.
- Elias Frantar, Carlos Riquelme, Neil Houlsby, Dan Alistarh and Utku Evci (2023). Scaling Laws for Sparsely-Connected Foundation Models. arXiv:2309.08520.
- Xingwu Sun, Shuaipeng Li, Ruobing Xie et al. (2025). Scaling Laws for Floating Point Quantization Training. arXiv:2501.02423.
- Mengzhao Chen, Chaoyi Zhang, Jing Liu et al. (2025). Scaling Law for Quantization-Aware Training. arXiv:2505.14302.
- Tim Dettmers and Luke Zettlemoyer (2022). The case for 4-bit precision: k-bit Inference Scaling Laws. arXiv:2212.09720.
- Xu Ouyang, Tao Ge, Thomas Hartvigsen et al. (2024). Low-Bit Quantization Favors Undertrained LLMs: Scaling Laws for Quantized LLMs with 100T Training Tokens. arXiv:2411.17691.
- Mouxiang Chen, Binyuan Hui, Zeyu Cui et al. (2025). Parallel Scaling Law for Language Models. arXiv:2505.10475.
- Dan Busbridge, Amitis Shidani, Floris Weers et al. (2025). Distillation Scaling Laws. arXiv:2502.08606.
- OpenAI, Josh Achiam, Steven Adler et al. (2023). GPT-4 Technical Report. arXiv:2303.08774.
- Akshita Bhagia, Jiacheng Liu, Alexander Wettig et al. (2024). Establishing Task Scaling Laws via Compute-Efficient Model Ladders. arXiv:2412.04403.
- Nicholas Lourie, Michael Y. Hu and Kyunghyun Cho (2025). Scaling Laws Are Unreliable for Downstream Tasks: A Reality Check. arXiv:2507.00885.
- Rylan Schaeffer, Hailey Schoelkopf, Brando Miranda et al. (2024). Why Has Predicting Downstream Capabilities of Frontier AI Models with Scale Remained Elusive?. arXiv:2406.04391.
- Jason Wei, Yi Tay, Rishi Bommasani et al. (2022). Emergent Abilities of Large Language Models. arXiv:2206.07682.
- Rylan Schaeffer, Brando Miranda and Sanmi Koyejo (2023). Are Emergent Abilities of Large Language Models a Mirage?. arXiv:2304.15004.
- Zhengxiao Du, Aohan Zeng, Yuxiao Dong and Jie Tang (2024). Understanding Emergent Abilities of Language Models from the Loss Perspective. arXiv:2403.15796.
- Bradley Brown, Jordan Juravsky, Ryan Ehrlich et al. (2024). Large Language Monkeys: Scaling Inference Compute with Repeated Sampling. arXiv:2407.21787.
- Rylan Schaeffer, Joshua Kazdan, John Hughes et al. (2025). How Do Large Language Monkeys Get Their Power (Laws)?. arXiv:2502.17578.
- Yangzhen Wu, Zhiqing Sun, Shanda Li, Sean Welleck and Yiming Yang (2024). Inference Scaling Laws: An Empirical Analysis of Compute-Optimal Inference for Problem-Solving with Language Models. arXiv:2408.00724.
- Niklas Muennighoff, Zitong Yang, Weijia Shi et al. (2025). s1: Simple test-time scaling. arXiv:2501.19393.
- Devvrit Khatri, Lovish Madaan, Rishabh Tiwari et al. (2025). The Art of Scaling Reinforcement Learning Compute for LLMs. arXiv:2510.13786.
- Yang Yue, Zhiqi Chen, Rui Lu et al. (2025). Does Reinforcement Learning Really Incentivize Reasoning Capacity in LLMs Beyond the Base Model?. arXiv:2504.13837.
- Mingjie Liu, Shizhe Diao, Ximing Lu et al. (2025). ProRL: Prolonged Reinforcement Learning Expands Reasoning Boundaries in Large Language Models. arXiv:2505.24864.
- Thomas Kwa, Ben West, Joel Becker et al. (2025). Measuring AI Ability to Complete Long Software Tasks. arXiv:2503.14499.
- METR (2026). Time Horizon 1.1. METR blog.
- Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian et al. (2021). Training Verifiers to Solve Math Word Problems. arXiv:2110.14168.
- Chengying Tu, Xuemiao Zhang, Rongxiang Weng et al. (2025). A Survey on LLM Mid-Training. arXiv:2510.23081.
- Kaixiang Mo, Yuxin Shi, Weiwei Weng et al. (2025). Mid-Training of Large Language Models: A Survey. arXiv:2510.06826.
- Elie Bakouch, Carlos Miguel Patiño, Anton Lozhkov et al. (2025). SmolLM3: smol, multilingual, long-context reasoner. Hugging Face blog.
- Zengzhi Wang, Fan Zhou, Xuefeng Li and Pengfei Liu (2025). OctoThinker: Mid-training Incentivizes Reinforcement Learning Scaling. arXiv:2506.20512.
- Soumye Singhal, Joseph Jennings, Ka Shun Shum et al. (2026). Priming Base Models for Agentic Post-Training: An Open Midtraining Recipe. arXiv:2610.22019.
- Meta AI (2024). Llama 3.2: Revolutionizing edge AI and vision with open, customizable models. Meta AI blog.
- Saurav Muralidharan, Sharath Turuvekere Sreenivas, Raviraj Joshi et al. (2024). Compact Language Models via Pruning and Knowledge Distillation. arXiv:2407.14679.
- Steven Feng, Shrimai Prabhumoye, Kezhi Kong et al. (2024). Maximize Your Data's Potential: Enhancing LLM Accuracy with Two-Phase Pretraining. arXiv:2412.15285.
- Yuling Gu, Oyvind Tafjord, Bailey Kuehl et al. (2024). OLMES: A Standard for Language Model Evaluations. arXiv:2406.08446.
- Dan Hendrycks, Collin Burns, Steven Basart et al. (2020). Measuring Massive Multitask Language Understanding. arXiv:2009.03300.
- Ricardo Dominguez-Olmedo, Florian E. Dorner and Moritz Hardt (2024). Training on the Test Task Confounds Evaluation and Emergence. arXiv:2407.07890.
- Bharat Runwal, Ashish Agrawal, Anurag Roy and Rameswar Panda (2026). PRISM: Demystifying Retention and Interaction in Mid-Training. arXiv:2603.17074.
- Syeda Nahida Akter, Shrimai Prabhumoye, Eric Nyberg et al. (2025). Front-Loading Reasoning: The Synergy between Pretraining and Post-Training Data. arXiv:2510.03264.
- Emmy Liu, Graham Neubig and Chenyan Xiong (2025). Midtraining Bridges Pretraining and Posttraining Distributions. arXiv:2510.14865.
- Syeda Nahida Akter, Shrimai Prabhumoye, John Kamalu et al. (2024). MIND: Math Informed syNthetic Dialogues for Pretraining LLMs. arXiv:2410.12881.
- Shuo Yang, Wei-Lin Chiang, Lianmin Zheng, Joseph E. Gonzalez and Ion Stoica (2023). Rethinking Benchmark and Contamination for Language Models with Rephrased Samples. arXiv:2311.04850.
- Wenhan Xiong, Jingyu Liu, Igor Molybog et al. (2023). Effective Long-Context Scaling of Foundation Models. arXiv:2309.16039.
- Yao Fu, Rameswar Panda, Xinyao Niu et al. (2024). Data Engineering for Scaling Language Models to 128K Context. arXiv:2402.10171.
- Bowen Peng, Jeffrey Quesnelle, Honglu Fan and Enrico Shippole (2023). YaRN: Efficient Context Window Extension of Large Language Models. arXiv:2309.00071.
- Xiaoran Liu, Hang Yan, Shuo Zhang et al. (2023). Scaling Laws of RoPE-based Extrapolation. arXiv:2310.05209.
- Shouyuan Chen, Sherman Wong, Liangjian Chen and Yuandong Tian (2023). Extending Context Window of Large Language Models via Positional Interpolation. arXiv:2306.15595.
- Hugging Face (2026). transformers/src/transformers/modeling_rope_utils.py. GitHub repository (huggingface/transformers).
- Xin Men, Mingyu Xu, Bingning Wang et al. (2024). Base of RoPE Bounds Context Length. arXiv:2405.14591.
- Tianyu Gao, Alexander Wettig, Howard Yen and Danqi Chen (2024). How to Train Long-Context Language Models (Effectively). arXiv:2410.02660.
- Amirhossein Kazemnejad, Inkit Padhi, Karthikeyan Natesan Ramamurthy, Payel Das and Siva Reddy (2023). The Impact of Positional Encoding on Length Generalization in Transformers. arXiv:2305.19466.
- Yiran Ding, Li Lyna Zhang, Chengruidong Zhang et al. (2024). LongRoPE: Extending LLM Context Window Beyond 2 Million Tokens. arXiv:2402.13753.
- Baptiste Rozière, Jonas Gehring, Fabian Gloeckle et al. (2023). Code Llama: Open Foundation Models for Code. arXiv:2308.12950.
- An Yang, Bowen Yu, Chengyuan Li et al. (2025). Qwen2.5–1M Technical Report. arXiv:2501.15383.
- Ziqing Qiao, Xiaoyue Xu, Sikui Zhang et al. (2026). Don't Stop Long-Context Continual Pre-Training Too Early: An Empirical Scaling Law. arXiv:2610.29352.
- Greg Kamradt (2023). GitHub - gkamradt/needle-in-a-haystack: Doing simple retrieval from LLM models at various context lengths to measure accuracy. GitHub repository.
- Cheng-Ping Hsieh, Simeng Sun, Samuel Kriman et al. (2024). RULER: What's the Real Context Size of Your Long-Context Language Models?. arXiv:2404.06654.
- Ali Modarressi, Hanieh Deilamsalehy, Franck Dernoncourt et al. (2025). NoLiMa: Long-Context Evaluation Beyond Literal Matching. arXiv:2502.05167.
- Yuri Kuratov, Aydar Bulatov, Petr Anokhin et al. (2024). BABILong: Testing the Limits of LLMs with Long Context Reasoning-in-a-Haystack. arXiv:2406.10149.
- Nelson F. Liu, Kevin Lin, John Hewitt et al. (2023). Lost in the Middle: How Language Models Use Long Contexts. arXiv:2307.03172.
- Howard Yen, Tianyu Gao, Minmin Hou et al. (2024). HELMET: How to Evaluate Long-Context Language Models Effectively and Thoroughly. arXiv:2410.02694.
- Yi Lu, Jing Nathan Yan, Songlin Yang et al. (2024). A Controlled Study on Long Context Extension and Generalization in LLMs. arXiv:2409.12181.
- Lizhe Fang, Yifei Wang, Zhaoyang Liu et al. (2024). What is Wrong with Perplexity for Long-context Language Modeling?. arXiv:2410.23771.
- Kshitij Gupta, Benjamin Thérien, Adam Ibrahim et al. (2023). Continual Pre-Training of Large Language Models: How to (re)warm your model?. arXiv:2308.04014.
- Suchin Gururangan, Ana Marasović, Swabha Swayamdipta et al. (2020). Don't Stop Pretraining: Adapt Language Models to Domains and Tasks. arXiv:2004.10964.
- Jupinder Parmar, Sanjev Satheesh, Mostofa Patwary, Mohammad Shoeybi and Bryan Catanzaro (2024). Reuse, Don't Retrain: A Recipe for Continued Pretraining of Language Models. arXiv:2407.07263.
- James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz et al. (2016). Overcoming catastrophic forgetting in neural networks. arXiv:1612.00796.
- Dan Biderman, Jacob Portes, Jose Javier Gonzalez Ortiz et al. (2024). LoRA Learns Less and Forgets Less. arXiv:2405.09673.
- Junhao Zheng, Xidi Cai, Shengjie Qiu and Qianli Ma (2025). Spurious Forgetting in Continual Learning of Language Models. arXiv:2501.13453.
- Jonghyun Han, Younghoon Song and Jongyoul Park (2026). A Deafening Silence: Catastrophic Forgetting Lives in the Output Embeddings of Tokens the Data Never Speaks. arXiv:2610.09835.
- Zhangir Azerbayev, Hailey Schoelkopf, Keiran Paster et al. (2023). Llemma: An Open Language Model For Mathematics. arXiv:2310.10631.
- DeepSeek-AI, Qihao Zhu, Daya Guo et al. (2024). DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligence. arXiv:2406.11931.
- Kazuki Fujii, Taishi Nakamura, Mengsay Loem et al. (2024). Continual Pre-Training for Cross-Lingual LLM Adaptation: Enhancing Japanese Language Capabilities. arXiv:2404.17790.
- Zitong Yang, Neil Band, Shuangping Li, Emmanuel Candès and Tatsunori Hashimoto (2024). Synthetic continued pretraining. arXiv:2409.07431.
- Yiming Cui, Ziqing Yang and Xin Yao (2023). Efficient and Effective Text Encoding for Chinese LLaMA and Alpaca. arXiv:2304.08177.
- Geoffrey Hinton, Oriol Vinyals and Jeff Dean (2015). Distilling the Knowledge in a Neural Network. arXiv:1503.02531.
- Yuxian Gu, Li Dong, Furu Wei and Minlie Huang (2023). MiniLLM: On-Policy Distillation of Large Language Models. arXiv:2306.08543.
- Rishabh Agarwal, Nino Vieillard, Yongchao Zhou et al. (2023). On-Policy Distillation of Language Models: Learning from Self-Generated Mistakes. arXiv:2306.13649.
- Yoon Kim and Alexander M. Rush (2016). Sequence-Level Knowledge Distillation. arXiv:1606.07947.
- Meta (2024). Llama 3.2 Model Card. Model card (GitHub).
- Taiming Lu and Zhuang Liu (2026). Strong Teacher Not Needed? On Distillation in LLM Pretraining. arXiv:2605.23857.
- Sharath Turuvekere Sreenivas, Saurav Muralidharan, Raviraj Joshi et al. (2024). LLM Pruning and Distillation in Practice: The Minitron Approach. arXiv:2408.11796.
- Mengzhou Xia, Tianyu Gao, Zhiyuan Zeng and Danqi Chen (2023). Sheared LLaMA: Accelerating Language Model Pre-training via Structured Pruning. arXiv:2310.06694.
- Shijie Wu, Ozan Irsoy, Steven Lu et al. (2023). BloombergGPT: A Large Language Model for Finance. arXiv:2303.17564.
- Nathan Lambert (2025). Reinforcement Learning from Human Feedback. arXiv:2504.12501.
- Chunting Zhou, Pengfei Liu, Puxin Xu et al. (2023). LIMA: Less Is More for Alignment. arXiv:2305.11206.
- Bill Yuchen Lin, Abhilasha Ravichander, Ximing Lu et al. (2023). The Unlocking Spell on Base LLMs: Rethinking Alignment via In-Context Learning. arXiv:2312.01552.
- Nathan Lambert, Jacob Morrison, Valentina Pyatkin et al. (2024). Tulu 3: Pushing Frontiers in Open Language Model Post-Training. arXiv:2411.15124.
- Jason Wei, Maarten Bosma, Vincent Y. Zhao et al. (2021). Finetuned Language Models Are Zero-Shot Learners. arXiv:2109.01652.
- Victor Sanh, Albert Webson, Colin Raffel et al. (2021). Multitask Prompted Training Enables Zero-Shot Task Generalization. arXiv:2110.08207.
- Yizhong Wang, Swaroop Mishra, Pegah Alipoormolabashi et al. (2022). Super-NaturalInstructions: Generalization via Declarative Instructions on 1600+ NLP Tasks. arXiv:2204.07705.
- Hyung Won Chung, Le Hou, Shayne Longpre et al. (2022). Scaling Instruction-Finetuned Language Models. arXiv:2210.11416.
- Shayne Longpre, Le Hou, Tu Vu et al. (2023). The Flan Collection: Designing Data and Methods for Effective Instruction Tuning. arXiv:2301.13688.
- Arnav Gudibande, Eric Wallace, Charlie Snell et al. (2023). The False Promise of Imitating Proprietary LLMs. arXiv:2305.15717.
- Yizhong Wang, Yeganeh Kordi, Swaroop Mishra et al. (2022). Self-Instruct: Aligning Language Models with Self-Generated Instructions. arXiv:2212.10560.
- Wei-Lin Chiang, Zhuohan Li, Zi Lin et al. (2023). Vicuna: An Open-Source Chatbot Impressing GPT-4 with 90%* ChatGPT Quality. LMSYS Org blog.
- Meta (2024). Llama 3 | Model Cards and Prompt formats. Llama documentation.
- Hugging Face (2025). Chat templates. Hugging Face Transformers documentation.
- Zhengyan Shi, Adam X. Yang, Bin Wu et al. (2024). Instruction Tuning With Loss Over Instructions. arXiv:2405.14394.
- Lewis Tunstall, Edward Beeching, Nathan Lambert et al. (2023). Zephyr: Direct Distillation of LM Alignment. arXiv:2310.16944.
- Neel Jain, Ping-yeh Chiang, Yuxin Wen et al. (2023). NEFTune: Noisy Embeddings Improve Instruction Finetuning. arXiv:2310.05914.
- Idan Shenfeld, Jyothish Pari and Pulkit Agrawal (2025). RL's Razor: Why Online Reinforcement Learning Forgets Less. arXiv:2509.04259.
- Edward J. Hu, Yelong Shen, Phillip Wallis et al. (2021). LoRA: Low-Rank Adaptation of Large Language Models. arXiv:2106.09685.
- John Schulman and Thinking Machines Lab (2025). LoRA Without Regret. Thinking Machines Lab: Connectionism (blog).
- Damjan Kalajdzievski (2023). A Rank Stabilization Scaling Factor for Fine-Tuning with LoRA. arXiv:2312.03732.
- Shih-Yang Liu, Chien-Yi Wang, Hongxu Yin et al. (2024). DoRA: Weight-Decomposed Low-Rank Adaptation. arXiv:2402.09353.
- Gabriel Ilharco, Marco Tulio Ribeiro, Mitchell Wortsman et al. (2022). Editing Models with Task Arithmetic. arXiv:2212.04089.
- Prateek Yadav, Derek Tam, Leshem Choshen, Colin Raffel and Mohit Bansal (2023). TIES-Merging: Resolving Interference When Merging Models. arXiv:2306.01708.
- Paul Christiano, Jan Leike, Tom B. Brown et al. (2017). Deep reinforcement learning from human preferences. arXiv:1706.03741.
- Nisan Stiennon, Long Ouyang, Jeff Wu et al. (2020). Learning to summarize from human feedback. arXiv:2009.01325.
- Amanda Askell, Yuntao Bai, Anna Chen et al. (2021). A General Language Assistant as a Laboratory for Alignment. arXiv:2112.00861.
- Ralph Allan Bradley and Milton E. Terry (1952). Rank Analysis of Incomplete Block Designs: I. The Method of Paired Comparisons. Biometrika.
- Leo Gao, John Schulman and Jacob Hilton (2022). Scaling Laws for Reward Model Overoptimization. arXiv:2210.10760.
- Nathan Lambert, Valentina Pyatkin, Jacob Morrison et al. (2024). RewardBench: Evaluating Reward Models for Language Modeling. arXiv:2403.13787.
- Zhilin Wang, Yi Dong, Olivier Delalleau et al. (2024). HelpSteer2: Open-source dataset for training top-performing reward models. arXiv:2406.08673.
- Noam Razin, Zixuan Wang, Hubert Strauss et al. (2025). What Makes a Reward Model a Good Teacher? An Optimization Perspective. arXiv:2503.15477.
- Yanjun Chen, Dawei Zhu, Yirong Sun et al. (2024). The Accuracy Paradox in RLHF: When Better Reward Models Don't Yield Better Language Models. arXiv:2410.06554.
- Yuntao Bai, Saurav Kadavath, Sandipan Kundu et al. (2022). Constitutional AI: Harmlessness from AI Feedback. arXiv:2212.08073.
- Harrison Lee, Samrat Phatale, Hassan Mansoor et al. (2023). RLAIF vs. RLHF: Scaling Reinforcement Learning from Human Feedback with AI Feedback. arXiv:2309.00267.
- Lunjun Zhang, Arian Hosseini, Hritik Bansal et al. (2024). Generative Verifiers: Reward Modeling as Next-Token Prediction. arXiv:2408.15240.
- Dakota Mahan, Duy Van Phung, Rafael Rafailov et al. (2024). Generative Reward Models. arXiv:2410.12832.
- Anisha Gunjal, Anthony Wang, Elaine Lau et al. (2025). Rubrics as Rewards: Reinforcement Learning Beyond Verifiable Domains. arXiv:2507.17746.
- Vijay Viswanathan, Yanchao Sun, Shuang Ma et al. (2025). Checklists Are Better Than Reward Models For Aligning Language Models. arXiv:2507.18624.
- Rafael Rafailov, Archit Sharma, Eric Mitchell et al. (2023). Direct Preference Optimization: Your Language Model is Secretly a Reward Model. arXiv:2305.18290.
- Ahmad Beirami, Alekh Agarwal, Jonathan Berant et al. (2024). Theoretical guarantees on the best-of-n alignment policy. arXiv:2401.01879.
- Hanze Dong, Wei Xiong, Deepanshu Goyal et al. (2023). RAFT: Reward rAnked FineTuning for Generative Foundation Model Alignment. arXiv:2304.06767.
- Caglar Gulcehre, Tom Le Paine, Srivatsan Srinivasan et al. (2023). Reinforced Self-Training (ReST) for Language Modeling. arXiv:2308.08998.
- John Schulman (2020). Approximating KL Divergence. Blog post.
- John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford and Oleg Klimov (2017). Proximal Policy Optimization Algorithms. arXiv:1707.06347.
- John Schulman, Philipp Moritz, Sergey Levine, Michael Jordan and Pieter Abbeel (2015). High-Dimensional Continuous Control Using Generalized Advantage Estimation. arXiv:1506.02438.
- Shengyi Huang, Michael Noukhovitch, Arian Hosseini et al. (2024). The N+ Implementation Details of RLHF with PPO: A Case Study on TL;DR Summarization. arXiv:2403.17031.
- Daniel M. Ziegler, Nisan Stiennon, Jeffrey Wu et al. (2019). Fine-Tuning Language Models from Human Preferences. arXiv:1909.08593.
- Yuntao Bai, Andy Jones, Kamal Ndousse et al. (2022). Training a Helpful and Harmless Assistant with Reinforcement Learning from Human Feedback. arXiv:2204.05862.
- Rui Zheng, Shihan Dou, Songyang Gao et al. (2023). Secrets of RLHF in Large Language Models Part I: PPO. arXiv:2307.04964.
- Lorenz Wolf, Robert Kirk and Mirco Musolesi (2025). Reward Model Overoptimisation in Iterated RLHF. arXiv:2505.18126.
- Thomas Coste, Usman Anwar, Robert Kirk and David Krueger (2023). Reward Model Ensembles Help Mitigate Overoptimization. arXiv:2310.02743.
- Jacob Eisenstein, Chirag Nagpal, Alekh Agarwal et al. (2023). Helping or Herding? Reward Model Ensembles Mitigate but do not Eliminate Reward Hacking. arXiv:2312.09244.
- Alexandre Ramé, Nino Vieillard, Léonard Hussenot et al. (2024). WARM: On the Benefits of Weight Averaged Reward Models. arXiv:2401.12187.
- Rafael Rafailov, Yaswanth Chittepu, Ryan Park et al. (2024). Scaling Laws for Reward Model Overoptimization in Direct Alignment Algorithms. arXiv:2406.02900.
- Prasann Singhal, Tanya Goyal, Jiacheng Xu and Greg Durrett (2023). A Long Way to Go: Investigating Length Correlations in RLHF. arXiv:2310.03716.
- Yann Dubois, Balázs Galambosi, Percy Liang and Tatsunori B. Hashimoto (2024). Length-Controlled AlpacaEval: A Simple Way to Debias Automatic Evaluators. arXiv:2404.04475.
- Lichang Chen, Chen Zhu, Davit Soselia et al. (2024). ODIN: Disentangled Reward Mitigates Hacking in RLHF. arXiv:2402.07319.
- Mrinank Sharma, Meg Tong, Tomasz Korbak et al. (2023). Towards Understanding Sycophancy in Language Models. arXiv:2310.13548.
- Jiaxin Wen, Ruiqi Zhong, Akbir Khan et al. (2024). Language Models Learn to Mislead Humans via RLHF. arXiv:2409.12822.
- OpenAI (2025). Expanding on what we missed with sycophancy. OpenAI blog.
- OpenAI (2025). Sycophancy in GPT-4o: what happened and what we’re doing about it. OpenAI blog.
- Robert Kirk, Ishita Mediratta, Christoforos Nalmpantis et al. (2023). Understanding the Effects of RLHF on LLM Generalisation and Diversity. arXiv:2310.06452.
- Monte MacDiarmid, Benjamin Wright, Jonathan Uesato et al. (2025). Natural Emergent Misalignment from Reward Hacking in Production RL. arXiv:2511.18397.
- Kawin Ethayarajh, Winnie Xu, Niklas Muennighoff, Dan Jurafsky and Douwe Kiela (2024). KTO: Model Alignment as Prospect Theoretic Optimization. arXiv:2402.01306.
- Mohammad Gheshlaghi Azar, Mark Rowland, Bilal Piot et al. (2023). A General Theoretical Paradigm to Understand Learning from Human Preferences. arXiv:2310.12036.
- Yu Meng, Mengzhou Xia and Danqi Chen (2024). SimPO: Simple Preference Optimization with a Reference-Free Reward. arXiv:2405.14734.
- Jiwoo Hong, Noah Lee and James Thorne (2024). ORPO: Monolithic Preference Optimization without Reference Model. arXiv:2403.07691.
- Richard Yuanzhe Pang, Weizhe Yuan, Kyunghyun Cho et al. (2024). Iterative Reasoning Preference Optimization. arXiv:2404.19733.
- Ryan Park, Rafael Rafailov, Stefano Ermon and Chelsea Finn (2024). Disentangling Length from Quality in Direct Preference Optimization. arXiv:2403.19159.
- Arka Pal, Deep Karkhanis, Samuel Dooley et al. (2024). Smaug: Fixing Failure Modes of Preference Optimisation with DPO-Positive. arXiv:2402.13228.
- Noam Razin, Sadhika Malladi, Adithya Bhaskar et al. (2024). Unintentional Unalignment: Likelihood Displacement in Direct Preference Optimization. arXiv:2410.08847.
- Shusheng Xu, Wei Fu, Jiaxuan Gao et al. (2024). Is DPO Superior to PPO for LLM Alignment? A Comprehensive Study. arXiv:2404.10719.
- Shangmin Guo, Biao Zhang, Tianlin Liu et al. (2024). Direct Language Model Alignment from Online AI Feedback. arXiv:2402.04792.
- Yunhao Tang, Daniel Zhaohan Guo, Zeyu Zheng et al. (2024). Understanding the performance gap between online and offline alignment algorithms. arXiv:2405.08448.
- Jack Lanchantin, Angelica Chen, Janice Lan et al. (2025). Bridging Offline and Online Reinforcement Learning for LLMs. arXiv:2506.21495.
- Hamish Ivison, Yizhong Wang, Jiacheng Liu et al. (2024). Unpacking DPO and PPO: Disentangling Best Practices for Learning from Preference Feedback. arXiv:2406.09279.
- Yao Xiao, Hai Ye, Linyao Chen et al. (2025). Finding the Sweet Spot: Preference Data Construction for Scaling Preference Optimization. arXiv:2502.16825.
- Taeyoun Kim and Aviral Kumar (2026). Addressing Over-Refusal in LLMs with Competing Rewards. arXiv:2606.31748.
- Paul Röttger, Hannah Rose Kirk, Bertie Vidgen et al. (2023). XSTest: A Test Suite for Identifying Exaggerated Safety Behaviours in Large Language Models. arXiv:2308.01263.
- Justin Cui, Wei-Lin Chiang, Ion Stoica and Cho-Jui Hsieh (2024). OR-Bench: An Over-Refusal Benchmark for Large Language Models. arXiv:2405.20947.
- Josef Dai, Xuehai Pan, Ruiyang Sun et al. (2023). Safe RLHF: Safe Reinforcement Learning from Human Feedback. arXiv:2310.12773.
- Deep Ganguli, Liane Lovitt, Jackson Kernion et al. (2022). Red Teaming Language Models to Reduce Harms: Methods, Scaling Behaviors, and Lessons Learned. arXiv:2209.07858.
- Ethan Perez, Saffron Huang, Francis Song et al. (2022). Red Teaming Language Models with Language Models. arXiv:2202.03286.
- Tong Mu, Alec Helyar, Johannes Heidecke et al. (2024). Rule Based Rewards for Language Model Safety. arXiv:2411.01111.
- Melody Y. Guan, Manas Joglekar, Eric Wallace et al. (2024). Deliberative Alignment: Reasoning Enables Safer Language Models. arXiv:2412.16339.
- Eric Wallace, Kai Xiao, Reimar Leike et al. (2024). The Instruction Hierarchy: Training LLMs to Prioritize Privileged Instructions. arXiv:2404.13208.
- OpenAI (2025). OpenAI Model Spec. OpenAI.
- Andy Arditi, Oscar Obeso, Aaquib Syed et al. (2024). Refusal in Language Models Is Mediated by a Single Direction. arXiv:2406.11717.
- Anthropic (2024). Claude's character. Anthropic research blog.
- Sharan Maiya, Henning Bartsch, Nathan Lambert and Evan Hubinger (2025). Open Character Training: Shaping the Persona of AI Assistants through Constitutional AI. arXiv:2511.01689.
- Runjin Chen, Andy Arditi, Henry Sleight, Owain Evans and Jack Lindsey (2025). Persona Vectors: Monitoring and Controlling Character Traits in Language Models. arXiv:2507.21509.
- Daya Guo, Dejian Yang, Haowei Zhang et al. (2025). DeepSeek-R1 incentivizes reasoning in LLMs through reinforcement learning. Nature.
- Qiying Yu, Zheng Zhang, Ruofei Zhu et al. (2025). DAPO: An Open-Source LLM Reinforcement Learning System at Scale. arXiv:2503.14476.
- Hugging Face (2025). huggingface/Math-Verify. GitHub repository.
- Hunter Lightman, Vineet Kosaraju, Yura Burda et al. (2023). Let's Verify Step by Step. arXiv:2305.20050.
- Jonathan Uesato, Nate Kushman, Ramana Kumar et al. (2022). Solving math word problems with process- and outcome-based feedback. arXiv:2211.14275.
- Peiyi Wang, Lei Li, Zhihong Shao et al. (2023). Math-Shepherd: Verify and Reinforce LLMs Step-by-step without Human Annotations. arXiv:2312.08935.
- Amrith Setlur, Chirag Nagpal, Adam Fisch et al. (2024). Rewarding Progress: Scaling Automated Process Verifiers for LLM Reasoning. arXiv:2410.08146.
- Chujie Zheng, Zhenru Zhang, Beichen Zhang et al. (2024). ProcessBench: Identifying Process Errors in Mathematical Reasoning. arXiv:2412.06559.
- Zhenru Zhang, Chujie Zheng, Yangzhen Wu et al. (2025). The Lessons of Developing Process Reward Models in Mathematical Reasoning. arXiv:2501.07301.
- Kimi Team, Angang Du, Bofei Gao et al. (2025). Kimi k1.5: Scaling Reinforcement Learning with LLMs. arXiv:2501.12599.
- Rulin Shao, Shuyue Stella Li, Rui Xin et al. (2025). Spurious Rewards: Rethinking Training Signals in RLVR. arXiv:2506.10947.
- Ronald J. Williams (1992). Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine Learning.
- Ziniu Li, Tian Xu, Yushun Zhang et al. (2023). ReMax: A Simple, Effective, and Efficient Reinforcement Learning Method for Aligning Large Language Models. arXiv:2310.10505.
- Arash Ahmadian, Chris Cremer, Matthias Gallé et al. (2024). Back to Basics: Revisiting REINFORCE Style Optimization for Learning from Human Feedback in LLMs. arXiv:2402.14740.
- Eric Zelikman, Yuhuai Wu, Jesse Mu and Noah D. Goodman (2022). STaR: Bootstrapping Reasoning With Reasoning. arXiv:2203.14465.
- Avi Singh, John D. Co-Reyes, Rishabh Agarwal et al. (2023). Beyond Human Data: Scaling Self-Training for Problem-Solving with Language Models. arXiv:2312.06585.
- Lakshya Chaudhry (2026). Is it RL or Data? A Controlled Comparison of GRPO and Rejection-Sampling Fine-Tuning. arXiv:2610.25812.
- MiniMax, Aili Chen, Aonian Li et al. (2025). MiniMax-M1: Scaling Test-Time Compute Efficiently with Lightning Attention. arXiv:2506.13585.
- Yu Yue, Yufeng Yuan, Qiying Yu et al. (2025). VAPO: Efficient and Reliable Reinforcement Learning for Advanced Reasoning Tasks. arXiv:2504.05118.
- Jingcheng Hu, Yinmin Zhang, Qi Han et al. (2025). Open-Reasoner-Zero: An Open Source Approach to Scaling Up Reinforcement Learning on the Base Model. arXiv:2503.24290.
- Logan Engstrom, Andrew Ilyas, Shibani Santurkar et al. (2020). Implementation Matters in Deep Policy Gradients: A Case Study on PPO and TRPO. arXiv:2005.12729.
- Marcin Andrychowicz, Anton Raichuk, Piotr Stańczyk et al. (2020). What Matters In On-Policy Reinforcement Learning? A Large-Scale Empirical Study. arXiv:2006.05990.
- Jian Hu, Jason Klein Liu, Haotian Xu and Wei Shen (2025). REINFORCE++: Stabilizing Critic-Free Policy Optimization with Global Advantage Normalization. arXiv:2501.03262.
- Zichen Liu, Changyu Chen, Wenjun Li et al. (2025). Understanding R1-Zero-Like Training: A Critical Perspective. arXiv:2503.20783.
- verl contributors (2025). verl/verl/trainer/ppo/core_algos.py at main · verl-project/verl. GitHub repository source file.
- Jujie He, Jiacai Liu, Chris Yuhao Liu et al. (2025). Skywork Open Reasoner 1 Technical Report. arXiv:2505.22312.
- Wei Xiong, Jiarui Yao, Yuhui Xu et al. (2025). A Minimalist Approach to LLM Reasoning: from Rejection Sampling to Reinforce. arXiv:2504.11343.
- Ximing Lu, Aviral Kumar, Jan Kautz, Yejin Choi and David Acuna (2026). MagicBeanStalk: Escaping the RLVR Zero Advantage Trap with Recursive Data Synthesis. arXiv:2610.12659.
- Zihe Liu, Jiashun Liu, Yancheng He et al. (2025). Part I: Tricks or Traps? A Deep Dive into RL for LLM Reasoning. arXiv:2508.08221.
- Mistral-AI, Abhinav Rastogi, Albert Q. Jiang et al. (2025). Magistral. arXiv:2506.10910.
- Maxwell Nye, Anders Johan Andreassen, Guy Gur-Ari et al. (2021). Show Your Work: Scratchpads for Intermediate Computation with Language Models. arXiv:2112.00114.
- Jason Wei, Xuezhi Wang, Dale Schuurmans et al. (2022). Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. arXiv:2201.11903.
- OpenAI, Aaron Jaech, Adam Kalai et al. (2024). OpenAI o1 System Card. arXiv:2412.16720.
- Weihao Zeng, Yuzhen Huang, Qian Liu et al. (2025). SimpleRL-Zoo: Investigating and Taming Zero Reinforcement Learning for Open Base Models in the Wild. arXiv:2503.18892.
- Kanishk Gandhi, Ayush Chakravarthy, Anikait Singh, Nathan Lile and Noah D. Goodman (2025). Cognitive Behaviors that Enable Self-Improving Reasoners, or, Four Habits of Highly Effective STaRs. arXiv:2503.01307.
- Edward Yeo, Yuxuan Tong, Morry Niu, Graham Neubig and Xiang Yue (2025). Demystifying Long Chain-of-Thought Reasoning in LLMs. arXiv:2502.03373.
- Yiping Wang, Qing Yang, Zhiyuan Zeng et al. (2025). Reinforcement Learning for Reasoning in Large Language Models with One Training Example. arXiv:2504.20571.
- Etash Guha, Ryan Marten, Sedrick Keh et al. (2025). OpenThoughts: Data Recipes for Reasoning Models. arXiv:2506.04178.
- Yufeng Yuan, Yu Yue, Ruofei Zhu, Tiantian Fan and Lin Yan (2025). What's Behind PPO's Collapse in Long-CoT? Value Optimization Holds the Secret. arXiv:2503.01491.
- Chujie Zheng, Shixuan Liu, Mingze Li et al. (2025). Group Sequence Policy Optimization. arXiv:2507.18071.
- Wenhan Ma, Hailin Zhang, Liang Zhao et al. (2025). Stabilizing MoE Reinforcement Learning by Aligning Training and Inference Routers. arXiv:2510.11370.
- Ganqu Cui, Yuchen Zhang, Jiacheng Chen et al. (2025). The Entropy Mechanism of Reinforcement Learning for Reasoning Language Models. arXiv:2505.22617.
- DeepSeek-AI, Aixin Liu, Aoxue Mei et al. (2025). DeepSeek-V3.2: Pushing the Frontier of Open Large Language Models. arXiv:2512.02556.
- Shenzhi Wang, Le Yu, Chang Gao et al. (2025). Beyond the 80/20 Rule: High-Entropy Minority Tokens Drive Effective Reinforcement Learning for LLM Reasoning. arXiv:2506.01939.
- Penghui Qi, Zichen Liu, Xiangxin Zhou et al. (2025). Defeating the Training-Inference Mismatch via FP16. arXiv:2510.26788.
- Feng Yao and Liyuan Liu (2025). Flash-RL: Implementation for FP8/INT8 Rollout for RL training without performence drop. GitHub repository.
- Lasse Espeholt, Hubert Soyer, Remi Munos et al. (2018). IMPALA: Scalable Distributed Deep-RL with Importance Weighted Actor-Learner Architectures. arXiv:1802.01561.
- Alexandre Piché, Ehsan Kamalloo, Rafael Pardinas, Xiaoyin Chen and Dzmitry Bahdanau (2025). PipelineRL: Faster On-policy Reinforcement Learning for Long Sequence Generation. arXiv:2509.19128.
- Yu Li, Yufa Zhou and Tian Lan (2026). On the Origin and Evolution of Training-Inference Mismatch in LLM Reinforcement Learning. arXiv:2610.40945.
- Tianrun Yu, Kaixiang Zhao, Shangzhe Li et al. (2026). Rethinking Training-Inference Mismatch in LLM Reinforcement Learning: Where It Arises and How to Correct It. arXiv:2609.32444.
- Yaxiang Zhang, Yingru Li, Jiacai Liu et al. (2026). Beyond Precision: Training-Inference Mismatch is an Optimization Problem and Simple LR Scheduling Fixes It. arXiv:2602.01826.
- Taiheng Pan (2026). Cool the Sampler, Not the Learner: Sampling Temperature Moves the Staleness Cliff of Importance-Corrected GRPO. arXiv:2609.36953.
- Xuezhi Wang, Jason Wei, Dale Schuurmans et al. (2022). Self-Consistency Improves Chain of Thought Reasoning in Language Models. arXiv:2203.11171.
- Xingyu Chen, Jiahao Xu, Tian Liang et al. (2024). Do NOT Think That Much for 2+3=? On the Overthinking of o1-Like LLMs. arXiv:2412.21187.
- Wenjie Ma, Jingxuan He, Charlie Snell et al. (2025). Reasoning Models Can Be Effective Without Thinking. arXiv:2504.09858.
- Alejandro Cuadron, Dacheng Li, Wenjie Ma et al. (2025). The Danger of Overthinking: Examining the Reasoning-Action Dilemma in Agentic Tasks. arXiv:2502.08235.
- Yue Wang, Qiuzhi Liu, Jiahao Xu et al. (2025). Thoughts Are All Over the Place: On the Underthinking of o1-Like LLMs. arXiv:2501.18585.
- Parshin Shojaee, Iman Mirzadeh, Keivan Alizadeh et al. (2025). The Illusion of Thinking: Understanding the Strengths and Limitations of Reasoning Models via the Lens of Problem Complexity. arXiv:2506.06941.
- A. Lawsen (2025). Comment on The Illusion of Thinking: Understanding the Strengths and Limitations of Reasoning Models via the Lens of Problem Complexity. arXiv:2506.09250.
- Amrith Setlur, Nived Rajaraman, Sergey Levine and Aviral Kumar (2025). Scaling Test-Time Compute Without Verification or RL is Suboptimal. arXiv:2502.12118.
- Mark Chen, Jerry Tworek, Heewoo Jun et al. (2021). Evaluating Large Language Models Trained on Code. arXiv:2107.03374.
- Xinhao Yao, Lu Yu, Xiaolin Hu et al. (2025). The Debate on RLVR Reasoning Capability Boundary: Shrinkage, Expansion, or Both? A Two-Stage Dynamic View. arXiv:2510.04028.
- Fang Wu, Weihao Xuan, Danny Xing et al. (2025). The Invisible Leash: Why RLVR May or May Not Escape Its Origin. arXiv:2507.14843.
- Xumeng Wen, Zihan Liu, Shun Zheng et al. (2025). Reinforcement Learning with Verifiable Rewards Implicitly Incentivizes Correct Reasoning in Base LLMs. arXiv:2506.14245.
- Charlie Zhang, Graham Neubig and Xiang Yue (2025). On the Interplay of Pre-Training, Mid-Training, and RL on Reasoning Language Models. arXiv:2512.07783.
- Mingqi Wu, Zhihao Zhang, Qiaole Dong et al. (2025). Reasoning or Memorization? Unreliable Results of Reinforcement Learning Due to Data Contamination. arXiv:2507.10532.
- Zhewei Yao, Reza Yazdani Aminabadi, Olatunji Ruwase et al. (2023). DeepSpeed-Chat: Easy, Fast and Affordable RLHF Training of ChatGPT-like Models at All Scales. arXiv:2308.01320.
- Jian Hu, Xibin Wu, Wei Shen et al. (2024). OpenRLHF: An Easy-to-use, Scalable and High-performance RLHF Framework. arXiv:2405.11143.
- Guangming Sheng, Chi Zhang, Zilingfeng Ye et al. (2024). HybridFlow: A Flexible and Efficient RLHF Framework. arXiv:2409.19256.
- Gerald Shen, Zhilin Wang, Olivier Delalleau et al. (2024). NeMo-Aligner: Scalable Toolkit for Efficient Model Alignment. arXiv:2405.01481.
- Wei Fu, Jiaxuan Gao, Xujie Shen et al. (2025). AReaL: A Large-Scale Asynchronous Reinforcement Learning System for Language Reasoning. arXiv:2505.24298.
- Yinmin Zhong, Zili Zhang, Xiaoniu Song et al. (2025). StreamRL: Scalable, Heterogeneous, and Elastic RL for LLMs with Disaggregated Stream Generation. arXiv:2504.15930.
- verl contributors (2024). verl/HybridFlow: A Flexible and Efficient RL Post-Training Framework. GitHub repository.
- Bo Wu, Sid Wang, Yunhao Tang et al. (2025). LlamaRL: A Distributed Asynchronous Reinforcement Learning Framework for Efficient Large-scale LLM Training. arXiv:2505.24034.
- Michael Noukhovitch, Shengyi Huang, Sophie Xhonneux et al. (2024). Asynchronous RLHF: Faster and More Efficient Off-Policy RL for Language Models. arXiv:2410.18252.
- Yuhang Xu, Kaibin Tian, Yang Tian et al. (2026). BubbleSpec: Turning Long-Tail Bubbles into Speculative Rollout Drafts for Synchronous Reinforcement Learning. arXiv:2605.08862.
- OpenAI, Christopher Berner, Greg Brockman et al. (2019). Dota 2 with Large Scale Deep Reinforcement Learning. arXiv:1912.06680.
- Leandro von Werra, Younes Belkada, Lewis Tunstall et al. (2020). TRL: Transformers Reinforcement Learning. GitHub repository.
- Weixun Wang, Shaopan Xiong, Gengru Chen et al. (2025). Reinforcement Learning Optimization for Large-Scale Learning: An Efficient and User-Friendly Scaling Library. arXiv:2506.06122.
- Shiyi Cao, Dacheng Li, Fangzhou Zhao et al. (2025). SkyRL-Agent: Efficient RL Training for Multi-turn LLM Agent. arXiv:2511.16108.
- Reiichiro Nakano, Jacob Hilton, Suchir Balaji et al. (2021). WebGPT: Browser-assisted question-answering with human feedback. arXiv:2112.09332.
- Shunyu Yao, Jeffrey Zhao, Dian Yu et al. (2022). ReAct: Synergizing Reasoning and Acting in Language Models. arXiv:2210.03629.
- Timo Schick, Jane Dwivedi-Yu, Roberto Dessì et al. (2023). Toolformer: Language Models Can Teach Themselves to Use Tools. arXiv:2302.04761.
- Jiazhan Feng, Shijue Huang, Xingwei Qu et al. (2025). ReTool: Reinforcement Learning for Strategic Tool Use in LLMs. arXiv:2504.11536.
- Jiayi Pan, Xingyao Wang, Graham Neubig et al. (2024). Training Software Engineering Agents and Verifiers with SWE-Gym. arXiv:2412.21139.
- Yuxiang Wei, Olivier Duchenne, Jade Copet et al. (2025). SWE-RL: Advancing LLM Reasoning via Reinforcement Learning on Open Software Evolution. arXiv:2502.18449.
- Naman Jain, Jaskirat Singh, Manish Shetty et al. (2025). R2E-Gym: Procedural Environments and Hybrid Verifiers for Scaling Open-Weights SWE Agents. arXiv:2504.07164.
- Bowen Jin, Hansi Zeng, Zhenrui Yue et al. (2025). Search-R1: Training LLMs to Reason and Leverage Search Engines with Reinforcement Learning. arXiv:2503.09516.
- Lang Feng, Zhenghai Xue, Tingcong Liu and Bo An (2025). Group-in-Group Policy Optimization for LLM Agent Training. arXiv:2505.10978.
- Yifei Zhou, Andrea Zanette, Jiayi Pan, Sergey Levine and Aviral Kumar (2024). ArCHer: Training Language Model Agents via Hierarchical Multi-Turn RL. arXiv:2402.19446.
- Zihan Wang, Kangrui Wang, Qineng Wang et al. (2025). RAGEN: Understanding Self-Evolution in LLM Agents via Multi-Turn Reinforcement Learning. arXiv:2504.20073.
- Victoria Krakovna, Jonathan Uesato, Vladimir Mikulik et al. (2020). Specification gaming: the flip side of AI ingenuity. DeepMind blog.
- Alexander Pan, Kush Bhatia and Jacob Steinhardt (2022). The Effects of Reward Misspecification: Mapping and Mitigating Misaligned Models. arXiv:2201.03544.
- Sydney Von Arx, Lawrence Chan and Beth Barnes (2025). Recent Frontier Models Are Reward Hacking. METR blog.
- Bowen Baker, Joost Huizinga, Leo Gao et al. (2025). Monitoring Reasoning Models for Misbehavior and the Risks of Promoting Obfuscation. arXiv:2503.11926.
- Tomek Korbak, Mikita Balesni, Elizabeth Barnes et al. (2025). Chain of Thought Monitorability: A New and Fragile Opportunity for AI Safety. arXiv:2507.11473.
- Tianyi Lorena Yan and John Hewitt (2026). Reward Misspecification Degrades Chain-of-Thought Monitorability. arXiv:2610.28303.
- Miles Turpin, Julian Michael, Ethan Perez and Samuel R. Bowman (2023). Language Models Don't Always Say What They Think: Unfaithful Explanations in Chain-of-Thought Prompting. arXiv:2305.04388.
- Tamera Lanham, Anna Chen, Ansh Radhakrishnan et al. (2023). Measuring Faithfulness in Chain-of-Thought Reasoning. arXiv:2307.13702.
- Yanda Chen, Joe Benton, Ansh Radhakrishnan et al. (2025). Reasoning Models Don't Always Say What They Think. arXiv:2505.05410.
- Melody Y. Guan, Miles Wang, Micah Carroll et al. (2025). Monitoring Monitorability. arXiv:2512.18311.
- Anthropic (2025). System Card: Claude Opus 4 & Claude Sonnet 4. Anthropic system card.
- Arun Jose and Julian Stastny (2026). Shallow Beliefs: Synthetic document finetuning does not inoculate against emergent misalignment from reward hacking. arXiv:2609.14998.
- Clémentine Fourrier, Nathan Habib, Julien Launay and Thomas Wolf (2023). What's going on with the Open LLM Leaderboard?. Hugging Face blog.
- Yuzhen Huang, Jinghan Zhang, Zifei Shan and Junxian He (2024). Compression Represents Intelligence Linearly. arXiv:2404.09937.
- Rowan Zellers, Ari Holtzman, Yonatan Bisk, Ali Farhadi and Yejin Choi (2019). HellaSwag: Can a Machine Really Finish Your Sentence?. arXiv:1905.07830.
- Lovish Madaan, Aaditya K. Singh, Rylan Schaeffer et al. (2024). Quantifying Variance in Evaluation Benchmarks. arXiv:2406.10229.
- Keisuke Sakaguchi, Ronan Le Bras, Chandra Bhagavatula and Yejin Choi (2019). WinoGrande: An Adversarial Winograd Schema Challenge at Scale. arXiv:1907.10641.
- Yonatan Bisk, Rowan Zellers, Ronan Le Bras, Jianfeng Gao and Yejin Choi (2019). PIQA: Reasoning about Physical Commonsense in Natural Language. arXiv:1911.11641.
- Mandar Joshi, Eunsol Choi, Daniel S. Weld and Luke Zettlemoyer (2017). TriviaQA: A Large Scale Distantly Supervised Challenge Dataset for Reading Comprehension. arXiv:1705.03551.
- Peter Clark, Isaac Cowhey, Oren Etzioni et al. (2018). Think you have Solved Question Answering? Try ARC, the AI2 Reasoning Challenge. arXiv:1803.05457.
- Mirac Suzgun, Nathan Scales, Nathanael Schärli et al. (2022). Challenging BIG-Bench Tasks and Whether Chain-of-Thought Can Solve Them. arXiv:2210.09261.
- Dan Hendrycks, Collin Burns, Saurav Kadavath et al. (2021). Measuring Mathematical Problem Solving With the MATH Dataset. arXiv:2103.03874.
- Jacob Austin, Augustus Odena, Maxwell Nye et al. (2021). Program Synthesis with Large Language Models. arXiv:2108.07732.
- David Rein, Betty Li Hou, Asa Cooper Stickland et al. (2023). GPQA: A Graduate-Level Google-Proof Q&A Benchmark. arXiv:2311.12022.
- Mubashara Akhtar, Anka Reuel, Prajna Soni et al. (2026). When AI Benchmarks Plateau: A Systematic Study of Benchmark Saturation. arXiv:2602.16763.
- Wikipedia contributors (2026). American Invitational Mathematics Examination. Wikipedia.
- Elliot Glazer, Ege Erdil, Tamay Besiroglu et al. (2024). FrontierMath: A Benchmark for Evaluating Advanced Mathematical Reasoning in AI. arXiv:2411.04872.
- Long Phan, Alice Gatti, Ziwen Han et al. (2025). Humanity's Last Exam. arXiv:2501.14249.
- Francois Chollet, Mike Knoop, Gregory Kamradt and Bryan Landers (2024). ARC Prize 2024: Technical Report. arXiv:2412.04604.
- François Chollet (2024). OpenAI o3 Breakthrough High Score on ARC-AGI-Pub. ARC Prize blog.
- Francois Chollet, Mike Knoop, Gregory Kamradt, Bryan Landers and Henry Pinkard (2025). ARC-AGI-2: A New Challenge for Frontier AI Reasoning Systems. arXiv:2505.11831.
- Iman Mirzadeh, Keivan Alizadeh, Hooman Shahrokhi et al. (2024). GSM-Symbolic: Understanding the Limitations of Mathematical Reasoning in Large Language Models. arXiv:2410.05229.
- Jiawei Liu, Chunqiu Steven Xia, Yuyao Wang and Lingming Zhang (2023). Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generation. arXiv:2305.01210.
- Simon Ott, Adriano Barbosa-Silva, Kathrin Blagec, Jan Brauner and Matthias Samwald (2022). Mapping global dynamics of benchmark creation and saturation in artificial intelligence. arXiv:2203.04592.
- Mehran Kazemi, Bahare Fatemi, Hritik Bansal et al. (2025). BIG-Bench Extra Hard. arXiv:2502.19187.
- Colin White, Samuel Dooley, Manley Roberts et al. (2024). LiveBench: A Challenging, Contamination-Limited LLM Benchmark. arXiv:2406.19314.
- Mislav Balunović, Jasper Dekoninck, Ivo Petrov, Nikola Jovanović and Martin Vechev (2025). MathArena: Evaluating LLMs on Uncontaminated Math Competitions. arXiv:2505.23281.
- Michael Skarlinski, Jon Laurent, Albert Bou and Andrew White (2025). About 30% of Humanity's Last Exam chemistry/biology answers are likely wrong. FutureHouse blog.
- Weiqi Zhai, Zhihai Wang, Jinghang Wang et al. (2026). HLE-Verified: A Systematic Verification and Structured Revision of Humanity's Last Exam. arXiv:2602.13964.
- Melanie Sclar, Yejin Choi, Yulia Tsvetkov and Alane Suhr (2023). Quantifying Language Models' Sensitivity to Spurious Features in Prompt Design or: How I learned to start worrying about prompt formatting. arXiv:2310.11324.
- Chujie Zheng, Hao Zhou, Fandong Meng, Jie Zhou and Minlie Huang (2023). Large Language Models Are Not Robust Multiple Choice Selectors. arXiv:2309.03882.
- Aryo Pradipta Gema, Joshua Ong Jun Leang, Giwon Hong et al. (2024). Are We Done with MMLU?. arXiv:2406.04127.
- Deep Ganguli, Nicholas Schiefer, Marina Favaro and Jack Clark (2023). Challenges in evaluating AI systems. Anthropic blog.
- Hugh Zhang, Jeff Da, Dean Lee et al. (2024). A Careful Examination of Large Language Model Performance on Grade School Arithmetic. arXiv:2405.00332.
- Berk Atil, Sarp Aykent, Alexa Chittams et al. (2024). Non-Determinism of "Deterministic" LLM Settings. arXiv:2408.04667.
- Stella Biderman, Hailey Schoelkopf, Lintang Sutawika et al. (2024). Lessons from the Trenches on Reproducible Evaluation of Language Models. arXiv:2405.14782.
- Andreas Hochlehnert, Hardik Bhatnagar, Vishaal Udandarao et al. (2025). A Sober Look at Progress in Language Model Reasoning: Pitfalls and Paths to Reproducibility. arXiv:2504.07086.
- Evan Miller (2024). Adding Error Bars to Evals: A Statistical Approach to Language Model Evaluations. arXiv:2411.00640.
- Pranav Singh and Prashant Singh (2026). What Fixed-Rollout pass@k Evaluations Can Identify. arXiv:2609.09245.
- Shunyu Yao, Noah Shinn, Pedram Razavi and Karthik Narasimhan (2024). τ-bench: A Benchmark for Tool-Agent-User Interaction in Real-World Domains. arXiv:2406.12045.
- METR (2026). Task-Completion Time Horizons of Frontier AI Models. METR.
- Sam Bowyer, Laurence Aitchison and Desi R. Ivanova (2025). Position: Don't Use the CLT in LLM Evals With Fewer Than a Few Hundred Datapoints. arXiv:2503.01747.
- Dallas Card, Peter Henderson, Urvashi Khandelwal et al. (2020). With Little Power Comes Great Responsibility. arXiv:2010.06595.
- Cheng Xu, Shuhao Guan, Derek Greene and M-Tahar Kechadi (2024). Benchmark Data Contamination of Large Language Models: A Survey. arXiv:2406.04244.
- Inbal Magar and Roy Schwartz (2022). Data Contamination: From Memorization to Exploitation. arXiv:2203.08242.
- Simone Balloccu, Patrícia Schmidtová, Mateusz Lango and Ondřej Dušek (2024). Leak, Cheat, Repeat: Data Contamination and Evaluation Malpractices in Closed-Source LLMs. arXiv:2402.03927.
- Aaditya K. Singh, Muhammed Yusuf Kocyigit, Andrew Poulton et al. (2024). Evaluation data contamination in LLMs: how do we measure it and (when) does it matter?. arXiv:2411.03923.
- Weijia Shi, Anirudh Ajith, Mengzhou Xia et al. (2023). Detecting Pretraining Data from Large Language Models. arXiv:2310.16789.
- Jingyang Zhang, Jingwei Sun, Eric Yeats et al. (2024). Min-K%++: Improved Baseline for Detecting Pre-Training Data from Large Language Models. arXiv:2404.02936.
- Michael Duan, Anshuman Suri, Niloofar Mireshghallah et al. (2024). Do Membership Inference Attacks Work on Large Language Models?. arXiv:2402.07841.
- Yonatan Oren, Nicole Meister, Niladri Chatterji, Faisal Ladhak and Tatsunori B. Hashimoto (2023). Proving Test Set Contamination in Black Box Language Models. arXiv:2310.17623.
- Aarohi Srivastava, Abhinav Rastogi, Abhishek Rao et al. (2022). Beyond the Imitation Game: Quantifying and extrapolating the capabilities of language models. arXiv:2206.04615.
- Alon Jacovi, Avi Caciularu, Omer Goldman and Yoav Goldberg (2023). Stop Uploading Test Data in Plain Text: Practical Strategies for Mitigating Data Contamination by Evaluation Benchmarks. arXiv:2305.10160.
- Yongjie Wang, Xinyue Zhang, Kunhong Yao et al. (2026). Search-Time Contamination in Deep Research Agents: Measuring Performance Inflation in Public Benchmark Evaluation. arXiv:2606.05241.
- Lianmin Zheng, Wei-Lin Chiang, Ying Sheng et al. (2023). Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena. arXiv:2306.05685.
- Aman Singh Thakur, Kartik Choudhary, Venkat Srinik Ramayapally, Sankaran Vaidyanathan and Dieuwke Hupkes (2024). Judging the Judges: Evaluating Alignment and Vulnerabilities in LLMs-as-Judges. arXiv:2406.12624.
- Sijun Tan, Siyuan Zhuang, Kyle Montgomery et al. (2024). JudgeBench: A Benchmark for Evaluating LLM-based Judges. arXiv:2410.12784.
- Arjun Panickssery, Samuel R. Bowman and Shi Feng (2024). LLM Evaluators Recognize and Favor Their Own Generations. arXiv:2404.13076.
- Peiyi Wang, Lei Li, Liang Chen et al. (2023). Large Language Models are not Fair Evaluators. arXiv:2305.17926.
- Koki Wataoka, Tsubasa Takahashi and Ryokan Ri (2024). Self-Preference Bias in LLM-as-a-Judge. arXiv:2410.21819.
- Dawei Li, Renliang Sun, Yue Huang et al. (2025). Preference Leakage: A Contamination Problem in LLM-as-a-judge. arXiv:2502.01534.
- Xiaosen Zheng, Tianyu Pang, Chao Du et al. (2024). Cheating Automatic LLM Benchmarks: Null Models Achieve High Win Rates. arXiv:2410.07137.
- Anastasios N. Angelopoulos, Stephen Bates, Clara Fannjiang, Michael I. Jordan and Tijana Zrnic (2023). Prediction-Powered Inference. arXiv:2301.09633.
- Wei-Lin Chiang, Lianmin Zheng, Ying Sheng et al. (2024). Chatbot Arena: An Open Platform for Evaluating LLMs by Human Preference. arXiv:2403.04132.
- Meriem Boubdir, Edward Kim, Beyza Ermis, Sara Hooker and Marzieh Fadaee (2023). Elo Uncovered: Robustness and Best Practices in Language Model Evaluation. arXiv:2311.17295.
- Shivalika Singh, Yiyang Nan, Alex Wang et al. (2025). The Leaderboard Illusion. arXiv:2504.20879.
- Tianle Li, Anastasios Angelopoulos and Wei-Lin Chiang (2024). Does style matter? Disentangling style and substance in Chatbot Arena. LMSYS blog.
- Tianle Li, Wei-Lin Chiang, Evan Frick et al. (2024). From Crowdsourced Data to High-Quality Benchmarks: Arena-Hard and BenchBuilder Pipeline. arXiv:2406.11939.
- Bill Yuchen Lin, Yuntian Deng, Khyathi Chandu et al. (2024). WildBench: Benchmarking LLMs with Challenging Tasks from Real Users in the Wild. arXiv:2406.04770.
- Jeffrey Zhou, Tianjian Lu, Swaroop Mishra et al. (2023). Instruction-Following Evaluation for Large Language Models. arXiv:2311.07911.
- Valentina Pyatkin, Saumya Malik, Victoria Graf et al. (2025). Generalizing Verifiable Instruction Following. arXiv:2507.02833.
- Yangsibo Huang, Milad Nasr, Anastasios Angelopoulos et al. (2025). Exploring and Mitigating Adversarial Manipulation of Voting-Based Leaderboards. arXiv:2501.07493.
- Soovadeep Bakshi, Apurba Bose, Aishwarya Bose and Sandip Nandi (2026). Similar Models, Broken Odds: Where Luce's Axiom Fails in Chatbot Arena. arXiv:2610.19095.
- Sayash Kapoor, Benedikt Stroebl, Zachary S. Siegel, Nitya Nadgir and Arvind Narayanan (2024). AI Agents That Matter. arXiv:2407.01502.
- Carlos E. Jimenez, John Yang, Alexander Wettig et al. (2023). SWE-bench: Can Language Models Resolve Real-World GitHub Issues?. arXiv:2310.06770.
- Mike A. Merrill, Alexander G. Shaw, Nicholas Carlini et al. (2026). Terminal-Bench: Benchmarking Agents on Hard, Realistic Tasks in Command Line Interfaces. arXiv:2601.11868.
- UK AI Security Institute (2024). Inspect. Inspect documentation.
- Princeton NLP (2024). princeton-nlp/SWE-bench_Verified. Hugging Face dataset card.
- Yuxuan Zhu, Tengjun Jin, Yada Pruksachatkun et al. (2025). Establishing Best Practices for Building Rigorous Agentic Benchmarks. arXiv:2507.02825.
- Chunqiu Steven Xia, Yinlin Deng, Soren Dunn and Lingming Zhang (2024). Agentless: Demystifying LLM-based Software Engineering Agents. arXiv:2407.01489.
- Xiang Deng, Jeff Da, Edwin Pan et al. (2025). SWE-Bench Pro: Can AI Agents Solve Long-Horizon Software Engineering Tasks?. arXiv:2509.16941.
- Tianbao Xie, Danyang Zhang, Jixuan Chen et al. (2024). OSWorld: Benchmarking Multimodal Agents for Open-Ended Tasks in Real Computer Environments. arXiv:2404.07972.
- Shuyan Zhou, Frank F. Xu, Hao Zhu et al. (2023). WebArena: A Realistic Web Environment for Building Autonomous Agents. arXiv:2307.13854.
- Grégoire Mialon, Clémentine Fourrier, Craig Swift et al. (2023). GAIA: a benchmark for General AI Assistants. arXiv:2311.12983.
- Jun Shern Chan, Neil Chowdhury, Oliver Jaffe et al. (2024). MLE-bench: Evaluating Machine Learning Agents on Machine Learning Engineering. arXiv:2410.07095.
- Hjalmar Wijk, Tao Lin, Joel Becker et al. (2024). RE-Bench: Evaluating frontier AI R&D capabilities of language model agents against human experts. arXiv:2411.15114.
- Giulio Starace, Oliver Jaffe, Dane Sherburn et al. (2025). PaperBench: Evaluating AI's Ability to Replicate AI Research. arXiv:2504.01848.
- David Rein, Joel Becker, Amy Deng et al. (2025). HCAST: Human-Calibrated Autonomy Software Tasks. arXiv:2503.17354.
- Tom Davidson, Jean-Stanislas Denain, Pablo Villalobos and Guillem Bas (2023). AI capabilities can be significantly improved without expensive retraining. arXiv:2312.07413.
- Thomas Kwa and Vincent Cheng (2025). How Does Time Horizon Vary Across Domains?. METR blog.
- Joel Becker, Nate Rush, Elizabeth Barnes and David Rein (2025). Measuring the Impact of Early-2025 AI on Experienced Open-Source Developer Productivity. arXiv:2507.09089.
- Toby Shevlane, Sebastian Farquhar, Ben Garfinkel et al. (2023). Model evaluation for extreme risks. arXiv:2305.15324.
- Mary Phuong, Matthew Aitchison, Elliot Catt et al. (2024). Evaluating Frontier Models for Dangerous Capabilities. arXiv:2403.13793.
- Megan Kinniment, Lucas Jun Koba Sato, Haoxing Du et al. (2023). Evaluating Language-Model Agents on Realistic Autonomous Tasks. arXiv:2312.11671.
- Nathaniel Li, Alexander Pan, Anjali Gopal et al. (2024). The WMDP Benchmark: Measuring and Reducing Malicious Use With Unlearning. arXiv:2403.03218.
- Andy K. Zhang, Neil Perry, Riya Dulepet et al. (2024). Cybench: A Framework for Evaluating Cybersecurity Capabilities and Risks of Language Models. arXiv:2408.08926.
- OpenAI (2025). Preparedness Framework, Version 2. OpenAI policy document.
- Anthropic (2023). Anthropic's Responsible Scaling Policy, Version 1.0. Anthropic policy document.
- Anthropic (2024). Our updated Responsible Scaling Policy. Anthropic news.
- Anthropic (2026). Responsible Scaling Policy Version 3.0. Anthropic policy document.
- Anthropic (2026). Anthropic's Responsible Scaling Policy: Version 3.0. Anthropic news.
- Google DeepMind (2025). Updating the Frontier Safety Framework. Google DeepMind blog.
- Four Flynn, Helen King and Anca Dragan (2025). Strengthening our Frontier Safety Framework. Google DeepMind blog.
- Teun van der Weij, Felix Hofstätter, Ollie Jaffe, Samuel F. Brown and Francis Rhys Ward (2024). AI Sandbagging: Language Models can Strategically Underperform on Evaluations. arXiv:2406.07358.
- Ryan Greenblatt, Fabien Roger, Dmitrii Krasheninnikov and David Krueger (2024). Stress-Testing Capability Elicitation With Password-Locked Models. arXiv:2405.19550.
- Anthropic (2026). Anthropic's Responsible Scaling Policy. Anthropic policy page.
- David Manheim and Scott Garrabrant (2018). Categorizing Variants of Goodhart's Law. arXiv:1803.04585.
- PyTorch Contributors (2026). Distributed Data Parallel. PyTorch 2.15 documentation (notes).
- Horace He and Thinking Machines Lab (2025). Defeating Nondeterminism in LLM Inference. Connectionism (Thinking Machines Lab blog).
- Rajeev Thakur, Rolf Rabenseifner and William Gropp (2005). Optimization of Collective Communication Operations in MPICH. The International Journal of High Performance Computing Applications.
- Andrew Gibiansky (2017). Bringing HPC Techniques to Deep Learning. Blog post (Baidu Research).
- Pitch Patarasuk and Xin Yuan (2009). Bandwidth optimal all-reduce algorithms for clusters of workstations. Journal of Parallel and Distributed Computing.
- Sylvain Jeaugey (2019). Massively Scale Your Deep Learning Training with NCCL 2.4. NVIDIA Technical Blog.
- Peter Sanders, Jochen Speck and Jesper Larsson Träff (2009). Two-tree algorithms for full bandwidth broadcast, reduction and scan. Parallel Computing.
- Zhiyi Hu, Siyuan Shen, Tommaso Bonato et al. (2025). Demystifying NCCL: An In-depth Analysis of GPU Communication Protocols and Algorithms. arXiv:2507.04786.
- Shen Li, Yanli Zhao, Rohan Varma et al. (2020). PyTorch Distributed: Experiences on Accelerating Data Parallel Training. arXiv:2006.15704.
- Jacob Austin, Sholto Douglas, Roy Frostig et al. (2025). How to Parallelize a Transformer for Training. How To Scale Your Model (online book).
- NVIDIA (2026). Distributed Optimizer. Megatron-LM documentation (GitHub).
- Guanhua Wang, Heyang Qin, Sam Ade Jacobs et al. (2023). ZeRO++: Extremely Efficient Collective Communication for Giant Model Training. arXiv:2306.10209.
- Yanli Zhao, Andrew Gu, Rohan Varma et al. (2023). PyTorch FSDP: Experiences on Scaling Fully Sharded Data Parallel. arXiv:2304.11277.
- PyTorch Contributors (2026). torch.distributed.fsdp.fully_shard. PyTorch 2.15 documentation.
- Yifu Wang, Horace He, Less Wright et al. (2024). [Distributed w/ TorchTitan] Introducing Async Tensor Parallelism in PyTorch. PyTorch Forums.
- Shibo Wang, Jinliang Wei, Amit Sabne et al. (2022). Overlap Communication with Dependent Computation via Decomposition in Large Deep Learning Models. Proceedings of the 28th ACM International Conference on Architectural Support for Programming Languages and Operating Systems, Volume 1.
- Yanping Huang, Youlong Cheng, Ankur Bapna et al. (2018). GPipe: Efficient Training of Giant Neural Networks using Pipeline Parallelism. arXiv:1811.06965.
- Aaron Harlap, Deepak Narayanan, Amar Phanishayee et al. (2018). PipeDream: Fast and Efficient Pipeline Parallel DNN Training. arXiv:1806.03377.
- Deepak Narayanan, Amar Phanishayee, Kaiyu Shi, Xie Chen and Matei Zaharia (2020). Memory-Efficient Pipeline-Parallel DNN Training. arXiv:2006.09503.
- Penghui Qi, Xinyi Wan, Guangxing Huang and Min Lin (2023). Zero Bubble Pipeline Parallelism. arXiv:2401.10241.
- Hao Liu, Matei Zaharia and Pieter Abbeel (2023). Ring Attention with Blockwise Transformers for Near-Infinite Context. arXiv:2310.01889.
- Hao Liu and Pieter Abbeel (2023). Blockwise Parallel Transformer for Large Context Models. arXiv:2305.19370.
- William Brandon, Aniruddha Nrusimha, Kevin Qian et al. (2023). Striped Attention: Faster Ring Attention for Causal Transformers. arXiv:2311.09431.
- Sam Ade Jacobs, Masahiro Tanaka, Chengming Zhang et al. (2023). DeepSpeed Ulysses: System Optimizations for Enabling Training of Extreme Long Sequence Transformer Models. arXiv:2309.14509.
- Jiarui Fang and Shangchun Zhao (2024). USP: A Unified Sequence Parallelism Approach for Long Context Generative AI. arXiv:2405.07719.
- Hao Ge, Junda Feng, Qi Huang et al. (2025). ByteScale: Efficient Scaling of LLM Training with a 2048K Context Length on More Than 12,000 GPUs. arXiv:2502.21231.
- Amy Yang, Jingyi Yang, Aya Ibrahim et al. (2024). Context Parallelism for Scalable Million-Token Inference. arXiv:2411.01783.
- Samyam Rajbhandari, Conglong Li, Zhewei Yao et al. (2022). DeepSpeed-MoE: Advancing Mixture-of-Experts Inference and Training to Power Next-Generation AI Scale. arXiv:2201.05596.
- Changho Hwang, Wei Cui, Yifan Xiong et al. (2022). Tutel: Adaptive Mixture-of-Experts at Scale. arXiv:2206.03382.
- Chenggang Zhao, Shangyan Zhou, Liyue Zhang et al. (2025). DeepEP: an efficient expert-parallel communication library. GitHub repository.
- Sami Jaghouar, Jack Min Ong, Manveer Basra et al. (2024). INTELLECT-1 Technical Report. arXiv:2412.01152.
- Arthur Douillard, Yanislav Donchev, Keith Rush et al. (2025). Streaming DiLoCo with overlapping communication: Towards a Distributed Free Lunch. arXiv:2501.18512.
- H. Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson and Blaise Agüera y Arcas (2016). Communication-Efficient Learning of Deep Networks from Decentralized Data. arXiv:1602.05629.
- Sebastian U. Stich (2018). Local SGD Converges Fast and Communicates Little. arXiv:1805.09767.
- Tao Lin, Sebastian U. Stich, Kumar Kshitij Patel and Martin Jaggi (2018). Don't Use Large Mini-Batches, Use Local SGD. arXiv:1808.07217.
- Arthur Douillard, Qixuan Feng, Andrei A. Rusu et al. (2023). DiLoCo: Distributed Low-Communication Training of Language Models. arXiv:2311.08105.
- Zachary Charles, Gabriel Teston, Lucio Dery et al. (2025). Communication-Efficient Language Model Training Scales Reliably and Robustly: Scaling Laws for DiLoCo. arXiv:2503.09799.
- Stefan Horoi, Benjamin Thérien, Guy Wolf and Eugene Belilovsky (2026). Can Model Merging Improve Aggregation in DiLoCo?. arXiv:2607.03011.
- Bowen Peng, Lizhang Chen, Baiyu Su et al. (2024). DeMo: Decoupled Momentum Optimization. arXiv:2411.19870.
- Hanlin Tang, Shaoduo Gan, Ammar Ahmad Awan et al. (2021). 1-bit Adam: Communication Efficient Large-Scale Training with Adam's Convergence Speed. arXiv:2102.02888.
- Amir Sarfi, Benjamin Thérien, Joel Lidin and Eugene Belilovsky (2025). Overcoming the Communication-Performance Tradeoff in LLM Pretraining. arXiv:2508.15706.
- Jari Kolehmainen, Nikolay Blagoev, Semih Kara et al. (2025). NoLoCo: No-all-reduce Low Communication Training Method for Large Models. arXiv:2506.10911.
- Yuanzhong Xu, HyoukJoong Lee, Dehao Chen et al. (2021). GSPMD: General and Scalable Parallelization for ML Computation Graphs. arXiv:2105.04663.
- Lianmin Zheng, Zhuohan Li, Hao Zhang et al. (2022). Alpa: Automating Inter- and Intra-Operator Parallelism for Distributed Deep Learning. arXiv:2201.12023.
- Zhihao Jia, Matei Zaharia and Alex Aiken (2018). Beyond Data and Model Parallelism for Deep Neural Networks. arXiv:1807.05358.
- JAX authors (2026). Manual parallelism with shard_map. JAX documentation.
- PyTorch team (2026). torchtitan: A PyTorch native platform for training generative AI models. GitHub repository.
- NVIDIA (2026). Megatron-LM: Ongoing research training transformer models at scale. GitHub repository.
- NVIDIA (2026). Megatron-Bridge: Training library for Megatron-based models with bidirectional Hugging Face conversion capability. GitHub repository.
- NVIDIA (2026). NVIDIA-NeMo/Speech: A scalable generative AI framework built for researchers and developers. GitHub repository.
- DeepSpeed team (2026). DeepSpeed is a deep learning optimization library that makes distributed training and inference easy, efficient, and effective. GitHub repository.
- Google AI Hypercomputer (2026). maxtext: A simple, performant, and scalable Jax LLM. GitHub repository.
- Hugging Face (2026). nanotron: Minimalistic large language model 3D-parallelism training. GitHub repository.
- Stanford CRFM and Marin community (2026). levanter: Legible, Scalable, Reproducible Foundation Models with Named Tensors and Jax. GitHub repository.
- Meta AI (2022). OPT-175B Logbook. metaseq GitHub repository.
- Gemini Team, Rohan Anil, Sebastian Borgeaud et al. (2023). Gemini: A Family of Highly Capable Multimodal Models. arXiv:2312.11805.
- Apostolos Kokolis, Michael Kuchnik, John Hoffman et al. (2024). Revisiting Reliability in Large-Scale Machine Learning Research Clusters. arXiv:2410.21680.
- Borui Wan, Gaohong Liu, Zuquan Song et al. (2025). Robust LLM Training Infrastructure at ByteDance. arXiv:2509.16293.
- Qinghao Hu, Zhisheng Ye, Zerui Wang et al. (2024). Characterization of Large Language Model Development in the Datacenter. arXiv:2403.07648.
- Bianca Schroeder and Garth A. Gibson (2010). A Large-Scale Study of Failures in High-Performance Computing Systems. IEEE Transactions on Dependable and Secure Computing.
- Devesh Tiwari, Saurabh Gupta, James Rogers et al. (2015). Understanding GPU errors on large-scale HPC systems and the implications for system design and operation. 2015 IEEE 21st International Symposium on High Performance Computer Architecture (HPCA).
- Yi He, Mike Hutton, Steven Chan et al. (2023). Understanding and Mitigating Hardware Failures in Deep Learning Training Systems. Proceedings of the 50th Annual International Symposium on Computer Architecture.
- Shengkun Cui, Archit Patke, Hung Nguyen et al. (2025). Story of Two GPUs: Characterizing the Resilience of Hopper H100 and Ampere A100 GPUs. arXiv:2503.11901.
- Harish Dattatraya Dixit, Sneha Pendharkar, Matt Beadon et al. (2021). Silent Data Corruptions at Scale. arXiv:2102.11245.
- Peter H. Hochschild, Paul Turner, Jeffrey C. Mogul et al. (2021). Cores that don't count. Proceedings of the Workshop on Hot Topics in Operating Systems.
- Subhasish Mitra, Subho Banerjee, Martin Dixon et al. (2025). Silent Data Corruption by 10x Test Escapes Threatens Reliable Computing. arXiv:2508.01786.
- Gheorghe Comanici, Eric Bieber, Mike Schaekermann et al. (2025). Gemini 2.5: Pushing the Frontier with Advanced Reasoning, Multimodality, Long Context, and Next Generation Agentic Capabilities. arXiv:2507.06261.
- Jeffrey Ma, Hengzhi Pei, Leonard Lausen and George Karypis (2025). Understanding Silent Data Corruption in LLM Training. arXiv:2502.12340.
- Wei An, Xiao Bi, Guanting Chen et al. (2024). Fire-Flyer AI-HPC: A Cost-Effective Software-Hardware Co-Design for Deep Learning. arXiv:2408.14158.
- Harish Dattatraya Dixit, Laura Boyle, Gautham Vunnam et al. (2022). Detecting silent data corruptions in the wild. arXiv:2203.08989.
- Anton Altenbernd, Philipp Wiesner and Odej Kao (2026). Exploring Silent Data Corruption as a Reliability Challenge in LLM Training. arXiv:2604.00726.
- Zhipeng Xia, Haotian Xu, Siyu Yun et al. (2026). TrainSDC: Characterizing and Mitigating Silent Data Corruption in Large Language Model Training. arXiv:2608.30769.
- Jinkun Lin, Ziheng Jiang, Zuquan Song et al. (2025). Understanding Stragglers in Large Model Training Using What-if Analysis. arXiv:2505.05713.
- Tianyuan Wu, Wei Wang, Yinghao Yu et al. (2024). FALCON: Pinpointing and Mitigating Stragglers for Large-Scale Hybrid-Parallel Training. arXiv:2410.12588.
- Marco Kurzynski, Shaizeen Aga and Di Wu (2025). Lit Silicon: A Case Where Thermal Imbalance Couples Concurrent Execution in Multiple GPUs. arXiv:2511.09861.
- Guanliang Liu, Abhinandan Patni, Congzhu Lin et al. (2026). Guard: Scalable Straggler Detection and Node Health Management for Large-Scale Training. arXiv:2605.17879.
- Yifan Xiong, Yuting Jiang, Ziyue Yang et al. (2024). SuperBench: Improving Cloud AI Infrastructure Reliability with Proactive Validation. arXiv:2402.06194.
- Borui Wan, Mingji Han, Yiyao Sheng et al. (2024). ByteCheckpoint: A Unified Checkpointing System for Large Foundation Model Development. arXiv:2407.20143.
- PyTorch Contributors (2026). Distributed Checkpoint - torch.distributed.checkpoint. PyTorch 2.15 documentation.
- Colin Gaffney, Shutong Li, Daniel Ng et al. (2026). Orbax: Distributed Checkpointing with JAX. arXiv:2605.23066.
- Lucas Pasqualin, Less Wright, Iris Zhang et al. (2024). Reducing Model Checkpointing Times by Over 10x with PyTorch Distributed Asynchronous Checkpointing. PyTorch blog.
- Jayashree Mohan, Amar Phanishayee and Vijay Chidambaram (2021). CheckFreq: Frequent, Fine-Grained DNN Checkpointing. FAST 2021.
- Zhuang Wang, Zhen Jia, Shuai Zheng et al. (2023). GEMINI: Fast Failure Recovery in Distributed Training with In-Memory Checkpoints. Proceedings of the 29th Symposium on Operating Systems Principles.
- Tanmaey Gupta, Sanjeev Krishnan, Rituraj Kumar et al. (2024). Just-In-Time Checkpointing: Low Cost Error Recovery from Deep Learning Training Failures. Proceedings of the Nineteenth European Conference on Computer Systems.
- John W. Young (1974). A first order approximation to the optimum checkpoint interval. Communications of the ACM.
- J.T. Daly (2006). A higher order estimate of the optimum checkpoint interval for restart dumps. Future Generation Computer Systems.
- Vaibhav Singh and Daniel Herrington (2024). Introducing ML Productivity Goodput: a metric to measure AI system efficiency. Google Cloud Blog.
- Daemyung Kang, Eunjin Hwang, Hanjeong Lee et al. (2026). From Detection to Recovery: Operational Analysis on LLM Pre-training with 504 GPUs. arXiv:2605.09370.
- Imbue (2024). From bare metal to a 70B model: infrastructure set-up and scripts. Imbue research blog.
- NVIDIA (2025). DCGM Diagnostics. NVIDIA DCGM documentation.
- Tao He, Xue Li, Zhibin Wang et al. (2023). Unicron: Economizing Self-Healing LLM Training at Scale. arXiv:2401.00134.
- PyTorch Contributors (2025). Distributed communication package - torch.distributed. PyTorch 2.9 documentation.
- Omkar Salpekar, Rohan Varma, Kenny Yu et al. (2026). Training LLMs with Fault Tolerant HSDP on 100,000 GPUs. arXiv:2602.00277.
- PyTorch Contributors (2026). torchrun (Elastic Launch). PyTorch 2.15 documentation.
- Tristan Rice and Howard Huang (2025). Fault Tolerant Llama: training with 2000 synthetic failures every ~15 seconds and no checkpoints on Crusoe L40S. PyTorch blog.
- Zhenqian Chen, Baoquan Zhong, Xiang Li et al. (2025). Role-Based Fault Tolerance System for LLM RL Post-Training. arXiv:2512.22492.
- Andrej Karpathy (2019). A Recipe for Training Neural Networks. Blog post.
- NVIDIA (2026). Analyzing Xid Errors with the Xid Catalog. NVIDIA documentation.
- Stas Bekman and BigScience Workshop (2022). The final training: Trials and tribulations during the 176B 250k multi-lingual training. bigscience-workshop/bigscience GitHub repository (BLOOM tr11–176B-ml chronicles).
- Yangtao Deng, Xiang Shi, Zhuo Jiang et al. (2024). Minder: Faulty Machine Detection for Large-scale Distributed Model Training. arXiv:2411.01791.
- PyTorch Contributors (2025). Automatic differentiation package - torch.autograd. PyTorch 2.9 documentation.
- Yuxuan Jiang, Ziming Zhou, Boyu Xu et al. (2025). Training with Confidence: Catching Silent Errors in Deep Learning Training with Automated Proactive Checks. arXiv:2506.14813.
- PyTorch Contributors (2024). Reproducibility. PyTorch 2.9 documentation.
- Chirag Pandya and Junjie Wang (2025). Flight Recorder for Debugging Stuck Jobs. PyTorch Tutorials.
- Ben Frederickson (2018). py-spy: Sampling profiler for Python programs. GitHub repository.
- NVIDIA (2026). Environment Variables — NCCL 2.32.3 documentation. NCCL User Guide.
- Jiasheng Zhou, Longbin Zeng, Clavis Chen et al. (2026). ARGUS: Production-Scale Tracing and Performance Diagnosis for over 10,000-GPU Clusters. arXiv:2606.20374.
- Yida Gu, Fakang Wang, Jianhao Fu et al. (2026). CCL-D: A High-Precision Diagnostic System for Slow and Hang Anomalies in Large-Scale Model Training. arXiv:2605.04478.
- Zhihan Jiang, Junjie Huang, Zhuangbin Chen et al. (2025). L4: Diagnosing Large-scale LLM Training Failures via Automated Log Analysis. arXiv:2503.20263.
- Shivam Raikundalia (2026). PyTorch Profiler. PyTorch Tutorials.
- Meta Platforms (2024). Holistic Trace Analysis. HTA documentation.
- NVIDIA (2026). User Guide - Nsight Systems. NVIDIA documentation.
- The SGLang Team (2025). Towards Deterministic Inference in SGLang and Reproducible RL Training. LMSYS Org blog.
- Shiju Zhao, Jiacheng Yang, Qihang Chen et al. (2026). CoRun: Padding is Simple and Efficient for Deterministic LLM Inference. arXiv:2608.14376.
- Cecilia Summers and Michael J. Dinneen (2021). Nondeterminism and Instability in Neural Network Optimization. arXiv:2103.04514.
- Aurick Qiao, Sang Keun Choe, Suhas Jayaram Subramanya et al. (2020). Pollux: Co-adaptive Cluster Scheduling for Goodput-Optimized Deep Learning. arXiv:2008.12260.
- Volcano project (2026). Introduction | Volcano. Volcano documentation.
- SchedMD (2025). Slurm Workload Manager - Gang Scheduling. Slurm documentation.
- Arnab Choudhury, Yang Wang, Tuomas Pelkonen et al. (2024). MAST: Global Scheduling of ML Training across Geo-Distributed Datacenters at Hyperscale. OSDI 2024.
- Paul Barham, Aakanksha Chowdhery, Jeff Dean et al. (2022). Pathways: Asynchronous Distributed Dataflow for ML. arXiv:2203.12533.
- SchedMD (2025). Slurm Workload Manager - Overview. Slurm documentation.
- SchedMD (2025). Slurm Workload Manager - Preemption. Slurm documentation.
- SchedMD (2025). Slurm Workload Manager - slurm.conf. Slurm documentation.
- Kubernetes SIGs (2025). JobSet: a k8s native API for distributed ML training and HPC workloads. GitHub repository.
- MLflow (2025). ML Experiment Tracking | MLflow. MLflow documentation.
- Hydra project (2025). Getting started | Hydra. Hydra documentation.
- Weights & Biases (2026). Artifacts overview - Weights & Biases Docs. W&B documentation.
- TensorFlow (2025). TensorBoard | TensorFlow. TensorFlow documentation.
- WebDataset contributors (2025). webdataset/webdataset: A high-performance Python-based I/O system for large (and small) deep learning problems, with strong support for PyTorch. GitHub repository.
- MosaicML (2025). Streaming. MosaicML Streaming documentation.
- PyTorch (2025). Stateful DataLoader — TorchData documentation. TorchData documentation.
- MLflow (2025). ML Model Registry | MLflow. MLflow documentation.
- D. Sculley, Gary Holt, Daniel Golovin et al. (2015). Hidden Technical Debt in Machine Learning Systems. NeurIPS 2015.
- Eric Breck, Shanqing Cai, Eric Nielsen, Michael Salib and D. Sculley (2017). The ML Test Score: A Rubric for ML Production Readiness and Technical Debt Reduction. IEEE International Conference on Big Data 2017.
- NVIDIA (2025). Metrics | NVIDIA NIM Benchmarking Documentation. NVIDIA NIM documentation.
- kipply (2022). Transformer Inference Arithmetic. Blog post.
- Ted Zadouri, Hubert Strauss and Tri Dao (2025). Hardware-Efficient Attention for Fast Decoding. arXiv:2505.21487.
- Pol G. Recasens, Ferran Agullo, Yue Zhu et al. (2025). Mind the Memory Gap: Unveiling GPU Bottlenecks in Large-Batch LLM Inference. arXiv:2503.08311.
- Megha Agarwal, Asfandyar Qureshi, Nikhil Sardana et al. (2023). LLM Inference Performance Engineering: Best Practices. Blog post.
- Pengfei Zuo, Huimin Lin, Junbo Deng et al. (2025). Serving Large Language Models on Huawei CloudMatrix384. arXiv:2506.12708.
- Apple (2026). MacBook Air - Tech Specs. Apple product page (accessed 2026-11-03).
- Yinmin Zhong, Shengyu Liu, Junda Chen et al. (2024). DistServe: Disaggregating Prefill and Decoding for Goodput-optimized Large Language Model Serving. arXiv:2401.09670.
- Amey Agrawal, Anmol Agarwal, Nitin Kedia et al. (2024). Etalon: Holistic Performance Evaluation Framework for LLM Inference Systems. arXiv:2407.07000.
- Jiachen Liu, Jae-Won Chung, Zhiyu Wu et al. (2024). Andes: Defining and Enhancing Quality-of-Experience in LLM-Based Text Streaming Services. arXiv:2404.16283.
- StepFun, Bin Wang, Bojun Wang et al. (2025). Step-3 is Large yet Affordable: Model-system Co-design for Cost-effective Decoding. arXiv:2507.19427.
- DeepSeek (2026). Models & Pricing | DeepSeek API Docs. DeepSeek API documentation (accessed 2026-11-03).
- Connor Holmes, Masahiro Tanaka, Michael Wyatt et al. (2024). DeepSpeed-FastGen: High-throughput Text Generation for LLMs via MII and DeepSpeed-Inference. arXiv:2401.08671.
- Gyeong-In Yu, Joo Seong Jeong, Geon-Woo Kim, Soojeong Kim and Byung-Gon Chun (2022). Orca: A Distributed Serving System for Transformer-Based Generative Models. OSDI 2022.
- NVIDIA (2026). Overview - TensorRT LLM. TensorRT-LLM documentation.
- vLLM Team (2025). Optimization and Tuning - vLLM. vLLM documentation.
- Ramya Prabhu, Ajay Nayak, Jayashree Mohan, Ramachandran Ramjee and Ashish Panwar (2024). vAttention: Dynamic Memory Management for Serving LLMs without PagedAttention. arXiv:2405.04437.
- Woosuk Kwon, Zhuohan Li, Siyuan Zhuang et al. (2023). vLLM: Easy, Fast, and Cheap LLM Serving with PagedAttention. vLLM Blog.
- vLLM Team (2025). Automatic Prefix Caching - vLLM. vLLM documentation.
- vLLM Team (2025). vLLM V1: A Major Upgrade to vLLM's Core Architecture. vLLM Blog.
- Lianmin Zheng, Liangsheng Yin, Zhiqiang Xie et al. (2023). SGLang: Efficient Execution of Structured Language Model Programs. arXiv:2312.07104.
- Yuhan Liu, Yihua Cheng, Jiayi Yao et al. (2025). LMCache: An Efficient KV Cache Layer for Enterprise-Scale LLM Inference. arXiv:2510.09665.
- Ying Sheng, Shiyi Cao, Dacheng Li et al. (2023). S-LoRA: Serving Thousands of Concurrent LoRA Adapters. arXiv:2311.03285.
- Amey Agrawal, Nitin Kedia, Ashish Panwar et al. (2024). Taming Throughput-Latency Tradeoff in LLM Inference with Sarathi-Serve. arXiv:2403.02310.
- Amey Agrawal, Ashish Panwar, Jayashree Mohan et al. (2023). SARATHI: Efficient LLM Inference by Piggybacking Decodes with Chunked Prefills. arXiv:2308.16369.
- Ruoyu Qin, Zheming Li, Weiran He et al. (2024). Mooncake: A KVCache-centric Disaggregated Architecture for LLM Serving. arXiv:2407.00079.
- Junda Chen, Yonghao Zhuang and Hao Zhang (2025). Disaggregated Inference: 18 Months Later. Hao AI Lab blog.
- Chao Wang, Pengfei Zuo, Zhangyu Chen et al. (2025). Prefill-Decode Aggregation or Disaggregation? Unifying Both for Goodput-Optimized LLM Serving. arXiv:2508.01989.
- SGLang Team (2025). Welcome to SGLang - SGLang Documentation. SGLang documentation.
- Hugging Face (2025). Text Generation Inference. Hugging Face documentation.
- Georgi Gerganov and ggml-org contributors (2023). ggml-org/llama.cpp: LLM inference in C/C++. GitHub repository.
- NVIDIA (2025). ai-dynamo/dynamo: A Datacenter Scale Distributed Inference Serving Framework. GitHub repository.
- Yao Fu, Leyang Xue, Yeqi Huang et al. (2024). ServerlessLLM: Low-Latency Serverless Inference for Large Language Models. arXiv:2401.14351.
- Ruidong Zhu, Ziheng Jiang, Chao Jin et al. (2025). MegaScale-Infer: Serving Mixture-of-Experts at Scale with Disaggregated Expert Parallelism. arXiv:2504.02263.
- The SGLang Team (2025). Deploying DeepSeek with PD Disaggregation and Large-Scale Expert Parallelism on 96 H100 GPUs. LMSYS Org blog.
- Mitchell Stern, Noam Shazeer and Jakob Uszkoreit (2018). Blockwise Parallel Decoding for Deep Autoregressive Models. arXiv:1811.03115.
- Yaniv Leviathan, Matan Kalman and Yossi Matias (2022). Fast Inference from Transformers via Speculative Decoding. arXiv:2211.17192.
- Charlie Chen, Sebastian Borgeaud, Geoffrey Irving et al. (2023). Accelerating Large Language Model Decoding with Speculative Sampling. arXiv:2302.01318.
- Amirhossein Bozorgkhoo and Igor Molybog (2026). Speculative Decoding Scaling Laws (SDSL): Throughput Optimization Made Simple. arXiv:2603.11053.
- Yuhui Li, Fangyun Wei, Chao Zhang and Hongyang Zhang (2024). EAGLE: Speculative Sampling Requires Rethinking Feature Uncertainty. arXiv:2401.15077.
- Yuhui Li, Fangyun Wei, Chao Zhang and Hongyang Zhang (2025). EAGLE-3: Scaling up Inference Acceleration of Large Language Models via Training-Time Test. arXiv:2503.01840.
- Tianle Cai, Yuhong Li, Zhengyang Geng et al. (2024). Medusa: Simple LLM Inference Acceleration Framework with Multiple Decoding Heads. arXiv:2401.10774.
- Yuhui Li, Fangyun Wei, Chao Zhang and Hongyang Zhang (2024). EAGLE-2: Faster Inference of Language Models with Dynamic Draft Trees. arXiv:2406.16858.
- Yichao Fu, Peter Bailis, Ion Stoica and Hao Zhang (2024). Break the Sequential Dependency of LLM Inference Using Lookahead Decoding. arXiv:2402.02057.
- Ranajoy Sadhukhan, Jian Chen, Zhuoming Chen et al. (2024). MagicDec: Breaking the Latency-Throughput Tradeoff for Long Context Generation with Speculative Decoding. arXiv:2408.11049.
- Ekagra Ranjan, Komal K. Teru, Bharat Venkitesh and Acyr Locatelli (2026). Why Speculative Decoding Works Better Than Predicted on Sparse MoE Models. arXiv:2610.38981.
- Yongchao Long, Chunrui Zheng, Yuxuan Zhou et al. (2026). When Does Better Acceptance Pay? A Controlled Study of Speculative Decoding. arXiv:2610.24993.
- Vage Egiazarian, Roberto L. Castro, Denis Kuznedelev et al. (2025). Bridging the Gap Between Promise and Performance for Microscaling FP4 Quantization. arXiv:2509.23202.
- Tim Dettmers, Mike Lewis, Younes Belkada and Luke Zettlemoyer (2022). LLM.int8(): 8-bit Matrix Multiplication for Transformers at Scale. arXiv:2208.07339.
- Guangxuan Xiao, Ji Lin, Mickael Seznec et al. (2022). SmoothQuant: Accurate and Efficient Post-Training Quantization for Large Language Models. arXiv:2211.10438.
- Saleh Ashkboos, Amirkeivan Mohtashami, Maximilian L. Croci et al. (2024). QuaRot: Outlier-Free 4-Bit Inference in Rotated LLMs. arXiv:2404.00456.
- Elias Frantar, Saleh Ashkboos, Torsten Hoefler and Dan Alistarh (2022). GPTQ: Accurate Post-Training Quantization for Generative Pre-trained Transformers. arXiv:2210.17323.
- Ji Lin, Jiaming Tang, Haotian Tang et al. (2023). AWQ: Activation-aware Weight Quantization for LLM Compression and Acceleration. arXiv:2306.00978.
- Eldar Kurtic, Alexandre Marques, Shubhra Pandit, Mark Kurtz and Dan Alistarh (2024). "Give Me BF16 or Give Me Death"? Accuracy-Performance Trade-Offs in LLM Quantization. arXiv:2411.02355.
- Yujun Lin, Haotian Tang, Shang Yang et al. (2024). QServe: W4A8KV4 Quantization and System Co-design for Efficient LLM Serving. arXiv:2405.04532.
- Mart van Baalen, Andrey Kuzmin, Suparna S Nair et al. (2023). FP8 versus INT8 for efficient deep learning inference. arXiv:2303.17951.
- Abhinav Dutta, Sanjeev Krishnan, Nipun Kwatra and Ramachandran Ramjee (2024). Accuracy is Not All You Need. arXiv:2407.09141.
- Jiayi Yuan, Hongyi Liu, Shaochen Zhong et al. (2024). KV Cache Compression, But What Must We Give in Return? A Comprehensive Benchmark of Long Context Capable Approaches. arXiv:2407.01527.
- Jiashi Li, Shengyu Liu and Yuanhang Sun (2025). FlashMLA: Efficient Multi-head Latent Attention Kernels. GitHub repository.
- Zirui Liu, Jiayi Yuan, Hongye Jin et al. (2024). KIVI: A Tuning-Free Asymmetric 2bit Quantization for KV Cache. arXiv:2402.02750.
- Coleman Hooper, Sehoon Kim, Hiva Mohammadzadeh et al. (2024). KVQuant: Towards 10 Million Context Length LLM Inference with KV Cache Quantization. arXiv:2401.18079.
- Zhenyu Zhang, Ying Sheng, Tianyi Zhou et al. (2023). H₂O: Heavy-Hitter Oracle for Efficient Generative Inference of Large Language Models. arXiv:2306.14048.
- Yuhong Li, Yingbing Huang, Bowen Yang et al. (2024). SnapKV: LLM Knows What You are Looking for Before Generation. arXiv:2404.14469.
- Jiaming Tang, Yilong Zhao, Kan Zhu et al. (2024). Quest: Query-Aware Sparsity for Efficient Long-Context LLM Inference. arXiv:2406.10774.
- Guangxuan Xiao, Jiaming Tang, Jingwei Zuo et al. (2024). DuoAttention: Efficient Long-Context LLM Inference with Retrieval and Streaming Heads. arXiv:2410.10819.
- Tri Dao, Daniel Haziza, Francisco Massa and Grigory Sizov (2023). Flash-Decoding for long-context inference. Stanford CRFM blog.
- Zihao Ye, Lequn Chen, Ruihang Lai et al. (2025). FlashInfer: Efficient and Customizable Attention Engine for LLM Inference Serving. arXiv:2501.01005.
- Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes and Yejin Choi (2019). The Curious Case of Neural Text Degeneration. arXiv:1904.09751.
- Angela Fan, Mike Lewis and Yann Dauphin (2018). Hierarchical Neural Story Generation. arXiv:1805.04833.
- Minh Nhat Nguyen, Andrew Baker, Clement Neo et al. (2024). Turning Up the Heat: Min-p Sampling for Creative and Coherent LLM Outputs. arXiv:2407.01082.
- Chenxia Tang, Jianchun Liu, Hongli Xu and Liusheng Huang (2024). Top-nσ: Not All Logits Are You Need. arXiv:2411.07641.
- John Hewitt, Christopher D. Manning and Percy Liang (2022). Truncation Sampling as Language Model Desmoothing. arXiv:2210.15191.
- Yifan Song, Guoyin Wang, Sujian Li and Bill Yuchen Lin (2024). The Good, The Bad, and The Greedy: Evaluation of LLMs Should Not Ignore Non-Determinism. arXiv:2407.10457.
- Matthew Renze and Erhan Guven (2024). The Effect of Sampling Temperature on Problem Solving in Large Language Models. arXiv:2402.05201.
- Rylan Schaeffer, Joshua Kazdan and Yegor Denisov-Blanch (2025). Min-p, Max Exaggeration: A Critical Analysis of Min-p Sampling in Language Models. arXiv:2506.13681.
- Brandon T. Willard and Rémi Louf (2023). Efficient Guided Generation for Large Language Models. arXiv:2307.09702.
- Kanghee Park, Jiayu Wang, Taylor Berg-Kirkpatrick, Nadia Polikarpova and Loris D'Antoni (2024). Grammar-Aligned Decoding. arXiv:2405.21047.
- Luca Beurer-Kellner, Marc Fischer and Martin Vechev (2024). Guiding LLMs The Right Way: Fast, Non-Invasive Constrained Generation. arXiv:2403.06988.
- Saibo Geng, Hudson Cooper, Michał Moskal et al. (2025). JSONSchemaBench: A Rigorous Benchmark of Structured Outputs for Language Models. arXiv:2501.10868.
- Yixin Dong, Charlie F. Ruan, Yaxing Cai et al. (2024). XGrammar: Flexible and Efficient Structured Generation Engine for Large Language Models. arXiv:2411.15100.
- OpenAI (2021). human-eval/human_eval/execution.py at master · openai/human-eval. GitHub repository.
- Chris Lu, Cong Lu, Robert Tjarko Lange et al. (2024). The AI Scientist: Towards Fully Automated Open-Ended Scientific Discovery. arXiv:2408.06292.
- OpenAI (2024). OpenAI o1 System Card (September 12, 2024). System card.
- Max McGuinness, Mikaela Grace, Jiri De Jonghe, Jake Eaton and Abel Ribbink (2026). How we contain Claude across products. Anthropic Engineering blog.
- Rafiqul Rabin, Jesse Hostetler, Sean McGregor, Brett Weir and Nick Judd (2025). SandboxEval: Towards Securing Test Environment for Untrusted Code. arXiv:2504.00018.
- Kimi Team, Tongtong Bai, Yifan Bai et al. (2026). Kimi K3: Open Frontier Intelligence. arXiv:2607.24653.
- Simhadri Podala Narasimha (2026). Containing the Autonomous Operator: A Defense-in-Depth Framework and Reference Architecture for Securing AI Agents on Kubernetes. arXiv:2610.02861.
- Simon Willison (2025). The lethal trifecta for AI agents: private data, untrusted content, and external communication. Blog post.
- gVisor Authors (2024). Security Model. gVisor documentation.
- Linux man-pages project (2026). namespaces(7) - Linux manual page. Linux man-pages.
- Tejun Heo (2015). Control Group v2. The Linux Kernel documentation.
- Docker Inc. (2025). Docker Engine security. Docker documentation.
- Linux man-pages project (2026). capabilities(7) - Linux manual page. Linux man-pages.
- The Kubernetes Authors (2026). Pod Security Standards. Kubernetes documentation.
- Linux man-pages project (2026). seccomp(2) - Linux manual page. Linux man-pages.
- Docker Inc. (2026). Seccomp security profiles for Docker. Docker documentation.
- Linux man-pages project (2026). user_namespaces(7) - Linux manual page. Linux man-pages.
- The Kubernetes Authors (2026). User Namespaces. Kubernetes documentation.
- Linux man-pages project (2026). landlock(7) - Linux manual page. Linux man-pages.
- Steven R Brandt, Max Morris, Patrick Diehl et al. (2025). Locking Down Science Gateways with Landlock and Seccomp. arXiv:2509.18548.
- Open Container Initiative (2025). Linux Container Configuration. GitHub (opencontainers/runtime-spec/blob/main/config-linux.md).
- Open Container Initiative (2024). Open Container Initiative Runtime Specification. GitHub repository.
- gVisor Authors (2024). What is gVisor?. gVisor documentation.
- Kata Containers (2026). Kata Containers Architecture. GitHub (kata-containers/kata-containers/blob/main/docs/design/architecture/README.md).
- Maysara Alhindi and Joseph Hallett (2025). Playing in the Sandbox: A Study on the Usability of Seccomp. arXiv:2506.10234.
- Murugiah Souppaya, John Morello and Karen Scarfone (2017). Application container security guide. National Institute of Standards and Technology.
- Alexandru Agache, Marc Brooker, Andreea Florescu et al. (2020). Firecracker: Lightweight Virtualization for Serverless Applications. 17th USENIX Symposium on Networked Systems Design and Implementation (NSDI 20).
- Ethan G. Young, Pengfei Zhu, Tyler Caraza-Harter, Andrea C. Arpaci-Dusseau and Remzi H. Arpaci-Dusseau (2019). The True Cost of Containing: A gVisor Case Study. HotCloud 2019.
- gVisor Authors (2024). Performance Guide. gVisor documentation.
- gVisor Authors (2024). Platform Guide. gVisor documentation.
- Ayush Ranjan (2023). Faster filesystem access with Directfs. gVisor blog.
- Ayush Ranjan (2023). Rootfs Overlay. gVisor blog.
- Firecracker Project (2026). Specification. GitHub (firecracker-microvm/firecracker/blob/main/SPECIFICATION.md).
- Marc Brooker, Adrian Costin Catangiu, Mike Danilov et al. (2021). Restoring Uniqueness in MicroVM Snapshots. arXiv:2102.12892.
- Dmitrii Ustiugov, Plamen Petrov, Marios Kogias, Edouard Bugnion and Boris Grot (2021). Benchmarking, Analysis, and Optimization of Serverless Function Snapshots. arXiv:2101.09355.
- Kubernetes SIG Apps (2026). agent-sandbox. GitHub repository.
- WebAssembly Community Group (2024). WASI.dev. WASI project site.
- Simon Shillaker and Peter Pietzuch (2020). Faasm: Lightweight Isolation for Efficient Stateful Serverless Computing. arXiv:2002.09344.
- Abhinav Jangda, Bobby Powers, Emery Berger and Arjun Guha (2019). Not So Fast: Analyzing the Performance of WebAssembly vs. Native Code. arXiv:1901.09056.
- Containers project (2024). containers/bubblewrap: Low-level unprivileged sandboxing tool used by Flatpak and similar projects. GitHub repository.
- Google (2024). google/nsjail: A lightweight process isolation tool that utilizes Linux namespaces, cgroups, rlimits and seccomp-bpf syscall filters. GitHub repository.
- SWE-bench team (2024). Docker Setup. SWE-bench documentation.
- UK AI Security Institute (2025). Sandboxing – Inspect. Inspect documentation.
- Yiming Yan, Hongyang Wang, Wenbo Chen et al. (2026). Sandman: Building and Operating Sandboxes for Agentic Reinforcement Learning on Shared Kubernetes. arXiv:2610.39711.
- The Kubernetes Authors (2026). Resource Management for Pods and Containers. Kubernetes documentation.
- The Kubernetes Authors (2026). Jobs. Kubernetes documentation.
- Ziqian Zhong, Aditi Raghunathan and Nicholas Carlini (2025). ImpossibleBench: Measuring LLMs' Propensity of Exploiting Test Cases. arXiv:2510.20270.
- Firecracker Project (2026). Firecracker Snapshotting. GitHub (firecracker-microvm/firecracker/blob/main/docs/snapshotting/snapshot-support.md).
- John Yang, Kilian Lieret, Carlos E. Jimenez et al. (2025). SWE-smith: Scaling Data for Software Engineering Agents. arXiv:2504.21798.
- Ibragim Badertdinov, Alexander Golubev, Maksim Nekrashevich et al. (2025). SWE-rebench: An Automated Pipeline for Task Collection and Decontaminated Evaluation of Software Engineering Agents. arXiv:2505.20411.
- Greg Brockman, Vicki Cheung, Ludwig Pettersson et al. (2016). OpenAI Gym. arXiv:1606.01540.
- Mark Towers, Ariel Kwiatkowski, Jordan Terry et al. (2024). Gymnasium: A Standard Interface for Reinforcement Learning Environments. arXiv:2407.17032.
- Xingyao Wang, Boxuan Li, Yufan Song et al. (2024). OpenHands: An Open Platform for AI Software Developers as Generalist Agents. arXiv:2407.16741.
- Anthropic (2024). Introducing the Model Context Protocol. Anthropic news.
- Model Context Protocol (2025). Specification. modelcontextprotocol.io.
- SWE-bench team (2024). Evaluation - SWE-bench. SWE-bench documentation.
- John Yang, Carlos E. Jimenez, Alexander Wettig et al. (2024). SWE-agent: Agent-Computer Interfaces Enable Automated Software Engineering. arXiv:2405.15793.
- Florian Brand and Jean-Stanislas Denain (2025). What skills does SWE-bench Verified evaluate?. Epoch AI blog.
- Tom Adamczewski (2025). How to run SWE-bench Verified in one hour on one machine. Epoch AI blog.
- Thibault Le Sellier De Chezelles, Maxime Gasse, Alexandre Drouin et al. (2024). The BrowserGym Ecosystem for Web Agent Research. arXiv:2412.05467.
- Harsh Trivedi, Tushar Khot, Mareike Hartmann et al. (2024). AppWorld: A Controllable World of Apps and People for Benchmarking Interactive Coding Agents. arXiv:2407.18901.
- Tianbao Xie, Mengqi Yuan, Danyang Zhang et al. (2025). Introducing OSWorld-Verified. XLANG blog.
- Edward Lue Chee Lip, Boden Moraski, Tim Knappe et al. (2026). What Makes a Terminal-Bench Task Hard? Separating Genuine Hardness from Fake-Hardness on an Adjudicated Agentic Corpus. arXiv:2609.26826.
- You Wang, Michael Pradel and Zhongxin Liu (2025). Are "Solved Issues" in SWE-bench Really Solved Correctly? An Empirical Study. arXiv:2503.15223.
- Reem Aleithan, Haoran Xue, Mohammad Mahdi Mohajer et al. (2024). SWE-Bench+: Enhanced Coding Benchmark for LLMs. arXiv:2410.06992.
- Qingzhou Luo, Farah Hariri, Lamyaa Eloussi and Darko Marinov (2014). An empirical analysis of flaky tests. Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering.
- Dario Amodei, Chris Olah, Jacob Steinhardt et al. (2016). Concrete Problems in AI Safety. arXiv:1606.06565.
- Joar Skalse, Nikolaus H. R. Howe, Dmitrii Krasheninnikov and David Krueger (2022). Defining and Characterizing Reward Hacking. arXiv:2209.13085.
- Anthropic (2025). Claude 3.7 Sonnet System Card. Anthropic system card.
- Amit Roth, Ivan Bercovich and Yonathan Efroni (2026). Hack-Verifiable Terminal Bench: Evaluating Reward Hacking in Terminal Tasks. arXiv:2608.22103.
- Mia Taylor, James Chua, Jan Betley, Johannes Treutlein and Owain Evans (2025). School of Reward Hacks: Hacking harmless tasks generalizes to misaligned behavior in LLMs. arXiv:2508.17511.
- Anthropic (2025). Natural emergent misalignment from reward hacking. Anthropic research.
- Bowen Baker, Joost Huizinga, Aleksander Madry et al. (2025). Detecting misbehavior in frontier reasoning models. OpenAI blog (archived).
- Marc Brooker, Mike Danilov, Chris Greenwood and Phil Piwonka (2023). On-demand Container Loading in AWS Lambda. arXiv:2305.13162.
- Tyler Harter, Brandon Salmon, Rose Liu, Andrea C. Arpaci-Dusseau and Remzi H. Arpaci-Dusseau (2016). Slacker: Fast Distribution with Lazy Docker Containers. 14th USENIX Conference on File and Storage Technologies (FAST 16).
- Yunpeng Dong, Jingkai He, Shiqi Liu et al. (2026). DeltaBox: Scaling Stateful AI Agents with Millisecond-Level Sandbox Checkpoint/Rollback. arXiv:2605.22781.
- The Kubernetes Authors (2026). Considerations for large clusters. Kubernetes documentation.
- Ning Shang, Yifei Liu, Yi Zhu et al. (2025). rStar2-Agent: Agentic Reasoning Technical Report. arXiv:2508.20722.
- GLM-5-Team, Aohan Zeng, Xin Lv et al. (2026). GLM-5: from Vibe Coding to Agentic Engineering. arXiv:2602.15763.
- Gian Segato (2026). Quantifying infrastructure noise in agentic coding evals. Anthropic Engineering blog.
- Qwen Team (2025). Qwen3-Coder: Agentic Coding in the World. Blog post.
- Kairong Luo, Haodong Wen, Shengding Hu et al. (2025). A Multi-Power Law for Loss Curve Prediction Across Learning Rate Schedules. arXiv:2503.12811.
- Jonathan Coles, Stefano Schuppli, Lukas Drescher et al. (2026). An Engineering Journey Training Large Language Models at Scale on Alps: The Apertus Experience. arXiv:2604.12973.
- Tatsunori Hashimoto and Percy Liang (2026). Stanford CS336 | Language Modeling from Scratch. Stanford University course.
- Jacob Austin, Sholto Douglas, Roy Frostig et al. (2025). How To Scale Your Model. Google DeepMind (online book).
- Andrej Karpathy (2022). nanoGPT. GitHub repository.
- Andrej Karpathy (2024). llm.c. GitHub repository.
- Andrej Karpathy (2025). nanochat: The best ChatGPT that $100 can buy. GitHub repository.
- Stas Bekman (2026). Machine Learning Engineering Open Book. GitHub repository (open book).
- Bingchen Zhao, Despoina Magka, Minqi Jiang et al. (2025). The Automated LLM Speedrunning Benchmark: Reproducing NanoGPT Improvements. arXiv:2506.22419.
- Ege Erdil and David Schneider-Joseph (2024). Data movement limits to frontier model training. arXiv:2411.01137.
- Mitchell Wortsman, Gabriel Ilharco, Samir Yitzhak Gadre et al. (2022). Model soups: averaging weights of multiple fine-tuned models improves accuracy without increasing inference time. arXiv:2203.05482.