Marginal Utility Diminishes: Exploring the Minimum Knowledge for BERT Knowledge Distillation

Yuanxin Liu, Fandong Meng, Zheng Lin, Weiping Wang, Jie Zhou

Abstract

Recently, knowledge distillation (KD) has shown great success in BERT compression. Instead of only learning from the teacher's soft label as in conventional KD, researchers find that the rich information contained in the hidden layers of BERT is conducive to the student's performance. To better exploit the hidden knowledge, a common practice is to force the student to deeply mimic the teacher's hidden states of all the tokens in a layer-wise manner. In this paper, however, we observe that although distilling the teacher's hidden state knowledge (HSK) is helpful, the performance gain (marginal utility) diminishes quickly as more HSK is distilled. To understand this effect, we conduct a series of analysis. Specifically, we divide the HSK of BERT into three dimensions, namely depth, length and width. We first investigate a variety of strategies to extract crucial knowledge for each single dimension and then jointly compress the three dimensions. In this way, we show that 1) the student's performance can be improved by extracting and distilling the crucial HSK, and 2) using a tiny fraction of HSK can achieve the same performance as extensive HSK distillation. Based on the second finding, we further propose an efficient KD paradigm to compress BERT, which does not require loading the teacher during the training of student. For two kinds of student models and computing devices, the proposed KD paradigm gives rise to training speedup of 2.7x ~ 3.4x.

Introduction

Large-scale pre-trained language models like BERT have revolutionized NLP but remain computationally prohibitive for edge deployment. Knowledge Distillation (KD) has emerged as a primary solution, where a compact "student" model is trained to replicate the behavior of a larger "teacher." Modern approaches go beyond output labels, utilizing Hidden State Knowledge (HSK)—the internal activations across all layers and tokens. While effective, full HSK distillation is resource-intensive, requiring the massive teacher model to be active during every training step. This study investigates whether such extensive data transfer is necessary, uncovering a significant law of diminishing returns in teacher-student knowledge transfer.

The Law of Diminishing Returns in HSK

A core finding of this research is that the "marginal utility" of teacher knowledge decreases rapidly. As shown in Figure 1, the performance of student models (ROSITA and TinyBERT) on the QNLI task peaks or plateaus very early as the amount of distilled HSK increases. In many instances, utilizing less than 1% of the teacher's total hidden state information yields results comparable to, or even better than, full-scale distillation.

Figure 1: QNLI accuracy vs. normalized amount of HSK, illustrating the diminishing marginal utility of teacher knowledge.

Multi-Dimensional HSK Compression

To identify the "minimum knowledge" required, the authors analyzed HSK across three structural dimensions:

1. Depth (Layer Selection)

Rather than a simple one-to-one layer mapping, the study found that specific "upper-middle" layers (e.g., layer 10 of a 12-layer BERT) often provide superior guidance compared to the final layer.

2. Length (Token Selection)

By using attention-based scoring, the researchers identified crucial tokens. A surprising discovery was the role of the [SEP] token. Despite receiving high attention, its internal representations often act as "noise" during distillation. Removing [SEP] tokens from the HSK allowed students to achieve higher accuracy with significantly less data.

Extracted figure from page 5 of Marginal Utility Diminishes: Exploring the Minimum Knowledge for BERT Knowledge Distillation

3. Width (Activation Masking)

The study compared various masking strategies for hidden vectors. Magnitude-based masking—retaining only the activations with the highest absolute values—was found to be significantly more effective than random or uniform sampling, suggesting that the most "active" neurons carry the bulk of the transferable knowledge.

Efficient Offline Distillation

Leveraging the discovery that only a tiny fraction of HSK is necessary, the authors propose an Offline KD paradigm. By pre-computing and storing only the "crucial" subset of HSK, the teacher model no longer needs to be loaded during student training. This approach reduces the storage requirements for a dataset like MNLI from ~1 TB to a manageable 1-5 GB, democratizing the distillation process for researchers without high-end server clusters.

Results and Discussion

The proposed offline paradigm achieved a 2.7x to 3.4x training speedup across various hardware configurations. Furthermore, "compressed" distillation frequently outperformed standard baselines. For example, on the CoLA benchmark, TinyBERT using compressed HSK achieved a score of 37.5, a substantial improvement over the 29.8 achieved via standard distillation. This suggests that current methods may be over-engineered, and that filtering out "noisy" internal data can actually facilitate better student learning.

Conclusion

This work demonstrates that "less is more" in the context of BERT distillation. By focusing on crucial hidden state knowledge across depth, length, and width, researchers can achieve state-of-the-art performance with a fraction of the computational and storage costs. Future work will explore applying these heuristics to the pre-training phase and utilizing automated search algorithms to further optimize knowledge selection.

Summary updated

BibTeX
@inproceedings{liu2021marginal,
  author = {Yuanxin Liu and Fandong Meng and Zheng Lin and Weiping Wang and Jie Zhou},
  title = {{Marginal Utility Diminishes: Exploring the Minimum Knowledge for BERT Knowledge Distillation}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2021},
  doi = {10.18653/v1/2021.acl-long.228},
}
Figure