Abstract
Knowledge distillation (KD) for BERT typically requires the student model to mimic the teacher's hidden state knowledge (HSK) for every token and layer. This study demonstrates that much of this information is redundant. By systematically compressing HSK across depth, length, and width, we show that using less than 1% of the teacher's knowledge can match or exceed full-scale distillation performance. This finding enables an "offline" distillation paradigm that achieves a ~3x training speedup and significantly reduces memory requirements, making high-quality distillation accessible on standard hardware.
Introduction
Large pre-trained language models like BERT have set new benchmarks in NLP but remain computationally expensive to deploy. Knowledge Distillation (KD) addresses this by training a smaller "student" model to mimic a larger "teacher." Modern techniques, such as TinyBERT, force the student to replicate the teacher's Hidden State Knowledge (HSK)—the internal mathematical representations—across every token and layer.
While effective, this approach creates a massive computational bottleneck. The teacher model must be loaded alongside the student during training, consuming significant memory and slowing down the process. This paper investigates whether all this internal data is necessary, or if students are being overwhelmed by redundant information.
Methodology
The researchers explored the "minimum knowledge" required for effective distillation by compressing HSK across three dimensions:
- Depth (Layers): Testing which layers provide the most stable guidance. Findings suggest that upper-middle layers (e.g., layer 10 of 12) often provide better signals than the final layer.
- Length (Tokens): Using attention scores to identify critical tokens. The study found that the special
[SEP]token often contains trivial patterns that can distract the student. - Width (Activations): Applying Magnitude Masking (Mag Mask) to retain only the most significant activations while zeroing out the rest.
By combining these strategies, the authors developed an Offline KD Paradigm. Instead of running the teacher and student concurrently, they pre-calculate and store a tiny, curated subset of the teacher's HSK. The student then trains exclusively on this stored data, removing the need to load the massive teacher model during the training phase.
Key Results and Insights
The Law of Diminishing Returns
The most significant finding is that the marginal utility of hidden knowledge drops sharply. As shown in Figure 1, adding more HSK beyond a very small threshold (often less than 1%) provides almost no performance gain and, in some cases, can even lead to slight degradation due to noise.
Efficiency and Performance
- Training Speedup: The offline paradigm achieved a 2.7× to 3.4× speedup on both GPU and CPU by decoupling the student from the teacher.
- Performance Parity: Across GLUE tasks (CoLA, SST-2, QNLI, MNLI), students using compressed HSK achieved results comparable or superior to full-scale distillation. For instance, on the CoLA task, focused HSK compression significantly improved scores over standard methods.
- Storage Feasibility: While full HSK for large datasets like MNLI would require ~1TB, the compressed versions fit into a few gigabytes, making them portable for use on standard personal computers.
Conclusion
This research reveals that BERT distillation is heavily redundant. By identifying and utilizing only the "minimum knowledge" required, researchers can achieve state-of-the-art results with a fraction of the computational cost. Future work may involve automating the search for optimal knowledge subsets and extending these findings to other architectures like GPT or T5.
Summary updated