[Paper Review] ALP-KD: Attention-Based Layer Projection for Knowledge Distillation
This paper proposes ALP-KD, an attention-based layer projection method for knowledge distillation that combines multiple teacher layers using learnable attention weights, avoiding the need to skip layers. It achieves superior performance by enabling the student to mimic both final and intermediate representations, outperforming existing methods on GLUE benchmarks when distilling BERT into smaller models.
Knowledge distillation is considered as a training and compression strategy in which two neural networks, namely a teacher and a student, are coupled together during training. The teacher network is supposed to be a trustworthy predictor and the student tries to mimic its predictions. Usually, a student with a lighter architecture is selected so we can achieve compression and yet deliver high-quality results. In such a setting, distillation only happens for final predictions whereas the student could also benefit from teacher's supervision for internal components. Motivated by this, we studied the problem of distillation for intermediate layers. Since there might not be a one-to-one alignment between student and teacher layers, existing techniques skip some teacher layers and only distill from a subset of them. This shortcoming directly impacts quality, so we instead propose a combinatorial technique which relies on attention. Our model fuses teacher-side information and takes each layer's significance into consideration, then performs distillation between combined teacher layers and those of the student. Using our technique, we distilled a 12-layer BERT (Devlin et al. 2019) into 6-, 4-, and 2-layer counterparts and evaluated them on GLUE tasks (Wang et al. 2018). Experimental results show that our combinatorial approach is able to outperform other existing techniques.
Motivation & Objective
- Address the limitation of existing knowledge distillation methods that skip intermediate teacher layers due to architectural mismatch.
- Improve student performance by enabling supervision from multiple, non-identical teacher layers instead of relying on one-to-one layer matching.
- Develop a combinatorial, attention-based mechanism to dynamically weigh and fuse relevant teacher layer representations for distillation.
- Demonstrate that combining teacher layers via attention leads to better internal representation alignment between student and teacher models.
- Achieve state-of-the-art performance in distilling deep teacher networks (e.g., 12-layer BERT) into compact student models (6-, 4-, and 2-layer variants).
Proposed method
- Propose a novel attention-based layer projection (ALP-KD) mechanism that fuses multiple teacher layer features into a single, weighted combination for distillation.
- Use a learnable attention mechanism to assign importance scores to each teacher layer based on its relevance to the student’s current layer.
- Formulate the combined teacher representation as a weighted sum of intermediate features from multiple teacher layers, where weights are computed via a multi-head attention module.
- Integrate the fused teacher representation into the student’s training process via a distillation loss that compares the student’s intermediate output with the weighted combination of teacher features.
- Allow flexible configuration by enabling attention over non-adjacent or non-matching layers, eliminating the need for layer-by-layer alignment.
- Train the student model using a combined loss: cross-entropy on hard labels and distillation loss between student outputs and the attention-combined teacher features.
Experimental results
Research questions
- RQ1Can combining multiple non-identical teacher layers through attention improve knowledge distillation beyond one-to-one layer matching?
- RQ2How does attention-based fusion of teacher representations affect the alignment of intermediate hidden states between student and teacher models?
- RQ3Does avoiding the skip problem—by not discarding any teacher layers—lead to measurable improvements in student model performance?
- RQ4To what extent does ALP-KD outperform existing methods like PKD and RKD in terms of accuracy and representation fidelity on NLP benchmarks?
- RQ5Can ALP-KD be effectively applied to distill deep models (e.g., 12-layer BERT) into significantly smaller architectures (e.g., 2-layer BERT) without performance degradation?
Key findings
- ALP-KD outperforms existing knowledge distillation methods, including PKD and RKD, across multiple GLUE benchmark tasks when distilling a 12-layer BERT into 6-, 4-, and 2-layer student models.
- The attention-based fusion of teacher layers leads to significantly closer intermediate representations between student and teacher models, as shown by cosine distance visualization: ALP-KD achieved a mean distance of 0.05, compared to 0.20 for PKD.
- Visualizations of hidden states (via PCA) confirm that ALP-KD students learn representations that are more similar to the teacher’s than those of baseline methods.
- The method effectively mitigates the skip problem by utilizing information from all teacher layers, rather than discarding layers due to architectural mismatch.
- ALP-KD maintains strong performance even when distilling from very deep teachers into very narrow students, demonstrating robustness across architectural disparities.
- The ablation study confirms that attention-based combination is essential—simple concatenation or uniform weighting is insufficient for competitive results.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.