Anytime Neural Networks via Joint Optimization of Auxiliary Losses

Hanzhang Hu, Debadeepta Dey, J. Andrew Bagnell, Martial Hebert

Introduction

Modern Deep Neural Networks (DNNs) achieve state-of-the-art accuracy but often require significant computational resources, processing the entire network before providing a result. In dynamic environments like autonomous driving or high-traffic web services, the ability to trade off computation time for accuracy on-the-fly is critical. Anytime Neural Networks (ANNs) address this by incorporating auxiliary prediction layers throughout the architecture, allowing for intermediate results. However, training these networks effectively remains a challenge, as early-layer losses often dominate the optimization process, degrading the performance of deeper, more capable layers.

Adaptive Loss Balancing (AdaLoss)

The primary difficulty in training ANNs lies in the scale imbalance between auxiliary losses. Early layers, having less predictive power, produce much larger losses and gradients than later layers. Standard training typically uses a static weighted sum of these losses, which inadvertently prioritizes the "easiest" layers.

To overcome this, the authors introduce AdaLoss, an adaptive weighting scheme. AdaLoss dynamically scales each auxiliary loss inversely to its exponential moving average. This approach is mathematically equivalent to minimizing the geometric mean of the expected training losses, effectively normalizing the contribution of each layer regardless of its inherent loss scale.

Relative training loss increase for different weighting schemes. AdaLoss maintains performance close to the theoretical optimum (OPT) across all building blocks.

Exponentially Deepening ANNs (EANNs)

Even with optimized loss weighting, a single ANN often faces a trade-off where early and late accuracy are anti-correlated. The authors propose Exponentially Deepening Anytime Neural Networks (EANNs) to mitigate this. EANNs utilize an ensemble of networks with exponentially increasing depths. By computing the smallest network first and progressing to larger ones, the system ensures high-quality early predictions while only delaying the final, most accurate prediction by a constant fraction of total compute.

Key Results

The combination of AdaLoss and EANNs yields significant improvements in efficiency and accuracy across benchmarks like CIFAR-10/100, SVHN, and ImageNet.

Accuracy-compute trade-off. A smaller ANN trained with AdaLoss matches the performance of a significantly larger network trained with standard static weights.

On CIFAR and SVHN, AdaLoss reduced the relative error gap at the final layer from 18.9% (with constant weighting) to just 2.73%. On ImageNet, an AdaLoss-trained MSDNet32 matched the accuracy of the larger MSDNet38, representing a 40% reduction in computational cost for the same performance level. Furthermore, EANNs built from ResANNs outperformed traditional anytime predictors, demonstrating the power of combining adaptive optimization with strategic architectural ensembles.

Conclusion

AdaLoss provides a robust, theoretically grounded method for balancing auxiliary losses in Anytime Neural Networks. By ensuring that every layer is optimized relative to its own potential, and pairing this with exponentially deepening ensembles, researchers can create models that are both highly accurate and computationally flexible. Future work may extend AdaLoss to broader multi-task learning scenarios or explore gradient-norm-based normalization to further refine the optimization process.

Summary updated

BibTeX
@misc{hu2017anytime,
  author = {Hanzhang Hu and Debadeepta Dey and J. Andrew Bagnell and Martial Hebert},
  title = {{Anytime Neural Networks via Joint Optimization of Auxiliary Losses}},
  year = {2017},
  eprint = {1708.06832},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1708.06832},
}
Figure