Cross-Layer Distillation with Semantic Calibration

Defang Chen, Jian-Ping Mei, Yuan Zhang, Can Wang, Zhe Wang, Yan Feng, Chun Chen

Abstract

Knowledge distillation (KD) often suffers from semantic mismatch when intermediate layers of teacher and student networks are forced into rigid one-to-one associations. We present Semantic Calibration for Cross-layer Knowledge Distillation (SemCKD), a framework that leverages an attention mechanism to automatically align student layers with the most semantically relevant teacher layers. By allowing "soft associations," SemCKD mitigates negative regularization and achieves state-of-the-art performance across diverse architectures on CIFAR-100 and ImageNet benchmarks.

Introduction

Knowledge Distillation (KD) is a widely used technique for training compact "student" networks by transferring knowledge from larger, pre-trained "teacher" models. While early KD research focused on matching final output logits, modern approaches emphasize matching intermediate feature maps to capture the internal representations of the teacher.

However, a significant challenge remains: Semantic Mismatch. When distilling between different architectures (e.g., ResNet to ShuffleNet), layers at the same depth may represent entirely different visual features. Most existing methods rely on "hard associations," forcing a specific student layer to match a corresponding teacher layer. If these layers are semantically misaligned, it results in negative regularization, where the teacher's guidance confuses the student and degrades its performance. SemCKD addresses this by allowing the student to dynamically select which teacher layers provide the most relevant information.

Methodology: Semantic Calibration

The proposed SemCKD framework moves away from manual layer pairing in favor of a learned, flexible association strategy. The architecture consists of three core components:

  1. Attention-Based Soft Association: For each layer in the student network, the framework evaluates all candidate layers in the teacher. Using an attention mechanism similar to those found in Transformers, it assigns weights ($\alpha$) to each teacher layer based on its semantic similarity to the current student layer. This allows a single student layer to aggregate knowledge from multiple teacher layers simultaneously.
  2. Feature Map Projection: Because teacher and student layers often differ in spatial dimensions (height, width) and channel counts, the student's features are passed through a projection module. This module, consisting of 1x1 and 3x3 convolutions, maps student features into the teacher's coordinate space for direct comparison.
  3. Loss Function: The student is optimized to minimize the Mean-Square-Error (MSE) between its projected features and the weighted combination of teacher features. This "soft" approach ensures that the student only mimics the most semantically compatible parts of the teacher's internal logic.
Overview of the SemCKD framework showing (a) the cross-layer distillation process and (b) the attention allocation mechanism using keys and queries.

Experimental Results

The authors evaluated SemCKD on the CIFAR-100 and ImageNet datasets across seven different teacher-student architecture pairs, including VGG, ResNet, WideResNet, ShuffleNet, and MobileNet.

Performance Gains

SemCKD consistently outperformed major feature-map distillation methods such as FitNet, AT, and VID. To quantify these gains, the authors introduced the Average Relative Improvement (ARI) metric. SemCKD achieved a leading average ARI of 68.34%, demonstrating its robustness across heterogeneous model pairings. The results confirm that SemCKD is highly compatible with other distillation techniques (like CRD), providing orthogonal benefits when combined.

Visual Alignment

To understand why SemCKD performs better, the authors employed Grad-CAM to visualize the regions of an image that the models find most discriminative. As shown in the visualizations below, SemCKD students successfully align their attention with the teacher's focus (e.g., the head of a goose or the body of a racer), whereas other distillation methods often produce scattered or noisy attention maps.

Grad-CAM visualizations comparing various distillation methods. SemCKD shows superior alignment with the teacher's discriminative regions compared to baselines like FitNet, AT, and VID.

Discussion and Conclusion

The success of SemCKD highlights that "semantic levels" in neural networks are fluid rather than fixed by layer depth. By proving that naive one-to-one matching can be detrimental, this work establishes semantic calibration as a vital component of effective knowledge transfer.

While SemCKD shows state-of-the-art results, there is room for further optimization in the attention strategy to match rare cases where hand-crafted associations still excel. Additionally, while the projection layers add training overhead, the final deployed student model remains lightweight. Future research could extend this semantic calibration approach to more complex spatial tasks such as object detection and semantic segmentation.

Summary updated

BibTeX
@inproceedings{chen2021cross,
  author = {Defang Chen and Jian-Ping Mei and Yuan Zhang and Can Wang and Zhe Wang and Yan Feng and Chun Chen},
  title = {{Cross-Layer Distillation with Semantic Calibration}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2021},
  doi = {10.1609/aaai.v35i8.16865},
}
Figure