When does label smoothing help?

Rafael Müller, Simon Kornblith, Geoffrey E. Hinton

Label smoothing is a ubiquitous "trick" used to boost neural network accuracy, but it is often deployed without a full understanding of its underlying mechanics. While it improves generalization and model calibration, it can also act as a double-edged sword. By forcing internal representations into tight, equidistant clusters, label smoothing "erases" the nuanced similarities between classes, making these models surprisingly poor teachers for knowledge distillation.

The Mystery of Soft Targets

In deep learning, we typically train classifiers using "hard targets"—assigning a probability of 1.0 to the correct class and 0.0 to everything else. Label smoothing (LS) softens this approach by distributing a small amount of probability mass across all incorrect classes. While LS is known to improve performance in state-of-the-art models like Inception and the Transformer, the community hasn't fully understood why it works or what it does to the model's internal logic.

To demystify LS, researchers investigated how it changes the geometry of the penultimate layer's representations and why a technique that improves accuracy can simultaneously degrade a model's ability to pass knowledge on to a "student" network.

Visualizing the Impact: Tight Clusters vs. Broad Clouds

To understand the internal changes caused by LS, the researchers developed a novel visualization method. They projected high-dimensional activations from the penultimate layer onto a 2D plane. By choosing three class "templates" (the weights of the final linear layer) as an orthonormal basis, they could visualize how examples cluster relative to their correct and incorrect classes.

2D projections of penultimate layer representations across different datasets.

Without LS, representations of a class are spread out in broad clouds. This allows the model to learn nuanced relationships—for instance, that some "dog" images share visual features with "cats." However, with LS, the model is forced to make every example of a class nearly equidistant from all incorrect class templates. As seen in the visualizations above, this results in incredibly tight, isolated clusters.

The Distillation Paradox

This clustering behavior explains a frustrating phenomenon in model training: the distillation paradox.

Knowledge distillation relies on the "dark knowledge" hidden in the relative probabilities of incorrect classes. For example, a model might predict a "poodle" has a 0.1% chance of being a "labrador" but only a 0.0001% chance of being a "car." This structural information is incredibly valuable for training a smaller student network.

Because LS forces representations into tight clusters and flattens the differences between incorrect classes, it effectively "erases" this dark knowledge. Consequently, a more accurate teacher (trained with LS) can result in a worse student. In a CIFAR-10 experiment, a teacher trained with LS achieved higher accuracy than a standard teacher. However, when used to train a student, the LS-teacher produced a student with 0.91% test error, whereas the standard teacher produced a superior student with 0.74% error.

Implicit Calibration

Despite its drawbacks for distillation, LS offers a massive benefit for model calibration. Standard neural networks often become "overconfident," predicting probabilities that are much higher than their actual accuracy.

Reliability diagrams comparing model calibration with and without label smoothing.

LS acts as a built-in calibrator, preventing the network from becoming overly certain. The researchers compared LS to Temperature Scaling, a standard post-processing technique used to align confidence scores with actual accuracy. They found that LS makes the model’s predicted probabilities much more representative of its actual likelihood of being correct. On CIFAR-100, LS reduced the Expected Calibration Error (ECE) from 0.150 to 0.024—outperforming even dedicated temperature scaling in some scenarios. This improved calibration is particularly beneficial for tasks relying on sequence generation, like beam-search in machine translation.

Conclusion and Future Directions

Label smoothing is not just a simple regularization trick; it fundamentally alters the geometry of a network's internal representations. While it yields performance gains—such as reducing ImageNet Top-1 error from 23.1% to 22.8% and increasing BLEU scores in translation—it destroys the relative class information necessary for knowledge distillation.

Future research could explore whether there are ways to gain the calibration benefits of label smoothing without sacrificing the "dark knowledge" required for effective distillation. Potential solutions might include adaptive smoothing techniques or applying LS only during specific phases of the training lifecycle.

Summary updated

BibTeX
@inproceedings{muller2019when,
  author = {Rafael Müller and Simon Kornblith and Geoffrey E. Hinton},
  title = {{When does label smoothing help?}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2019},
  url = {https://openreview.net/forum?id=pxrD-29Gnju},
}
Figure