What is knowledge distillation?
The AI Glossary
In our classes, we often pause to explain the ideas behind AI and the language used to describe it. These posts grew out of those conversations. They’re for anyone who would like to understand AI better, with no technical background assumed.
Knowledge distillation trains a model using information produced by another model. The model providing the training signal is often called the teacher, and the model learning from it the student. The student is commonly smaller or cheaper to run, although that is not a requirement of every distillation method.
A conventional labeled example supplies one target answer. A teacher can supply more detail. When classifying an image, it might assign most probability to “cat,” some to “dog” and very little to “airplane.” Those differences can help the student learn relationships that a single category label does not express.
These probability outputs are sometimes called soft targets. Some methods make the distribution less concentrated during training so that relationships among less likely categories are easier to learn. Other methods use a teacher’s internal representations or generated examples. For language models, a teacher may produce responses that become part of the student’s training data.
Distillation is different from quantization. Quantization changes the precision used to store or calculate a model’s numbers. Distillation trains a model to imitate selected behavior. The two techniques can be combined, but they do not solve exactly the same problem.
The student does not automatically acquire everything the teacher can do. Results depend on the examples, the training objective and the student’s capacity. A student may reproduce errors, omit rare capabilities or behave differently on unfamiliar inputs. How much accuracy is preserved—and how much computing cost is saved—depends on the task and the student model’s capacity.
A hospital might investigate distilling a larger model’s document-classification behavior into a smaller model for a high-volume workflow. That could reduce operating requirements, but it needs an evaluation set checked independently of the teacher. Otherwise the assessment may reward agreement rather than correctness. Data permissions also matter when teacher outputs are generated from sensitive records. Distillation can make a useful capability more practical to deploy; it does not certify that the capability was correct or appropriately obtained.
Sources: Hinton, Vinyals and Dean — Distilling the Knowledge in a Neural Network (2015)
To learn more, take a look at the AI in Health Care Certificate of Specialization from the Advanced Learning Academy at Harvard T.H. Chan School of Public Health. You can take an individual course or work toward the full certificate.
AI is a fast-moving field. This explanation reflects our class discussions and related material at the time of writing. Terminology, capabilities and tools may change.
For suggested additions or corrections, please email me at tpanch@hsph.harvard.edu.
Dr. Trishan Panch
Program Director, AI in Health Care
Harvard T.H. Chan School of Public Health — Advanced Learning Academy
Lead with AI in Health Care
The AI Pragmatist is a monthly newsletter from ALA faculty, with new explainers & essays from the Advanced Learning Academy