Back to LLMs Mind Map
中文·English
LLMsID: distillation

Knowledge Distillation

知识蒸馏
🎯Core Definition
Knowledge distillation (KD) has a student model mimic the teacher's soft output distribution pT=softmax(z/T)p_T = \text{softmax}(z/T), where temperature TT softens probabilities to expose inter-class dark knowledge; loss is L=αLCE(y,pS)+(1α)T2KL(pSpT)\mathcal{L} = \alpha \mathcal{L}_{CE}(y, p_S) + (1-\alpha) \cdot T^2 \cdot \text{KL}(p_S \| p_T), with T2T^2 compensating the softened gradient scale.
💡Use Cases
compressing a large model into a deployable small one, transferring knowledge on unlabeled data (teacher outputs as soft labels), and cross-architecture learning (LLM teacher to a smaller transformer); in LLM compression it is orthogonal to quantization — quantization cuts bit-width, distillation cuts model capacity, and the two stack.
Key Problems Solved
when models are too large to deploy, distillation distills the teacher's generalization into the student at lower training cost than training from scratch, and soft labels retain inter-class similarity information that hard labels drop; together with quantization it forms two complementary compression axes.
🎯5 High-Frequency Exam Points
1
Why learn from soft targets instead of hard labels?
2
Role of temperature T; effects of T too large or too small?
3
How do distillation and quantization relate — why are they orthogonal?
4
Common KD variants (logits, features, self-distillation)?
5
What happens when the student-teacher capacity gap is large, and how to mitigate?
Updated 2026-08-12
🎯
Test Your Knowledge: Practice Questions for "Knowledge Distillation"
Single choice pitfall questions with instant feedback and mistake tracking.
🚀 Start Card Practice
Previous CardSmoothQuant/AWQ & FP8Next CardMoE Routing Top-k

🔗 More LLMs Knowledge Cards

Agent & Tool CallingAlignment Tax & Preference DataScaled Dot-Product AttentionAttention Variants MHA/MQA/GQA