Introduction
In the pursuit of efficient deep learning, dynamic pruning has emerged as a promising technique to reduce computational costs by skipping unimportant neurons during inference. However, a significant "efficiency gap" exists: while these methods often show substantial reductions in theoretical FLOPs, they frequently fail to deliver commensurate speedups on real-world hardware like GPUs. This discrepancy is primarily due to irregular memory access patterns created by sparse pruning, which forces hardware to rely on slow indexing or ineffective masking.
The Dynamic Slimmable Network (DS-Net) framework addresses this challenge by adjusting a neural network's width—the number of active filters—on-the-fly for every input. By utilizing a "dynamic slicing" technique that maintains contiguous weight storage, DS-Net bridges the gap between theoretical efficiency and actual hardware acceleration.
Methods
DS-Net introduces three primary innovations to enable practical and high-performance dynamic width:
- Dynamic Channel Slicing: Rather than selecting arbitrary filters, DS-Net "slices" the weight tensor. When a lower width is required, the network simply utilizes the first $k$ filters. This contiguous slice is natively supported by modern hardware and deep learning frameworks, allowing for standard, high-speed matrix multiplications without the overhead of sparse indexing.
- Double-Headed Dynamic Gate: A lightweight gating module predicts the optimal slimming ratio for each input image. It consists of an attention head for feature recalibration and a slimming head to determine the active width.
- Disentangled Two-Stage Training: To stabilize the training of a variable-shape network, the authors employ a two-stage process:
- Stage I (Supernet Training): Utilizes In-place Ensemble Bootstrapping (IEB), where an Exponential Moving Average (EMA) version of the model serves as a stable teacher for smaller sub-networks.
- Stage II (Gate Training): Employs Sandwich Gate Sparsification (SGS) to penalize the gate for excessive computation on "easy" samples while ensuring sufficient resources for "hard" ones.
Experimental Setup
The framework was evaluated across several major benchmarks:
- ImageNet: For large-scale image classification performance.
- CIFAR-10: To test the transferability of dynamic gates to smaller tasks.
- PASCAL VOC: To demonstrate effectiveness as a backbone for object detection (integrated with the FSSD framework).
Key Insights
- Hardware-Friendliness vs. Sparsity: A core finding is that contiguous memory access is more critical for real-world latency than maximal theoretical sparsity. By restricting filter selection to contiguous blocks, DS-Net achieves superior speedups compared to more flexible but irregular pruning methods.
- Dynamic vs. Static Models: Dynamic routing allows a model to adapt its complexity to the difficulty of the input. While a static model must be sized for the worst-case (hardest) image, a dynamic model can operate efficiently on easier inputs, saving significant resources on average.
- Stability via EMA: The use of an EMA "momentum" target in IEB provides the necessary stability for convergence, preventing the "blind leading the blind" issue common in self-distillation.
Key Results
DS-Net demonstrates significant improvements in both accuracy and real-world speed:
- Actual Acceleration: On an NVIDIA GeForce RTX 2080 Ti, a ResNet-50 variant of DS-Net achieved a latency of 7.9ms, very close to the theoretical limit of 7.2ms. In contrast, traditional masking-based pruning methods were actually slower than the full model (12.4ms).
- Accuracy Improvements: DS-Net outperformed the state-of-the-art US-Net by up to 5.9% on ImageNet at comparable complexity levels.
- Efficiency Gains: The method achieves a 2-4× reduction in computation and a 1.62× real-world speedup over standard ResNet-50 and MobileNet backbones with minimal accuracy loss.
- Object Detection: On PASCAL VOC, DS-Net-L improved mAP by 1.8 points while reducing computation by 1.34× compared to a standard MobileNetV1 backbone.
Limitations and Future Work
Currently, DS-Net focuses on dynamic width. Future research could explore integrating dynamic depth (layer skipping) and dynamic resolution (input scaling) to further enhance efficiency. Additionally, while the gating overhead is minimal for standard models, optimizing the gate for extremely small "micro-models" remains an area for further investigation to ensure it does not become a bottleneck on ultra-low-power edge devices.
Summary updated