The idea: every stage after pretraining moves the same weights with a narrower signal and far less, far costlier data, so pretraining decides what the model knows and the later stages decide what it does with it; three more stages (distillation, PEFT, quantisation) make any of them cheaper.
Down the line, the signal narrows, the data shrinks by orders of magnitude, and compute falls to a few percent of pretraining
Compute columns are each stage's FLOPs or GPU-hours as a share of the same model family's pretraining derived: InstructGPT's SFT 4.9 and RLHF 60 petaflop/s-days against GPT-3's 3,640; R1's 147K H800 hours against V3's 2,788K; OLMo 2's mid-training share as its report gives it. The stages' data are in different units (tokens, demonstrations, pairs, environments), so the streams' dot counts are schematic. Every stage name links to the page that owns it.
You need: what a decoder-only Transformer is and how it is trained by next-token prediction (The transformer from zero: one block, every shape, a GPT you train, the block this page trains; the map of the whole family is Topic: llm-architecture); Adam itself is on Optimisers and learning-rate schedulers, but this page only names it.
A language model is built in stages. Pretraining teaches a randomly initialised network to predict the next token of trillions of tokens of text; mid-training and continued pretraining keep the same objective on a shifted mix; post-training turns the result into an assistant (SFT, preference optimisation, RLVR). Three more stages make it cheaper: distillation, PEFT and quantization. Every stage can be compared on the same four questions:
Predict, then click: read the Data column top to bottom. Which way does the count move, and which way does the cost per example move? Then click any cell for the one-paragraph comparison and the page that owns the depth: the data column shrinks from trillions of tokens to a few hundred examples, while the cost column's expensive part moves from training compute to rollouts and environments.
What it changes. Every weight, from random initialisation, by predicting the next token over the whole vocabulary. It decides what the model knows and sets the ceiling later stages work under: RL raises pass@1 but base models still solve more problems given many samples (Yue et al.).
Data. Llama 3 405B read 15.6T tokens (Llama 3). About 20 tokens per parameter is compute-optimal (Chinchilla: 70B on 1.4T, paper); serving-bound models go far past it. Made by crawlers and classifiers: filtered web, code, papers. Data improvements gave 12.0 times the compute efficiency of 2019 at a 1e19-FLOP budget, model improvements 3.7 times, both together 15 times (Dwarkesh Patel and Jerry Han; our reading).
Cost. About 6 FLOPs per parameter per token: Llama 3 405B took 3.8 × 1025 FLOPs at 38 to 43% utilisation of up to 16,384 H100s (Llama 3). DeepSeek-V3's whole official run was 2.788M H800 hours, $5.576M at an assumed $2 an hour, research excluded (DeepSeek-V3). Your own numbers: Scaling calculator; disclosed runs: Price list.
What goes wrong. Loss spikes and divergence (OLMo 2's initialisation and normalisation changes cut its spike score from 0.40% to 0.03%, OLMo 2), and at scale the cluster: Llama 3 had 419 unexpected interruptions in 54 days, one every 3.1 hours derived, yet kept over 90% effective training time.
What it changes. All weights, same next-token objective, on a shifted mix: a high-quality anneal as the learning rate decays (maths, code, instruction-like and synthetic data), a new domain or language, or long documents with rescaled positional encodings for a longer window (Positional Encodings).
Data. OLMo 2 7B anneals on 50B tokens three times and averages the results (OLMo 2); Thomson Reuters kept 200B tokens of a 19T pool (The Batch); Llama 3 went from 8K to 128K context in six stages over about 800B tokens (Llama 3). Made by curation: classifiers, data vendors, synthetic generation.
Cost. OLMo 2's mid-training took 5 to 10% of the FLOPs and added 9.9 points on its 7B (OLMo 2). Thomson Reuters' final mid-training run on Qwen3.5-397B-A17B cost $450,000; its $40M figure is the whole two-year programme, talent included (see the Price list).
What goes wrong. Catastrophic forgetting of general ability, driven mostly by the shift in data (re-warming the learning rate is about a quarter of it in Ibrahim et al.'s Table 12); instruction following breaks until post-training is re-run. Replay of general data (even 1 to 5%) and a lower re-warmed peak are the defences (Ibrahim et al.). Llama 3 ended each long-context stage only once short-context scores had recovered.
What it changes. All weights (or a LoRA adapter), next-token loss on the response tokens only, so the model answers in a chat template instead of continuing the text. It teaches form more than skill: R1's cold-start SFT scored 59.0% on AIME 2024 against 77.9% for pure RL from the same base (DeepSeek-R1).
Data. InstructGPT: about 13k prompts with demonstrations, written by about 40 contractors (InstructGPT); LIMA: 1,000 curated examples (LIMA). Now mostly written by a stronger model: 400 trajectories from GPT-6 Astra taught a 4B model to plan Postgres queries (write-up).
Cost. InstructGPT's SFT on the 175B model took 4.9 petaflop/s-days against 3,640 for GPT-3's pretraining, 0.13% derived. With LoRA it fits on consumer GPUs: the whole Postgres planner, SFT and RL, cost $1,200 (write-up).
What goes wrong. Off-policy: the model never sees its own mistakes, so it learns the look of an answer. Chat-template mismatches between training and serving are a common silent bug (Tokenizers).
What it changes. Shifts probability towards the answer a judge ranked higher, with a KL term keeping the model near its SFT starting point. PPO learns a reward model and optimises against it; DPO turns the same objective into a classification loss on pairs, with no reward model and no sampling (DPO). Labelers preferred the 1.3B InstructGPT to the 175B GPT-3.
Data. InstructGPT: 33k prompts with ranked answers for the reward model, 31k unlabelled prompts for PPO (InstructGPT). Constitutional AI: 182,831 harmlessness comparisons labelled by a model, against 16 written principles, plus 135,296 human helpfulness comparisons (Constitutional AI). AI feedback is now the norm for most labels.
Cost. PPO holds policy, reference, reward model and critic: 252 GB at 7B before activations, twice DPO's 126 GB derived (Axis 3). InstructGPT's PPO on 175B took 60 petaflop/s-days, 1.6% of GPT-3's pretraining derived.
What goes wrong. The policy climbs the learned reward while true quality stalls or falls: verbosity, sycophancy, formatting tricks (Gao et al.; Reward Hacking). Defences: the KL leash (Axis 4), reward-model ensembles, mixing pretraining gradients back in against the "alignment tax".
What it changes. The model's own sampled attempts are rewarded by a program (exact answers, unit tests, an environment's outcome). Long, self-checking chains of thought emerge: DeepSeek-R1-Zero went from 15.6% to 77.9% on AIME 2024 with rule rewards only (DeepSeek-R1). It can also train cost: SWE-2 learned all its effort levels in one RL run (Cognition).
Data. Prompts with checkable answers, and for agents whole environments: MiMo-V2.6 trained across 7,000+ task environments (card); Mercor and SkyRL on 1,928 expert-made tasks (Mercor). The answers are the model's own; people or tools make the tasks and checkers.
Cost. Many samples per prompt (16 for R1-Zero, 64 for DeepSeekMath) make it inference-heavy. R1's RL and SFT data: 147K H800 hours, $294K, 5.3% of V3's official run derived; MiMo-V2.6-Pro's final RL stage: $2.62M in under six days. The sandboxes are their own infrastructure: DSec runs about 3 million a day self-reported (DSec).
What goes wrong. The checker becomes the proxy: hard-coded outputs, edited or skipped tests, exiting before assertions. Long runs lose entropy and stop exploring; large MoE models go unstable (MiMo-V2.6 froze its router). Defences: hidden and mutated tests, a sandboxed grader, an environment that cannot be escaped.
What it changes. A new, smaller student is trained to imitate a teacher: on the teacher's sampled answers (sequence-level), on its full token distributions (logits, which needs a shared tokenizer), or on-policy, where the student writes and the teacher grades every token. It is the main reason 1B to 8B models are useful now.
Data. Qwen2.5-32B fine-tuned on 800K samples from R1 scored 72.6% on AIME 2024 against 47.0% after R1-Zero-style RL on the same base (DeepSeek-R1); Gemma 3 12B trained on 500 ToolGrad examples scored 83.1 on BFCL against Gemini 2.5 Pro's 83.2 (Google Research).
Cost. SFT-priced: one pass over teacher outputs, plus the teacher's inference. On-policy distillation is reported to need 9 to 30 times less compute than off-policy SFT on teacher samples, and against reasoning RL about a tenth of the GPU-hours (Qwen3) or 7 to 10 times fewer steps reported (Thinking Machines).
What goes wrong. Off-policy students never see their own mistakes; a teacher far stronger than the student can hurt it; mismatched tokenizers block logit distillation; the student inherits the teacher's quirks and, through terms of service, its legal exposure.
What it changes. The base is frozen and a low-rank update W0 + BA is trained, then merged at no inference cost. On GPT-3 175B, 4.7M trainable parameters reached 73.4% on WikiSQL against 73.8% for full fine-tuning, in a 35 MB adapter instead of a 350 GB copy (LoRA).
Data. PEFT is a way of running SFT, DPO or RL, not a data regime: the data is that stage's. For RL even rank 1 is enough, since policy gradients carry little information per episode (Thinking Machines).
Cost. No optimiser state for frozen weights: QLoRA fine-tunes LLaMA 65B in under 48 GB (45.0 GB measured) where 16-bit fine-tuning needs more than 780 GB (QLoRA). The arithmetic, with a calculator on real configs, is PEFT's section "Memory: full fine-tuning, LoRA and QLoRA".
What goes wrong. An adapter cannot absorb billions of tokens of new knowledge (use CPT); LoRA on attention only underperforms; and the claim that LoRA beats full fine-tuning sits inside the noise of the original paper.
What it changes. No learning at all after training (post-training quantization), or fake quantization inside training (quantization-aware training). Weights, and sometimes activations, move from bf16 (2 bytes) to FP8 (1) or about 4 bits plus scales; fine-grained FP8 is now used for training itself (DeepSeek-V3).
Data. GPTQ, AWQ and llama.cpp's importance matrix need a small calibration set; dynamic FP8 needs none; quantization-aware training needs training data. A calibration set unlike real use quietly costs capability off its distribution.
Cost. About 0.6 GB per billion parameters at 4 bits; DeepSeek-V3's FP8 training kept the loss within 0.25% of BF16 in its ablations (DeepSeek-V3). llama.cpp's default Q4_K_M is 4.89 effective bits per weight on Llama-3.1-8B (llama.cpp).
What goes wrong. A few channels with huge values wreck naive scaling; dense models fall off a cliff below about 3 bits, while MoE experts tolerate harder quantization; newer, heavily trained small models lose more at the same bits.
Numbers are published, with the source linked, unless marked derived (formula shown), illustrative, reported (the maker's own figure, not independently checked) or unconfirmed.
Every stage before compression updates the same weights by gradient descent. What differs is the signal: pretraining and mid-training reward predicting text; SFT rewards imitating a demonstration; preference optimisation rewards the answer a judge ranked higher; RLVR rewards whatever the model itself produced that a checker accepted. Each signal is narrower than the last and moves behaviour more per example. The compression stages change something else: distillation makes a new, smaller model; PEFT changes how many weights move (a low-rank add-on, often under 0.1% of the model); quantization changes how the weights are stored, with no learning at all unless it is quantization-aware training.
What one prompt's answer looks like after each stage, on a real open recipe (Tulu 3 8B, stage by stage), is the hero of Alignment: SFT, RLHF, DPO Family, RLVR; how five open recipes chain the stages is its section 8, "How recipes combine the stages".
RL can now train the cost-quality trade itself. Cognition's SWE-2, RL post-trained from Moonshot's 2.8T-parameter Kimi K3, learned all its reasoning-effort levels in a single RL run, "with each penalty tuned to the local slope of the base model's Pareto frontier", rather than one checkpoint per tier; SWE-2 medium used 58% fewer turns and cost 81% less than SWE-1.7 on the same work. It matched Fable 5.1 on FrontierCode 1.1 Main (50.0% against 50.9%) at a claimed 64% lower cost reported, but scored 27.3% on Terminal-Bench 4 against 55.8% and 57.9% for Fable 5.1 and GPT-6 Astra (Cognition).
Every count is the source's own, linked in its step beside this figure; "about" and "+" are the source's wording. Bars are not comparable across the two panels.
Down the lifecycle, data gets smaller, more expensive per example, and made by someone other than a web crawler. Pretraining reads trillions of tokens nobody wrote for it; mid-training selects billions of better ones; SFT needs thousands of demonstrations; preference optimisation needs tens of thousands of ranked pairs; RLVR needs prompts or whole environments with a checker, and generates its own answers. The labeller changed too: people, then a model reading a written constitution, then a program that checks the answer, and now the model's own production traffic.
Predict, then watch: which colour will dominate the 2026 bars, people or a model? The record fills in one disclosed dataset at a time, from GPT-3's era to 2026, step by step below. Two scales, because tokens and examples do not compare: each bar's length is its count on a logarithmic axis; its colour is who made the data.
Data quality carries more of pretraining's progress than modelling. From 2019 to 2025, at a 1e19-FLOP budget, data improvements gave 12.0 times and model improvements 3.7 times more compute efficiency, so 12.0 / 3.7 = 3.24 times more from data derived. The two effects add in benchmark points (88% of variance additive) but overlap in compute: together they saved 15 times, not the 45 of their product (Dwarkesh Patel and Jerry Han; our reading). Chinchilla's rule of about 20 tokens per parameter still says how to split a compute budget; it never said that one token is worth another. Curation is on Topic: data-curation-and-datasets; who curated each open recipe's data, stage by stage, and how much: Open recipes compared.
Pretraining's cost is arithmetic: about 6 floating-point operations per parameter per token, so C ≈ 6ND, divided by what the cluster sustains. Post-training used to be a rounding error on top of it, and reasoning and agentic RL changed that, by moving the cost from the backward pass to generating rollouts and running the environments they act in:
Those are the ratios; every disclosed run with its dollar figure and what that figure includes (one stage, one run, or a whole programme) is on the Price list, and FLOPs and GPU-days for any model and token count, Chinchilla-optimal or over-trained, are in the Scaling calculator.
Memory derived: a trained model holds 16 bytes per parameter (bf16 weights and gradients, fp32 master weights and two Adam moments, ZeRO §3.1), a frozen one 2; activations and the rollout engine's cache are left out. PPO 36 bytes per parameter, 252 GB at 7B; GRPO with a verifier and DPO 18, 126 GB: "roughly half the memory", as the RL page puts it. Group size 8 and the right or wrong answers are illustrative; DeepSeekMath used 64 per prompt and R1-Zero 16. DPO's reference log-probabilities can be computed once and cached, which removes the reference from memory during training (4 forward passes per pair, 2 cacheable: DPO).
The memory side of post-training is set by how many models must sit on the GPUs at once. PPO, the algorithm of InstructGPT-style RLHF, holds four: the policy being trained, a frozen reference copy for the KL penalty, a reward model, and a critic that estimates how good each partial answer is. GRPO (from DeepSeekMath) drops the critic: it samples a group of answers per prompt and scores each against the group's mean. DPO drops sampling altogether and trains on fixed pairs.
Predict, then watch: PPO holds four models and GRPO three; how much bigger is PPO's memory bar at the same size, and what does GRPO pay instead? Step one batch of four prompts through each (switch algorithm above the figure): PPO's memory bar is twice GRPO's at the same model size; GRPO pays instead in rollouts, 8 per prompt here where PPO samples one.
PPO, step by step
GRPO, step by step
DPO, step by step
Model by model, with the streams between them, PPO against GRPO is Alignment's Fig. 4; a verifier scoring a group of eight is its Fig. 7. This figure keeps what only shows when the three are side by side: the memory each needs and the answers each generates.
The trade is visible in what each wins. DPO is cheap and stable and was adopted everywhere; on harder tasks, later controlled studies found well-tuned on-policy RL ahead, which is why reasoning models use GRPO and its successors. GRPO's memory saving was argued, not measured, in the paper that introduced it (DeepSeekMath); its standing rests on cost and on R1.
For agentic RL the bill moves again, from the trainer to the machines the rollouts act in: every rollout needs its own isolated sandbox, the harness decides as much as the algorithm, and at the cheap end one task with a cheap checker lets a 4B model beat a built-in planner for $1,200. The cases, with their numbers, are in the closed block.
The Postgres planner used 400 SFT trajectories, not 420, and cost $1,200 in total, not "hundreds of dollars"; "best of three" meant the best of up to 15 candidates, and a single rollout gives 1.41 times with 2 regressions; the untrained model produced a valid plan for 14 of the 113 queries. The 35B Thomson Reuters sibling (on Qwen3.6-35B) will be released for academic and non-commercial use, not alongside. The research preference models have been on arXiv since 14 August, not 6 September; WinoGrande 94.1% is the agentic variant's best and SVAMP 95.7% the inference-only one's. Sources: checks of 2 October 2026 in the 7 September and 21 September tech news issues.
The old page also reasoned that MiMo's $2.62M RL stage and Thomson Reuters' $40M "are not separated by an order of magnitude", treating the $40M as a three-month mid-training run. It was not: the $40M covers talent and compute over about two years, and Thomson Reuters' CTO put the final training run at $450,000 (LawNext, 24 Aug 2026; The Batch's "three months" is the outlier among the sources). Like for like, MiMo's final RL stage cost about 5.8 times Thomson Reuters' final run derived. Both figures, with what each covers, are on the Price list.
Each stage has a characteristic failure, and the dangerous ones look like success on the stage's own metric: the loss keeps falling, the reward keeps rising.
| Stage | What goes wrong | Standard defence |
|---|---|---|
| Pretraining | Loss spikes and divergence; at scale, hardware: Llama 3's 405B run had 419 unexpected interruptions in 54 days, one every 3.1 hours derived, 78% of them hardware (Llama 3) | Initialisation and normalisation fixes (OLMo 2's cut its spike score from 0.40% to 0.03%, OLMo 2), z-loss, QK-norm; frequent asynchronous checkpoints, which kept Llama 3 above 90% effective training time |
| Mid-training, CPT | Catastrophic forgetting of general ability, driven mostly by the shift in data (re-warming the learning rate is about a quarter of it in Ibrahim et al.'s Table 12); instruction following breaks until post-training is re-run | Replay of general data (even 1 to 5% helps), a lower re-warmed peak, staged mixes (Ibrahim et al.) |
| SFT | Imitation without the skill; off-policy, so the model never sees its own mistakes; chat-template mismatches between training and serving | Fewer, better examples; follow with RL or on-policy distillation |
| Preference optimisation | Reward hacking: verbosity, sycophancy, format tricks; an "alignment tax" on benchmarks | A KL penalty to the reference (below), reward-model ensembles, mixing pretraining gradients back in (InstructGPT's PPO-ptx) |
| RLVR | Verifier gaming (hard-coded outputs, edited tests, exiting before assertions); entropy collapse in long runs; instability in large MoE models | Hidden and mutated tests, a sandboxed grader; MiMo-V2.6 froze the MoE router and describes "a multi-layer defense against reward hacking" (card) |
| Distillation | The student inherits the teacher's quirks; too strong a teacher can hurt a tiny student; different tokenizers block logit distillation | Verified traces only, an intermediate teacher, on-policy distillation; but choose the KL direction first: in a controlled study the token-level KL direction shaped results more than who wrote the rollouts, and the on-policy edge did not reliably survive later RLVR (Piskorz et al., arXiv 2609.35259; the two directions drawn: Distillation's Fig. 2) |
| PEFT | Too little capacity to absorb bulk knowledge; attention-only LoRA underperforms | LoRA on every matrix, especially the MLPs; full fine-tuning or CPT for billions of tokens |
| Quantization | A few outlier channels wreck naive scaling; dense models fall off a cliff below about 3 bits | Outlier-aware methods (AWQ, rotations), FP8 or 4-bit with fine-grained scales, quantization-aware training |
A learned reward model is a proxy for what people want. Optimised hard enough, the policy finds what the proxy over-rewards: the proxy score keeps climbing while the true ("gold") score peaks and falls. The KL penalty to the reference is the leash: it charges the policy for distance, so it decides where the policy stops, near where the proxy still tracks the gold; it does not lift the curve. The measured curves (Gao, Schulman and Hilton's best-of-n and RL fits, the gap shrinking with reward-model size) are drawn on Reward Hacking, section 2, "The curve: proxy up, gold down"; one riddle under best-of-n, answer by answer, is its Fig. 1.
RLVR replaces the learned proxy with a checker, which removes this curve but not the problem: the checker is the new proxy, narrower and still gameable (where each coding hack cuts into the reward: Reward Hacking's Fig. 2; what a policy can reach, scorer to harness: its Fig. 3). Two 2026 responses move the defence out of the reward. DSec treats misbehaviour, reward hacking included, as a property of the sandbox: an environment that cannot be escaped removes a class of shortcut before the reward has to resist it (DSec). And reward hacking learned in training can generalise into broad misalignment, which telling the model during training that the hack is acceptable ("inoculation prompting") largely prevents (Anthropic; detail on Reward Hacking).
Loops that train on their own history narrow. Dream-RSI's replay is valid only inside the region its history covers, so it sharpens a mapped search rather than extending it (Dream-RSI). NVIDIA's Agora had 13 agents publish 1,703 contributions over 11 days and 19 hours as Git commits, taking a language-model evaluator from 3.39 to 1.899 bits per byte with 165 independent reproductions and no reported failure, but effort converged on one lineage ("shared visibility supported reuse, but did not by itself sustain broad exploration"), and the authors stepped in several times during the run; with one task, one run and no comparison, their changes cannot be separated from the effect of the system's diversity views (Agora).
Every stage runs on the same machinery: a memory budget per parameter, a way of splitting the model across GPUs, a number format, and a cluster that fails. The stages differ mainly in how much of it they need.
Training with Adam in mixed precision holds about 16 bytes per parameter before activations: 2 for bf16 weights, 2 for gradients, 12 for fp32 master weights and two moments (ZeRO). Freezing the base (PEFT) drops that to the 2 bytes of the frozen weights plus a small adapter; storing the frozen base in 4 bits (QLoRA) to about half a byte; serving needs only the weights, in whatever format they ship. The calculator for full fine-tuning, LoRA and QLoRA on real configs (LLaMA 65B on one 48 GB card included) is PEFT, section "Memory: full fine-tuning, LoRA and QLoRA", whose Fig. 5 stacks the three side by side; what every format costs in bits is Quantization and Precision.
Five ways to split one training step across GPUs, one line each; each split, with a step-through of what every GPU holds and sends, is a section of Distributed Training (numbers in the last column), and its Layout calculator tab composes them for a real run. To see the memory every split fights, Llama 3 8B on one 80 GB H100, to scale, is its Fig. 2; a published layout laid out as a mesh of GPUs, its Fig. 14.
| Split | What each GPU holds | Cost and where it fits | Distributed Training |
|---|---|---|---|
| Data parallel, sharded (ZeRO, FSDP) | A slice of the batch; with ZeRO-3 also a 1/N slice of weights, gradients and optimiser state | At most 1.5 times plain data parallelism's communication; a 7.5B model on 64 GPUs drops from 120 to 1.9 GB per GPU (ZeRO). FSDP2 with hybrid sharding covers most fine-tuning and pretraining below about 70B | sections 3, 4 |
| Tensor parallel | A slice of every weight matrix | Four all-reduces per layer, so it needs NVLink-class links and stays inside a node (Megatron-LM) | section 5 |
| Pipeline parallel | A run of consecutive layers | Idle "bubbles" while the pipeline fills; across nodes for 100B and up | section 6 |
| Expert parallel | Some of an MoE model's experts | All-to-all traffic for every token's route (Switch Transformers) | section 7 |
| Context parallel | A slice of a long sequence | For long-context phases: Llama 3 used it at 128K | section 8 |
Memory can also be bounded by scheduling when each tensor must exist rather than by approximating anything. A September 2026 paper does this for the four memory peaks of long-context MoE training (expert dispatch, vocabulary projection, activation checkpoints, optimiser state): the vocabulary projection's peak falls 86.6%, from 79.5 to 10.6 GiB, for 4.4% more time with an exact loss, and the whole stack trains 120B to 667B MoE models at a 1M-token context on 16 to 64 H200s, 8 to 32 times the context of a tuned FSDP2 baseline, a weak baseline and single runs (paper page, arXiv).
A pretraining run is one synchronous program on thousands of GPUs: every step waits for every GPU, so one broken part stops all of them. Each layer of the stack owns one job, and when something breaks they act in a fixed order, bottom to top. Each row names the page that owns it in depth.
| Layer, bottom to top | What it owns | Depth |
|---|---|---|
| Accelerators and fabric | GPUs, NVLink inside a server, InfiniBand, RoCE or EFA between servers. This is what fails: about 78% of Llama 3's unexpected interruptions were confirmed or suspected hardware | Topic: hardware; how the hardware reports a fault on Power, cooling, reliability |
| Collectives (NCCL) | Moving gradients and activations between GPUs; usually the first to notice a failure, because every other GPU is left waiting in a collective | Distributed Training, Launching distributed training |
| Scheduler | Handing out whole servers, all or nothing (every node or none, often called gang scheduling), queues and priorities: Slurm, Kubernetes with an add-on such as Kueue or Volcano, or an in-house one (Llama 3 used Meta's MAST, §3.3.1) | Slurm, Kubernetes for ML, Topic: ml-infra-and-orchestration |
| Launcher | Starting one process per GPU, rendezvous, restarting workers (torchrun's elastic agent) | Launching distributed training |
| Framework | The training loop, the parallel layout, mixed precision and the checkpoint format (table below) | Libraries on top of PyTorch, Distributed PyTorch |
| Checkpoints and storage | Sharded saves (one file per rank) that can be reloaded on a different layout, asynchronous saves. Llama 3's bursty checkpoint writes saturated a 240 PB storage fabric on 7,500 servers that sustains 2 TB/s and peaks at 7 TB/s (§3.3.1) | Storage and data movement |
| Health checks and recovery | Finding the bad machine, replacing it from spares, restarting from the last checkpoint, or continuing without it | Fault tolerance at scale |
| Experiment layer | Metrics, dashboards, alerts, configs and data versions (Weights & Biases, MLflow, TensorBoard) | ML platforms and workflows, Observability and cost |
Frameworks (as of 3 October 2026). Which parallel split to use is on Distributed Training; how each library is used, with code, on Libraries on top of PyTorch. What each brings to running a job:
| Framework | Where it fits |
|---|---|
| Megatron-LM and Megatron Core | NVIDIA's reference for tensor, pipeline, expert, context and data parallelism with FP16, BF16, FP8 and FP4; most frontier-scale codebases trace their kernels and layouts back to it (Megatron-LM paper). Megatron-LM is the reference scripts, Megatron Core the library |
| NVIDIA NeMo | The suite around Megatron Core: data curation, training recipes, RL, evaluation, export; from the 26.02 container, LLM training is documented under Megatron Bridge, which also converts checkpoints to and from Hugging Face (NeMo docs) |
| torchtitan | PyTorch-native pretraining: FSDP2, TP, PP and CP composed on DTensor, torch.compile, MXFP8 and NVFP4, asynchronous Distributed Checkpoint, torchft, replay-based silent-corruption checks, and since August 2026 TitanRL for RL on the same model code. Its paper reports 65.08%, 12.59% and 30% speed-ups at 1D, 2D and 3D parallelism over its own baselines (Liang et al.). The cleanest codebase to learn 4D parallelism from |
| DeepSpeed | The ZeRO family and offload to CPU and NVMe (ZeRO); still common through the Hugging Face Trainer and Accelerate |
| Fine-tuning tier | Hugging Face Accelerate, Trainer, TRL and nanotron; Axolotl. torchtune is no longer maintained: development wound down in 2025 (The future of torchtune) |
| RL post-training | A rollout engine (vLLM or SGLang) beside the trainer, with a weight sync between them: verl, OpenRLHF, SkyRL, NeMo RL, TitanRL. Agentic RL also needs environment sandboxes: DeepSeek's DSec runs about 3 million a day on roughly 160 nodes (DSec). Algorithms on Alignment |
Failures, in three numbers. Over a 54-day snapshot of Llama 3 405B pretraining on up to 16,384 H100s, Meta logged 419 unexpected interruptions, one every 3.1 hours (54 × 24 / 419) derived, and still kept over 90% effective training time (§3.3.4, July 2024). The time between failures belongs to the job, not the hardware: if servers fail independently it is one server's divided by the number of servers, so at Meta's research-cluster rate of 6.50 failures per thousand node-days it is 1.8 hours at 16,384 GPUs and about 14 minutes at 131,072 (Kokolis et al., HPCA 2025). And each checkpoint trades a pause now against lost work later, which gives a best interval of about √(2 × pause × time between failures) (Young 1974, Daly 2006). What a checkpoint weighs follows from the bytes above: the fp32 master weights and Adam's two moments are 12 bytes per parameter, 14 if the bf16 weights are saved too, so a full restart checkpoint of a 405B model is about 4.9 to 5.7 TB, 297 to 346 MB per GPU on 16,384 GPUs derived, inside Llama 3's reported 1 MB to 4 GB per GPU (§3.3.1).
A checklist for a big run, each item owned in depth by the page named:
Pick what you need; each path names its stages, its data, its cost and its usual failure.
In the lifecycle's order. Times are each page's own header: core reading, plus what sits in closed details.
Figures: the loss on every character as a toy trains; loss over model size and tokens, the scaling surface. The objective and how to read the loss; compute and scaling laws (C = 6ND, Kaplan against Chinchilla, why everyone over-trains); data in stages and what the anneal buys; running at scale; open recipes. Tab: Speedrun records. (33 min, plus 4 in closed details)
Holds what the former Continued Pretraining (CPT) page taught (sections 6 and 7): domain adaptation and long-context extension, forgetting, replay ratios, learning-rate re-warming, the CMR and D-CPT mixture laws, a run checklist. Tab: CPT recipes compared. A child of Topic: data-curation-and-datasets. (45 min, plus 23 in closed details)
Figures: eight real Tulu 3 SFT rows in one batch; four answers, six pairs, one score each; one RL step, model by model; one DPO pair; a verifier scores a group of eight. Which tokens SFT learns from and how batching weights them; reward models; PPO and GRPO in the pipeline; DPO and its family; online against offline; RLVR; how open recipes combine the stages. Tab: Method family tree. (33 min, plus 4 in closed details)
Figures: one riddle under best-of-n; where each coding hack cuts into the reward; what the policy can reach. Goodhart made precise; the proxy-against-gold curve, measured; chat-model and coding-agent hacks; detection; mitigations and what defeats each; hacking that generalises into misalignment. Tab: Case gallery. (32 min, plus 11 in closed details)
Figures: LoRA on one real matrix; the real update, direction by direction; one Llama 3 8B block, to scale; training state for full fine-tuning, LoRA and QLoRA; five adapters in one batch. The methods and what each trains; how low a real update's rank is; which matrices to adapt; memory, with a calculator; LoRA against full fine-tuning; DoRA; serving many adapters. Tab: Trainable parameters. (26 min, plus 2 in closed details)
Figures: real logits, softmax at a temperature; forward and reverse KL; the teacher's text against the student's own; Llama 3.1 8B pruned two ways. Soft targets and temperature; the KL direction; whose text the student learns from; distil or RL; pruning then distilling; what makes a good small model. Tabs: Distil a toy student, Small models compared. (24 min, plus 8 in closed details)
Figures: five ways to share a scale; GPTQ on one row; 16 real tokens by 64 channels; one linear layer, three matmuls, one recipe. Number formats; sharing a scale; post-training quantisation (GPTQ, AWQ); outliers, migration and rotation; quantisation-aware training and ternary models; FP8 and NVFP4 training; serving formats and their names. (31 min, plus 10 in closed details)
Figures: Llama 3 8B on one 80 GB H100; five collectives, four GPUs; one feed-forward block, two GPUs; a published layout as a mesh of GPUs. The memory every split fights; the five collectives; data parallel, ZeRO and FSDP; tensor and sequence, pipeline, expert and context parallelism; composing them; activation checkpointing; frameworks. Tab: Layout calculator. (35 min, plus 5 in closed details)
The lifecycle was assembled in about seven years, mostly by papers that changed one stage each. The recipes that put them together in the open, stage by stage, are compared in Open recipes compared.
Pretraining becomes an experiment you can control: T5 fixes one pipeline and moves one choice at a time; denoising beats plain language modelling, cleaned web text (C4, 745 GB) beats eight times more unfiltered text, and multi-task pretraining then fine-tuning only matches plain pretraining (T5). ZeRO and Megatron-LM make models bigger than one GPU trainable.
Scaling laws: loss falls as a smooth power law in parameters, data and compute; the paper's advice to spend compute mostly on parameters was later overturned (Kaplan et al.).
LoRA makes fine-tuning a 35 MB adapter instead of a 350 GB copy (LoRA); RoPE (RoFormer) and top-1 MoE routing (Switch Transformers) arrive.
Chinchilla: grow parameters and tokens together, about 20 tokens per parameter; a 70B model on 1.4T tokens beat the 280B Gopher at the same compute, 67.6% against 60.0% on MMLU (Chinchilla). InstructGPT fixes the three-step recipe (SFT, reward model, PPO with a KL penalty) (InstructGPT); Constitutional AI replaces human harmlessness labels with a model reading 16 written principles (Constitutional AI). FlashAttention (paper).
DPO removes the reward model and the RL loop (DPO); QLoRA fine-tunes 65B on one GPU (QLoRA); LIMA argues 1,000 curated examples suffice for SFT (LIMA).
GRPO drops PPO's critic (DeepSeekMath); Llama 3 publishes the most detailed frontier-scale run, with six rounds of reward model, rejection sampling, SFT and DPO (Llama 3); DeepSeek-V3 trains in FP8; OLMo 2 releases everything, logs included (OLMo 2).
DeepSeek-R1: outcome-only RL on a base model produces long self-checking reasoning, and SFT on 800K of its samples beats RL for smaller models (DeepSeek-R1). Open replications follow; DAPO releases algorithm, data and code, reaching 50 points on AIME 2024 from the Qwen2.5-32B base (GitHub, paper), the runnable baseline for RLVR.
RL moves into environments (MiMo-V2.6, SWE-2, Mercor's 397B run) and its infrastructure gets published (DSec); training data comes from production traffic (NeoHorse-1); and models do part of the research. Anthropic's internal measurements: over 80% of code merged into its production codebase written by Claude by May 2026; the model's research suggestions beating the human choice 64% of the time in April 2026, against 51% in November 2025; Claude leading 26% of its AI research work, with over 30,000 agents active on its most-used internal platform; continuous-integration load up 25 times in six months self-reported (When AI builds itself, measuring the pace). Z.ai reports GLM-5.3 building the inference stack that serves it in 13 days, while saying it has not reached recursive self-improvement because humans kept the objectives (Z.ai). Both labs draw the line in the same place: the loop closes on execution, not on choosing goals. The full series with every check is in the 21 September tech news issue.
The old page listed DAPO among September 2026 results; it was released in March 2025 (the 50-point checkpoint in May 2025). "When AI builds itself" first appeared in early June 2026, and 18 September updated one chart. The model's research suggestions beat the human choice 64% of the time, not "matched"; the "roughly 90% of their work" is the share of work at or above "AI collaborates", not staff time; the 30,000 agents are those on Anthropic's most-used internal platform; and the CI post gives the 10-fold growth of the test suite as a cause of the 25-fold CI growth, not a response to it (checks of 2 October 2026 in the 21 September and 28 September issues).
The stage-specific ones live with their owners: "DPO is RLHF without the downsides" on Alignment, a rising reward on Reward Hacking, "LoRA always matches full fine-tuning" on PEFT, "quantization is free" on Quantization and Precision.
Twenty training recipes that their makers wrote down, from T5 (2019) to MiMo-V2.6-Pro and K2 Horizon (September 2026), on the same stage-by-stage columns: pretraining, mid-training and context extension, supervised fine-tuning, preference tuning, reinforcement learning, distillation, compute and openness. Every cell carries its source, the source's date, and whether the number is published, derived here by arithmetic (formula shown), or unconfirmed. A cell the lab left empty says not disclosed, and is coloured, because which stages a lab stays quiet about is itself the finding.
The patterns these recipes fall into (preference before RL; RL inside the loop with preference inside RL; no RL at all) are read off five of them, as stage strips, in Alignment: SFT, RLHF, DPO Family, RLVR, section 8, "Three patterns."; this tab keeps every cell and its source.
Each row is one recipe; each marker one stage whose token count is stated or derivable, placed on a logarithmic axis so 40 million and 15 trillion fit on one line. Hollow markers are inherited from the base model. Rows follow the filters above.
For each recipe column (openness is always stated, so it is left out), how the rows shown split between published, derived, unconfirmed, inherited, not disclosed and not used. Bars count rows, so they sum to the number of rows shown.
Each recipe's stages in the order its report gives them. Most go pretraining, then SFT, then preference or RL; the exceptions are the interesting part. Rows follow the filters above.
One run's compute laid out to scale, a stage at a time, with the post-training stages magnified underneath. Pick a recipe; for DeepSeek, switch between V3 and R1 to watch two chat models built on the same base; for Olmo 3, between the November release and 3.1's longer RL. Only these three families report compute for every stage, so only they can be drawn; for the price of each run in dollars, see Price list.
Numbers that circulate in summaries, launch coverage or even the reports themselves, against the primary source.
Every training run whose cost has been published or reported, on one log axis, with what it bought and, above all, what the figure includes. A headline price is usually one stage of one run, priced at an assumed GPU rental rate; another is a whole programme with staff. They only compare when they cover the same things, so each figure says what it covers.
The log axis squeezes a factor of a million into a few centimetres. Here the same two prices are drawn as squares whose area is the dollar figure, every other run of that stage nested between them; press play to zoom from the bigger budget down to the smaller one. Below the squares, a like-for-like check says whether the ratio is fair.
The same model, priced again as each excluded cost is added back. Steps marked illustrative use ratios measured on other projects, because the lab never published its own; they show the size of what is missing, not a measurement. Purchases of hardware are a different kind of number (capital, reused for many models) and get their own bar.
Training a dense Transformer costs about six floating-point operations per parameter per token: two for the forward pass (one multiply, one add), four for the backward pass. That gives the rule every lab uses, C ≈ 6ND. The rest of this tab hangs off that one number: how long it takes on real hardware, what it costs to rent, and what the Chinchilla fit says the compute should have bought.
A preset fills these from its configuration. For DeepSeek-V3's MLA the width is h(dqk + dv)/2 = 128 × 160.
Every row is computed at its preset's defaults: the lab's own MFU where it states one, otherwise 40%. Residual is computed over published, minus one. A residual is a fact about the accounting, not an error to tune away: the explanation under the table says where each one comes from. Tap a row's name to load it into the calculator.
Which split of one budget between parameters and tokens is best, and why labs now train far past it, is taught on Pretraining, section 3, "Compute and scaling laws: how big, for how long": the two answers for "Chinchilla-optimal" (Approaches 1 and 2 against Approach 3 and its Besiroglu refit), Kaplan's 2020 rule against Chinchilla's on one budget, and the over-training trade against serving cost (Sardana et al.), each with a slider on the same constants this calculator uses. The fitted loss over model size and tokens, the surface these allocations are read from, is its Fig. 3. This tab keeps the arithmetic for any one run: compute, time and cost, the fits' optimum and loss for comparison, and every preset against what its lab published.
Sources: Kaplan et al. 2020 (arXiv 2001.08361), Hoffmann et al. 2022 (2203.15556), Besiroglu et al. 2024 (2404.10102), each preset's paper or model card (linked in the table), NVIDIA's A100, H100 and HGX datasheets. Repository pages that verify these papers in depth: Scaling Laws, Chinchilla, Llama 3 Herd, DeepSeek-V3, OLMo 2, GPT-3, Qwen3. Every number is recomputed by src/scale/recompute.py, and the page's JavaScript is checked against it.
The comparison lives on the Reading tab; the three data tabs on this page hold the recipes, the prices and the arithmetic of one run; the pages under this one each own one stage or one piece of machinery in depth; how the model itself is built is on Topic: llm-architecture. Links open in a new tab, with reading times.
The fully open training recipes side by side, stage by stage: data, tokens, compute, post-training. Behind Axis 2.
Every disclosed training run with its dollar or GPU-hour figure, and what that figure includes. Behind Axis 3.
FLOPs, GPU-days and rental cost for any model size and token count, checked against what twelve labs published. Behind Axis 3; the allocation itself (Chinchilla against over-training) is taught on Pretraining, section 3.
The eight child pages, each with what it covers and its reading time, are the last section of the Reading tab: The pages under this one.
On 2026-10-18 how an LLM is built moved to Topic: llm-architecture; these two pages, children of this one until then, now live there (same pages, rebuilt).
Now under Topic: llm-architecture. BPE, WordPiece, SentencePiece and Unigram; what current models use, vocabulary size against embedding cost, and how tokenizers fail. (about 42 min)
Now under Topic: llm-architecture. Sinusoidal to RoPE, ALiBi and NoPE, and context extension by RoPE scaling (PI, NTK, YaRN). (about 40 min)
How the model being trained is built: the decoder block, attention variants, mixture of experts, position, normalisation, long context, state-space hybrids, tokenizers, and the parameter, FLOP and KV-cache arithmetic.
The labs and models this lifecycle produces, compared on thinking, serving cost and openness (MoE moved to Topic: llm-architecture). (32 min, plus 6)
The landscape's child on test-time compute in depth: serial against parallel scaling, selectors and verifiers, budgets, and what RLVR produces. (35 min, plus 8)
Reinforcement learning beyond language models. (20 min read · +38h resources)
The RL objectives behind post-training in depth: PPO, GRPO, Dr. GRPO, DAPO, GSPO, KL estimators, hyperparameters. (53 min read)
Where the data axis goes deeper: filtering, mixtures, synthetic data. (35 min read · +7h 40m resources)
How models are judged, including the biases of LLM judges that preference data and experiment selection inherit. (17 min read · +1h resources)
What happens after training: KV cache, batching, quantised serving, and how each token is picked on its child Sampling and Decoding (about 22 min). (43 min read · +7h 30m resources)
The accelerators and interconnects the machinery runs on. (31 min read · +9h 13m resources)
Clusters, schedulers and orchestration around training jobs. (29 min read · +3h 35m resources)
What fails in big runs (every published failure table, checked), detection, recovery designs from requeue to replica groups, silent data corruption, stragglers, goodput accounting. Took over this topic's old Training Infrastructure page with Power, cooling, reliability; the summary is in the Reading tab's Running the job. (40 min read)
Failure rates against cluster size, the checkpoint-interval maths with an exact simulator, power swings, the hardware's error reporting. (28 min read)
Each links to its page in the Papers database, which checks the paper's claims; times are each page's own reading time.
Loss as a power law in parameters, data and compute; then the corrected allocation, about 20 tokens per parameter. (Scaling Laws 17 min, Chinchilla 19 min)
The controlled comparison of objectives, architectures, corpora and fine-tuning schemes; mostly negative results that still hold. (23 min)
Sharded data parallelism and tensor parallelism. (ZeRO 21 min, Megatron-LM 20 min)
Parameter-efficient fine-tuning, and fine-tuning on one GPU. (LoRA 21 min, QLoRA 25 min)
The alignment lineage: RLHF, AI feedback, direct preference optimisation, GRPO, and reasoning from RL. (23, 18, 19, 24 and 35 min)
Rotary position embeddings: attention that depends only on relative distance, with no extra parameters; the base every context-extension method rescales. (22 min)
Top-1 expert routing: parameters grow without a matching rise in FLOPs per token; the origin of expert parallelism. (26 min)
Exact attention computed in tiles that stay in on-chip memory: faster training and memory linear in sequence length. (26 min)
A fully open recipe and the most detailed semi-open account of a frontier-scale run. (OLMo 2 26 min, Llama 3 29 min)
FP8 training at 671B and the most-quoted training bill, with what it includes. (32 min)
Traffic as post-training data, the sandbox layer under agentic RL, bounded MoE training memory, self-improving search, collective agent research, and environments from agent trajectories. (27, 26, 23, 23, 27 and 23 min)
4,000+ scaling experiments distilled into an interactive book; the modern reference for distributed training. (about 8h)
Free and current; the whole post-training pipeline. (about 6h)
Byte-pair encoding from scratch. (2h 15m)
The most complete open pretraining recipe. (about 30 min)
Each is used in the Reading tab; times as recorded when they were first read.
This page's narrated video (made 22 September 2026) sits under it in Notion. It predates DSec, MiMo-V2.6's published RL cost and the frozen-router technique.