Dynamic neural networks offer a promising path toward efficient AI by adapting their computational cost to the complexity of the input. However, training these networks effectively remains a challenge. This paper, presented at ECCV 2022, introduces L2W-DEN, a novel meta-learning framework designed to optimize the training of early-exiting networks (EENs) by dynamically weighting training samples.
The Training-Testing Gap in Dynamic Networks
Early-exiting networks (EENs) are designed for efficiency. They feature multiple classifiers (exits) at various depths. During inference, "easy" samples—those that are clear and unambiguous—can be classified at shallow layers and exit early, saving significant computational resources. Conversely, "hard" samples continue through the network to deeper, more complex layers.
The fundamental issue addressed by this research is the training-testing gap. Standard training protocols typically apply a uniform loss across all exits for every training sample. This means a highly complex, "hard" sample contributes to the loss of a shallow exit, even though that sample would never realistically exit there during inference. Ideally, shallow exits should specialize in mastering easy samples to ensure high-confidence early departures, while deeper exits should focus on the difficult cases that the early layers cannot resolve.
Meta-Learning for Sample Weighting
To bridge this gap, the authors propose a Weight Prediction Network (WPN) integrated into a meta-learning framework. The WPN is a small multi-layer perceptron (MLP) that learns to assign a specific weight to each sample at each exit based on the training losses.
The training process follows a sophisticated three-step meta-learning loop:
- Pseudo-update: The backbone network ($f^t$) is temporarily updated using weights generated by the current WPN ($g^t$) to create a "look-ahead" model ($̂f^t$).
- Meta-objective Optimization: The framework simulates test-time behavior on a "meta-batch." It determines where samples would naturally exit based on prediction confidence. The meta-loss is then calculated only for samples at their predicted exit points. The WPN is updated to minimize this meta-loss, learning which weighting schemes lead to the best dynamic performance.
- Final Backbone Update: The original backbone network is updated using the optimized weights provided by the newly refined WPN.
Crucially, the WPN is only utilized during the training phase. At inference time, the backbone network operates independently, resulting in zero additional computational overhead during deployment.
Experimental Results and Insights
The authors evaluated L2W-DEN on standard benchmarks including CIFAR-10, CIFAR-100, and ImageNet, applying it to state-of-the-art architectures like MSDNet and RANet.
Key Findings:
- Efficiency Gains: On ImageNet, L2W-DEN achieved the same accuracy as a standard MSDNet while requiring only 70% of the computation (a 1.4x speedup).
- Accuracy Improvements: On CIFAR-100, the method provided a ~1.3% boost in Top-1 accuracy for the same computational budget.
- The Importance of "Easy" Samples: A key insight from the learned weights is that early exits prioritize easy samples (those with lower loss). This contradicts common weighting schemes like Focal Loss that focus on hard samples, but it is logical for EENs: early exits must be highly reliable on easy data to allow for safe early termination.
- Robustness to Imbalance: In long-tailed (class-imbalanced) scenarios, L2W-DEN showed even greater improvements over baselines, suggesting that specialized weighting helps the model manage difficult, underrepresented classes more effectively at deeper layers.
Conclusion
L2W-DEN successfully aligns the training of dynamic networks with their intended use case. By forcing classifiers to specialize in the types of samples they will actually encounter at inference, the framework significantly improves the accuracy-efficiency trade-off. While the meta-learning process increases training complexity and time, the benefit of a more efficient, high-performing model at deployment—with no extra inference cost—makes it a compelling strategy for real-world dynamic AI applications.
Summary updated