Last Layer Empirical Bayes

Valentin Villecroze, Yixin Wang, Gabriel Loaiza-Ganem

TL;DR

Deep ensembles outperform Bayesian Neural Networks (BNNs) at uncertainty quantification largely because they secretly act like empirical Bayes—implicitly learning strong, data-dependent priors that concentrate around high-likelihood solutions. This paper introduces Last Layer Empirical Bayes (LLEB), which explicitly parameterizes a learned prior on the network’s final layer using normalizing flows; while theoretically well-motivated to match ensemble-like performance in a single model, LLEB ultimately performs on par with—but not significantly better than—standard baselines.

What Problem Does This Paper Address?

Quantifying uncertainty in neural network predictions is vital for safety-critical applications like automated driving and medical diagnostics. Today, deep ensembles are the gold standard for uncertainty quantification (UQ), consistently beating BNNs. However, ensembles are computationally expensive: training an ensemble of size $M$ requires training $M$ separate models from scratch.

Recent theoretical work revealed why ensembles perform so well: they implicitly perform empirical Bayes, placing learned priors as point masses on maximum-likelihood solutions ($\Theta^*$). Standard BNNs, by contrast, rely on fixed, weak priors (like isotropic Gaussians). The authors ask: Can we explicitly learn a flexible, data-dependent prior via empirical Bayes in a single model, capturing the diversity and performance of deep ensembles without the $M\times$ training cost?

Methods

Training a full-network generative model over millions of weights is computationally intractable. To preserve tractability, LLEB restricts uncertainty estimation to the network’s last layer:

  • Normalizing Flow Priors: Instead of assuming a fixed Gaussian prior, LLEB models the last-layer parameter distribution $q_\eta(\theta_{\text{QU}})$ using a Normalizing Flow (specifically, a Neural Spline Flow).
  • Implicit Regularization: Rather than collapsing to a single maximum-likelihood point mass, the flow’s mathematical invertibility provides implicit regularization, encouraging the learned distribution to retain volume and diversity across the parameter space.
  • Two-Step Optimization: While small networks can be trained end-to-end by maximizing the expected log-likelihood, larger architectures (e.g., ResNets) experience training instability. To solve this, the authors adopt a two-stage approach:
  • Train the entire network to convergence via standard maximum likelihood estimation (MLE).
  • Freeze the representation backbone ($\theta_{\text{NU}}^*$), discard the final deterministic head, and train the normalizing flow $q_\eta$ on the last layer to maximize $\mathbb{E}_{\theta_{\text{QU}} \sim q_\eta}[\log p(\mathcal{D} \mid \theta_{\text{QU}}, \theta_{\text{NU}}^*)]$.

Datasets

The authors evaluated in-distribution classification, calibration, and out-of-distribution (OOD) detection across two standard benchmark image pairs:

  1. MNIST (in-distribution) paired with Fashion-MNIST (OOD), and vice versa.
  2. CIFAR-10 (in-distribution) paired with SVHN (OOD), and vice versa.

No new datasets were introduced.

Key Insights and Ideas

  • Interpolating Between BNNs and Ensembles: Standard BNNs use very weak, fixed priors; ensembles use extremely strong, discrete priors centered at local minima. LLEB is positioned right in the middle: strong enough to concentrate on good weight spaces, but continuous and flexible.
  • Why Normalizing Flows Help: Directly maximizing expected log-likelihood over arbitrary function approximators usually leads to posterior collapse into a point mass (standard MLE). Because normalizing flows are diffeomorphic (invertible and smooth), they resist collapse naturally without needing explicit penalties.
  • Negative Regularization Findings: The authors attempted adding explicit entropy penalties ($\pm \lambda H(q_\eta)$) to explicitly tune parameter diversity. Surprisingly, neither increasing nor decreasing entropy improved calibration or OOD performance over the unregularized flow.

Key Results

Evaluated on test accuracy (Acc), Expected Calibration Error (ECE), and OOD epistemic uncertainty detection (ROC-AUC):

  • Single-Model Comparisons: LLEB performs competitively with baselines of comparable computational cost—such as Last-Layer Laplace (LLL) and Monte Carlo Dropout (MCD)—but fails to achieve a clear edge:
  • CIFAR-10 $\rightarrow$ SVHN: LLEB achieves 92.85% accuracy, 0.06 ECE, and 0.94 AUC, roughly matching LLL (92.82% Acc, 0.70 ECE, 0.94 AUC) and MCD (92.29% Acc, 0.10 ECE, 0.89 AUC).
  • MNIST $\rightarrow$ Fashion-MNIST: LLEB obtains 97.74% accuracy, 0.00 ECE, and 0.95 AUC (compared to LLL's 0.96 AUC and MCD's 0.91 AUC).
  • Ensemble Settings ($M = 5$): Ensembling five LLEB models achieves performance comparable to standard deep ensembles (e.g., CIFAR-10 accuracy of 94.78% vs. 94.82% for default ensembles, with matching AUCs of 0.95 vs. 0.91), but does not consistently surpass them.

Limitations and Future Work

  • Concessions to Tractability: Restricting the Bayesian treatment exclusively to the final layer while freezing earlier representation layers likely bottlenecks expressiveness, preventing LLEB from matching the functional diversity explored across all layers by full deep ensembles.
  • Lack of Consistent Empirical Gains: As fitting for the “I Can’t Believe It’s Not Better” workshop, the method is sound and theoretically grounded, but does not clearly outperform existing cheap approximations like Laplace or dropout heads.
  • Future Work: Developing scalable architectures that can apply empirical Bayes across intermediate representations or finding alternative parameterizations that achieve ensemble-like diversity without full retraining.

Summary updated

BibTeX
@inproceedings{villecroze2025last,
  author = {Valentin Villecroze and Yixin Wang and Gabriel Loaiza-Ganem},
  title = {{Last Layer Empirical Bayes}},
  booktitle = {ICBINB @ ICLR},
  year = {2025},
  url = {https://openreview.net/forum?id=j53Vs162RA},
}
Figure