Skip to content

19.1 Training lifecycle and learning signals

This part of Choosing Training and Adaptation Methods develops the mechanisms below. Work the numerical examples or trace the code before checking the answer.

Concepts from other sections (14)

This section uses these ideas. Each has a short definition and a link to the section that explains it in full. Tap a dotted term in the text to preview it.

Learning objectives

  • Identify the data and objective for each training stage.

A modern model is made in a fixed sequence of stages, as written down in the Llama 3 report and taught in CS336:

data → pretraining → mid-training → SFT → preference / RL → evals → release

The table below summarizes what each stage does, how big it is, and what learning signal it uses.

StageWhat happensTypical scaleSignal
DataCrawl (Common Crawl), text extraction, language ID, dedup (exact hash + MinHash LSH near-dup), quality filtering (heuristics + classifier, e.g. FineWeb-Edu), PII and toxicity filters, decontamination against evals, tokenizer training (BPE), mixture weights across web/code/math/books/multilingual10s of trillions of raw tokens down to ~15T keptnone (curation)
PretrainingNext-token cross entropy on the mixture, cosine or WSD learning-rate schedule102310^{23} to 1025+10^{25+} FLOPsself-supervised
Mid-trainingAnneal on high-quality data, up-weight code/math, long-context extension (raise RoPE base θ\theta, train on long documents, 8K to 128K+)1-10% of pretraining tokensself-supervised
SFTInstruction→response demonstrations in a chat template10410^4 to 10610^6 examplessupervised
Preference / RLReward model + PPO, or DPO on pairs, or GRPO on verifiable tasks; often several rounds10410^4 to 10610^6 promptspreference / reward
EvalsCapability (MMLU-Pro, GPQA, SWE-bench, AIME), safety, regression vs previous checkpointevery checkpointmeasurement
ReleaseQuantize, convert, write model card, ship weights and serving config

Two of these rows deserve emphasis. First, data is the source code: most of the quality differences between open models trace to filtering and mixtures, not to architecture (FineWeb, free). Second, decontamination is a correctness requirement, not a nicety. A benchmark that leaked into pretraining makes every later evaluation on it meaningless.

Different people own different stages, and it helps to know what each of them will ask you. The research scientist owns objectives, data recipes, ablations, and the post-training algorithm, and asks questions like “What is your KL coefficient and how did you pick it?” The ML engineer owns training and evaluation pipelines, data tooling, checkpoints, and reproducibility: “How do you version data and resume a failed run?” The member of technical staff on performance owns MFU, kernels (FlashAttention, fused optimizers), the parallelism layout, communication overlap, and FP8: “What MFU do you get on H100 for a 70B with TP=8?” And the forward deployed engineer owns a customer’s adaptation, choosing among prompting, RAG, LoRA, and full fine-tuning, building their dataset and evaluation, running the job, and getting it served. Their question is the one the last section of this chapter answers: “Will fine-tuning fix this, how much data, what will it cost, and how do we know it worked?”

At a fine-tuning cloud, customers almost always start from an open base or instruct model, so the deployed engineer’s pipeline is the last three rows of the table. But you cannot reason about those rows without the arithmetic of the first ones, so that is where we start.

Identify the data and objective for each training stage. State the assumptions before applying the result to a different workload.

  1. Why must the evaluation split be fixed before choosing a fine-tune?

    Answer

    Choosing data or hyperparameters using the test split makes that split part of training; reserve it for the final comparison.

Chapter contents · Next: Pretraining compute and scaling