A Beginner’s Guide to Knowledge Distillation for Large Language Models
A Juejin explainer introduces knowledge distillation as a training method that transfers knowledge from a teacher model to a student model through generated answers, probability distributions, or reasoning traces. It outlines the workflow from selecting models and preparing questions through data cleaning, supervised fine-tuning, and evaluation, while using DeepSeek-R1’s distilled models as a case study. The article also distinguishes distillation from fine-tuning, quantization, RAG, and reinforcement learning, and cautions that generated reasoning may not reflect a teacher’s internal computation.
The guide gives AI practitioners a clear, non-mathematical framework for understanding how smaller language models can acquire selected capabilities from stronger or more specialized teachers.
最近经常看到大模型蒸馏这个词,尤其是在讨论大模型的训练成本、推理能力以及不同模型之间的技术差距时,蒸馏几乎成了一个绕不开的概念。
但很多人可能和我最开始一样,对蒸馏存在不少疑问。
大模型输出的不就是文字吗?为什么拿这些文字去训练另一个模型,就能够提升它的能力?蒸馏到底是在复制知识,还是在学习推理能力?为什么一些参数量很小的模型,也能够解决相当复杂的问题?
今天就来聊聊知识蒸馏。不涉及复杂的数学公式,即使没有机器学习基础,也可以看懂。
一、什么是知识蒸馏?
知识蒸馏(Knowledge Distillation,简称 KD)是一种将知识从一个模型迁移到另一个模型的训练技术。