Robust Approximate Sampling via Stochastic Gradient Barker Dynamics

Lorenzo Mauri, Giacomo ZanellaAISTATS 2024

Introduction

In modern Bayesian machine learning, sampling from posterior distributions using massive datasets is a fundamental challenge. Standard Markov Chain Monte Carlo (MCMC) methods are often computationally prohibitive as they require processing the entire dataset to calculate a single gradient. To address this, researchers typically employ Stochastic Gradient MCMC (SG-MCMC), which approximates gradients using small "mini-batches" of data.

The current standard, Stochastic Gradient Langevin Dynamics (SGLD), suffers from a significant drawback: extreme sensitivity to the "step-size" hyperparameter. An oversized step-size introduces massive bias, while an undersized one leads to slow exploration. Furthermore, SGLD often breaks down when encountering highly variable or skewed "noisy" gradients. This paper introduces Stochastic Gradient Barker Dynamics (SGBD), a robust alternative designed to maintain stability even under sub-optimal tuning and irregular gradient noise.

Methodology: The Barker Proposal

The core innovation of SGBD lies in its use of the Barker proposal mechanism. Unlike Langevin dynamics, which uses the gradient to shift the mean of a proposal distribution, the Barker mechanism uses the gradient to "skew" the distribution. Essentially, the gradient determines the probability of moving in a certain direction rather than the exact location of the move. This decoupling of the direction from the size of the move makes the algorithm inherently more stable.

However, using noisy stochastic gradients in a vanilla Barker setup introduces a "shrinkage" effect, where the sampler becomes less likely to move toward modes, leading to overestimated variance. To counteract this, the authors developed Corrected SGBD (c-SGBD), which uses an on-the-fly estimate of gradient noise variance to "re-sharpen" the distribution. For extreme noise scenarios, they propose Extreme SGBD (e-SGBD), which relies only on the sign of the gradient, similar to robust optimization techniques like AdaGrad.

Robustness and Bias Analysis

A key advantage of SGBD is its resilience to hyperparameter choices. As shown in Figure 3, while SGLD's bias explodes as the step-size (controlled by $\alpha$) increases, SGBD variants maintain a remarkably low and stable bias mean. This robustness allows practitioners to use larger step-sizes for faster exploration without sacrificing the accuracy of the posterior approximation.

Comparison of bias and posterior density between SGLD and SGBD. SGBD maintains low bias even as step-size increases, whereas SGLD bias grows significantly.

Experimental Results

The authors evaluated SGBD across several benchmarks, including high-dimensional logistic regression (Sepsis dataset), Bayesian Matrix Factorization (MovieLens 100k), and Independent Component Analysis (MEG data).

On the MovieLens 100k task—a high-dimensional problem with over 54,000 dimensions—SGBD variants consistently outperformed SGLD. As illustrated in Figure 4, SGBD achieved lower Root Mean Squared Error (rMSE) in both sample-based and MCMC-averaged metrics. This demonstrates that SGBD's stability translates directly into better predictive performance in complex, real-world models.

Predictive performance on MovieLens 100k. SGBD variants achieve lower root mean squared error (rMSE) compared to SGLD counterparts over iterations.

Furthermore, in tasks characterized by "scale heterogeneity" (like the Sepsis dataset), SGBD handled varying parameter scales gracefully, whereas SGLD struggled to find a single step-size that worked for all coordinates. In high-dimensional ICA tasks, c-SGBD produced the highest log-likelihood on unseen data, confirming its utility for complex posterior landscapes.

Conclusion and Future Work

Stochastic Gradient Barker Dynamics offers a more robust framework for Bayesian sampling than traditional Langevin-based methods. By leveraging the Barker proposal, it achieves a superior mixing-accuracy trade-off and simplifies the hyperparameter tuning process.

Future research directions include relaxing the Gaussian noise assumption for bias correction to better handle heavy-tailed data and incorporating "momentum" mechanisms (similar to SGHMC) to improve exploration in flat regions of the distribution. Additionally, developing adaptive step-size schemes specifically for SGBD could further enhance its practical utility.

Summary updated

BibTeX
@inproceedings{mauri2024robust,
  author = {Lorenzo Mauri and Giacomo Zanella},
  title = {{Robust Approximate Sampling via Stochastic Gradient Barker Dynamics}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2024},
}
Figure