Spot-adaptive Knowledge Distillation

Jie Song, Ying Chen, Jingwen Ye, Mingli Song · DOI

TL;DR

This paper introduces Spot-Adaptive Knowledge Distillation (SAKD), a novel method that dynamically selects which layers of a teacher network to distill knowledge from, adapting these choices based on individual training samples and training progress. By focusing on "where to distill" rather than "what to distill," SAKD significantly boosts the performance of existing knowledge distillation techniques across various architectures and datasets.

What Problem Does This Paper Address?

Deep neural networks (DNNs) are powerful but often too large for deployment on resource-constrained devices. Knowledge Distillation (KD) is a popular technique to compress these large "teacher" networks into smaller "student" networks by transferring knowledge. Traditional KD methods fix the "distillation spots" – the specific layers from which knowledge is extracted – for the entire training process, regardless of the input sample or the stage of training. This static approach can be suboptimal, potentially leading to over-regularization or insufficient supervision. The paper argues that these distillation spots should be dynamic, adapting to the specific needs of each sample and the evolving learning state of the student.

Methods

The core innovation is the Spot-Adaptive Knowledge Distillation (SAKD) strategy. SAKD integrates the teacher and student networks into a multi-path routing network. A lightweight policy network is introduced to make per-sample decisions on which path the data should take through this combined network.

Here's how it works:

  • Multi-path Routing Network: This network combines the teacher and student models. At specific "branch spots" (corresponding to potential distillation layers), a decision is made whether to route the data through the teacher's layer or the student's layer.
  • Policy Network: This network takes features from both the teacher and student as input and outputs probabilities for routing decisions at each branch spot. It's trained to learn which teacher layers are most beneficial to distill from for a given sample.
  • Adaptive Distillation: If the policy network routes data to a teacher layer, it signifies that the corresponding student layer is not yet proficient and needs to learn from the teacher. Conversely, if routed to a student layer, it implies the student has learned sufficiently from that part of the teacher.
  • Gumbel-Softmax: To enable end-to-end differentiability for the discrete routing decisions, the Gumbel-Softmax trick is employed.
  • Optimization: The overall objective function includes the standard student loss (cross-entropy), a KL divergence loss between teacher and student outputs, and a knowledge distillation loss (LKD) for the selected spots. A separate routing loss optimizes the policy network. Crucially, the teacher network's parameters are frozen during training.

Datasets

The paper evaluates SAKD on the following datasets:

  • CIFAR-100: A dataset with 100 classes and 32x32 pixel images.
  • Tiny-ImageNet: A subset of ImageNet with 200 classes and 64x64 pixel images.
  • ImageNet: A large-scale dataset with 1000 classes.

Key Insights and Ideas

  • "Where to Distill" Matters: The paper convincingly argues that the location of distillation is as crucial as what knowledge is distilled. Static distillation spots are a bottleneck.
  • Dynamic Adaptation is Key: Adapting distillation spots per sample and per training epoch allows the student to receive more targeted supervision, leading to better learning.
  • Policy Network Learns Intelligently: The policy network effectively learns to identify when distillation is beneficial, avoiding over-regularization and focusing on informative teacher layers.
  • Universality of SAKD: The proposed method is orthogonal to existing "what to distill" strategies and can be seamlessly integrated with them, enhancing their performance.
  • Heterogeneous Distillation Benefits: SAKD proves effective even when the student and teacher architectures are significantly different, a challenging scenario in KD.

Key Results

SAKD consistently improved the performance of ten state-of-the-art distillation methods across various teacher-student architectures and datasets.

  • CIFAR-100: SAKD improved accuracy by up to 0.84% when combined with PKT and by 0.67% with CRD in homogeneous settings. In heterogeneous settings, it achieved improvements of up to 0.60% with VID.
  • Tiny-ImageNet: Similar consistent improvements were observed.
  • ImageNet: SAKD boosted top-1 accuracy by 0.72% for CC and top-5 accuracy by 1.11% for SP when distilling from ResNet-34 to ResNet-18.
  • Ablation Studies: SAKD significantly outperformed baseline strategies like "always-distillation," "random-distillation," and "anti-distillation," demonstrating the value of its adaptive approach.

Limitations and Future Work

  • Hyperparameter Sensitivity: While SAKD is shown to be robust to hyperparameter tuning (specifically $\beta_3$ and $\tau$), some sensitivity still exists.
  • Computational Overhead: The introduction of a policy network and routing mechanism adds some computational overhead, though the paper notes that training the teacher network itself would be more costly.
  • Future Directions: The authors suggest extending SAKD to scenarios like data-free distillation (where training data is unavailable) and transformer-based distillation, indicating its potential for broader applicability.

Summary updated

BibTeX
@article{song2022spot,
  author = {Jie Song and Ying Chen and Jingwen Ye and Mingli Song},
  title = {{Spot-adaptive Knowledge Distillation}},
  journal = {IEEE Trans. Image Process.},
  year = {2022},
  doi = {10.1109/tip.2022.3170728},
}
Figure