Reinforced Multi-Teacher Selection for Knowledge Distillation

Fei Yuan, Linjun Shou, Jian Pei, Wutao Lin, Ming Gong, Yan Fu, Daxin Jiang

Abstract

Large-scale pre-trained language models like BERT and RoBERTa have revolutionized Natural Language Processing but remain computationally prohibitive for real-time deployment. Knowledge Distillation (KD) is a common technique used to compress these "teacher" models into smaller "student" models. However, traditional multi-teacher KD often relies on fixed weighting schemes that fail to account for the capacity gap between teachers and students or the instance-specific expertise of different models. We present RL-KD, a framework that utilizes Reinforcement Learning to dynamically select the most appropriate teachers for every individual training instance. Evaluated on the GLUE benchmark, RL-KD consistently outperforms standard KD and ensemble methods, achieving significant gains in accuracy for compressed 3-layer and 6-layer BERT models.

Introduction

In the current NLP landscape, model performance often scales with parameter count. While effective, these massive models are slow and expensive to run in production environments. Knowledge Distillation addresses this by training a compact student model to mimic the output distributions (soft labels) of a larger teacher.

While using multiple teachers can provide a more diverse signal, the standard approach of averaging their advice is suboptimal. This paper identifies two primary limitations in fixed-weight multi-teacher distillation:

  1. The Capacity Gap: A more powerful teacher (e.g., RoBERTa-Base) is not always a better instructor for a small student. If the teacher's internal representations are too complex, a shallow student may fail to converge, whereas it might learn effectively from a simpler teacher.
  2. Instance Sensitivity: Different models possess specialized strengths. One teacher might excel at sentiment analysis while another is superior at logical inference. Treating all teachers as equals across all data points ignores these specialized capabilities.

The RL-KD Framework

To overcome these limitations, we propose Reinforced Multi-Teacher Selection (RL-KD). This framework introduces a Reinforcement Learning agent that acts as a dynamic selector, deciding which teachers should contribute to the student's learning for each specific training example.

Figure 1: The RL-KD framework uses an RL agent to dynamically select teachers based on the environment state, providing a tailored curriculum for the student model.

Agent Components

  • State ($s_j$): For each training instance, the agent observes the sentence's semantic representation, the soft labels predicted by each teacher, and the cross-entropy loss each teacher incurred on that example.
  • Action ($a_j$): The agent performs a binary action for each teacher: either selecting it to contribute to the current training step or excluding it.
  • Reward: The agent is rewarded based on the student's subsequent performance. The most effective reward function ($reward_3$) incorporates both training loss and accuracy on a separate validation set, encouraging the selection of teachers that promote generalization rather than simple memorization.

Experimental Results

We evaluated RL-KD using four high-performing teachers—BERT${12}$, RoBERTa${12}$, XLNet${12}$, and ALBERT${12}$—to train students with 3 and 6 layers across the GLUE benchmark.

Figure 6: Performance comparison on GLUE tasks. RL-KD (Our Method) consistently achieves the highest average scores across different student architectures and reward functions.

As shown in the results, RL-KD (specifically using $reward_3$) achieves a state-of-the-art average score of 79.6 for a 3-layer student, significantly higher than the 77.1 achieved by standard fine-tuning or the 77.3 from vanilla single-teacher distillation.

Key Insights

  • Small Data Efficiency: The benefits of RL-KD are most pronounced on smaller datasets like RTE. For a 3-layer student, RL-KD reached 64.6% accuracy, a substantial improvement over the 56.7% achieved by standard BERT$_{12}$ distillation. This suggests that dynamic selection helps the student navigate noisy or sparse signals more effectively.
  • Addressing the Paradox: The framework successfully navigates the "Stronger Teacher Paradox." By allowing the agent to bypass overly complex teachers when they confuse the student, the system ensures the student always learns from the most "digestible" source for a given instance.
  • Robustness: Beyond raw accuracy, RL-KD demonstrates lower variance across multiple runs compared to traditional ensemble methods, indicating that the learned selection policy is stable and reliable.

Conclusion

RL-KD represents a significant step forward in model compression by moving away from "one size fits all" distillation. By framing teacher selection as a reinforcement learning problem, we allow the student to benefit from a diverse set of experts without being overwhelmed by their complexity. Future work will focus on reducing the computational overhead of the training process and exploring automated methods for selecting the initial teacher pool.

Summary updated

BibTeX
@inproceedings{yuan2021reinforced,
  author = {Fei Yuan and Linjun Shou and Jian Pei and Wutao Lin and Ming Gong and Yan Fu and Daxin Jiang},
  title = {{Reinforced Multi-Teacher Selection for Knowledge Distillation}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2021},
  doi = {10.1609/aaai.v35i16.17680},
}
Figure