Improved Knowledge Distillation for Pre-trained Language Models via Knowledge Selection

Chenglong Wang, Yi Lu, Yongyu Mu, Yimin Hu, Tong Xiao, Jingbo Zhu

Abstract

Pre-trained Language Models (PLMs) like BERT have achieved remarkable success but are often too large for efficient deployment. Knowledge Distillation (KD) is a standard compression technique, yet existing methods typically treat teacher knowledge as a static set of features to be transferred uniformly. We propose a reinforcement learning-based Knowledge Selection Module (KSM) that dynamically selects the most appropriate teacher knowledge types at different training stages. By optimizing the "lesson plan" for the student model, our approach achieves over 98.5% of the teacher's performance with significantly reduced parameters and latency.

Introduction

The computational demands of large-scale Pre-trained Language Models (PLMs) necessitate effective compression techniques. Knowledge Distillation (KD) addresses this by training a compact student model to emulate a larger teacher. However, traditional KD methods suffer from redundancy and poor timing, as they often transfer all available knowledge types (e.g., final outputs, intermediate features) simultaneously throughout the training process. Our preliminary findings indicate that the sequence and timing of knowledge transfer significantly impact final performance. For instance, probing experiments on the RTE dataset revealed that simply changing the sequence of knowledge types used during training could lead to a 10% performance difference. To address this, we introduce a dynamic Knowledge Selection Module (KSM) that utilizes an Actor-Critic framework to tailor the distillation process to the student's current learning state.

Methodology

The core of our method is the Knowledge Selection Module (KSM), which employs an Actor-Critic reinforcement learning approach. The Actor determines the selection or weighting of four knowledge types:

  • Response Knowledge (ResK): Mimicking the teacher's final predictions.
  • Feature Knowledge (FeaK): Mimicking intermediate layer representations.
  • Relation Knowledge (RelK): Learning relationships between different layers.
  • Finetune Knowledge (FinK): Learning directly from ground-truth labels.
The proposed framework featuring the Actor-Critic based Knowledge Selection Module (KSM) and the student model distillation process.

The Critic evaluates the long-term impact of these selections based on a reward signal derived from the change in cross-entropy loss, which proved more stable than raw accuracy metrics. To ensure scalability and reduce computational overhead, we implement a Multi-Phase Training strategy that calculates rewards over blocks of steps rather than at every individual step.

Experiments and Results

We evaluated our framework on the GLUE benchmark, focusing on diverse tasks such as MNLI, RTE, QQP, MRPC, QNLI, and SST-2. Our results show that a 6-layer BERT student ($BERT_6$) can retain 98.5% of the performance of a 12-layer $BERT_{BASE}$ teacher while using approximately 40% fewer parameters. Notably, our method consistently outperformed static baselines like DistilBERT, PKD (Patient Knowledge Distillation), and Dynamic KD.

Comparison of accuracy over training episodes for Vanilla KD versus our method using Soft and Hard actions.

A key finding is the superiority of "Soft Actions," where the KSM assigns continuous weights to knowledge types, over "Hard Actions" (binary selection). This suggests that a nuanced blend of knowledge is more effective than strict selection. Furthermore, the dynamic curriculum learned by the KSM aligns with the intuition that different features are prioritized as the student model matures; for example, intermediate features (FeaK) are often more critical in early training phases, whereas final output distributions (ResK) become more relevant later.

Conclusion

This work demonstrates that dynamic knowledge selection is a powerful tool for improving knowledge distillation in PLMs. By treating distillation as a curriculum learning problem, we achieve state-of-the-art compression results. While the training overhead of the KSM remains a challenge for extremely large datasets, the efficiency gains in the final student model are substantial. Future research will explore more lightweight selection modules and the extension of this framework to multi-teacher distillation scenarios.

Summary updated

BibTeX
@inproceedings{wang2022improved,
  author = {Chenglong Wang and Yi Lu and Yongyu Mu and Yimin Hu and Tong Xiao and Jingbo Zhu},
  title = {{Improved Knowledge Distillation for Pre-trained Language Models via Knowledge Selection}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2022},
  doi = {10.18653/v1/2022.findings-emnlp.464},
}
Figure