Learning to Weight Samples for Dynamic Early-Exiting Networks

Yizeng Han, Yifan Pu, Zihang Lai, Chaofei Wang, Shiji Song, Junfen Cao, Wenhui Huang, Chao Deng, Gao Huang

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.

Comparison of conventional training vs. L2W-DEN weighting strategies. Conventional training treats all samples equally, whereas L2W-DEN specializes exits for easy or hard samples.

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 L2W-DEN meta-learning framework, illustrating the interaction between the backbone network, the Weight Prediction Network (WPN), and the meta-objective.

The training process follows a sophisticated three-step meta-learning loop:

  1. 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$).
  2. 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.
  3. 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

BibTeX
@inproceedings{han2022learning,
  author = {Yizeng Han and Yifan Pu and Zihang Lai and Chaofei Wang and Shiji Song and Junfen Cao and Wenhui Huang and Chao Deng and Gao Huang},
  title = {{Learning to Weight Samples for Dynamic Early-Exiting Networks}},
  booktitle = {European Conference on Computer Vision},
  year = {2022},
  doi = {10.1007/978-3-031-20083-0\_22},
}
Figure