Embedded Knowledge Distillation in Depth-level Dynamic Neural Network

Shuchang Lyu, Ting-Bing Xu, Guangliang ChengarXiv 2021

TL;DR

This paper introduces a Depth-Level Dynamic Neural Network (DDNN) that allows a single model to dynamically switch between different-depth sub-networks for varying computational needs. They achieve this by developing an "Embedded Knowledge Distillation" (EKD) training mechanism, which effectively transfers knowledge from a full-depth "teacher" network to shallower "student" sub-networks, leading to improved performance for the sub-networks without sacrificing the full network's accuracy.

What Problem Does This Paper Address?

In real-world computer vision applications, different devices have varying computational power and memory constraints. This necessitates the use of neural networks of different depths (e.g., ResNet-18 vs. ResNet-50) to achieve a balance between accuracy and efficiency. Traditionally, this means training multiple distinct networks independently, which is computationally expensive and time-consuming. While dynamic networks exist, they often struggle to guarantee the accuracy of each individual sub-network. This paper aims to solve this by creating a single, unified dynamic network that can efficiently produce multiple high-accuracy sub-networks, each tailored for different resource constraints, all trained simultaneously.

Methods

The core innovation is the Depth-Level Dynamic Neural Network (DDNN) combined with Embedded Knowledge Distillation (EKD).

  • DDNN: The DDNN is built upon a large, baseline "full-net" (e.g., ResNet-50). This full-net is then strategically divided into stages, and "skip connections" are introduced to create shallower sub-networks by bypassing certain blocks or stages. This allows the network to dynamically adjust its depth during inference.
  • EKD: This is the training mechanism designed to ensure the quality of the sub-networks. It leverages the full-net as a "teacher" to guide the learning of the "student" sub-networks. Key components include:
  • Kullback-Leibler (KL) Divergence: Used to align the posterior class probabilities (soft labels) of the full-net with those of each sub-net. This encourages sub-networks to make similar high-level predictions as the full network.
  • Self-Attention Distillation: Applied to intermediate feature maps at the same resolution across different depths. This helps to ensure that the semantic features learned by the sub-networks are consistent with those of the full-net, driving more robust feature representations.
  • Ensemble Distillation: The full-net itself also benefits from the sub-networks, with its performance being enhanced by an ensemble of its own predictions and those of its sub-nets.

The overall objective function combines the standard cross-entropy loss for both the full-net and sub-nets with the KL divergence and MSE-based self-attention distillation losses.

Datasets

The paper evaluates its method on the following standard image classification datasets:

  • CIFAR-10
  • CIFAR-100
  • ImageNet

No new benchmarks were introduced; the focus was on demonstrating the effectiveness of the proposed method on existing, widely used datasets.

Key Insights and Ideas

  • Unified Training for Diverse Needs: The most significant insight is that a single training process can yield multiple, high-performing networks of varying depths, eliminating the need for separate training runs for each desired model size.
  • Teacher-Student Synergy: EKD creates a beneficial feedback loop where the teacher (full-net) guides the students (sub-nets), and in turn, the students contribute to improving the teacher's performance through ensemble distillation.
  • Beyond Class Probabilities: Distilling not just final predictions but also intermediate feature representations (via self-attention) is crucial for ensuring that sub-networks learn rich and consistent semantic information.
  • Efficiency Without Sacrifice: The method achieves improved sub-network performance without significantly compromising the accuracy of the original full-depth network, a common challenge in dynamic network design.

Key Results

  • Improved Sub-network Accuracy: Sub-nets trained with EKD-DDNN consistently outperform individually trained networks of the same depth, showing an average improvement of 0.5-1% on CIFAR and ImageNet. In some cases, the improvement is over 1%.
  • Preserved Full-net Accuracy: The performance of the full-net within the DDNN is largely preserved, with minimal accuracy decline compared to training it independently.
  • Efficiency: The DDNN integrates multiple networks into a single model without adding extra parameters or computational cost (FLOPs) during inference compared to the full-net.
  • Effectiveness on Complex Tasks: EKD demonstrates stronger performance gains on the more challenging CIFAR-100 dataset compared to CIFAR-10, highlighting its robustness.

Limitations and Future Work

  • Limitations: The paper acknowledges that while sub-nets in DDNN with EKD training show improvement, they might still have a slightly lower error rate (0.5-1% lower) compared to independently trained networks. However, this is presented as a trade-off for the significant gains in efficiency and unified training.
  • Future Work: The paper implicitly suggests future work could explore extending this EKD mechanism to other types of dynamic networks, such as width-level dynamic networks, or applying it to different computer vision tasks beyond classification. The effectiveness of ensemble distillation in preserving full-net accuracy also opens avenues for further research in this area.

Summary updated

BibTeX
@misc{lyu2021embedded,
  author = {Shuchang Lyu and Ting-Bing Xu and Guangliang Cheng},
  title = {{Embedded Knowledge Distillation in Depth-level Dynamic Neural Network}},
  year = {2021},
  eprint = {2103.00793},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2103.00793},
}
Figure