Knowledge Distillation
Knowledge distillation
Knowledge distillation is a model compression technique in which a small "student" model is trained to imitate the output probability distribution of a larger "teacher" model, so the smaller model keeps as much of the teacher's performance as possible. Instead of learning only from the correct labels, the student also learns from the probabilities the teacher assigns to every option (soft targets). A student trained this way can do better than the same small model trained on labels alone. The term and the widely used temperature-based method come from a 2015 paper by Geoffrey Hinton, Oriol Vinyals and Jeff Dean at Google, which built on earlier model-compression work by Rich Caruana and colleagues.[1] For large language models, the term is also used more loosely for fine-tuning a small model on text generated by a larger one.[4]
What does Knowledge Distillation mean in simple terms?
Knowledge distillation lets a small model learn from the judgement of a large, capable model. The large model passes on more than the right answer: it also shares its sense of how likely each option is, for example "this looks 70% like A and 25% like B". Hinton's paper gives an example: a photo of a BMW is very unlikely to be mistaken for a garbage truck, but that mistake is still far more likely than mistaking it for a carrot, and that kind of information helps the small model generalize.[1] It is like a senior colleague who explains not only the answer but also why the close alternatives are wrong, so a new hire learns faster. Teams use distillation to build lighter models that run on phones or cheaper servers.[2]
How can Knowledge Distillation be explained with an analogy?
A new team member who has absorbed a senior colleague's judgement, not just the answer key, and can do much of the same work with far fewer resources.
Where is Knowledge Distillation used?
Hugging Face (DistilBERT) — A BERT model 40% smaller
In October 2019, Hugging Face researchers released DistilBERT, a compressed version of BERT built with knowledge distillation.[2] Unlike most earlier work, which distilled task-specific models, they applied distillation during pre-training, with the larger BERT as teacher and a training loss that combined language modelling, distillation and a cosine-distance term.[2] The resulting general-purpose model can then be fine-tuned for tasks such as text classification, and the authors also tested it on a mobile device.[2]
Result: 40% smaller and 60% faster than BERT, while keeping 97% of its language-understanding performance (as reported by the authors).[2]
DeepSeek — Passing R1's reasoning to smaller Qwen and Llama models
In January 2025, DeepSeek released its reasoning model DeepSeek-R1 together with six smaller "distilled" models based on Qwen2.5 and Llama.[3][4] These were fine-tuned on about 800,000 samples curated with R1, so here distillation means learning from the teacher's generated answers rather than from its probability scores.[4] DeepSeek reported that distilling R1's reasoning patterns into small models worked better than running reinforcement learning directly on those small models.[4] Its MIT license explicitly allows using the R1 series for distillation.[4]
Result: DeepSeek-R1-Distill-Qwen-32B scored 72.6% pass@1 on AIME 2024 (OpenAI o1-mini: 63.6%) and 94.3% on MATH-500 (o1-mini: 90.0%), according to DeepSeek's model card.[4]
Google DeepMind (Gemma 2) — Training small models by distillation
In July 2024, Google DeepMind's Gemma team trained the 2B and 9B Gemma 2 models with knowledge distillation instead of standard next-token prediction.[5] At each token, the target was the next-token probability distribution from a larger teacher model instead of a single correct token (a one-hot vector).[5] This let them train on more than 50 times the compute-optimal number of tokens predicted by scaling theory.[5] In an ablation, a 2B model distilled from a 7B teacher outperformed the same model trained from scratch on the same 500 billion tokens.[5]
Result: Google reported the best performance for their size and results competitive with models 2–3 times larger.[5]
NAVER Cloud (Korea) — Pruning plus distillation for a 0.5B model
NAVER Cloud's HyperCLOVA X team described how it built HyperCLOVAX-SEED-Text-Instruct-0.5B by combining pruning (removing less important parameters from a trained model) with knowledge distillation, which restores performance after pruning.[6] It compared the pre-training resources with those of Qwen2.5-0.5B-Instruct, a model of similar size, and said its model scored higher on most of more than 20 internal and external benchmarks.[6]
Result (company-reported): Pre-training used about 4,358 A100 GPU hours and USD 6,537, versus 169,257 GPU hours and USD 253,886 for Qwen2.5-0.5B-Instruct — about one thirty-ninth of the reported comparison cost.[6]
Try it today
- Start with distilbert-base-uncased and the original BERT, fine-tune both for the same text-classification task and dataset, then compare them.[2]
- Record accuracy and response time for both models in a table to see the trade-off between size, speed and quality.
- Open the DeepSeek-R1-Distill model card and compare the 7B and 32B distilled models' AIME and MATH-500 scores with the o1-mini baseline.[4]
- Pick one repetitive task your team currently sends to a large model, such as classification or summarization, and note it as a candidate for a teacher-to-student setup.
- Read the introduction of Hinton's 2015 paper on "soft targets" and write one line on how they differ from hard (correct-answer) labels.[1]
Limits and direction
The student is trained to generalize the way the teacher does, so results depend on having a strong teacher and a suitable transfer dataset, and the teacher's mistakes and biases can be passed on as well.[1] When the student is much too small to capture everything the teacher knows, it cannot match the teacher fully; Hinton's team found that intermediate "temperature" settings, which control how soft the teacher's probabilities are, worked best in that case.[1] Generating training signals also means running a large teacher many times, so include that compute cost in your estimate.[3][5] In practice, distillation is not simply shrinking a model: the teacher, the data, and the training objective have to be designed together.[1]
Two trends stand out. First, training small models by distillation, rather than from scratch, is becoming common: Google trained the small Gemma 2 models on teacher distributions, and DeepSeek reported that distillation beat reinforcement learning for small models.[4][5] Second, distillation is being combined with other compression methods such as pruning; NAVER Cloud reported training a 0.5B model at a fraction of the comparable pre-training cost this way.[6] Distillation is also used to train in-house small models on the outputs of commercial models. Check the provider's terms first: OpenAI's Terms of Use for individual services, for example, prohibit using output to develop models that compete with OpenAI; API and business use is governed by separate terms that must also be checked, while DeepSeek's MIT license explicitly allows distillation.[4][7] Weigh accuracy, cost and licensing together before adopting distillation.
Which sources explain Knowledge Distillation?
- arXiv (Hinton, Vinyals, Dean / Google) — Distilling the Knowledge in a Neural Network (2015-03-09) — https://arxiv.org/abs/1503.02531
- arXiv (Sanh, Debut, Chaumond, Wolf / Hugging Face) — DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter (2019-10-02) — https://arxiv.org/abs/1910.01108
- arXiv (DeepSeek-AI) — DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning (2025-01-22) — https://arxiv.org/abs/2501.12948
- Hugging Face (DeepSeek-AI) — DeepSeek-R1-Distill-Qwen-32B model card (2025) — https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B
- arXiv (Gemma Team, Google DeepMind) — Gemma 2: Improving Open Language Models at a Practical Size (2024-07-31) — https://arxiv.org/abs/2408.00118
- NAVER Cloud CLOVA Tech Blog — 작지만 강력하게: 고효율 LLM을 만드는 HyperCLOVA X의 경량화 기술 (2025-05-29) — https://clova.ai/tech-blog/%EC%9E%91%EC%A7%80%EB%A7%8C-%EA%B0%95%EB%A0%A5%ED%95%98%EA%B2%8C-%EA%B3%A0%ED%9A%A8%EC%9C%A8-llm%EC%9D%84-%EB%A7%8C%EB%93%9C%EB%8A%94-hyperclova-x%EC%9D%98-%EA%B2%BD%EB%9F%89%ED%99%94-%EA%B8%B0
- OpenAI — Terms of Use (effective 2026-01-01) — https://openai.com/policies/terms-of-use/
Tell us what you think
Your feedback helps us improve the content.