LLM distillation is a training method where a small “student” model learns to imitate a large “teacher” model by training on the teacher’s outputs instead of, or as well as, human-labelled data. It is how labs ship cheap, fast models. It is also at the centre of 2026’s biggest AI dispute: on 29 October, The Next Web reported claims that DeepSeek and Moonshot trained their newest models heavily on OpenAI’s GPT-6 Astra outputs.
This article covers how LLM distillation works, a 75-line NumPy demo you can run, why some distillation is routine and some gets accounts banned, and what it means if you build with these models.

Key takeaways
- Distillation trains a small model on a big model’s outputs; the technique dates back to Hinton, Vinyals and Dean’s 2015 paper.
- In our demo, a student with 258 parameters reached 90.3% accuracy from teacher soft labels, against 84.1% from 300 human labels.
- Distilling your own models is normal practice. Distilling a rival’s model through its API usually breaks that provider’s terms and is now treated as an attack.
- Anthropic says new safeguards cut the data collected by distillation attacks by roughly 90% to 99%.
What is LLM distillation?
LLM distillation compresses what a large model knows into a smaller one. You send the large model many inputs, record its answers (or its full probability distribution over possible next tokens), and train the small model to reproduce them. The small model ends up far cheaper to run while keeping much of the large one’s quality on the tasks you distilled.
The idea comes from the 2015 paper “Distilling the Knowledge in a Neural Network” by Geoffrey Hinton, Oriol Vinyals and Jeff Dean. A well-known early result is DistilBERT from Hugging Face (2019), which kept about 97% of BERT’s language-understanding performance with 40% fewer parameters and ran 60% faster.
How LLM distillation works: teacher, student and soft labels
The trick that makes distillation work is the soft label. A human label says “this is class 3” and nothing else. A teacher model’s output says “probably class 3, but class 7 is plausible and class 1 is nearly impossible”.
Those relative probabilities carry information about how the teacher sees the problem, and the student learns from all of it.

Temperature controls how much of that detail the student sees. Dividing the teacher’s logits by a temperature T above 1 before the softmax flattens the distribution, so small probabilities become visible. Hinton’s paper multiplies the soft-target loss by T² so its gradients stay comparable to the hard-label loss.
For large language models there are two common flavours:
- Logit (white-box) distillation: the student trains on the teacher’s full next-token distribution. You need access to the teacher’s weights or logits, so this is what labs do with their own models.
- Output (black-box) distillation: the student trains on text the teacher generated, sometimes including its step-by-step reasoning. You only need API access, which is why it is the form behind the 2026 disputes.
Try it: LLM distillation in 75 lines of NumPy
You do not need a GPU to see distillation work. This script trains a teacher network on a 10-class problem, then trains two identical tiny students: one on 300 human labels, one on the teacher’s soft labels for 6,000 unlabelled inputs. It needs only Python and NumPy.
pip install numpy
import numpy as np
rng = np.random.default_rng(42)
N_CLASSES, DIM = 10, 20
def make_data(n):
centers = np.random.default_rng(7).normal(0, 1.6, (N_CLASSES, DIM))
y = rng.integers(0, N_CLASSES, n)
return centers[y] + rng.normal(0, 1.7, (n, DIM)), y
def softmax(z, t=1.0):
z = z / t
z = z - z.max(axis=1, keepdims=True)
e = np.exp(z)
return e / e.sum(axis=1, keepdims=True)
class MLP:
def __init__(self, hidden):
self.w1 = rng.normal(0, np.sqrt(2 / DIM), (DIM, hidden)); self.b1 = np.zeros(hidden)
self.w2 = rng.normal(0, np.sqrt(2 / hidden), (hidden, N_CLASSES)); self.b2 = np.zeros(N_CLASSES)
def logits(self, x):
self.h = np.maximum(0, x @ self.w1 + self.b1)
return self.h @ self.w2 + self.b2
def fit(self, x, targets, epochs=200, lr=0.05, t=1.0):
for _ in range(epochs):
g = (softmax(self.logits(x), t) - targets) / len(x)
gh = (g @ self.w2.T) * (self.h > 0)
self.w2 -= lr * self.h.T @ g; self.b2 -= lr * g.sum(0)
self.w1 -= lr * x.T @ gh; self.b1 -= lr * gh.sum(0)
return self
def accuracy(self, x, y):
return (self.logits(x).argmax(1) == y).mean()
def params(self):
return sum(a.size for a in (self.w1, self.b1, self.w2, self.b2))
x_train, y_train = make_data(6000)
x_test, y_test = make_data(4000)
one_hot = np.eye(N_CLASSES)
teacher = MLP(256).fit(x_train, one_hot[y_train], epochs=300)
print(f"Teacher ({teacher.params():>5} params) test accuracy: {teacher.accuracy(x_test, y_test):.1%}")
small = rng.choice(len(x_train), 300, replace=False)
student_hard = MLP(8).fit(x_train[small], one_hot[y_train[small]], epochs=600)
print(f"Student A ({student_hard.params():>4} params), 300 hard labels: {student_hard.accuracy(x_test, y_test):.1%}")
T = 4.0
soft = softmax(teacher.logits(x_train), T)
student_soft = MLP(8).fit(x_train, soft, epochs=600, t=T)
print(f"Student B ({student_soft.params():>4} params), teacher soft labels: {student_soft.accuracy(x_test, y_test):.1%}")
sample = softmax(teacher.logits(x_test[:1]), T)[0]
top = np.argsort(sample)[::-1][:3]
print("One soft label (T=4), top 3 classes:", ", ".join(f"class {c}: {sample[c]:.2f}" for c in top))
Running it with Python 3.13 and NumPy 2 prints:
Teacher ( 7946 params) test accuracy: 94.5%
Student A ( 258 params), 300 hard labels: 84.1%
Student B ( 258 params), teacher soft labels: 90.3%
One soft label (T=4), top 3 classes: class 1: 0.37, class 5: 0.17, class 0: 0.10
The student is 30 times smaller than the teacher. Trained on the teacher’s soft labels it closes most of the gap (90.3% against the teacher’s 94.5%), while the same student trained on the few human labels it could get stalls at 84.1%. The last line shows why: a soft label tells the student that class 5 and class 0 are the “near misses” for this example, which a hard label never does.
That is the whole commercial logic of LLM distillation in miniature. Labelled data is expensive; a strong teacher can label unlimited inputs for the price of API calls. (The demo skips Hinton’s T² loss scaling; the fixed learning rate absorbs it at this size.)
Why LLM distillation became an AI copying fight
LLM distillation is routine when you distil your own model. It turns into a fight when the teacher belongs to a competitor and the student is trained through the competitor’s API, at scale, without permission. Three events in 2026 made this the most argued-about training technique of the year.
- Anthropic’s accusation. eWeek reported in August that Anthropic accused DeepSeek, Moonshot AI and MiniMax of campaigns that used roughly 24,000 fake accounts to generate about 16 million exchanges with Claude. Moonshot has denied distilling Anthropic’s models.
- OpenAI’s account bans. On 30 September, OpenAI said accounts linked to Kimi’s developer ran a coordinated campaign in July to extract the hidden reasoning behind its models’ answers, involving more than 15,000 users. It banned the accounts by 28 July and shared findings with other labs (The Next Web).
- The GPT-6 Astra report. On 29 October, The Information reported that DeepSeek’s updated V4.1-Flash and Moonshot’s Kimi K3.1 Pro relied heavily on GPT-6 Astra outputs. The report rests on anonymous sources and has not been independently verified. Read our breakdown of Kimi K3.1 Pro for what the model itself offers.
Labs are responding with technical defences. Anthropic said in October that new safeguards cut the data collected from Claude in distillation attacks by roughly 90% to 99%. Common measures include rate limits, detection of query patterns that look like dataset generation, and hiding raw reasoning traces from API responses.
Distillation vs fine-tuning vs model extraction
These three terms get mixed up constantly. The difference is where the training signal comes from and whether the model owner agreed.
| Fine-tuning | LLM distillation (own teacher) | Model extraction (“distillation attack”) | |
|---|---|---|---|
| Training signal | Your labelled examples | Your teacher model’s outputs or logits | A third party’s API outputs |
| Owner’s permission | Not needed | You own the teacher | Usually prohibited by the provider’s terms |
| Typical goal | Teach a skill or style | Shrink a model and cut serving cost | Copy a rival’s capability cheaply |
| Examples | Instruction tuning a base model | DistilBERT, small “Flash” or “Mini” models | The 2026 allegations against several labs |
Distilling from an open-weight model is a separate case again: what you may do depends on its licence. Some open licences restrict using outputs to train other models, and some do not. Our guide to open weight vs open source compares the major licences.
What this means for developers
For most teams, LLM distillation is simply a cost tool. If a frontier model handles your task well but costs too much per call, LLM distillation of a small model on its outputs for that narrow task can cut serving costs sharply. Before you do it:
- Read the teacher’s terms. Commercial APIs from OpenAI, Anthropic and Google restrict using outputs to build competing models. Check whether your use counts.
- Prefer teachers you are allowed to distil: your own fine-tuned model, or an open-weight model whose licence permits it.
- Distil a narrow task, not general intelligence. A student trained on 50,000 examples of your support tickets will beat a general small model at support tickets. It will not become a frontier model.
- Evaluate on held-out data the teacher never saw, and compare against the teacher on the same set, as the demo does.
- Keep a human-labelled test set. If the teacher is wrong, the student learns the same mistakes with more confidence.
If you run a model API yourself, assume someone will try to distil it. Rate limits, anomaly detection on query patterns and not exposing raw reasoning are the standard defences, and they belong next to your prompt injection protections.
FAQ
Is LLM distillation illegal?
The technique is not illegal; labs use it on their own models all the time. The disputes are about permission and terms of service: training on a competitor’s API outputs usually violates that provider’s terms, and companies treat it as a contract and security issue. Whether it also breaks law depends on jurisdiction and is not settled. This is not legal advice.
What is the difference between a teacher and a student model?
The teacher is the large, accurate model whose outputs are used as training targets. The student is the smaller model being trained to match those outputs so it can run faster and cheaper.
Why do soft labels work better than hard labels?
Soft labels include the teacher’s probabilities for every class, so the student learns which wrong answers are close to right. That extra information means the student learns more from each example, as the demo’s 90.3% versus 84.1% result shows.
Can you detect if a model was distilled from another?
Not with certainty. Signs include near-identical phrasing, shared mistakes, and a model calling itself by a competitor’s name. Providers mostly detect distillation on their side, by spotting accounts that generate datasets at scale.
Where LLM distillation goes next
Expect more distilled “Flash” and “Mini” models from every lab, because serving cost matters more each quarter, and expect API providers to keep tightening access to reasoning traces. For builders, the safe path is simple: distil models you own or are licensed to distil, and measure the student against real data before trusting it.


