Variational Learning is Effective for Large Deep Networks

Yuesong Shen, Nico Daheim, Bai Cong, Peter Nickl, Gian Maria Marconi, Bazan Clement Emile Marcel Raoul, Rio Yokota, Iryna Gurevych, Daniel Cremers, Mohammad Emtiyaz Khan, Thomas Möllenhoff

Introduction

In contemporary deep learning, optimization is dominated by first-order methods like SGD and Adam. While effective for finding local minima, these methods typically provide only point estimates of model weights. Variational learning, a subset of Bayesian Deep Learning, offers a more robust alternative by learning a distribution over weights. This approach theoretically provides better generalization and inherent uncertainty quantification. However, variational methods have historically been dismissed for large-scale applications due to high computational costs, tuning difficulties, and lower peak performance compared to standard optimizers.

The paper "Variational Learning is Effective for Large Deep Networks" challenges this status quo by introducing IVON (Improved Variational Online Newton). IVON is a variational optimizer that matches or exceeds the performance of AdamW and SGD across large-scale architectures, including GPT-2 and ResNet-50, while maintaining comparable computational efficiency.

The IVON Optimizer: Bridging Theory and Practice

IVON is designed as a "drop-in" replacement for the Adam optimizer, making it accessible for existing deep learning pipelines. It functions by bridging the gap between second-order optimization and variational inference.

Technical Innovations

The core of IVON lies in its efficient handling of the Hessian matrix (the second-order derivative of the loss function). Traditional second-order methods are computationally prohibitive because they require "per-example" gradients. IVON circumvents this using a reparameterization trick that allows for Hessian estimation through a single vector multiplication with the minibatch gradient.

Structurally, IVON maintains a mean ($m$) and a precision/Hessian estimate ($h$). Its update logic mirrors the momentum-based updates of Adam, but it incorporates several stability mechanisms to ensure performance at scale:

  • Riemannian Gradient Descent: Used to ensure that learned variances remain positive.
  • Hessian Initialization: A specific strategy to prevent early training instability by carefully setting the initial $h_0$ parameter.
  • Weight-Decay as Prior: Interpreting weight decay through a Bayesian lens to regularize the learned distribution.

Empirical Performance

The authors conducted extensive benchmarking to demonstrate IVON's scalability and effectiveness across diverse domains.

Large-Scale Language Modeling

Training GPT-2 (up to 773M parameters) from scratch on the OpenWebText corpus (50B tokens) revealed that IVON is not just a theoretical improvement. It achieved a 0.4 reduction in validation perplexity compared to AdamW, suggesting that variational objectives can indeed scale to the frontiers of NLP.

Computer Vision and Generalization

On ImageNet-1k using a ResNet-50 architecture, IVON delivered a ~2% accuracy increase over AdamW. More importantly, it showed significantly better calibration, as measured by Expected Calibration Error (ECE). In smaller-scale tests like TinyImageNet, IVON consistently avoided the severe overfitting issues that often plague AdamW, demonstrating superior robustness.

Key Insights: Beyond Accuracy

The value of IVON extends beyond simple accuracy metrics, offering several unique advantages for model deployment and analysis.

Flat Minima and Generalization

Variational learning naturally biases the optimizer toward "flat" regions of the loss landscape. Similar to Sharpness-Aware Minimization (SAM), this property is a key driver of IVON’s superior generalization. By seeking regions where the loss is less sensitive to weight perturbations, the model becomes more resilient to distribution shifts.

Uncertainty and Diagnostics

Because IVON learns a Gaussian posterior, it provides weight uncertainty "for free." This is vital for safety-critical deployments where a model must signal when it is "unsure." Furthermore, IVON enables a Leave-One-Out (LOO) cross-validation estimate during training. This allows researchers to predict generalization error without a separate validation set, providing a powerful diagnostic tool for early stopping and model selection.

Model Merging

In the context of Large Language Models (LLMs), merging different finetuned models is a common challenge. IVON provides the necessary Hessian information to merge models effectively without the expensive post-training passes required by existing methods.

Limitations and Future Work

Despite its strengths, IVON faces specific challenges that define future research directions:

  • Batch Normalization: The optimizer currently does not play well with Batch Normalization layers, which limits its use in some legacy vision architectures (though it works perfectly with LayerNorm in Transformers).
  • Hyperparameter Tuning: While the authors provide guidelines, IVON can be more sensitive to initial precision ($h_0$) than standard first-order methods.
  • Sampling Overhead: While a single Monte Carlo sample is often sufficient, higher-fidelity uncertainty estimates require multiple samples, which increases the computational footprint.

Conclusion

IVON represents a significant milestone in Bayesian Deep Learning. By proving that variational learning can be both efficient and high-performing at scale, the authors provide a path toward more reliable, self-aware, and generalizable deep learning models. The method's success in the NeurIPS 2021 Competition on Approximate Inference further underscores its potential as a robust alternative to standard optimization suites.

Summary updated

BibTeX
@inproceedings{shen2024variational,
  author = {Yuesong Shen and Nico Daheim and Bai Cong and Peter Nickl and Gian Maria Marconi and Bazan Clement Emile Marcel Raoul and Rio Yokota and Iryna Gurevych and Daniel Cremers and Mohammad Emtiyaz Khan and Thomas Möllenhoff},
  title = {{Variational Learning is Effective for Large Deep Networks}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=cXBv07GKvk},
}
Figure