Abstract
Pre-trained language models like BERT are powerful but computationally expensive, hindering deployment on resource-constrained devices. Knowledge Distillation (KD) is a common compression technique where a small "student" model learns from a large "teacher." However, standard KD often ignores the varying difficulty of training samples, leading to suboptimal performance. We introduce Tutor-KD, a framework that incorporates a "tutor network" to curate training data. By optimizing for samples that are easy for the teacher to explain and challenging for the student via reinforcement learning, Tutor-KD achieves state-of-the-art results. Notably, a 6-layer student model trained with this method outperforms the original 12-layer BERT-base teacher on the GLUE benchmark.
What Problem Does This Paper Address?
The primary challenge in deploying models like BERT is their massive parameter count. While Knowledge Distillation (KD) helps by transferring knowledge to smaller architectures, it typically treats all training data equally.
The authors identify that this "one-size-fits-all" approach is flawed. If a training sample is too difficult, the teacher's predictions may be noisy or incorrect, causing the student to learn errors. Conversely, if a sample is too easy, the student gains no new information. This lack of data curation limits the efficiency of training, especially for extremely small models where the capacity gap between teacher and student is large.
Methods: The Tutor-KD Framework
To bridge this gap, the authors propose adding a third component to the distillation process: the Tutor Network.
The Tutor's Role
Instead of feeding raw data directly to the models, the tutor acts as a curator. It takes a text sample, masks specific words, and replaces them with "corrupted" tokens. This process is optimized using the REINFORCE algorithm (a policy gradient method) to maximize a dual reward system:
- Teacher’s Reward ($R_T$): Encourages the tutor to produce samples where the teacher is confident and accurate.
- Student’s Reward ($R_S$): Encourages the tutor to produce samples that the student currently finds difficult to predict.
Training Objectives
Beyond the tutor's curation, the framework employs several advanced distillation techniques:
- Logit Modification: Normalizes teacher outputs to prevent the student from over-fitting to overly confident teacher predictions.
- Internal Representation Distillation: The student mimics not just the final output but also the teacher's intermediate hidden states and attention patterns.
Key Insights
- The "Goldilocks" Zone: Effective learning occurs when material is just beyond the student's current capability but is clearly explained by the teacher. The tutor dynamically maintains this balance.
- Curriculum Learning: As the student improves, the tutor naturally generates more complex samples, creating an evolving curriculum.
- Teacher Confidence is Crucial: The study highlights that forcing a student to learn from samples where the teacher is "guessing" is counterproductive. The tutor ensures the teacher only provides high-quality signals.
Results and Evaluation
The models were evaluated on the GLUE benchmark after pre-training on English Wikipedia and BookCorpus.
- Surpassing the Teacher: A 6-layer student model achieved an average GLUE score of 82.7, exceeding the 82.2 score of the 12-layer BERT-base teacher.
- Superior Compression: Tutor-KD consistently outperformed established baselines like TinyBERT and MiniLM v2.
- Impact on Small Models: For a 5.7M parameter model (19x smaller than BERT-base), Tutor-KD improved performance by 2.7 points over standard KD, demonstrating its effectiveness in bridging large capacity gaps.
Limitations and Future Work
While successful, the authors note that training the tutor with policy gradients can be unstable due to high variance. Future research will focus on variance reduction techniques and testing the framework with even larger teacher models where the capacity gap is even more pronounced.
Summary updated