tonytautai home/local-ai/run-local-ai/running/training/method/distillation

man distillation

A Big Teacher, a Small Student.

Model distillation explained in one line: a large model answers, a small model is trained to copy those answers, and the small one ends up far better than its size suggests.

Tony Tautai

model distillation explained

A Teacher and a Student

model distillation explained

A large model produces answers. A small model is trained to reproduce them. The small model ends up far better at that task than its size suggests. The large one is the teacher, and it never ships. The student is what runs on the appliance. It is one of the methods compared when you go back to local model training methods.

Why It Works

A big general model knows how to read a messy scanned invoice because it has seen millions of documents. A small model has not. But the small model does not need the general knowledge; it needs the specific behaviour: these pixels, this field, that value. The teacher's outputs are a very dense, very focused training signal for exactly that. The student learns the behaviour without the knowledge, and the behaviour is all the task needs.

Where the Teacher's Answers Come From

model distillation explained

Here is the catch for a firm bound by secrecy. The teacher is usually a large model, often a cloud one. Sending client documents to it to generate training labels is exactly the thing you were trying to avoid. Our answer is to distil on fictional documents and on public licensed datasets only, built to resemble the target domain, and never on a customer's files. The student then meets real documents only on the customer's own appliance.

Practicalities

The quality of the student is capped by the quality of the teacher's labels, so review a sample of them by hand before training. Mix in some human-labelled examples where the teacher is known to be weak. Distil for one task; a student asked to imitate a teacher on everything learns a blurred version of everything. And test on a frozen set the teacher never saw, so that you are measuring the student and not the teacher's memory.

Compared With the Alternatives

Distillation gives you a new small model. An adapter, the subject of lora fine tuning guide, explained, adapts an existing one cheaply. Retrieval, which is weighed in our guide to fine tuning vs rag, changes nothing about the model. How many examples each needs is covered in our answer to how much data to fine tune llm, and the decision between training anything at all and simply retrieving is set out in our guide to local ai training vs rag when to use which.

The teacher's job is to be copied. The student's job is to run, offline, on a box in your office, and to be measured there.

ssh [email protected]

Prove it on your documents.

Every engagement starts the same way: we run the system on a sample of your own files, under NDA/DPA, and hand you a written report with the scores, misses included. No commitment.

Test it on my documents Request a diagnostic