Knowledge Distillation from Internal Representations
Gustavo Aguilar, Yuan Ling, Yu Zhang, Benjamin Yao, Xing Fan, Chenlei Guo
TL;DR
Standard knowledge distillation transfers only the teacher's output probabilities, which may fail to convey internal linguistic abstractions of large transformers. The authors propose distilling internal representations by matching self-attention distributions and CLS activations, using bottom-up (PID) and stacked (SID) strategies to compress teacher knowledge into a smaller student. Across GLUE tasks, internal representation distillation consistently outperforms soft-label KD and requires roughly half the parameters to achieve near-teacher performance, demonstrating practical efficiency gains. This approach enables more faithful transfer of linguistic structure and more deployable transformer models in resource-constrained settings.
Abstract
Knowledge distillation is typically conducted by training a small model (the student) to mimic a large and cumbersome model (the teacher). The idea is to compress the knowledge from the teacher by using its output probabilities as soft-labels to optimize the student. However, when the teacher is considerably large, there is no guarantee that the internal knowledge of the teacher will be transferred into the student; even if the student closely matches the soft-labels, its internal representations may be considerably different. This internal mismatch can undermine the generalization capabilities originally intended to be transferred from the teacher to the student. In this paper, we propose to distill the internal representations of a large model such as BERT into a simplified version of it. We formulate two ways to distill such representations and various algorithms to conduct the distillation. We experiment with datasets from the GLUE benchmark and consistently show that adding knowledge distillation from internal representations is a more powerful method than only using soft-label distillation.
