Abstract
Bayesian deep learning offers a principled way to address many issues concerning safety of artificial intelligence (AI), such as model uncertainty, model interpretability, and prediction bias. However, due to the lack of efficient Monte Carlo algorithms for sampling from the posterior of deep neural networks (DNNs), Bayesian deep learning has not yet powered our AI system. We propose a class of adaptive stochastic gradient Markov chain Monte Carlo (SGMCMC) algorithms, where the drift function is biased to enhance escape from saddle points and the bias is adaptively adjusted according to the gradient of past samples. We establish the convergence of the proposed algorithms under mild conditions, and demonstrate via numerical examples that the proposed algorithms can significantly outperform the existing SGMCMC algorithms, such as stochastic gradient Langevin dynamics (SGLD), stochastic gradient Hamiltonian Monte Carlo (SGHMC) and preconditioned SGLD, in both simulation and optimization tasks.
Introduction
Bayesian Deep Learning (BDL) is often considered a "holy grail" for safety-critical AI applications because it provides a natural framework for handling model uncertainty and reducing prediction bias. Despite its theoretical appeal, BDL is rarely deployed in production environments. The primary bottleneck is the extreme computational cost associated with sampling from the posterior distribution of high-dimensional Deep Neural Networks (DNNs).
The energy landscapes of DNNs are notoriously complex, characterized by "pathological curvatures"—long, narrow valleys—and numerous saddle points. Standard first-order samplers, such as Stochastic Gradient Langevin Dynamics (SGLD), frequently become trapped in these regions or exhibit inefficient oscillations. While second-order methods can navigate these geometries more effectively, they typically require calculating the Fisher Information Matrix, which is computationally prohibitive for models with millions of parameters. This work introduces a new class of adaptive SGLD algorithms that leverage past gradient information to bias the sampler's drift, bridging the gap between efficient modern optimizers and mathematically rigorous Bayesian tools.
Methods: Adaptive SGLD Framework
The authors propose a general framework for Adaptive SGLD that incorporates a bias term into the standard drift function. Unlike traditional Stochastic Gradient Markov Chain Monte Carlo (SGMCMC) methods, which generally rely on unbiased gradient estimates, this approach intentionally introduces bias based on the sampler's historical path.
Momentum SGLD (MSGLD)
MSGLD incorporates an exponentially decaying average of past gradients into the current parameter update. This "momentum" term helps dampen oscillations in narrow ravines and accelerates movement along the valley floor toward the energy minimum.
Adam SGLD (ASGLD)
Inspired by the Adam optimizer, ASGLD utilizes both the first and second moments of past gradients. By rescaling the bias term to be isotropic near stationary points, ASGLD effectively "pushes" the sampler away from saddle points by whitening the noise, making escape more probable.
A critical contribution of this work is the theoretical proof of ergodicity. The authors demonstrate that despite the intentional introduction of bias, these algorithms converge to the correct posterior distribution under mild conditions, provided the bias is adaptively adjusted and the error remains bounded.
Experimental Evaluation
The proposed algorithms were evaluated against synthetic landscapes and standard benchmarks:
- Synthetic Landscapes: Tests included highly correlated Gaussian distributions and multi-modal mixtures designed with "long narrow energy ravines" to challenge standard samplers.
- Benchmark Datasets: Performance was assessed on the Landsat satellite image dataset, MNIST (for sparse neural network training), and CIFAR-10/100 using a ResNet-18 architecture.
Key Results
- Robustness in Complex Geometries: In synthetic "narrow ravine" tests, standard SGLD, SGHMC, and preconditioned SGLD (pSGLD) often failed to converge. MSGLD achieved a 100% success rate, while ASGLD succeeded in 80% of runs.
- Improved Generalization: On CIFAR-100 with ResNet-18, MSGLD achieved a test accuracy of 73.67%, surpassing standard SGLD (71.91%) and SGHMC (73.11%).
- Competitive Sparse Learning: In MNIST sparse network training, ASGLD outperformed the standard Adam optimizer in both training and test accuracy, demonstrating that Bayesian methods can match or exceed pure optimization performance.
Discussion and Conclusion
The core insight of this research is that biased gradients, when properly managed, are a feature rather than a bug in MCMC. By using the history of the sampler's path, MSGLD and ASGLD can navigate difficult landscapes that trap traditional methods.
However, some limitations remain. The current implementation uses a diagonal approximation for the second moment of gradients to maintain scalability, which may overlook complex correlations between distant parameters. Additionally, the introduction of a "bias factor" ($a$) adds a hyperparameter that may require tuning for specific tasks. Future work may involve combining these adaptive drifts with cyclical step-size schedules to further enhance the sampler's ability to traverse multi-modal posterior distributions.
Summary updated