Open Source Special Topic · How Large Models Get Smaller

How Distillation Works: From Teacher to Student

The last lesson covered why you'd want a smaller model. This one covers how. The process is plainer than you might expect: have the teacher answer questions, record how it got there, and train the student on that material. The difficulty isn't in the pipeline — it's in the details.

Five Steps, Start to Finish
1

Assemble the question set

Collect questions that cover the target domain. You can curate them by hand or have a model generate them. This step sets the ceiling on what the student can do: whatever domain you never ask about, the student never learns.

2

The teacher answers, and you keep the full reasoning

The word that matters is "full." Keep only the final answer and the student just memorizes conclusions; keep the intermediate reasoning chain and it has a chance to learn how to think. That is also why reasoning models make particularly good teachers — they already write their thinking out.

3

Take the probability distribution, not just the final answer

Every time the model emits a word, what exists inside it is a full probability table over candidate words. Taking only the top entry throws away a lot of information; keeping the whole table transfers a completely different amount. The next section expands on this.

4

Train the student on that material

The training data has three parts: the original questions, the teacher's complete answers, and the probability distribution at every step. The student's objective is to bring its own output distribution as close as it can to the teacher's.

5

Evaluate and iterate

Measure how far the student is from the teacher on a test set, then go back and adjust the question set's coverage and the training configuration. This usually takes several rounds.

Why Step 3 Matters

Say you have an image classification question where the correct answer is cat. Conventional training tells the model: cat is right, everything else is wrong. Distillation hands the teacher's judgment to the student as-is.

Hard labels
How conventional training does it
CatRight
DogWrong
RabbitWrong
Dog and rabbit are both marked wrong, equally wrong. The fact that "a dog is fairly close to a cat, a rabbit is far off" is lost completely.
Soft labels
How distillation does it
Cat72%
Dog20%
Rabbit8%
Besides knowing the answer is cat, the student also learns how near or far the teacher considers these three to be. Same question, far more information carried.
In one sentence: hard labels tell the student the answer; soft labels also tell it how the teacher weighed the options. A single pass of training conveys several times as much, and that is the fundamental reason distillation costs less than training from scratch.
Temperature: Softening the Distribution

There is one more trick involved in practice. If the teacher is too confident, its probability distribution comes out very sharp — something like 98% / 1% / 1% — which is not much different from a hard label, so the advantage of soft labels never shows up.

The fix is to divide by a number T when computing the probabilities, the temperature. The larger T is, the flatter the distribution, and the clearer the relative relationships between words become. This is the same mechanism as the Temperature covered in Part 2, just used for a different purpose: there it was to make output more varied, here it is to pass more information along to the student.

This is the hardest part of the section to picture in the abstract, so here it is to drag directly. Below is the judgment a teacher gives when it looks at a photo of a cat, and T is yours to set.

Drag T slowly from the far left to the right, keeping your eyes on the Dog and Rabbit rows.
Temperature T T = 1
A Real Distillation Output

The pipeline on its own stays abstract. Here is a public example: when DeepSeek released R1 in January 2025, it also open-sourced six distilled models, all trained on reasoning data generated by R1.

DeepSeek-R1-Distill-Qwen-1.5BQwen2.5 base
DeepSeek-R1-Distill-Qwen-7BQwen2.5 base
DeepSeek-R1-Distill-Llama-8BLlama3 base
DeepSeek-R1-Distill-Qwen-14BQwen2.5 base
DeepSeek-R1-Distill-Qwen-32BQwen2.5 base
DeepSeek-R1-Distill-Llama-70BLlama3 base
Source: the DeepSeek-R1 official repository model card and GitHub notes, which read "open-source distilled 1.5B, 7B, 8B, 14B, 32B, and 70B checkpoints based on Qwen2.5 and Llama3 series." Published 2025-01-20, verified 2026-08-07.

One detail in this list deserves attention: the students are not built on DeepSeek's own base models — they were picked from other companies' open-source releases. Four of the six use Qwen2.5, two use Llama3.

DeepSeek never explained the choice, but you can work backwards to a few requirements. The base has to ship open weights under a license that permits further training, or you cannot release what you build. The size range has to be complete enough to cover everything from 1.5B up to 70B in one pass. And the community tooling has to be mature, so training and deployment do not mean rebuilding the wheel. Not many options met all three at the time.

Why this deserves its own section: what a vendor says about its own openness can be inflated, but another company choosing to build its flagship result on your base model is a vote cast with real compute budget. Watching what third parties pick is more reliable than reading official descriptions.
How Well Does It Actually Work

In the evaluations DeepSeek published, the 32B distilled version beat OpenAI o1-mini on several math and code benchmarks, and the company described it as reaching a new best result among the dense models of that period.

Keep your guard up here. When the community reproduced these results on its own test sets, the numbers did not always match the official ones, and some developers reported that real use fell short of the claimed level. That does not necessarily mean anyone faked anything; the more common causes are differences in benchmark selection, prompt wording, and sampling parameters. The conclusion is the usual one: official scores are only a reference, and before you actually use a model, run your own task through it.
Official evaluation figures come from the DeepSeek-R1 release notes; the disagreements over community reproductions can be found in public discussions such as r/LocalLLaMA. Verified 2026-08-07.

That covers most of what distillation buys you: cheap, fast, able to run locally. The next lesson covers the cost. The student learns everything the teacher has, including the teacher's bad habits.