Semantic-aware knowledge distillation with parameter-free feature uniformization

Guangyu Guo, Longfei Han, Le Wang, Dingwen Zhang, Junwei Han

Abstract

Knowledge Distillation (KD) is a pivotal technique for model compression, yet distilling intermediate features remains challenging due to the "dimension gap" between teacher and student networks. This paper introduces SPU (Semantic-aware Parameter-free Uniformization), a framework that addresses this gap through a parameter-free self-attention mechanism and a standalone semantic classification branch. By ensuring mapping equivalence and preserving task-specific semantics, SPU achieves state-of-the-art results on image classification benchmarks including CIFAR-100, CINIC-10, and ImageNet.

The Challenge of Intermediate Feature Distillation

While distilling final logits is straightforward, intermediate feature distillation offers a richer source of knowledge. However, it faces two primary hurdles:

  1. Dimension Gap: Teacher and student networks often differ in channel counts and spatial resolutions.
  2. Mapping Inequivalence: Traditional methods use learnable layers (e.g., 1x1 convolutions) to align these dimensions. Since these layers differ between the teacher and student, the transformation process itself can distort the transferred knowledge.
Conceptual comparison of distillation strategies

The SPU Framework

The proposed SPU framework overcomes these limitations by focusing on two core innovations: parameter-free uniformization and semantic-aware distillation.

Overview of the SPU framework and components

1. Parameter-Free Feature Uniformization

To eliminate "knowledge lost in translation," SPU employs a self-attention mechanism with zero trainable parameters. It converts arbitrary feature maps into fixed-length vectors ($L$) using channel pooling and global average pooling. Because this operation is purely mathematical, the teacher and student networks process data through an identical "lens," ensuring mapping equivalence.

2. Semantic-Aware Distillation Branch

To ensure that distilled features retain task-relevant "meaning," a standalone classification branch is added. The teacher’s intermediate features are transformed and used to train this branch with ground-truth labels. Once trained, the branch's weights are frozen, and the student is tasked with matching the resulting softened class scores. This forces the student to learn features directly optimized for the final classification task.

Experimental Results

SPU was evaluated against various state-of-the-art feature-based KD methods across three major benchmarks:

  • CIFAR-100: SPU consistently outperformed competitors. For a WRN-28-4 to WRN-16-4 distillation, it achieved 79.12% accuracy, surpassing the teacher's baseline. In more aggressive compression (WRN-28-4 to WRN-16-2), it led by over 0.4%.
  • CINIC-10: Across ShuffleNetV2 configurations, SPU showed improvements ranging from 0.07% to 0.62% over the next best methods.
  • ImageNet: SPU reached 71.31% Top-1 accuracy (ResNet-34 to ResNet-18), a significant gain over standard KD (70.66%).

Key Insights

  • Equivalence Matters: Removing learnable parameters from the alignment step ensures the student learns the actual feature distribution rather than just a mapping function.
  • Feature Aggregation: Aggregating features from multiple layers (the "AP" strategy) proved more effective than layer-by-layer matching, suggesting that semantic information is holistically distributed.
  • Optimal Vector Length: The hyperparameter $L$ (vector length) requires careful tuning; for CIFAR-100, a length of 4096 was found to be the "sweet spot" between information loss and overfitting.

Conclusion and Future Work

SPU provides a robust solution for intermediate feature distillation by prioritizing mapping equivalence and semantic relevance. While currently optimized for image classification, future work involves extending this "semantic-aware" logic to more complex tasks like object detection and instance segmentation, as well as exploring adaptive methods for setting the uniformization vector length.

Summary updated

BibTeX
@article{guo2023semantic,
  author = {Guangyu Guo and Longfei Han and Le Wang and Dingwen Zhang and Junwei Han},
  title = {{Semantic-aware knowledge distillation with parameter-free feature uniformization}},
  journal = {Vis. Intell.},
  year = {2023},
  doi = {10.1007/s44267-023-00003-0},
}
Figure