Bookmarks

Knowledge distillation

A training method in which a small student model picks up the behaviour of a large teacher model by imitating its outputs.

Also: model distillation, distillation

checked 18 Nov

All terms

Distillation produces a compact model whose quality is close to that of a large one: the student learns not only from the correct answers but also from how the teacher scores the alternatives. Such a model is cheaper to store and run.

How it works

In the original paper by Hinton and colleagues (2015), the teacher outputs a probability distribution over classes for each example. These are “soft targets”: they show what the teacher considers similar, not just which answer is correct. To make small probabilities more visible, the softmax temperature T is raised, and after the student is trained it is set back to T = 1. The loss function is a weighted sum of two parts: cross-entropy with the soft targets and cross-entropy with the true labels.

Distilling language models

For large language models, the teacher often just produces answers to a large set of prompts, and the student is then fine-tuned on those answers in the usual way (SFT). This is how the small DeepSeek-R1-Distill models were made: the DeepSeek-R1 authors fine-tuned Qwen and Llama models from 1.5B to 70B on 800,000 examples generated with DeepSeek-R1.

VariantWhat the student learnsExample
Soft targetsthe teacher’s probability distribution (with temperature)a classifier, Hinton’s 2015 paper
On the teacher’s textanswers and reasoning produced by the teacherDeepSeek-R1-Distill-Qwen-7B

Before using another model’s outputs for training, check the teacher’s licence: its terms may restrict such use.

Sources

the term is written from these pages

Verified 18 Nov

Not to be confused with

what it is mixed up with and how it differs

  • quantisation

    Quantisation compresses the numbers in the weights of the same model, whereas distillation trains a new, smaller model.

  • fine-tuning

    Fine-tuning changes an existing model using your own data, whereas in distillation the student, either a new or an existing model, is trained on the teacher’s answers.

In depth in the references

where the topic is covered in detail

Appears in the references