Sparse Teachers Can Be Dense with Knowledge

Yi Yang, Chen Zhang, Dawei Song

Abstract

Knowledge Distillation (KD) is a cornerstone of model compression, yet it often faces a "capacity gap" where the complexity of a large teacher model overwhelms a smaller student. This paper introduces STARK (Sparse Teacher Trick), a novel approach that improves distillation performance by strategically pruning the teacher model. By identifying and removing "student-unfriendly" parameters—those that contribute to teacher over-confidence or noise without aiding student learning—STARK creates a sparse teacher that transfers more effective knowledge. Experimental results on the GLUE benchmark show that STARK consistently outperforms standard KD and intermediate-model baselines, demonstrating that a pruned teacher can be a more effective educator than a dense one.

Introduction

In the pursuit of deploying high-performance AI on edge devices, Knowledge Distillation has become the standard technique for transferring the capabilities of massive "teacher" models (e.g., BERT-large) into compact "student" models. However, the assumption that a more powerful teacher always leads to a better student is frequently challenged by the capacity gap. Large models are often over-parameterized and exhibit extreme confidence in their predictions. For a student model with limited parameters, mimicking this high-certainty behavior can be counterproductive, as it lacks the capacity to resolve the complex decision boundaries the teacher has mastered.

This research proposes a counter-intuitive solution: to improve the student, we should first simplify the teacher. By sparsifying the teacher model to remove parameters that hinder the distillation process, we can bridge the capacity gap and improve the final performance of the compressed model.

The STARK Framework

The authors propose a three-stage procedure called STARK (Sparse Teacher Trick) to optimize the teacher for the specific needs of the student:

  1. Trial Distillation: The dense teacher is first distilled into a "trial student" on the target task. This stage acts as a diagnostic probe, identifying which aspects of the teacher's knowledge are easily absorbed and which cause the student to struggle.
  2. Parameter Sparsification: The core of the method lies in calculating a Knowledgeable Score for each parameter or module (such as an attention head) in the teacher. This score is an interpolation of two distinct metrics:
  3. Expressiveness Score: Measures how much a parameter contributes to the teacher's own accuracy.
  4. Student-Friendliness Score: Measures how much a parameter reduces the distillation loss for the student. By pruning parameters with low knowledgeable scores, the teacher is transformed into a sparse version that retains essential knowledge while discarding "unfriendly" noise.

  5. Actual Distillation: The final student model is trained from scratch using the newly sparsified teacher. The authors utilize a "weight rewinding" technique to ensure the comparison between dense and sparse teachers remains fair and focused on the quality of knowledge transfer.

Experimental Evaluation

The researchers evaluated STARK using the GLUE (General Language Understanding Evaluation) benchmark, testing across a variety of NLP tasks including sentiment analysis (SST-2), paraphrase detection (MRPC, QQP), and logical inference (MNLI, QNLI, RTE).

Key Insights

  • The "Less is More" Teacher: The study confirms that a teacher can be "too smart" for its own good. Pruning helps degrade the teacher's over-confidence (increasing the entropy of its output distributions) into a format that a smaller student can more easily digest.
  • The Expressiveness-Friendliness Tradeoff: There is a critical balance between maintaining the teacher's performance and making it accessible. Pruning solely for the teacher's accuracy preserves unfriendly parameters, while pruning solely for the student may discard the core knowledge necessary for the task.
  • Automatic Sparsity (STARK-AUTO): Interestingly, even random pruning can sometimes improve distillation because large models contain so many student-unfriendly parameters. The authors developed STARK-AUTO to automatically estimate the optimal pruning level by analyzing the density peaks of the knowledgeable scores.

Results and Discussion

STARK demonstrates significant improvements over standard KD and competitive baselines like Teacher Assistant Knowledge Distillation (TAKD) and MetaKD:

  • Performance Gains: On a 4-layer BERT student, STARK improved the average GLUE score by 1.0% over standard KD.
  • Superiority to Intermediate Models: STARK outperformed TAKD—which uses a medium-sized "tutor" model—by 0.7%. This suggests that a strategically pruned large teacher is more effective than a naturally smaller dense model.
  • Scalability: The benefits of STARK were observed across various scales, from distilling BERT-base into a 2-layer student to distilling BERT-large into an 8-layer student.

Conclusion and Future Work

STARK challenges the conventional wisdom of Knowledge Distillation by showing that sparse teachers can be more effective than dense ones. By filtering out "student-unfriendly" information, STARK provides a clearer signal for the student to follow.

Future research directions include applying STARK to task-agnostic settings (pre-training) and exploring its efficacy in other domains, such as Computer Vision with Vision Transformers or CNNs. While the current method introduces some computational overhead during the trial phase, the resulting improvements in student performance make it a compelling strategy for high-quality model compression.

Summary updated

BibTeX
@inproceedings{yang2022sparse,
  author = {Yi Yang and Chen Zhang and Dawei Song},
  title = {{Sparse Teachers Can Be Dense with Knowledge}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2022},
  doi = {10.18653/v1/2022.emnlp-main.258},
}
Figure