Matching Guided Distillation

Kaiyu Yue, Jiangfan Deng, Feng Zhou

Matching Guided Distillation (MGD) is a parameter-free approach to feature-based knowledge distillation. By replacing traditional adaptation layers with a channel matching mechanism formulated as a linear assignment problem, MGD avoids parameter bloat and interference with pre-trained features. The method employs coordinate descent to alternate between matching and distillation, achieving state-of-the-art performance across classification, transfer learning, and object detection tasks.

Introduction

Knowledge distillation (KD) aims to transfer knowledge from a large, complex teacher model to a smaller, more efficient student model. A significant challenge in feature-based KD is the semantic feature structure gap: teacher and student models often have different channel dimensions and feature representations.

Traditionally, this gap is bridged using "adaptation layers" (e.g., $1 \times 1$ convolutions) that transform student features to match the teacher's dimensions. However, these layers introduce two primary issues:

  1. Parameter Bloat: They add extra weights and optimizer states, increasing memory consumption during training.
  2. Pre-training Interference: For pre-trained student models, randomly initialized adaptation layers can disrupt existing feature representations, making the distillation process less stable and efficient.
Overview of the MGD framework showing the alternative optimization between matching and distillation.

Methodology

MGD reframes the relationship between teacher and student channels as a Linear Assignment (LA) problem. Instead of learning a transformation, MGD finds the optimal correspondence between teacher channels ($C_T$) and student channels ($C_S$) to minimize the Euclidean distance between matched pairs.

Channel Matching and Reduction

Since teacher models typically have more channels than students ($C_T > C_S$), multiple teacher channels must be mapped to a single student channel. The authors propose three strategies for this reduction:

  1. Sparse Matching: Only the single most relevant teacher channel is selected for each student channel, ignoring others.
  2. Random Drop: A single teacher channel is randomly sampled from each matched group.
  3. Absolute Max Pooling (AMP): This novel method selects the element with the largest absolute magnitude across matched channels. This preserves both strong positive and negative activations, which are critical for semantic information.
Comparison of channel reduction strategies: (a) Sparse Matching, (b) Random Drop, and (c) Absolute Max Pooling (AMP).

Optimization

The training process uses coordinate descent, alternating between two steps:

  • Matching Step: Update the matching matrix $M$ using the Hungarian algorithm based on current feature distances.
  • Distillation Step: Update the network weights via standard stochastic gradient descent (SGD) to minimize the distance between matched features.

Experimental Results

MGD consistently outperforms previous state-of-the-art methods across various benchmarks:

  • Image Classification: On CIFAR-100, MGD-AMP achieved a top-1 error of 21.12%, surpassing the previous best of 21.98%.
  • Transfer Learning: MGD is particularly effective for pre-trained models. On the CUB-200-2011 dataset, a MobileNet-V2 student distilled via MGD-AMP reduced top-1 error from 24.61% (baseline) to 20.64%.
  • Object Detection: On COCO using RetinaNet with a ResNet-18 backbone, MGD improved the mAP by 0.85 points over the baseline.
  • Efficiency: By eliminating adaptation layers, MGD significantly reduces GPU memory usage during training, as no gradients need to be stored for auxiliary transformation modules.

Conclusion

MGD demonstrates that parameter-free channel matching is a powerful alternative to traditional feature transformation in knowledge distillation. By leveraging the inherent magnitude of activations through Absolute Max Pooling and optimizing channel alignment dynamically, MGD provides a more efficient and effective pathway for distilling knowledge into both from-scratch and pre-trained student models.

Summary updated

BibTeX
@inproceedings{yue2020matching,
  author = {Kaiyu Yue and Jiangfan Deng and Feng Zhou},
  title = {{Matching Guided Distillation}},
  booktitle = {European Conference on Computer Vision},
  year = {2020},
  doi = {10.1007/978-3-030-58555-6\_19},
}
Figure