# AI Knowledge Distillation Simulation

Conceptual, bilingual \(English/中文\) demonstration of knowledge distillation from a hypothetical teacher to a hypothetical student model

By DUSK

Topic: Computing, AI &amp; Electronics

[Open the interactive Jig](https://ask.jig.com/j/s9H2oLvumw6z)

## Transcript

### 1. Teacher and student · 老师和学生

Knowledge distillation trains a small, fast model to copy a big model's answers\. Here a hypothetical Claude Opus 5\.5 is the teacher \(left\) and a hypothetical Claude Sonnet 5\.5 is the student \(right\)\. 知识蒸馏让一个小而快的模型学习大模型的回答。左边是假设的老师 Claude Opus 5\.5,右边是假设的学生 Claude Sonnet 5\.5。

Conceptual demonstration only, NOT Anthropic's confirmed training process\. All numbers are illustrative\. 仅为概念演示,并非 Anthropic 已确认的训练流程;所有数字均为示意。

### 2. A prompt goes in · 输入提示

Both models read the same prompt: "The capital of France is \_\_\_"\. The teacher does not give just one word\. It gives a probability, a measure of how sure it is, for every possible next word\. 两个模型读到同一个提示。老师不只给出一个词,而是给每个可能的下一个词一个概率,表示它有多确定。

Here the teacher is about 94% sure of "Paris"\. 老师大约有 94% 的把握是"巴黎"。

### 3. Hard and soft labels · 硬标签与软标签

A hard label keeps only the right answer: Paris 100%, everything else zero\. A soft label keeps the teacher's whole list, so the student also learns that Lyon is a better guess than Rome\. Switch between them\. 硬标签只保留正确答案。软标签保留老师的整张概率表,学生还能学到"里昂"比"罗马"更接近。切换看看。

These small hints are sometimes called "dark knowledge"\. 这些细小的提示有时被称为"暗知识"。

### 4. Temperature turns up the hints · 温度

The small hints are hard to see at normal temperature \(T = 1\)\. Raising the temperature T divides every score before they become probabilities, which flattens the bars so the runner\-up answers show\. Turn the knob\. 在正常温度 T = 1 时,这些提示很难看清。提高温度 T 会让概率更平滑,其他候选答案就显现出来。转动旋钮试试。

Paris stays on top at every temperature; only the spread changes\. 无论温度多高,"巴黎"始终最高,只是分布变平了。

### 5. Measuring the gap: KL divergence · KL 散度

The untrained student guesses almost evenly\. The clay collars on its bars mark the teacher's soft labels\. KL divergence adds up how far the student's bars are from those marks: the dial reads high when they differ and zero only when they match\. 未训练的学生几乎平均地猜。学生柱子上的陶色环标出老师的软标签。KL 散度衡量两者的差距:差得越多,指针越高;完全一致时为零。

KL divergence is measured from the teacher's point of view, so its order matters\. KL 散度以老师的分布为基准,顺序不能对调。

### 6. Training updates · 训练更新

Each training step nudges the student's settings a little to shrink the gap\. Watch its layers update, its bars climb toward the collars and the dial fall\. Slide to choose how many steps it trains\. 每一个训练步骤都会稍微调整学生的参数来缩小差距。看它的层在更新,柱子向陶色环靠近,指针下降。拖动滑块选择训练步数。

The student learns from the teacher's answers, not by copying its insides\. 学生学习的是老师的回答,而不是复制它的内部结构。

### 7. Faster, nearly as good · 更快,几乎一样好

The student has fewer layers, so it answers faster: watch the speed wheels spin\. After training, its answers at T = 1 come close to the teacher's\. In this illustration it keeps about 95% of the quality at about 2\.5 times the speed\. 学生的层更少,回答更快:看速度轮的转动。训练后,它在 T = 1 时的回答接近老师。示意中,它保留约 95% 的质量,速度约为 2\.5 倍。

A real example: DistilBERT is 40% smaller and 60% faster than BERT and keeps about 97% of its language\-understanding score\. 真实例子:DistilBERT 比 BERT 小 40%、快 60%,保留约 97% 的语言理解得分。

### 8. What the student keeps · 学生学到了什么

The teacher's full list of guesses taught the student more than right answers alone could\. When training ends the temperature goes back to 1, and the smaller student answers on its own\. Remember: this bench is a picture of the idea, not of how any real Claude model was made\. 老师完整的概率表比单纯的正确答案教会学生更多。训练结束后温度回到 1,小模型独立作答。请记住:这只是概念示意,不代表任何真实 Claude 模型的训练方式。

Idea from Hinton, Vinyals and Dean, "Distilling the Knowledge in a Neural Network" \(2015\)\. 思想来自 Hinton 等人 2015 年的论文。
