Abstract
PAC-Bayes generalization bounds offer a theoretically grounded method for providing risk certificates for Bayesian Neural Networks. However, the practical tightness of these bounds is often limited by the choice of the posterior distribution family. Most existing work relies on Mean-Field Variational Inference (MFVI), which approximates the posterior as a factorized Gaussian. This paper demonstrates that such approximations impose a "Gaussian tax," leading to unnecessarily loose bounds. By employing Hamiltonian Monte Carlo (HMC) to sample from the optimal Gibbs posterior and using Thermodynamic Integration (TI) to estimate the resulting Kullback–Leibler (KL) divergence, we achieve significantly tighter risk certificates. Experiments on MNIST variants show improvements of 5-6% over MFVI-based methods, yielding non-vacuous certificates as low as 10.8%.
Introduction
In the quest for reliable machine learning, providing mathematical guarantees on model performance—known as risk certificates—is as crucial as achieving high accuracy. The PAC-Bayes framework provides a robust mechanism for this, particularly for stochastic models like Bayesian Neural Networks (BNNs). A PAC-Bayes bound typically depends on the KL divergence between a chosen posterior $Q$ and a prior $P$. While the Gibbs posterior is theoretically optimal for minimizing these bounds, its lack of a closed-form solution has led researchers to favor simpler, more tractable approximations like MFVI.
The "Gaussian Tax" on Generalization
The reliance on MFVI comes at a cost. By forcing the posterior into a rigid, axis-aligned Gaussian shape, we sacrifice the ability to capture the complex, non-convex geometry of the true posterior landscape. This discrepancy, termed the "Gaussian tax," results in looser generalization bounds.
As shown in Figure 1, MFVI's mean and covariance (represented by ellipses) may fail to align with the high-density regions of the actual posterior. In contrast, HMC samples can traverse the true "banana-shaped" or complex contours, providing a much more faithful representation of the optimal distribution for the PAC-Bayes bound.
Methodology: HMC and Thermodynamic Integration
To move beyond Gaussian approximations, this work utilizes Hamiltonian Monte Carlo (HMC) to draw samples directly from the Gibbs posterior. Because the Gibbs posterior is defined by the training loss, HMC can effectively explore the weight space without assuming a specific parametric form.
A significant challenge arises in calculating the KL divergence, $KL(Q || P)$, when $Q$ is represented only by samples. The authors address this using Thermodynamic Integration (TI). TI estimates the log-partition function (and thus the KL divergence) by integrating the expected loss over a path of "tempered" distributions, transitioning from the prior ($\beta=0$) to the full posterior ($\beta=1$). A key technical contribution is the proof that the integrand in this process is convex, allowing for a rigorous upper bound on the KL divergence via the trapezium rule.
Empirical Results on MNIST
The proposed method was evaluated on several MNIST variants, including Binary MNIST and downsampled versions. The results consistently showed that HMC-based bounds outperform MFVI. On Binary MNIST, the HMC approach yielded a risk certificate of 10.8%, a 5-6% improvement over the 16-17% typically achieved by MFVI.
Interestingly, the gap between HMC and MFVI increases with the amount of training data. While the Gibbs posterior concentrates more effectively as $n$ grows, the rigid structure of MFVI prevents it from fully capitalizing on the additional information, highlighting the importance of posterior expressivity in large-data regimes.
Rigor and Convergence Diagnostics
The validity of MCMC-based bounds hinges on the quality of the samples. Unlike independent Gaussian samples, MCMC samples are correlated, requiring careful statistical treatment. The authors employed rigorous diagnostics, including Effective Sample Size (ESS) and the $\hat{R}$ statistic, to ensure chain convergence.
As illustrated in Figure 4, metrics such as cross-entropy loss and 0-1 loss decrease as the inverse temperature $\beta$ increases toward the full posterior. Simultaneously, the $\hat{R}$ counts (bottom row) remain concentrated near 1.0, indicating that the HMC chains have converged across the different temperature scales required for Thermodynamic Integration.
Conclusion and Future Work
This research confirms that the choice of posterior distribution is a primary bottleneck in achieving tight PAC-Bayes bounds. By using HMC and TI, we can recover the "lost" tightness inherent in variational approximations. While computationally more intensive, this approach sets a new benchmark for what is possible with data-independent priors. Future work involves scaling these techniques to larger architectures and integrating them with data-dependent priors to further push the boundaries of certified generalization.
Summary updated