Pea-KD: Parameter-efficient and accurate Knowledge Distillation

Ikhyun Cho, U Kang

Abstract

How can we efficiently compress a model while maintaining its performance? Knowledge Distillation (KD) is a widely known method for model compression where a smaller student model is trained to retain the performance of a larger teacher model. However, existing KD methods suffer from two primary limitations: a lack of model complexity in small students and the absence of an effective initial guide for the student to imitate the teacher. We propose Pea-KD (Parameter-efficient and accurate Knowledge Distillation), a novel framework consisting of Shuffled Parameter Sharing (SPS) and Pretraining with Teacher's Predictions (PTP). SPS increases model complexity through a unique parameter-sharing scheme, while PTP provides a specialized initialization to guide the student. Experiments show that Pea-KD improves student performance by an average of 4.4% across four GLUE tasks, significantly outperforming existing KD baselines.

Introduction

Knowledge Distillation (KD) is the standard approach for shrinking massive language models, such as BERT, to run on resource-constrained edge devices. By training a "student" model to mimic the internal probability distributions of a "teacher" model, KD aims to transfer knowledge without the associated computational cost.

Despite its popularity, the authors identify two major bottlenecks in current KD research:

  1. Capacity Deficit: Small student models often lack the parameters necessary to capture the complex reasoning of the teacher.
  2. The "Blind" Start: Students typically begin training from a random or poorly initialized state, making it difficult to replicate the teacher's nuanced understanding of specific tasks.

Pea-KD addresses these challenges by introducing structural complexity and a guided pretraining phase.

Methodology

Shuffled Parameter Sharing (SPS)

To increase the student's effective capacity without increasing its total parameter count, Pea-KD utilizes Shuffled Parameter Sharing (SPS). This is achieved through a two-step process:

  1. Layer Stacking: The number of layers in the student model is doubled, but the top half of the layers are forced to share weights with the bottom half.
  2. The Shuffle: Within these shared layers, the Query (Q) and Key (K) parameter matrices are swapped.
The SPS mechanism involves stacking layers and shuffling Query-Key matrices to boost effective capacity.

By shuffling the matrices, a single set of parameters is forced to learn features relevant to both Queries and Keys. This acts as a form of regularization and multi-task learning, compelling the model to develop more diverse and efficient data representations.

Pretraining with Teacher’s Predictions (PTP)

Before standard distillation begins, Pea-KD provides the student with a "head start" through a specialized initialization task. The student is trained to predict the teacher's confidence levels rather than just the final labels. The teacher's predictions are categorized into four "PTP labels" based on a confidence threshold ($t$):

PTP labels categorize teacher predictions based on correctness and confidence levels.

Training the student to predict these categories teaches it how the teacher thinks—specifically, which examples the teacher finds difficult or confusing—before it attempts to replicate the teacher's final outputs. This process reveals the "latent knowledge" and potential error patterns of the teacher, which are highly informative for the student's learning trajectory.

Key Results and Insights

Performance Gains

The authors evaluated Pea-KD (implemented as PeaBERT) on four key tasks from the GLUE benchmark: SST-2, QNLI, RTE, and MRPC.

  • Accuracy Boost: PeaBERT improved student performance by an average of 4.4% across the tasks.
  • Significant Leaps: On the QNLI task, a 1-layer PeaBERT student outperformed the standard PatientKD baseline by 14.8%.
  • State-of-the-Art Comparison: When compared against 6-layer models like DistilBERT and TinyBERT, PeaBERT (using the same parameter count) achieved an average score of 87.6, outperforming TinyBERT (86.3) and DistilBERT (82.0).

Efficiency and Training Speed

Unlike competitors like DistilBERT, which require massive general pretraining (often taking ~90 hours on 8 GPUs), Pea-KD achieves superior results by fine-tuning on the downstream task's data alone. This process is significantly faster, often completing in under an hour, making it a highly practical solution for rapid model deployment.

Conclusion

Pea-KD demonstrates that model compression does not have to be a choice between efficiency and accuracy. By rethinking parameter sharing as a multi-tasking problem (SPS) and treating teacher errors as educational signals (PTP), Pea-KD sets a new standard for knowledge distillation. Future work may explore adapting PTP for generative tasks or combining these methods with other compression techniques like quantization and pruning.

Summary updated

BibTeX
@misc{cho2020pea,
  author = {Ikhyun Cho and U Kang},
  title = {{Pea-KD: Parameter-efficient and accurate Knowledge Distillation}},
  year = {2020},
  eprint = {2009.14822},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2009.14822},
}
Figure