TL;DR
Bayesian Deep Ensembles typically treat optimization and sampling as completely disjoint steps, throwing away valuable geometric information about the loss landscape. This paper shows that curvature estimates from adaptive optimizers like AdamW can be recycled to initialize the sampler's preconditioner at zero additional cost. This simple transfer eliminates the need for a lengthy sampling warmup phase, enhances numerical stability, and improves uncertainty quantification.
What Problem Does This Paper Address?
Bayesian Neural Networks (BNNs) are excellent for uncertainty quantification (UQ), but sampling from their high-dimensional, multimodal posterior distributions using Markov chain Monte Carlo (MCMC) is notoriously expensive. A popular workaround is the two-stage Bayesian Deep Ensemble (BDE): first, use standard optimization to find multiple distinct modes (like a standard Deep Ensemble), and then initialize independent MCMC samplers from these modes to explore their local basins.
The catch? These two stages are traditionally treated as completely separate processes. The rich geometric information gathered by adaptive optimizers during the first phase is discarded. As a result, the subsequent sampling phase has to rediscover the local curvature from scratch during a long, computationally expensive scale-adaptation (warmup) period.
Methods
The authors propose bridging this gap by using terminal optimizer statistics to construct a static diagonal mass matrix ($M$) that acts as a preconditioner for Stochastic Gradient Hamiltonian Monte Carlo (SGHMC) sampling.
They formalize three optimizer-informed preconditioning strategies based on the final iteration ($T$) of training:
- Gradient-based: $M = \text{diag}(g_T^2 + \epsilon \mathbf{1})$ — uses the purely local final stochastic gradient.
- First-moment: $M = \text{diag}(\mu_T^2 + \epsilon \mathbf{1})$ — uses the exponentially smoothed gradient momentum.
- Second-moment: $M = \text{diag}(\sqrt{\nu_T} + \epsilon \mathbf{1})$ — leverages AdamW’s second-moment accumulator, which acts as a proxy for the Fisher Information Matrix (FIM).
To prevent numerical instabilities common in parameter-wise preconditioning, the authors introduce a Layer-wise Preconditioning strategy. Instead of maintaining a unique value for every single parameter, they average the optimizer statistics across all parameters within a given layer to compute a single scalar, normalizing it across the network. This acts as a regularizer against extreme parameter values and bounds the maximum step size.
Datasets
The approach was evaluated across a diverse suite of modalities and architectures:
- Tabular Regression:
bikesharingandproteindatasets using Fully Connected Networks (FCNs). - Image Classification:
F-MNISTusing a classic LeNet architecture, andCIFAR-10using a tailored ResNet-7. - Language Modeling:
shakespearecharacter-level modeling using a nanoGPT-style Transformer. Notably, the authors introduced a modified version calledmodern-shakespeare, translating the original text into simplified modern English using Gemini 2.5 Pro to make text quality evaluation more intuitive.
Key Insights and Ideas
- "Fisher for Free": Adaptive optimizers like AdamW already compute running variance statistics ($\nu_t$) to scale learning rates. Because this running variance approximates the diagonal of the Fisher Information Matrix, we essentially get a high-quality geometric preconditioner for free.
- Static Preconditioning Preserves Diversity: Surprisingly, this static transfer method outperforms adaptive samplers like AdaSGHMC. The authors discovered that adaptive samplers continuously update their mass matrices during warmup, effectively "overwriting" the initial geometry. This causes the different chains in the ensemble to become highly self-similar, destroying ensemble diversity. Keeping the optimizer-derived preconditioner static preserves the unique geometric features of each mode, leading to better generalization.
- Immediate Peak Performance: Local strategies (Gradient and First-moment) achieve peak predictive and UQ performance with zero sampling warmup steps.
Key Results
The main quantitative findings demonstrate that optimizer-derived preconditioning consistently beats both standard Deep Ensembles and adaptive samplers:
- Performance Boost: SGHMC with second-moment preconditioning achieved the highest average improvement over Deep Ensembles across all datasets, boosting uncertainty quantification metrics (LPPD) significantly (e.g., a +16.32% improvement on the
proteindataset). - Compute Savings: By completely eliminating the warmup phase for local preconditioning strategies, the total computational cost of a typical BDE pipeline (5,000 warmup + 10,000 sampling steps) can be cut by 33% without sacrificing accuracy.
- Robustness to Hyperparameters: Vanilla SGHMC is highly sensitive to the step size $\eta$ and degrades sharply if it's misspecified. Layer-wise optimizer-preconditioned variants remain stable across a much wider range of step sizes, acting as a numerical safeguard against performance collapse.
Limitations and Future Work
While layer-wise normalization provides excellent stability, the authors note that if the global step size is excessively large, effective updates can still exceed local basin bounds, leading to non-convergence.
Additionally, while the paper primarily focuses on the kinetic dynamics of SGHMC, the authors theoretically propose that this geometric transfer could resolve the "vanishing acceptance rate" problem in non-gradient samplers (like blocked Gibbs sampling) by transforming spherical proposals into ellipsoids aligned with local posterior curvature. Empirical validation of this non-gradient extension remains an open direction for future work.
Summary updated