NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Context-aware Dynamic Block

Yingcheng Su, Shunfeng Zhou, Yichao Wu, Xuebo Liu, Tian Su, Ding Liang, Junjie YanarXiv 2019

Introduction

Deep Neural Networks (DNNs) have achieved remarkable performance in computer vision but at the cost of significant computational overhead. This complexity poses a major challenge for deployment on resource-constrained mobile and edge devices.

Existing "dynamic inference" strategies attempt to mitigate this by skipping entire layers for simpler inputs. However, the authors argue that this layer-wise approach is too coarse. Skipping a whole layer—the "nuclear option"—may discard vital channels, while keeping a redundant layer wastes computation. The proposed Dynamic Multi-path Neural Network (DMNN) addresses this by introducing a fine-grained mechanism that simultaneously adjusts both network width (active channels) and depth (active layers) based on the input context.

Methodology

DMNN achieves its efficiency through two primary innovations: Block Subdivision and a Context-Aware Controller.

Block Subdivision

Rather than treating a residual block as an indivisible unit, DMNN splits it into $N$ parallel sub-blocks. For instance, a standard ResNet block can be divided into multiple paths, each responsible for a subset of the output channels. Each sub-block is equipped with an independent "on/off" switch, allowing the model to dynamically prune its width.

Context-Aware Controller

The controller acts as the decision-making engine for sub-block execution. To optimize the inference path, it leverages three distinct information sources:

  1. Spatial Information: Derived via global average pooling of the current input.
  2. Temporal State: A hidden state ($h_{l-1}$) passed from the previous block, enabling the model to maintain a "memory" of the inference trajectory.
  3. Category Awareness: The controller is trained with an explicit category loss to recognize broad object clusters (e.g., "animals" vs. "artifacts"), facilitating specialized feature extraction paths.
The gate mechanism and controller architecture.

To ensure the system remains end-to-end trainable despite the discrete nature of skipping operations, the authors employ the Gumbel-Softmax trick. Additionally, a resource-constrained loss function penalizes high FLOP counts, guiding the model toward a target efficiency during training.

Experimental Results

DMNN was evaluated on the ImageNet and CIFAR-100 benchmarks, demonstrating a superior accuracy-efficiency trade-off compared to static and dynamic baselines.

  • Efficiency Gains: DMNN-101 outperforms the standard ResNet-101 while reducing FLOPs by 45.1%.
  • Parameter Efficiency: A DMNN-50 model achieves performance comparable to ResNet-101 but with 42.1% fewer parameters.
  • Versatility: When applied to the already efficient MobileNetV2, DMNN still achieves a 10% reduction in FLOPs alongside a slight improvement in Top-1 accuracy.
Accuracy vs. FLOPs trade-off for DMNN compared to baselines on ImageNet.

Analysis of the learned paths reveals that the model naturally reserves more sub-blocks for "hard" samples (cluttered or small objects) and utilizes specialized routing for different object categories. Notably, the computational overhead of the controllers is negligible, representing only about 0.02% of the total FLOPs in a DMNN-50 architecture.

Conclusion

DMNN represents a significant step forward in dynamic inference by enabling simultaneous width and depth optimization. By utilizing a context-aware controller to navigate a subdivided block architecture, it achieves substantial computational savings without sacrificing accuracy. Future work may involve scaling the number of sub-blocks and evaluating the framework on downstream tasks such as object detection and segmentation.

Summary updated

BibTeX
@misc{su2019context,
  author = {Yingcheng Su and Shunfeng Zhou and Yichao Wu and Xuebo Liu and Tian Su and Ding Liang and Junjie Yan},
  title = {{Context-aware Dynamic Block}},
  year = {2019},
  eprint = {1902.10949},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1902.10949},
}
Figure