Notes

Knowledge Distillation (LLM)

A small model trained on raw web text and a small model trained to imitate a large one end up in very different places. Knowledge distillation is the second route: a big teacher model supplies the training signal, and a far smaller student learns to reproduce its behaviour.

Two kinds of signal
  • Soft targets. The student matches the teacher's full probability distribution over the next token, not just the single correct one. That distribution says which alternatives were nearly as good, and that shape carries far more information than a one-hot label.
  • Generated sequences. The teacher writes answers — explanations, reasoning, code — and the student is fine-tuned on them as ordinary instruction data. This is how most compact instruction-tuned models are actually built, since it needs no access to the teacher's internals.
Why it pays at this scale

A large model has already done the expensive work of turning messy text into clean, well-formed answers. Distillation transfers that polish instead of rediscovering it, so a few-billion-parameter student can hold a sensible conversation after training on a corpus a fraction of the original size. DistilBERT made the case early; the pattern now runs through most small open-weight releases.

What you give up

The student inherits the teacher's mistakes and biases along with its style, and cannot exceed it where it is wrong. Capability narrows: distilled models hold up on the tasks the distillation data covered and drop off outside them. The teacher's licence usually has something to say about training on its output.

Knowledge distillation trains a small student model to reproduce the behaviour of a large teacher, either by matching the teacher's full next-token probability distribution or by fine-tuning on text the teacher generated. It is the standard way to reach usable quality at a serving cost the large model cannot meet, and it underpins most compact instruction-tuned releases. The student inherits the teacher's errors and holds up best on tasks the distillation data covered.

A master cook can write recipes for an apprentice. The apprentice has none of the master's thirty years of tasting, but with good enough recipes they turn out dishes most diners cannot tell apart. Knowledge distillation works like that. A very large language system answers hundreds of thousands of questions, and a much smaller one is trained on those answers rather than on the whole internet. The small model ends up writing in a similar style and handling similar requests, while being cheap enough to run on a phone or a single computer. It also copies the big model's mistakes.