Model Distillation
What Is Model Distillation?
Model distillation is a technique that transfers the knowledge of a large, complex model (the teacher model) into a small, simple model (the student model).
A Vivid Analogy
Imagine a distinguished professor (a large model): immensely knowledgeable, but expensive to train and requiring a luxurious lecture hall. Meanwhile, an elementary school student (a small model) is lightweight and easy to manage, but has limited knowledge. Model distillation is the process of the professor condensing his problem-solving insights into "cheat sheets" and teaching them to the student.
Why Do We Need Model Distillation?
Computational Resource Problems
- High training costs: Training large models takes weeks or even months
- Slow inference: Large models cannot respond to requests in real time
- Deployment challenges: Ordinary companies cannot afford the required hardware
- Large model inference requires tens of GB or even hundreds of GB of memory
- Mobile devices and embedded systems cannot store large model parameters
Memory and Storage Problems
The Distillation Process Explained
Step 1: Prepare Training Data
Use the teacher model to generate soft labels. For example, given the input "this movie is great," the teacher outputs[positive: 0.88, negative: 0.12].Step 2: Train the Student Model
The student model learns to produce outputs similar to the teacher's, continuously optimizing by minimizing the difference between its outputs and the teacher's.Step 3: Validate the Distillation Results
Verify improvements in inference speed, reduced memory usage, and retained performance.Real-World Case: DeepSeek
DeepSeek released distilled models at 7B, 8B, 14B, and 32B scales using distillation techniques. In another notable case, a small team led by Fei-Fei Li trained a model rivaling ChatGPT o1 for only about $50 — the key was using knowledge distillation to obtain high-quality data from the Gemini API.
---
Source: Easy AI Tutorial series