Distilling a 7B teacher into a 1B student raised offline top-1 by two points, but after launch, complaints about low-frequency categories increased. The team’s first reaction was that the student’s capacity was insufficient, or that the online data distribution had shifted. The more common cause lies on the teacher’s side: what the student learns from soft labels is not “the correct answer” but “how the teacher sees the world,” including the parts the teacher gets wrong.
Offline gains, long-tail losses: this contrast is common
A typical distillation pipeline looks like this: the teacher produces soft labels on a large corpus, and the student is trained jointly on soft labels and a small amount of hard labels, with the loss aligning to the teacher’s probability distribution on one side and to the true labels on the other. Offline evaluation looks at overall top-1; it goes up, and everyone assumes the capability has been transferred. After launch, head categories are indeed more stable, while tail categories start showing errors that are hard to explain.
The problem lies in the evaluation metric. Suppose head samples account for 90% and soft labels give the student a two-point gain; the tail accounts for 10% and drops eight points. The overall result is still positive: 0.9×2 + 0.1×(-8) = 1.0. On the report it is a positive number; what tail users experience is something else. The team keeps tuning temperature, adding data, and switching to a larger student; the head keeps improving and the tail keeps degrading, because the optimization direction was never aimed correctly from the start.
This kind of rework has a very typical path: first suspect student capacity, then suspect data volume, and only finally slice the data to look at the teacher. Once you slice, you see that the student errs more consistently on the samples the teacher got wrong, and even treats the teacher’s wrong answer as the second candidate. A hard-label baseline is actually better on these slices. At this point, the problem is not “the student didn’t learn” but “the student learned too much like the teacher.”
Soft labels turn an error from a point into a region
Hard labels only tell the student what is correct. An image contains a cat, so the label is cat, and the model pushes down the other 999 classes. Soft labels give not only cat but also “dog 0.2, fox 0.05, the rest near zero.” Some of these non-zero entries are the class-similarity structure the teacher learned from data, usually called dark knowledge; the other part is simply the teacher’s errors.
The loss function makes this clearer. For student output q and teacher distribution p_T, the distillation term is:
L = -Σ p_T(c) log q_S(c)
Taking the gradient with respect to the logit of a certain class, the direction is roughly q_S(c) - p_T(c). If the teacher assigns 0.3 to a wrong class and the student currently assigns only 0.1, the gradient pushes the student’s wrong class upward until it approaches 0.3. Under hard labels, the target for this class is 0, and the gradient direction is opposite. The same wrong answer is not noise in soft labels; it is a supervision target with an explicit weight.
So the claim that “teacher errors will be averaged out during training” holds only under very narrow conditions: the errors must be sufficiently random, symmetric in direction, and the student must lack enough capacity to memorize them. Long-tail samples satisfy none of these three. When a teacher errs on a rare class, the error is often not random but due to lack of evidence, label bias, or learned spurious correlations. The same confusion pair recurs: this rare animal is always mistaken for a close relative, this uncommon fault is always assigned to a common fault. What the student sees is a stable, gradient-bearing error distribution, and what it learns is a smooth wrong boundary.
A hard-label error is a point; a soft-label error is a region. That is where amplification happens. The student does not occasionally err on one sample; within the region the teacher misdrew, it treats the teacher’s judgment as a generalizable rule.
This logic also holds in token-level distillation of large models. The teacher’s preferences for rare entities and format tokens are passed to the student as top-k logits. What the student learns is not a particular token pair but the teacher’s entire ranking at uncertain positions. If the teacher always splits a rare entity into common subwords, the student will learn that splitting too, and because of the smoothness of soft labels, it will generalize it to adjacent contexts.
Temperature is not an amplifier; calibration is what matters
When many teams see long-tail degradation, their first reaction is to tune temperature. Temperature does change the shape of soft labels, but it is not a one-way amplifier. What temperature changes is the steepness of the distribution, not the teacher’s error rate. High temperature flattens the distribution, more classes get comparable weights, and dark knowledge and errors are spread out together; low temperature approaches argmax, and if the teacher’s argmax on this sample is already wrong, low temperature merely turns a wrong soft distribution into a wrong hard label. Neither end is safe.
More critically, temperature is a global parameter, while error structure is local. You search the overall validation set for a temperature that gives the best top-1, and that result is most likely determined by head samples. Tail samples at the same temperature may fall exactly in the interval where errors are amplified. Using one global temperature to serve all slices amounts to assuming the teacher’s errors are identically distributed across classes, and that assumption usually does not hold.
What deserves more attention than temperature is calibration. The values from softmax are not inherently probabilities; the teacher saying 0.9 does not mean it has a 90% chance of being correct. A teacher that is overconfident on tail categories is the most dangerous teacher: when it is wrong, it is not hesitantly wrong but assigns a very high weight to the wrong class. The signal the student receives is not “this is uncertain” but “this is certain, only the answer is not the hard-label one.”
Uniform label smoothing also adds probability to wrong classes, but it is uniform and small in magnitude, so the student easily treats it as a regularizer. The teacher’s soft labels are structured, with errors concentrated on specific confusion pairs, so the student more easily treats them as rules. Both look like “less hard labels,” but the risks are completely different.
The same applies to ensemble teachers. Averaging the distributions of several teachers can reduce some random errors, but on the long tail, several teachers may each err toward different neighboring classes, and the average yields a distribution that no teacher actually believes. What the student learns is a vague judgment that “these classes are all about the same,” which sounds like uncertainty but is actually a collection of errors.
Which soft labels to keep: decide by slice
Whether to use soft labels should not be a global switch. A more robust approach is to judge layer by layer by slice and block samples where “the teacher may be confidently wrong.”
flowchart TD
A[样本进入蒸馏] --> B{该切片有校准集}
B -- 否 --> C[硬标签或人工]
B -- 是 --> D{教师准确率达标}
D -- 否 --> C
D -- 是 --> E{教师置信度高}
E -- 否 --> F[降权或硬标签]
E -- 是 --> G{与学生判断冲突}
G -- 是 --> H[人工抽检]
G -- 否 --> I[使用软标签]Four gates
The first gate is the calibration set. Without a calibration set for a given slice, you should not enable soft labels on that slice, because you do not know the relationship between the teacher’s error rate and confidence there. Many teams have an overall calibration set but no calibration sets split by class frequency or business scenario; as a result, global calibration looks fine while the tail is completely out of control.
The second gate is the teacher’s accuracy on this slice. Soft labels are worth using only if the teacher is genuinely stronger than the student on this slice, and consistently so. If the teacher is only slightly better than the student, or both are fine-tuned from the same model family, soft labels are mostly transmitting shared bias, not capability.
The third gate is confidence. When the teacher is uncertain, the non-zero entries in soft labels are mostly noise. These samples can be downweighted or reverted directly to hard labels. Note that confidence thresholds cannot be set arbitrarily; you need to look at the “high-confidence error rate” on the calibration set. If the teacher still gives high confidence on samples it gets wrong, this slice is not suitable for soft labels.
The fourth gate is conflict between student and teacher. Conflict does not necessarily mean the student is wrong, but on long-tail slices it deserves manual spot-checking. If the student insists on an answer different from the teacher’s, it may be that the student learned a signal from hard labels that the teacher lacks, or it may be the student’s error. Sampling a batch and looking at confusion pairs is more useful than continuing to tune hyperparameters.
Another variable that is easy to overlook is capacity gap. If the student is too small, it cannot learn the soft distribution, and the teacher’s dark knowledge cannot be passed on; if the student is too large, it will remember the teacher’s mistakes more firmly. Capacity is not better when larger; it must be considered together with gating.
A practical gating template
1 | distill_policy: |
The numbers here are only a starting point, not universal thresholds. What matters is the structure: soft labels by default, but every slice must pass three checks—calibration, accuracy, and confidence—and if it fails, fall back to hard labels or manual review. In high-risk scenarios, such as low-frequency categories in healthcare, finance, and legal affairs, I tend to set the thresholds more conservatively, or even skip soft labels entirely. Low-frequency but high-value users often fall exactly where the teacher is least confident.
Evaluation should measure inheritance rate, not just overall accuracy
If the distillation evaluation set reports only overall top-1, you will almost certainly fail to see error inheritance. At minimum, split the samples by whether the teacher is correct:
| Student correct | Student incorrect | |
|---|---|---|
| Teacher correct | A | B |
| Teacher incorrect | C | D |
The teacher-error inheritance rate is D / (C + D). Run soft labels and hard labels separately and compare this number. If soft labels lift the student more on samples where the teacher is correct, but the inheritance rate is also clearly higher on samples where the teacher is wrong, that is an explicit trade: gains at the head in exchange for errors at the tail. Whether it is worth it depends on how the business prices tail errors.
Also look separately at the “high-confidence error rate”: the share of samples where the teacher is wrong and confidence is above the threshold. This number predicts post-launch complaints better than overall accuracy, because high-confidence errors are passed to the student intact through soft labels, and the student can hardly correct them in later training.
There should be at least two slicing dimensions: class frequency and teacher confidence. Class frequency shows the long tail; confidence shows calibration. If possible, add a business dimension, such as by failure type, product category, or user tier. Overall metrics are for reporting; slice metrics are for decisions.
Who ultimately bears this cost
The benefits of distillation are direct: small models are cheap, low-latency, and easy to deploy. These benefits are taken by the product team, while the costs of teacher errors often land on labeling, customer service, and online incidents. What is more troublesome is that responsibility boundaries become blurred: the teacher team says the student did not learn well, the student team says the teacher’s labels are problematic, and the product team sees user complaints.
So before distillation, it is best to write three things clearly. The teacher team provides accuracy and calibration reports for each slice, not just a single overall precision. The distillation owner defines the gating policy: which slices use soft labels, which fall back to hard labels, and which require manual review. The product owner defines the acceptable tail error rate, especially for low-frequency high-value scenarios. Without these three, soft labels are a black box, and when something goes wrong, all anyone can do is guess.
Soft labels are not a free lunch; what they pass on is the teacher’s complete judgment, including the biases in that judgment. If the teacher is strong, well calibrated, and the slices are clear, soft labels can transfer the structure between classes—that is where their value lies. If the teacher is only slightly better, overconfident on the tail, and without slice calibration, soft labels teach errors into the student’s instincts.
Next time you do distillation, do not tune the temperature first. Take the existing evaluation set and cut it two ways: by class frequency and by whether the teacher is correct. If soft labels have a clearly higher inheritance rate than hard labels on samples where the teacher is wrong, first switch those slices back to hard labels or manual review, and then talk about how to transfer the teacher’s dark knowledge. If this order is reversed, no matter how finely you tune hyperparameters, you are only optimizing an overall number that has been averaged away.
Comments