An Empirical Investigation into the Effect of Parameter Choices in Knowledge Distillation

Md. Arafat Sultan, Aashka Trivedi, Parul Awasthy, Avirup SilarXiv 2024 · DOI

Abstract

Knowledge Distillation (KD) is a cornerstone of model compression, yet its performance is highly sensitive to hyperparameter choices often made by intuition. This study conducts a large-scale empirical investigation across 13 NLP datasets to quantify the impact of these choices and identifies a "stable" configuration that performs robustly across tasks without the need for expensive tuning.

Introduction

Knowledge Distillation involves training a smaller "student" model to mimic a larger "teacher." While powerful, the process is notoriously sensitive to specific settings: which teacher checkpoint to use, the distance metric between distributions, the weight of human labels, and temperature scaling. Most researchers rely on personal bias or random selection for these parameters. This paper fills the gap by systematically quantifying the "cost" of sub-optimal choices and providing evidence-based recommendations.

Methodology

The researchers evaluated 39 teacher-student-dataset triples across four major NLP tasks: Text Classification, Named Entity Recognition (NER), Reading Comprehension, and Machine Translation. To navigate the vast parameter space, they employed an approximate greedy search, starting from a standard default and iteratively optimizing individual parameters to isolate their effects.

Analysis of Parameter Impact

The study reveals that specific parameter choices significantly influence the final student performance. By comparing various configurations, the authors identified which settings consistently yield the best results.

Relative gain of individual parameter choices across difference deciles.

Key Findings:

  • The "Low-Loss" Teacher Wins: Surprisingly, the best teacher is not necessarily the one with the highest accuracy. Teachers with the lowest validation loss ($t_{ll}$)—indicating better-calibrated probability estimates—consistently produced superior students.
  • Distance Metrics: Cross-Entropy (CE) generally outperformed Mean Squared Error (MSE) as a distance measure between teacher and student distributions.
  • Human Labels are Optional: Tuning the weight of human labels ($\alpha$) provided the smallest performance gains but was the most computationally expensive to optimize. Distilling from the teacher's soft labels alone ($\alpha=1$) is often a sufficient strategy.
  • Temperature Simplicity: Setting the student's temperature to 1 ($\tau_s = 1$) while scaling the teacher's was found to be as effective as scaling both, aiding model interpretability.

Quantifying the Cost of Sub-optimal Choices

The difference between a well-tuned configuration and a poor one is substantial. Choosing a "weak" configuration instead of a "strong" one resulted in a relative performance loss of up to 9.4%.

Relative gain of the best configuration over the worst and random configurations.

As shown in the figure above, the gap between the best and worst configurations widens significantly at higher deciles, reaching a 4.3% gain at the 90th percentile. Even compared to a random parameter selection, a tuned configuration offers a gain of up to 3%.

The "Stable" Configuration

The authors identified a specific configuration ($t = t_{ll}, \mathcal{L}_2 = CE, \tau_s = 1, \alpha = 1$) that is remarkably robust. This "stable" setup matched or outperformed best test-specific configurations in 40% of all cases, providing a high-quality default for researchers.

Conclusion

This investigation moves KD beyond "hyperparameter vibes" by providing a systematic look at parameter sensitivity. While the study focused on NLP, the identified stable configuration offers a reliable starting point for model compression. Future work remains to determine if these specific settings hold true for other domains like computer vision or for extremely large-scale models.

Summary updated

Abstract

We present a large-scale empirical study of how choices of configuration parameters affect performance in knowledge distillation (KD). An example of such a KD parameter is the measure of distance between the predictions of the teacher and the student, common choices for which include the mean squared error (MSE) and the KL-divergence. Although scattered efforts have been made to understand the differences between such options, the KD literature still lacks a systematic study on their general effect on student performance. We take an empirical approach to this question in this paper, seeking to find out the extent to which such choices influence student performance across 13 datasets from 4 NLP tasks and 3 student sizes. We quantify the cost of making sub-optimal choices and identify a single configuration that performs well across the board.
BibTeX
@misc{sultan2024empirical,
  author = {Md. Arafat Sultan and Aashka Trivedi and Parul Awasthy and Avirup Sil},
  title = {{An Empirical Investigation into the Effect of Parameter Choices in Knowledge Distillation}},
  year = {2024},
  eprint = {2401.06356},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2401.06356},
}
Figure