← Contents Volume X · Lecture 22

Volume X · After Pretraining

22

The Student Becomes the Teacher

DeepSeek-R1 is a 671-billion-parameter model that thinks for thousands of tokens before it answers. Serving it takes a cluster. So DeepSeek did something that looks too simple to work: it had R1 write out about 800,000 solutions, and fine-tuned small models on them.

The mental model

Reasoning is a behaviour, and a behaviour can be shipped as data. A large model that has learned to reason writes the lessons; a small model studies them. The lesson lands better when the student practises on its own mistakes — and when several students share an ancestor, their weights can sometimes simply be combined.

Too big to serve

R1 is a mixture of experts with 671 billion parameters in total and 37 billion active per token. At one byte per weight, the arithmetic of Volume VIII, that is about 671 gigabytes before a single token of cache — a multi-accelerator node, not a card. And it is a model that answers at length: one reply can run to thousands of reasoning tokens. Most people who want a reasoning model want one that fits on a single device and answers at a reasonable price.

There are two routes to a small reasoner. Run the R1-Zero recipe of the last lecture on a small base model, and let RL discover the behaviour. Or let R1 do the discovering, write down how it solves problems, and train the small model to write the same. DeepSeek ran both on a 32-billion-parameter Qwen base and reported the comparison.

AIME 2024 PASS@1 · 32B MODELS · AS REPORTED BY DEEPSEEK R1-Zero recipe on Qwen-32B 47.0 QwQ-32B-Preview 50.0 R1-Distill-Qwen-32B 72.6 0 50 100 vermilion = learned from R1's written solutions, with no RL stage of its own
Figure 22a Same size, same benchmark, same laboratory's measurements. RL on the small model's own samples reached 47.0; supervised fine-tuning on R1's samples reached 72.6. A comparison inside one report is a claim by its authors, not an independent result.

DeepSeek's own reading is two-sided. Distilling a stronger model into a smaller one works well, whereas a small model doing large-scale RL needs a great deal of computation and may still fall short of what distillation achieves. And the same passage concedes that pushing past the frontier probably still requires stronger base models and larger-scale RL. Put as a division of labour: RL discovers, distillation transmits. Discovery is a search, which is expensive and bounded by what the base model can already be induced to sample. Transmission needs only text.

Eight hundred thousand lessons

The recipe is plain. The roughly 800,000 samples that R1's pipeline curated for its own stage 3 — about 600,000 reasoning examples and 200,000 other ones — were used, unchanged, to fine-tune open models. Six students: four from Qwen2.5 and two from Llama. The students got supervised fine-tuning and nothing else. DeepSeek says explicitly that it applied no RL stage to them, though it expects RL would help, and left that to others.

TEACHER THE DATASET SIX STUDENTS DeepSeek-R1 writes lessons ~800k samples of text ~600k reasoning ~200k other no logits kept Qwen2.5-Math-1.5B Qwen2.5-Math-7B Qwen2.5-14B Qwen2.5-32B Llama-3.1-8B Llama-3.3-70B-Instruct SFT only · no RL stage for any student
Figure 22b What crosses from teacher to student is text and nothing else. The Qwen and Llama students use different vocabularies from each other and from the teacher, and it does not matter, because no probabilities are exchanged.

“Distillation” names two different things, and this one is the less famous. Hinton, Vinyals and Dean (2015) trained a student to match the teacher's softened output distribution, which needs the teacher's probabilities. Kim and Rush (2016) showed the sequence-level alternative: train the student on text the teacher generated. R1's distillation is of the second kind. It has a practical consequence that matters more than it sounds: it works across tokenizers and architectures, and against any teacher you can sample from, because the student only ever reads sentences.

The six students, and the teacher, on AIME 2024 (pass@1, as reported by DeepSeek)
ModelFine-tuned fromAIME 2024
R1-Distill-Qwen-1.5BQwen2.5-Math-1.5B28.9
R1-Distill-Qwen-7BQwen2.5-Math-7B55.5
R1-Distill-Llama-8BLlama-3.1-8B50.4
R1-Distill-Qwen-14BQwen2.5-14B69.7
R1-Distill-Qwen-32BQwen2.5-32B72.6
R1-Distill-Llama-70BLlama-3.3-70B-Instruct70.0
DeepSeek-R1 (the teacher)DeepSeek-V3-Base79.8

Practising on your own mistakes

Fine-tuning on a teacher's text has a quiet flaw. Every token the student learns to predict is conditioned on a prefix the teacher wrote. At test time the prefix is the student's own, and the first slip carries it into a state no training example showed — the teacher never demonstrated recovering from an error because the teacher did not make one. This is exposure bias, and imitation learning had a name for the cure long before language models needed it. Ross, Gordon and Bagnell's DAgger (2011) lets the learner act, then asks the expert what it should have done in the states the learner actually reached.

On-policy distillation is DAgger for sequences. Agarwal et al.'s generalised knowledge distillation (ICLR 2024) trains the student on its own generated outputs, with the teacher scoring them, and lets the loss be a divergence other than forward KL when the student lacks the capacity to match the teacher exactly. The recent formulation from Thinking Machines (October 2025) makes the connection to RL concrete: sample from the student, and let the teacher grade every token.

On-policy distillation as a per-token reward (Thinking Machines, 2025) sample a sequence from the student
rewardt = − ( log π_student(x_t | x_<t) − log π_teacher(x_t | x_<t) )
expected over samples, this is −KL( π_student ‖ π_teacher ) — the reverse KL, summed over positions

Reverse KL punishes the student for putting probability where the teacher puts little, so a small student learns to commit to behaviours it can actually reproduce instead of smearing itself across ones it cannot. The loop reuses an RL training pipeline; only the reward changes, and it needs the teacher's log-probabilities rather than a verifier or a reward model.

TEACHER WRITES THE SEQUENCE STUDENT WRITES THE SEQUENCE DENSE feedback on every token SPARSE one number per answer SFT on teacher text R1's 800k-sample set states it may never visit on-policy distillation student writes, teacher grades each token — RLVR · GRPO Lecture 21: one reward for a whole answer dense feedback, on the student's own states
Figure 22c The lecture's whole argument about training signal fits in one grid. RL visits the right states but says almost nothing about them; SFT says a great deal about states the student may never reach; on-policy distillation does both.

There is one published comparison worth holding up to the light. The Qwen3 report describes a two-phase strong-to-weak distillation for its five small dense models and its 30B-A3B mixture of experts: first off-policy distillation on teacher outputs, then on-policy distillation, in which the student generates and its logits are aligned to a larger Qwen3 teacher. For Qwen3-8B the report tabulates, after the off-policy phase, a further RL stage reaching 67.6 on AIME'24 at 17,920 GPU hours, against 74.4 for on-policy distillation at 1,800 GPU hours — about a tenth of the compute. The Thinking Machines write-up cites the same pair of numbers, reports a 9 to 30 times compute reduction against SFT in its own reasoning experiment, and says its replication of the RL baseline reached 68%.

Hold those figures loosely. They are one model size on one pair of benchmarks, and the two sides are not given equal information: the distillation run has a much larger teacher grading it, while the RL run has only a verifier. Part of the saving is simply what a bigger teacher buys. What the comparison does establish is that dense per-token feedback on the student's own samples is a serious competitor to RL at this scale, which is why it is spreading. DeepSeek-V4 is reported to lean on on-policy distillation from a fleet of specialist teachers unconfirmed, a claim this course can date but not verify from a primary paper; Lecture 24 returns to it.

Combining models without training

Distillation moves knowledge through data. There is a cruder route that moves it through the weights themselves, and it works more often than it has any right to. Start from the observation that the checkpoints in this part were mostly not trained from scratch: a math fine-tune and a code fine-tune of the same base model began from identical weights and moved a modest distance. If both stay inside one low-loss region of weight space, a point between them, or a point beyond them along both directions, may be a perfectly good model.

Model soups (Wortsman et al., 2022) are the simplest case: take several fine-tunes of one pretrained model, differing in hyperparameters, and average their weights. For large pretrained models that fine-tune into a similar low-error region, the paper reports the average often beats the best single member, and, unlike an ensemble of models, costs nothing extra at inference. Task arithmetic (Ilharco et al., 2023) generalises the idea. Define a task vector as the fine-tuned weights minus the pretrained weights. Vectors can be added to combine abilities, negated to suppress one, and scaled by a coefficient chosen on held-out data.

SHARED LOW-LOSS REGION base math fine-tune code fine-tune merged soup τ math τ code merged = base + λ · ( τ math + τ code ) · soup = plain average of the fine-tuned weights
Figure 22d A drawing in two dimensions of a space with billions. The soup sits between its ingredients; task arithmetic walks past them, along the sum of what each fine-tune changed. Both bet that the region around the base is smooth enough to cross.

The bet fails when the changes collide. Two fine-tunes may push the same parameter in opposite directions, and most of what each one changed may be noise. TIES-Merging (Yadav et al., 2023) addresses both: reset parameters that moved only slightly, resolve the sign each parameter should take across models, and average only the entries that agree with it; the authors report that sign interference matters most. DARE (Yu et al., 2024) attacks the same redundancy differently: drop a random proportion p of each fine-tune's changes and rescale the survivors by 1/(1 − p). The authors report that the changes are small and redundant enough that 90% or even 99% can be dropped with little loss.

What merging cannot do

Merging adds no knowledge that no ingredient had; it interpolates, or extrapolates a little, among abilities already present. It asks for the same architecture, and in practice the same pretrained starting point, because independently trained networks are not aligned unit for unit. Git Re-Basin (Ainsworth et al., 2022) shows that permuting hidden units can align some independently trained networks well enough to merge them, but that result is for small vision models and not a routine way to combine language models. And the coefficient λ is tuned on a validation set, so a merge is a model selected on that data, to be evaluated on other data.

In production, the best-documented use is modest. Meta's Llama 3 report describes averaging models obtained from experiments with different data and hyperparameters at the reward model, SFT and DPO stages. Outside the laboratories, the open-source toolkit MergeKit packages these methods, and its authors report that thousands of merged models have been published. Whether a given 2026 flagship merges anything is rarely stated, which makes it a good question for the next lecture.

Where the part lands

Follow the part from the start. Volume IX was about keeping a very large run from blowing up, and getting more out of each token. This volume began with a base model that predicts text and ended with several ways of making it behave. Reinforcement learning against a checker turns a base model into a reasoner, at the price of a model that is expensive to run. Distillation spreads that reasoning down the size ladder, first as text and then, more efficiently, as per-token feedback on the student's own attempts. Merging recombines what the training runs produced without spending another GPU-hour.

The post-training toolkit of Volume X
TechniqueWhat it needsWhat it givesLecture
RLVR with GRPOA base model, a verifier, many samples per questionA reasoner; long answers; expensive to serve21
Cold start, rejection sampling, SFTA strong checkpoint to sample fromReadable, stable traces, and a curated dataset21
Sequence-level distillationTeacher-sampled text onlyA small reasoner; ceiling is the teacher22
On-policy distillationTeacher log-probabilities on student samples; an RL-style loopDense feedback on the student's own states22
Model mergingModels fine-tuned from one base; a validation set for λOne set of weights combining several, with no further training22

Every row of that table is also a question a technical report either answers or declines to answer. The fifth question of the checklist in the next lecture asks what the post-training recipe is and what it was optimised against. You can now parse that sentence. A verifier or a learned judge. A critic or a group baseline. Distilled from whom, and on whose samples. Merged or not. The reports differ most in how much of that they say.

Read the primary source

❦