Skip to content

Pretraining

Skip →BPE (subword units)

This section explains how a frontier model is built: scaling laws, data, architecture, optimizers, and the tech reports that combine them. It is for researchers who want to read a 2026 model report and know where each design choice comes from. How a trained model works and is used (attention, long context, inference) lives in LLM Foundations.

There are two stages:

  • Stage 1 is the main track: tokens, the compute budget, data, the MoE and attention choices in current models, the optimizer, how training is split across GPUs, and three fully documented tech reports.
  • Stage 2 is for following current reports: scaling past Chinchilla, hyperparameter transfer, data mixtures, learning-rate schedules and mid-training, linear-time and hybrid layers, FP8, MoE training in practice, and two 2026 reports.

Both stages are reading; nothing requires you to train a model. The post-training sections of the reports belong to RL and Agents, so skip them here. The rest of the sidebar is optional depth.

Stage 1 · Main track · 10 numbered items · about 9 h of reading. Optional reading is under Optional deep dives below.

  1. BPE (subword units)paper · ~25 minSennrich, Haddow and Birch adapt byte-pair encoding to learn a subword vocabulary by repeatedly merging the most frequent adjacent symbol pair, giving open-vocabulary neural translation and the basis of most LLM tokenizers.
  2. Chinchilla (compute-optimal)paper · ~55 minHoffmann et al. (Chinchilla) fit over 400 training runs three ways and find that parameters and training tokens should grow in equal proportion with compute, about 20 tokens per parameter, so most large models of the time were under-trained.
  3. FineWeb & FineWeb-Edupaper · ~55 minPenedo et al. build a 15T-token English web corpus from 96 Common Crawl snapshots, ablating every extraction, filtering and deduplication step with small models, and then distil Llama-3-70B educational-quality judgments into a cheap classifier to produce the 1.3T-token FineWeb-Edu.
  4. DeepSeekMoE (fine-grained + shared)paper · ~50 minDeepSeekMoE splits each expert into several smaller ones and activates proportionally more of them, and isolates a few always-on shared experts, so routed experts specialise more and waste fewer parameters on common knowledge.
  5. MLA (DeepSeek-V2 latent attention)paper · ~60 minDeepSeek-V2 introduces Multi-head Latent Attention (MLA), which caches one low-rank latent vector plus a small shared RoPE key per token instead of per-head keys and values, cutting the KV cache to a few percent of multi-head attention without losing quality.
  6. Muon (and Moonlight)blog · ~55 minKeller Jordan's Muon replaces each hidden-layer momentum update with an approximately orthogonalized version, computed by five Newton-Schulz steps; Moonshot's Moonlight paper adds weight decay and per-shape update scaling and finds it needs about half the training FLOPs of AdamW at LLM scale.
  7. Parallelism (Ultra-Scale Playbook)book · ~60 minHugging Face's Ultra-Scale Playbook explains how to fit and speed up LLM training on GPU clusters. It covers memory accounting, data parallelism with ZeRO/FSDP sharding, tensor and sequence parallelism, context parallelism with Ring Attention, pipeline schedules and their bubble, expert parallelism, and how to combine all five into one layout. It uses Megatron-LM, ZeRO and Ring Attention for the underlying equations.
  8. Llama 3paper · ~60 minMeta's dense 8B / 70B / 405B models on 15.6T tokens. A deliberately simple architecture, scaling laws that predict benchmark accuracy, staged long-context training and a 6-round SFT + DPO post-training loop.
  9. DeepSeek-V3paper · ~60 minA 671B-parameter MoE with 37B active per token, trained on 14.8T tokens in FP8 for 2.788M H800 GPU-hours. MLA, auxiliary-loss-free balancing, multi-token prediction and R1 distillation in one recipe.
  10. OLMo 2 / Olmo 3paper · ~55 minAI2's fully open 7B–32B models, with weights, data, code and logs released. OLMo 2 adds stability fixes, mid-training on Dolmino and checkpoint souping; Olmo 3 adds sliding-window attention, long-context extension and thinking models.
  • Tokens and budget (1–2). BPE explains what a “token” is in every count that follows. Chinchilla shows how to split a compute budget between parameters and tokens (about 20 tokens per parameter); every later choice is made under this budget.
  • Data (3). FineWeb & FineWeb-Edu: where the tokens come from. Its model-based quality filter is a relevance classifier by another name.
  • Architecture (4–5). DeepSeekMoE cuts compute per token with fine-grained and shared experts; MLA cuts KV-cache memory by caching a latent instead of keys and values. MLA assumes GQA and RoPE (both on the LLM main track).
  • Training (6–7). Muon is the optimizer behind Kimi’s models and, in variants, several 2026 reports; read AdamW first if it is not familiar. Training at scale explains memory per parameter and how data, tensor, pipeline, context and expert parallelism split a run across GPUs, which is the vocabulary of every report’s infrastructure section.
  • Three reports (8–10), read as diffs. Llama 3 is the most complete account of a dense recipe (data, scaling-law fits, annealing, infrastructure). DeepSeek-V3 is the template that combines MoE, MLA, multi-token prediction and FP8. OLMo is fully open, so every data and training choice can be checked.

Start Stage 2 after Stage 1. It explains the choices you will meet in 2025–26 reports that Stage 1 only names. Where an item is marked section, read only that part.

Ready for Stage 2? Check that you can do these without looking anything up. If not, reread the Stage 1 page in brackets.

  • Compute a Chinchilla-optimal model size and token count for a given FLOP budget, using C ≈ 6ND (Chinchilla).
  • Explain shared vs routed experts and what load balancing prevents (DeepSeekMoE).
  • Estimate the training memory per parameter for mixed-precision Adam (training at scale).
  • Name the main stages of a modern pretraining run, including annealing (Llama 3).

Stage 2 · Frontier · 12 numbered items · about 8.5 h of reading. Optional reading is under Optional deep dives below.

  1. Data-constrained scalingpaper · ~50 minMuennighoff et al. run over 400 training runs with repeated data and fit a scaling law in which each extra epoch is worth exponentially less, finding that up to about four epochs are almost as good as fresh data and that value fades after about sixteen.
  2. Over-training scaling lawspaper · ~30 minGadre et al. train 104 models and show that scaling laws stay predictable when models are trained far past the Chinchilla point; the token-to-parameter ratio shifts the loss curve without changing its slope, and loss in turn predicts average downstream error.
  3. μP / μTransferpaper · ~30 minYang, Hu et al. show that under the Maximal Update Parametrization (μP) the best hyperparameters stay roughly fixed as a network gets wider, so they can be tuned on a small proxy and copied to the large model (μTransfer).
  4. DCLMpaper · ~55 minLi et al. turn pretraining-data curation into a controlled benchmark with a 240T-token Common Crawl pool, fixed training recipes at five scales and 53 evaluations, and find that a bigram fastText classifier trained on instruction-style positives is the best quality filter they tested.
  5. Data mixtures (DoReMi, RegMix)paper · ~45 minHow to set pretraining domain weights without training many full-size models. DoReMi learns weights with a Group DRO proxy, RegMix regresses loss on mixtures from hundreds of tiny proxy runs, and data mixing laws fit a functional form for loss as a function of the mix.
  6. LR schedules, WSD and mid-trainingpaper · ~50 minWhy LLM pretraining warms up, why cosine decay ties every checkpoint to a pre-chosen length, and how warmup–stable–decay (constant LR plus a short cooldown) fixes that. Covers the river-valley explanation for the cooldown loss drop, cooldown length and shape, cheap scaling-law sweeps by branching cooldowns, re-warming for continual pretraining, mid-training anneals on high-quality data, and checkpoint averaging.
  7. Mamba (selective SSM)paper · ~60 minGu and Dao make the parameters of a state space model depend on the input, which lets a recurrent model choose what to remember, and use a hardware-aware parallel scan so that it trains fast and decodes in constant memory, matching Transformers on language at up to 3B scale.
  8. Gated DeltaNetpaper · ~30 minYang, Kautz and Hatamizadeh combine Mamba2's decay gate, which can quickly erase memory, with DeltaNet's delta rule, which overwrites one key's value precisely, into a linear-time recurrent layer that beats both and forms the basis of attention hybrids.
  9. FP8-LMpaper · ~20 minMicrosoft's FP8-LM extends FP8 beyond matrix multiplies to gradients, optimizer states and distributed communication. It cuts Adam's state from 16 to 6 bytes per parameter, and on GPT-175B with H100s uses 39% less memory and trains 75% faster than BF16 Megatron-LM with matching accuracy.
  10. MoE Training Handbook (HF)section · ~45 minChapters 1–6: routing, load balancing, expert layout, training stability and systems costs.Hugging Face's practical guide to training a Mixture-of-Experts model in Megatron-LM, one setting at a time. It covers router scoring, load balancing, expert shape, block layout, optimizer and stability, and the systems cost of the all-to-all, then follows the model into serving and RL. Each choice comes with a signal to watch and, where possible, a measured run.
  11. DeepSeek-V4paper · ~60 minDeepSeek's 1M-context MoE pair, which compresses the KV cache with hybrid CSA/HCA attention, widens the residual with mHC and trains with Muon.
  12. Qwen3.8-Flash-Nextsection · ~25 minKey idea only: hybrid Gated DeltaNet + attention layout at frontier scale.Qwen's 125B-total / 6B-active MoE that mixes Gated DeltaNet with sparse attention (QSA), widens the residual with a gate and adds a 51B n-gram table off the GPU. It matches a 397B predecessor at about 1/9 of the training FLOPs.
  • Scaling beyond Chinchilla (1–3). Data-constrained scaling asks what repeated epochs are worth when unique tokens run out. Overtraining laws explain why deployed models train far past the compute-optimal point. μP transfers hyperparameters from a small proxy to the full model.
  • Data and schedule (4–6). DCLM is the second quality-classifier recipe and a benchmark for data choices. Data-mixture optimization (DoReMi, RegMix) picks domain weights with small proxy runs. Learning-rate schedules and mid-training explain WSD, cooldowns and the high-quality annealing phase every recent report uses.
  • Beyond attention (7–8). Mamba replaces attention with a selective recurrent state; Gated DeltaNet is the linear-attention layer current hybrids use.
  • Precision and MoE in practice (9–10). FP8-LM covers low-precision training; the MoE handbook chapters cover routing, load balancing and the all-to-all costs with measured numbers.
  • 2026 reports (11–12). DeepSeek-V4 and the hybrid layout of Qwen3.8-Flash-Next show the Stage 2 ideas combined at frontier scale.
  • Optional companions. GLM-5 and MiMo-V2-Flash (mostly post-training; read them from the RL and Agents tracks), Native Sparse Attention, multi-token prediction and the tech reports hub.
  • Read 1 · Scaling laws & compute further if you need to plan a training run or argue about emergence: start with Kaplan scaling laws (the curves Chinchilla revised), then read Emergent abilities with Emergence: a mirage? as a lesson about metrics.
  • Read 2 · Data & tokenization further if you build or filter a corpus: start with Dolma; SentencePiece is the other tokenizer family.
  • Read 3 · Architecture further if a report’s architecture section loses you: start with Multi-token prediction and Aux-loss-free balancing (both inside DeepSeek-V3), then Native Sparse Attention for the attention layers in newer hybrids; Switch Transformers and Mixtral give the MoE history. To actually train an MoE, read the MoE Training Handbook (router, load balancing, expert design and the all-to-all systems issues, with measured numbers). Recycler, inspired by multi-token prediction, adds the previous token’s final hidden state to the next embedding through a learned adapter.
  • Read 4 · Optimization & precision further if you train models yourself: AdamW is the baseline Muon is compared with; FP8-LM (Stage 2) covers low-precision training.
  • Read 5 · Model tech reports further if you want to follow current open models. How to read them: start with the hub How to read model tech reports, which says which sections to read in what order, lists red flags in vendor-reported numbers, and compares the post-training recipes of 15 reports side by side. Then read DeepSeek-V3.2 (the sparse attention GLM-5 reuses, plus agentic task synthesis), Kimi K3 or MiMo-V2.6, and DeepSeek-V4. Ripple-65B Preview is a small-team dense model with a published account of a sequential recipe ladder, and Inkling 2 Small reports the scale and task mix of one large joint RL run, though not the full recipe.
All pages by group
GroupPages
1 · Scaling laws & computeKaplan scaling laws · Chinchilla · Data-constrained scaling · Over-training scaling · Emergent abilities · Emergence: a mirage? · μP
2 · Data & tokenizationBPE · SentencePiece · FineWeb · DCLM · Dolma · Phi-4 (synthetic data)
2 · Data & tokenization · optional multimodal depthKVAE-3.0: continuous image/video/audio latents
5 · Model reports · optional November releaseGigaChat 4 & 3.5 Omni
3 · ArchitectureSwitch Transformers · Mixtral · DeepSeekMoE · Aux-loss-free balancing · MoE Training Handbook (HF) · MLA · Multi-token prediction · Recycler · Mamba · Gated DeltaNet · Native Sparse Attention · SCONE · Looped transformers (Nov 2026 wave)
4 · Optimization & precisionAdamW · Muon · FP8-LM · End-to-end 4-bit, distillation optimizers & GDN-2
5 · Model tech reports (open & frontier)How to read tech reports (hub) · Llama 3 · DeepSeek-V3 · DeepSeek-V3.2 · OLMo 2 / 3 · 📌 DeepSeek-V4 · 📌 DeepSeek-V4.1-Flash · 📌 MAI-Thinking-1 · 📌 Qwen3.8-Flash-Next · Qwen3 · Kimi K2 · Kimi K3 (+ K2.5) · GLM-4.5 · GLM-5 · MiMo-V2-Flash · MiMo-V2.6 · MiniMax-M1 · MiniMax-M2 · gpt-oss · Gemma 3 / 4 · Nemotron-H · Ripple-65B Preview · Inkling 2 Small · Inkling 2 Mini · Reflection Beam 501B · K2-Horizon · Tencent Hy4 & Hy4 flash · ERNIE-5.5-Flash-Base
Full reading path (includes optional pages)
  1. Scaling: Kaplan → Chinchilla → data-constrained and over-trained regimes. Read the emergence debate as a lesson about metrics, which every IR evaluator will recognise.
  2. Data: FineWeb and DCLM. Their model-based quality filters are relevance classifiers by another name.
  3. Architecture: Switch → Mixtral → DeepSeekMoE → MLA → multi-token prediction, then the linear-attention and SSM alternatives.
  4. Optimization: AdamW → Muon → FP8 training.
  5. Reports: read Llama 3 and DeepSeek-V3 in depth. Read OLMo for fully open science. Then read the 2026 reports as diffs against these, using the tech-report hub for what to read in each.

Questions to think through

These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.

  1. Derive / compute

    Using C ≈ 6ND and a hypothetical budget of 1e23 training FLOPs, find the model size and token count at about 20 tokens per parameter. Then compute the tokens a model 4× smaller could train on with the same budget, and explain why a lab serving heavy query traffic might prefer it.

    What a strong answer covers
    • With D = 20N, C = 120N², so N = √(1e23 / 120) ≈ 2.9e10 (about 29B parameters) and D ≈ 5.8e11 (about 580B tokens).
    • A 4× smaller model (about 7.2B) gets D = 1e23 / (6 × 7.2e9) ≈ 2.3e12 tokens, about 320 tokens per parameter.
    • Chinchilla optimises loss for a fixed training budget only; the smaller model reaches a somewhat higher loss for the same training compute but costs about 4× less per generated token (about 2N FLOPs per token).
    • At high query volume, inference dominates lifetime compute, which is the regime the over-training scaling laws address; repeated data limits how far this can go (data-constrained scaling).
  2. Mechanism

    MoE layers (Mixtral, DeepSeekMoE), MLA and linear-attention or state-space layers (Mamba, Gated DeltaNet) each attack a different cost. For each, name the cost it reduces, what must still be stored, and the main trade-off; then explain why recent reports mix several of them.

    What a strong answer covers
    • MoE: a router sends each token to a few experts, so FLOPs per token follow active parameters, but every expert must be stored and routing must be balanced.
    • MLA: caches a small latent vector per token instead of full per-head keys and values, shrinking the KV cache; decoding does more arithmetic per cached token, and RoPE needs a decoupled path.
    • Mamba and Gated DeltaNet: a fixed-size recurrent state replaces the growing cache, giving linear time in sequence length, at the price of weaker exact recall of arbitrary past tokens.
    • The costs are separate axes (compute per token, cache memory, attention time), so hybrid designs keep some full-attention layers for recall and use MoE for capacity.
  3. Design

    FineWeb-Edu and DCLM filter web text with a learned quality classifier. As an IR researcher, design such a filter for a large pretraining pool as a ranking problem: where labels come from, the classifier, the cut-off, how you evaluate it, and which failure modes you check.

    What a strong answer covers
    • Labels: positives from a reference set (DCLM uses OpenHermes-2.5 instructions and top ELI5 posts against random pool documents) or LLM judgments distilled into a cheap scorer (FineWeb-Edu uses Llama-3-70B educational scores).
    • Classifier: something cheap enough to score the whole pool, such as a bigram fastText model or a linear head on frozen embeddings.
    • Cut-off: a precision-recall choice; a strict threshold shrinks unique data, and repeated epochs lose value beyond about four (data-constrained scaling).
    • Evaluation: train small proxy models at a fixed token budget on each filtered pool and compare on a fixed benchmark suite, with several seeds.
    • Failure modes: loss of diversity or of whole domains (code, other languages), bias toward the reference style, and benchmark contamination through positives that resemble test sets.