Bayesian Model Selection, the Marginal Likelihood, and Generalization

Sanae Lotfi, Pavel Izmailov, Gregory W. Benton, Micah Goldblum, Andrew Gordon Wilson

Introduction

How do we compare hypotheses that are entirely consistent with our observations? In Bayesian machine learning, the standard tool for this is the marginal likelihood (LML), also known as Bayesian evidence. It represents the probability of generating our observations given a prior model. However, this paper challenges the common assumption that the LML is a reliable proxy for a model's ability to generalize. The authors demonstrate that relying solely on the LML can lead to both underfitting and overfitting, and they propose the Conditional Marginal Likelihood (CLML) as a more robust alternative that better aligns with actual test-time performance.

The Problem with Marginal Likelihood

The LML is celebrated for automatically encoding "Occam’s Razor"—it naturally favors the simplest model that can adequately explain the data, penalizing unnecessary complexity.

Occam's Razor and Marginal Likelihood

However, there is a subtle but critical gap in using LML for model selection. The LML answers the question: "What is the probability that my prior model generated this training data?" In contrast, generalization asks: "How well will my trained posterior model predict new, unseen data?"

The authors argue that these two questions are fundamentally different. In modern deep learning, we often deal with vague priors and massive parameter spaces. In these scenarios, the LML can become misaligned with generalization.

Prior Contraction and Occam Penalty

For instance, the LML might heavily penalize a model that generalizes perfectly simply because its initial, diffuse prior required a massive contraction to reach the posterior (incurring a large "Occam penalty"). Conversely, it might favor a "simple" model that actually overfits the training set.

The Conditional Marginal Likelihood (CLML) Solution

To bridge the gap between model selection and generalization, the authors propose the Conditional Marginal Likelihood (CLML).

The LML can be mathematically broken down into a sequence of predictions: the probability of the first data point, then the second point given the first, and so on. The critical realization is that the first few terms in this sequence are heavily dominated by the prior. If your prior is vague, these initial terms will be very small, dragging down the total LML even if the model learns rapidly and predicts all subsequent points perfectly.

The CLML addresses this by:

  1. Conditioning: Dropping the first $m$ terms of the LML decomposition. By conditioning on a small subset of data, the metric "washes out" the overwhelming influence of the initial prior.
  2. Focusing on Learning: This forces the evaluation to focus on how well the model generalizes after it has already seen some data, which is much closer to our actual goal in machine learning.
  3. Scalability: For deep neural networks where exact LML is intractable, the authors utilize a scalable Laplace Approximation to estimate the posterior and compute the CLML efficiently.

Key Insights and Results

The paper validates CLML across a diverse range of benchmarks, including synthetic tasks, image classification (CIFAR), regression, and transfer learning.

  • LML Does Not Guarantee Generalization: A model can have a lower LML than a competitor but significantly better test accuracy. This disconnect is especially pronounced when priors are vague.
  • Debunking the Training Speed Myth: Recent literature suggested that models that "train faster" have higher LML. The authors show that fast training (rapid posterior contraction) can actually incur a massive Occam penalty in the LML, hurting the score even if the model generalizes well.
  • Robustness to Prior Sensitivity: The LML is hyper-sensitive to the choice of prior precision. If this hyperparameter is slightly off, the LML can become negatively correlated with test accuracy. CLML, evaluated in "function space" rather than parameter space, remains remarkably stable across different prior settings.
  • Improved Performance in Practice:
    • In Neural Architecture Search (NAS) on CIFAR-100, the correlation between LML and test accuracy becomes negative with diffuse priors, whereas CLML maintains a strong positive correlation.
  • In Deep Kernel Learning (DKL) for low-data regimes, CLML-optimized models consistently achieved lower error rates than LML-optimized ones.
  • In Transfer Learning tasks subject to distribution shifts, CLML outperformed LML, proving to be a more robust metric for real-world generalization.

Limitations and Future Work

While CLML offers a significant step forward, it is not without limitations:

  • Hyperparameter Overfitting: If the hyperparameter search space is excessively flexible, CLML can still overfit because it is ultimately "fitting" to the conditioned data points.
  • Choosing the Cutoff ($m$): The performance of CLML depends on $m$ (how much data is conditioned on). While results are generally stable, finding a principled way to choose the optimal $m$ remains an open research question.
  • Computational Overhead: Although more efficient than standard cross-validation, the Laplace Approximation required for deep networks still carries a computational cost compared to simple point estimates.

Summary updated

BibTeX
@inproceedings{lotfi2022bayesian,
  author = {Sanae Lotfi and Pavel Izmailov and Gregory W. Benton and Micah Goldblum and Andrew Gordon Wilson},
  title = {{Bayesian Model Selection, the Marginal Likelihood, and Generalization}},
  booktitle = {International Conference on Machine Learning},
  year = {2022},
  url = {https://openreview.net/forum?id=9YK9NaFT_q8},
}
Figure