Abstract
Knowledge Distillation (KD) is a widely recognized method for model compression, training a smaller student model to retain the performance of a larger teacher. However, existing KD methods often suffer from limitations in student model capacity and the lack of an effective initial guide. We propose Pea-KD (Parameter-efficient and accurate Knowledge Distillation), a novel approach consisting of two main components: Shuffled Parameter Sharing (SPS) and Pretraining with Teacher's Predictions (PTP). SPS increases effective model capacity without adding parameters, while PTP acts as a specialized initialization to guide the student. Experiments on BERT across GLUE tasks show that Pea-KD improves student performance by 4.4% on average, outperforming existing KD baselines by significant margins while being orders of magnitude faster to train.
1. Introduction
The deployment of large-scale Transformer models like BERT on resource-constrained devices is hindered by their massive parameter counts. Knowledge Distillation (KD) addresses this by training a compact "student" model to mimic a "teacher" model. Despite its popularity, KD faces two major challenges:
- Capacity Gap: Small student models lack the parameters required to capture the complex logic of the teacher.
- Initialization Bottleneck: Students typically start from a generic state, making it difficult to fully internalize the teacher's specific knowledge from the start.
Pea-KD addresses these issues by maximizing parameter utility and providing a teacher-informed "warm-up" phase.
2. Methodology
2.1 Shuffled Parameter Sharing (SPS)
To overcome the capacity gap without increasing memory usage, we introduce Shuffled Parameter Sharing (SPS). SPS doubles the number of layers in the student model through weight sharing but introduces a novel shuffling mechanism. Specifically, in the shared layers, the Query (Q) and Key (K) parameter matrices are swapped. This forces the shared parameters to learn a more diverse set of features and prevents overfitting to a single role, effectively increasing the model's complexity without increasing its parameter count.
2.2 Pretraining with Teacher’s Predictions (PTP)
To solve the "cold start" problem, we propose a specialized initialization task called Pretraining with Teacher's Predictions (PTP). Instead of training on the final task immediately, the student is first trained to predict four meta-labels based on the teacher's performance: confidently correct, unconfidently correct, confidently wrong, and unconfidently wrong. This phase allows the student to internalize the teacher's uncertainty and latent knowledge before the main distillation begins.
3. Experiments and Results
We evaluated Pea-KD on four tasks from the GLUE benchmark: SST-2 (sentiment), QNLI (inference), RTE (entailment), and MRPC (paraphrase).
3.1 Accuracy Improvements
Pea-KD consistently outperformed standard KD and state-of-the-art baselines. On average, it improved student accuracy by 4.4%. A 6-layer PeaBERT model outperformed DistilBERT by 5.6% and TinyBERT by 1.3%. The most dramatic improvement was a 14.8% jump in accuracy for a 1-layer student on the QNLI task.
3.2 Training Efficiency
A key advantage of Pea-KD is its speed. Unlike TinyBERT, which requires expensive general-purpose pretraining, Pea-KD achieves superior results using only downstream task data. While DistilBERT training took approximately 90 hours on eight V100 GPUs, Pea-KD reached peak performance in under one hour on just two NVIDIA T4 GPUs.
4. Conclusion
Pea-KD provides a parameter-efficient and highly accurate framework for model distillation. By leveraging Shuffled Parameter Sharing to maximize capacity and Pretraining with Teacher's Predictions for better initialization, it significantly narrows the performance gap between teacher and student models while maintaining exceptional training efficiency.
Summary updated