Scalable Marginal Likelihood Estimation for Model Selection in Deep Learning

Alexander Immer, Matthias Bauer, Vincent Fortuin, Gunnar Rätsch, Mohammad Emtiyaz Khan

Introduction

This paper introduces a scalable method to estimate the marginal likelihood—a "gold standard" Bayesian metric—to select hyperparameters and neural network architectures using only training data. By combining Laplace’s method with clever Hessian approximations, the authors provide a practical alternative to expensive cross-validation that naturally resists overfitting.

The Challenge of Model Selection

In deep learning, hyperparameters (like weight decay) and architectures (like the number of layers) are typically chosen using a validation set or cross-validation. But what if validation data is scarce, or the data distribution is constantly shifting?

Bayesian theory offers a compelling alternative: the marginal likelihood (also known as evidence). It represents the probability of the data given the model, integrated over all possible parameter values. Theoretically, it acts as an "automatic Occam’s razor," favoring models that are complex enough to explain the data but simple enough to generalize. However, calculating this for deep neural networks is notoriously difficult. It requires integrating over millions of parameters, making it historically too slow and computationally expensive for modern AI.

A Scalable Bayesian Approach

The authors propose a scalable framework to approximate the marginal likelihood using Laplace’s method. The core steps involve:

  1. Finding the MAP: Training the network to find the "Maximum A Posteriori" (MAP) weights.
  2. Local Approximation: Fitting a Gaussian distribution around those weights. The "width" of this Gaussian depends on the Hessian (the matrix of second-order derivatives of the loss).
  3. Hessian Approximations: Because the full Hessian is too massive to compute for deep networks, the authors utilize scalable approximations such as the Generalized Gauss-Newton (GGN) and Empirical Fisher (EF) matrices. They further apply structural simplifications like Kronecker-factored (KFAC) and Diagonal approximations to make the math tractable for large models like ResNets.

Additionally, the paper introduces an online optimization strategy. Instead of waiting for training to finish, differentiable hyperparameters (like prior variance) are updated every few epochs using gradient ascent on the marginal likelihood estimate.

Key Findings and Performance

The researchers evaluated their method across a diverse range of tasks, including regression (e.g., the Snelson toy dataset, UCI benchmarks) and image classification (MNIST, FashionMNIST, CIFAR-10, and CIFAR-100), testing various MLPs, CNNs, and ResNets.

  • Occam’s Razor in Action: The marginal likelihood successfully penalizes overly complex models, naturally finding the sweet spot between underfitting and overfitting based purely on the training data.
  • Validation-Free Selection: The method can rank dozens of different architectures and pick the best one without a validation set. Remarkably, the ranking produced by the marginal likelihood had a 97% correlation with actual test accuracy on CIFAR datasets.
Correlation between Marginal Likelihood and Test Accuracy
  • Diagonal Approximations are "Good Enough": While diagonal Hessians are often poor for making predictions, the authors found they are surprisingly effective for model selection. This is a huge win for scalability, as diagonal computations are very cheap.
  • Better Calibration and Efficiency: Models selected via this method tend to be better calibrated and more adept at detecting out-of-distribution data compared to standard cross-validation. Furthermore, the online version of the algorithm only adds a small overhead (roughly 2x training time), which is significantly faster than running a full grid search.

Limitations and Future Directions

The primary limitation is the method's dependency on the MAP estimate. The approximation relies on the weights being at a local optimum; if the training hasn't converged or the loss landscape is extremely non-Gaussian, the estimate might be less accurate. Furthermore, while differentiable hyperparameters are tuned online, discrete architectural choices still require training candidate models and comparing them afterward.

Future work may extend this framework to non-supervised settings—such as Bayesian optimization, active learning, and reinforcement learning—where validation data is inherently unavailable.

Summary updated

BibTeX
@inproceedings{immer2021scalable,
  author = {Alexander Immer and Matthias Bauer and Vincent Fortuin and Gunnar Rätsch and Mohammad Emtiyaz Khan},
  title = {{Scalable Marginal Likelihood Estimation for Model Selection in Deep Learning}},
  booktitle = {International Conference on Machine Learning},
  year = {2021},
  url = {https://openreview.net/forum?id=OBVSmwUze8z},
}
Figure