Towards Understanding Ensemble, Knowledge Distillation and Self-Distillation in Deep Learning

Zeyuan Allen-Zhu, Yuanzhi Li

Deep learning practitioners frequently rely on three "miracles" to boost model performance: ensembling (averaging the outputs of several identical models trained with different random seeds), knowledge distillation (compressing an ensemble's superior performance back into a single model), and self-distillation (distilling a model into an identical architecture to improve its accuracy).

Despite their widespread use, traditional learning theories like Boosting or Bagging fail to fully explain these phenomena. Boosting requires sequential training with different weights, while Bagging relies on different data subsets. Furthermore, the Neural Tangent Kernel (NTK) regime—which treats neural networks as linear functions over random features—cannot explain knowledge distillation, as NTK ensembles cannot be effectively distilled into a single model.

This paper bridges this theoretical gap by treating deep learning as a feature learning process rather than a feature selection process, introducing the multi-view hypothesis to explain why these techniques succeed.

The Multi-View Hypothesis

To formally study these phenomena, the authors analyze a two-layer convolutional neural network (CNN) and introduce the concept of a multi-view data structure.

In this framework, data for a specific class contains multiple "views" or features. For example, a "car" might be identified by its headlights, wheels, or windows.

  • Multi-view data: Contains multiple features that can correctly identify the class (e.g., a full profile of a car).
  • Single-view data: Contains only one feature (e.g., a cropped image where only the wheels are visible).
Multi-view data examples showing different features of a car and a cat.

The authors prove that during training, a single neural network is "lazy." Once it finds enough features to achieve 100% training accuracy, it stops learning new ones. Because of random initialization, different models will latch onto different features. One model might only learn to recognize "headlights," while another learns "wheels." Both achieve perfect training accuracy but will fail on test images that only show the feature they ignored.

Why Ensembles and Distillation Work

The multi-view hypothesis naturally explains the success of ensembles and distillation:

  • Ensemble as Feature Union: By averaging the outputs of multiple independently trained models, the ensemble effectively covers all available views. If a 10-model ensemble includes some models that learned headlights, some that learned wheels, and some that learned windows, the combined system becomes robust to missing features, explaining the significant jump in test accuracy.
  • Dark Knowledge is Feature Guidance: Knowledge distillation works by transferring the ensemble's nuanced "soft labels" to a student model. If an image contains a cat but also has a feature resembling a car wheel, the ensemble might output "90% cat, 10% car." That 10% signal is the "dark knowledge." It forces the student model to learn the car-like feature it would have otherwise ignored, effectively teaching it the union of all features discovered by the ensemble.
  • Self-Distillation as Implicit Ensemble: Even if a single teacher model only learned one view, it provides a "smoother" signal than hard labels. This smoothed signal helps the student model pick up additional views more efficiently during training.

Deep Learning vs. NTK Regimes

The authors highlight a stark contrast between standard Deep Learning (DL) and the NTK regime. In NTK, ensembles merely use a larger pool of random features, and their performance cannot be distilled into a single model. In contrast, DL ensembles actively learn a more robust set of meaningful features.

Comparison of NTK and Deep Learning performance across ensembles and distillation.

Empirical experiments on CIFAR-10 and CIFAR-100 confirm this theory. For instance, an individual Wide ResNet (WRN-28-10) achieves ~96.70% accuracy on CIFAR-10. An ensemble of 10 models boosts this to 97.20%. Crucially, a distilled single model maintains that gain at 97.22%. The authors also prove mathematically that while a single model's test error scales with the fraction of single-view data, both the ensemble and the distilled student model can achieve exponentially lower error rates. Interestingly, simply averaging the weights of the models (Train Average) fails to capture this benefit, whereas matching the outputs (Distillation) succeeds.

Limitations and Future Directions

While the paper provides a robust theoretical foundation, the formal proofs are currently limited to two-layer CNNs. Although the empirical insights generalize to deeper architectures like ResNets, the mathematics for deep networks remain highly complex. Additionally, the multi-view model assumes features are somewhat independent, whereas real-world data often contains complex feature hierarchies and correlations. Future work will explore how this multi-view structure interacts with techniques like data augmentation and self-supervised learning, which also manipulate how models perceive different "views" of data.

Summary updated

BibTeX
@inproceedings{allenzhu2023towards,
  author = {Zeyuan Allen-Zhu and Yuanzhi Li},
  title = {{Towards Understanding Ensemble, Knowledge Distillation and Self-Distillation in Deep Learning}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=Uuf2q9TfXGA},
}
Figure