Rethinking Soft Labels for Knowledge Distillation: A Bias-Variance Tradeoff Perspective

Helong Zhou, Liangchen Song, Jiajie Chen, Ye Zhou, Guoli Wang, Junsong Yuan, Qian Zhang

TL;DR

This paper re-examines Knowledge Distillation (KD) through the lens of the bias-variance tradeoff, revealing that "soft labels" from a teacher network act as a sample-specific regularizer. By identifying "regularization samples" that inadvertently increase bias while lowering variance, the authors propose Weighted Soft Labels (WSL)—a method that adaptively tunes the teacher's influence on a per-sample basis to achieve state-of-the-art accuracy in both computer vision and NLP.

What Problem Does This Paper Address?

Knowledge Distillation—where a small "student" model learns from a large "teacher" model—is a staple of model compression. While we know it works, the why remains a subject of intense debate. Recent research suggests that the "soft labels" (probability distributions) provided by the teacher act as a form of regularization.

Visualizing the bias-variance tradeoff between one-hot and soft labels.

However, in classical statistics, regularization is a double-edged sword: it reduces variance (making the model more stable and generalizable) but often increases bias (making the model less accurate on the training data). The authors tackle a fundamental question: How does this bias-variance tradeoff play out across different training samples, and can we manipulate it to make students even smarter?

Methods

The authors provide a mathematical decomposition of the distillation loss into bias and variance components. Their key methodological contributions include:

  1. Identifying "Regularization Samples": They define specific training samples where the gradient of variance reduction is significantly larger than the gradient of bias reduction. Essentially, these are points where the teacher is forcing the student to "relax" its predictions so much that it starts getting the answer wrong.
  2. Sample-wise Analysis: They discover that the bias-variance tradeoff isn't a global setting; it varies from image to image.
  3. Weighted Soft Labels (WSL): To fix the "over-regularization" of certain samples, they introduce a weighting function: $$L_{wsl} = \left(1 - \exp\left(-\frac{L^s_{ce}}{L^t_{ce}}\right)\right) L_{kd}$$ This formula compares the student’s cross-entropy loss ($L^s_{ce}$) to the teacher’s ($L^t_{ce}$). If the student is already performing well relative to the teacher on a specific sample, the weight of the teacher's guidance is reduced. This prevents the teacher from "pulling" a correct student toward a biased or less certain prediction.

Key Insights and Ideas

  • The Teacher Smoothing Paradox: The authors explain a known "weird" phenomenon: teachers trained with label smoothing are actually worse at distillation. Why? Because they produce more "regularization samples," which increases the student's bias too much.
Table and plots demonstrating that teacher label smoothing increases regularization samples and hurts student accuracy.
  • Don't Delete, Just Turn Down the Volume: They found that completely filtering out "regularization samples" actually hurts performance. These samples still contain "dark knowledge" (information about class resemblances). The trick is to weight them lower, not ignore them.
  • Dynamic Evolution: The number of regularization samples isn't static; it increases as training progresses. This suggests that the "optimal" distillation strategy must evolve over the course of training.

Datasets and Key Results

The researchers validated their approach across diverse benchmarks, consistently outperforming standard KD and other state-of-the-art (SOTA) methods like Contrastive Representation Distillation (CRD):

  • CIFAR-100: On a WideResNet (WRN-40-2 to WRN-40-1) transfer, WSL achieved 74.48% accuracy, surpassing standard KD (73.54%) and CRD (74.14%).
  • ImageNet: For a ResNet-34 to ResNet-18 distillation, WSL reached 72.04% Top-1 accuracy, a significant jump over the student's baseline of 69.75%.
  • NLP (MultiNLI): Distilling a BERT-12 teacher into a BERT-3 student resulted in 76.28% accuracy, outperforming the standard KD replication of 75.50%.

Limitations and Future Work

  • Hyperparameter Sensitivity: The method introduces a balancing hyperparameter. While the authors provide a grid search range, finding the "perfect" balance for a new dataset still requires some manual tuning.
  • Weighting Function Choice: The exponential weighting function used is effective but somewhat empirical. The authors suggest that exploring more complex or theoretically "optimal" weighting forms is a promising future direction.
  • Broader Architectures: While they tested many CNNs and BERT, the interaction of this bias-variance tradeoff with newer architectures like Vision Transformers (ViTs) remains unexplored in this paper.

Summary updated

Abstract

Knowledge distillation is an effective approach to leverage a well-trained network or an ensemble of them, named as the teacher, to guide the training of a student network. The outputs from the teacher network are used as soft labels for supervising the training of a new network. Recent studies (M ̈uller et al., 2019; Yuan et al., 2020) revealed an intriguing property of the soft labels that making labels soft serves as a good regularization to the student network. From the perspective of statistical learning, regularization aims to reduce the variance, however how bias and variance change is not clear for training with soft labels. In this paper, we investigate the bias-variance tradeoff brought by distillation with soft labels. Specifically, we observe that during training the bias-variance tradeoff varies sample-wisely. Further, under the same distillation temperature setting, we observe that the distillation performance is negatively associated with the number of some specific samples, which are named as regularization samples since these samples lead to bias increasing and variance decreasing. Nevertheless, we empirically find that completely filtering out regularization samples also deteriorates distillation performance. Our discoveries inspired us to propose the novel weighted soft labels to help the network adaptively handle the sample-wise bias-variance tradeoff. Experiments on standard evaluation benchmarks validate the effectiveness of our method. Our code is available in the supplementary.
BibTeX
@inproceedings{zhou2021rethinking,
  author = {Helong Zhou and Liangchen Song and Jiajie Chen and Ye Zhou and Guoli Wang and Junsong Yuan and Qian Zhang},
  title = {{Rethinking Soft Labels for Knowledge Distillation: A Bias-Variance Tradeoff Perspective}},
  booktitle = {International Conference on Learning Representations},
  year = {2021},
  url = {https://openreview.net/forum?id=jClNzSvrbYi},
}
Figure