Suppose a large model handles a task well, but is too slow or expensive to deploy. Knowledge distillation trains a smaller student model to mimic a larger teacher model. The goal is to keep much of the teacher’s task performance while reducing model size, response time, and computational cost. section 3.3.1 section 5.3.2
A practical distillation workflow is:
- Choose a pretrained teacher and create or select a smaller student, possibly with fewer layers or reduced dimensionality. section 5.3.2
- Train the student on the task using the teacher’s outputs as a target. A loss term can encourage the student’s predictions to resemble the teacher’s alongside learning from task labels. section 5.3.2
- Check the resulting model’s size and task performance; finetune it further for a specific dataset if needed. section 5.3.2
Smaller is not identical
A BERT-to-DistilBERT finetuning example illustrates the intended trade-off: both size and performance drop, but size drops faster. A student may also fail to acquire some emergent qualities of its foundation-model teacher, so the training dataset needs careful curation. section 5.3.2 section 5.3.2
Figure 5.5 Knowledge distillation allows a smaller model to learn from a foundation model to replicate similar behavior with fewer parameters. The student model does not always learn the emergent qualities of the foundation model, so the dataset must be especially curated. The dotted line indicates a special relationship as the student model becomes the specialized LLM.
The diagram shows the teacher-to-student relationship and the caution that fewer parameters do not guarantee every teacher behavior survives. section 5.3.2
Distillation is not a free compression step. Training a student has substantial upfront cost, and improvements to the teacher must be transferred through later training cycles. There is no dependable recipe for choosing how small the student can be; test that choice against the task. Compared with straightforward post-training quantization, distillation demands more training work but produces a separate, smaller model. section 3.3.1 section 3.5





