Introduction
Deep learning models are frequently over-engineered for their target hardware. A model optimized for a high-end GPU may fail to run on a smartphone, while a mobile-optimized model might be too slow for an embedded sensor. Traditionally, engineers address this by training multiple models for different devices or using post-training compression like pruning, which often requires tedious fine-tuning for every new set of constraints.
The Doubly Nested Network (DNNet) introduces a "sliceable" architecture that can be instantly downsized in both depth (layers) and width (channels) to meet varying hardware constraints without retraining. This is particularly critical for dynamic environments where a device's available memory or battery may change in real-time.
Methodology: Two Degrees of Freedom
The core innovation of DNNet is its ability to be sliced along two independent axes: depth and width.
Layer-wise Slicing
DNNet utilizes intermediate "side-outputs" or auxiliary classifiers at various depths. This allows the model to "exit early" if the required confidence is met or if computational resources are depleted, a technique known as anytime inference.
Channel-wise Slicing
The paper’s primary contribution is enabling width-wise nesting. In standard CNNs, reducing channels is difficult because neurons are densely interconnected. DNNet introduces channel-causal convolutions, where channels are topologically sorted. Information flows only from lower-indexed channels to higher-indexed ones. Consequently, higher-indexed channels can be removed, and the remaining sub-network remains functional.
Training with Aggregate Loss
To optimize the entire grid of potential sub-models, DNNet uses an aggregate loss function. It simultaneously trains $L \times C$ sub-models (where $L$ is the number of layer groups and $C$ is the number of channel groups). A weight matrix ($\lambda$) allows developers to prioritize specific sub-models, such as ensuring the smallest configuration remains highly accurate.
Key Insights and Results
The researchers evaluated DNNet on the CIFAR-10 and SVHN datasets using a ResNet-32 backbone.
- Topological Ordering: By enforcing causal flow, the network learns that primary features must be captured by the first few channels, while subsequent channels provide refinement.
- Robustness to Slicing: Unlike standard ResNets, which suffer catastrophic accuracy loss when channels are naively removed, DNNet maintains high performance across a wide range of widths.
- Flexibility: On CIFAR-10, a single trained DNNet provided a grid of $16 \times 22$ valid sub-model configurations.
- Targeted Optimization: By adjusting the loss weights, the authors improved a specific low-resource sub-model's accuracy by 7.2% compared to a uniform weighting baseline.
Limitations and Future Directions
While DNNet shows promise, several areas remain for future exploration. The current study focused on ResNet-32 and smaller datasets like CIFAR and SVHN. Scaling channel-causal convolutions to modern architectures like Transformers or large-scale datasets like ImageNet is a necessary next step. Additionally, while the resulting model is versatile, training the full grid of classifiers increases initial computational overhead.
Summary updated