Abstract
Methods for improving the efficiency of deep network training (i.e. the resources required to achieve a given level of model quality) are of immediate benefit to deep learning practitioners. Distillation is typically used to compress models or improve model quality, but it's unclear if distillation actually improves training efficiency. Can the quality improvements of distillation be converted into training speed-ups, or do they simply increase final model quality with no resource savings? We conducted a series of experiments to investigate whether and how distillation can be used to accelerate training using ResNet-50 trained on ImageNet and BERT trained on C4 with a masked language modeling objective and evaluated on GLUE, using common enterprise hardware (8x NVIDIA A100). We found that distillation can speed up training by up to 1.96x in ResNet-50 trained on ImageNet and up to 1.42x on BERT when evaluated on GLUE. Furthermore, distillation for BERT yields optimal results when it is only performed for the first 20-50% of training. We also observed that training with distillation is almost always more efficient than training without distillation, even when using the poorest-quality model as a teacher, in both ResNet-50 and BERT. Finally, we found that it's possible to gain the benefit of distilling from an ensemble of teacher models, which has O(n) runtime cost, by randomly sampling a single teacher from the pool of teacher models on each step, which only has a O(1) runtime cost. Taken together, these results show that distillation can substantially improve training efficiency in both image classification and language modeling, and that a few simple optimizations to distillation protocols can further enhance these efficiency improvements.
Introduction: The Iterated Runs Problem
In modern machine learning, the reported cost of a model usually only accounts for the final "golden" run. In reality, practitioners spend far more resources on hyperparameter sweeps—training dozens or hundreds of models to find the best settings. Once the sweep is done, the sub-optimal models are typically discarded. This research addresses the "Iterated Runs Problem" by asking: Can we use these "waste" models to make the final training run more efficient? While Knowledge Distillation (KD) is traditionally used for model compression or accuracy boosts, this study investigates whether KD can be used to reach a target accuracy faster in terms of wall-clock time.
Methodology: Distillation as a Fungible Resource
The researchers treat distillation as a fungible resource: instead of using it to get a better model in the same amount of time, they use it to get an equivalent model in significantly less time. They employ two standard distillation losses: KL-Divergence (matching probability distributions) and Mean Squared Error (MSE, matching raw logit values).
To minimize computational overhead, two key optimizations are introduced:
- Early-phase Distillation: For BERT, "turning off" the teacher after the first 20-50% of training yields better results than distilling for the entire run.
- Random Teacher Sampling: Instead of an expensive $O(N)$ ensemble, the system randomly picks one teacher from a pool for each training step, maintaining $O(1)$ cost.
Key Results and Insights
The study evaluates efficiency across Computer Vision (ResNet-50 on ImageNet) and NLP (BERT on C4/GLUE).
ResNet-50 on ImageNet
Distillation proved to be a highly effective accelerator for image classification. As shown in Figure 1, models trained with KD reached the baseline accuracy of 76.6% up to 1.96x faster than models trained from scratch.
BERT on GLUE
For language modeling, distillation achieved a 1.42x speedup to reach baseline performance across downstream GLUE tasks. Interestingly, the "turn it off" phenomenon was observed: BERT students perform best when the teacher is removed midway through training, suggesting that "dark knowledge" is most useful during early feature learning stages.
Efficiency and Robustness
Training with distillation was almost always more efficient than training without it. Even using the "worst" model from a hyperparameter sweep as a teacher allowed the student to reach baseline accuracy faster than a scratch run. While KL-Divergence can produce the highest quality students, MSE loss was found to be more robust across various hyperparameters.
Discussion and Limitations
While the results are promising, some limitations remain. Distillation requires keeping the teacher model in GPU memory, which could lead to memory exhaustion for massive LLMs. Additionally, the recommendation to stop BERT distillation at 20-50% is currently empirical, lacking a precise analytical framework. Future work will explore if these "recycle" strategies scale to multi-billion parameter generative models where the Iterated Runs Problem is most costly.
Summary updated