← Learn AI
C_000206 · llms and generative ai · advanced

Knowledge Distillation

Training a small student model to reproduce a large teacher's outputs, transferring capability into a cheaper package.

Step 1 of 4

In words

What it is, why it matters, and what it is like.

Why am I learning this?

Knowledge distillation is the standard method for turning a massive, expensive artificial intelligence model into a small, fast version that can run on your phone or laptop. Without this technique, many modern AI tools would be too heavy to use outside of large data centers. By understanding this, you will see how companies make their powerful 'teacher' models available as lightweight 'student' versions for everyday devices. It also explains why so many smaller, openly available models exist: they are often distilled from larger giants to run locally on personal computers.

The idea, in plain terms

Imagine you are a new chef trying to learn how to make a perfect biryani. You have never cooked it before. You could read a recipe — that is like a dataset with hard labels: 'add 2 cups of rice', 'cook for 30 minutes'. But a recipe only tells you the steps, not the feel — the aroma, the color, the exact moment the rice is done.

Now imagine instead you stand next to a master chef who shows you their finished dish and tells you, 'This is what perfection looks like — aim for this.' You taste it, you see it, you smell it. You might learn faster and better than reading a recipe because you are not just copying steps, you are matching a richer target.

In artificial intelligence, a 'teacher' model is the master chef — big, slow, but incredibly skilled. It has seen millions of examples and learned complex patterns. When you train a model normally, you show it an image (say, a cat) and you tell it, 'The answer is cat'. That is a hard label — like a recipe. But the teacher model, when shown the same image, does not just say 'cat'. It also says, 'I am 98% sure it is a cat, 1.5% dog, 0.5% bird.' That soft distribution contains so much more information — it tells the student not just what the answer is, but what other answers were close. A cat picture that looks a bit like a dog teaches the student, 'These two are similar.' Hard labels never say that.

So knowledge distillation is simply: instead of teaching the student with the original data and hard labels, we teach it with the teacher's soft outputs. The student tries to mimic those outputs, and by doing so, it absorbs the teacher's wisdom — the relationships between classes, the subtle patterns — without needing to be as big or slow as the teacher.

An analogy

The master craftsman and the apprentice. A master carpenter can build a beautiful chair, but she is slow and expensive, and she uses a huge workshop. The apprentice wants to learn to build the same chair, but quickly and with just a few hand tools.

If the apprentice just reads a list of measurements — 'the leg is 40 cm long, the seat is 50 cm wide' — she might make a chair that looks roughly right, but it will lack the subtle curves, the perfect balance, the feel of quality. The measurements are the hard labels: correct but limited.

So instead, the master sits the apprentice down and says, 'Watch me. I am going to build a chair, but I am also going to narrate my decisions: 'I am using this wood because it flexes slightly; I am rounding this edge because it feels better in the hand; I am using a dovetail joint here because it is stronger than a nail.' The apprentice does not just see what the master does — she hears the why behind the choices. This is the soft output: a rich description of the craft, not just the final product.

The apprentice then practices by trying to make chairs that would get the same praise from the master. Every time she makes a chair, she compares it to what the master would have made — not just the measurement, but the whole feel. Over time, the apprentice becomes nearly as good as the master, but she works with a much smaller set of tools and much less time.

Where the analogy breaks down: In our analogy, the apprentice learns why from the master's words. In real distillation, the student never hears any why. It only sees the teacher's output probabilities — soft numbers — and tries to get its own output numbers to match. It does not understand the reasoning; it just learns to produce the same result. Also, the apprentice gets better than the master over time (she might have her own style), but a distilled student is capped at the teacher's quality — it can only be as good as what it imitates.

Definition

Knowledge distillation is a training method where a small model learns to copy the output probabilities of a larger model, transferring the larger model's learned knowledge into a more compact and efficient version.

Where this sits

This concept sits at the heart of inference optimization — the process of making models cheaper and faster to use. It works alongside quantization, which reduces the precision of numbers to save space, but distillation is different because it reduces the model's capacity by shrinking its size. A distilled model is often small enough that quantization alone is not enough; they are complementary steps. You will often see these used with local model deployment, which is the practice of running AI models on your own hardware rather than in the cloud.

Signal from the Frontier

Get the next essay on mind, machine, and meaning

Essays at the intersection of AI, philosophy, and Indian governance. No promotional content.

We'll send a one-click sign-in link to confirm. No password needed.

Views expressed are personal and do not represent the Government of India or the Government of Uttarakhand.

Knowledge Distillation — Learn AI — Dr. B.V.R.C. Purushottam