Stochastic Gradient Hamiltonian Monte Carlo Methods with Recursive Variance Reduction

Difan Zou, Pan Xu, Quanquan Gu

This paper introduces SRVR-HMC, a novel algorithm that significantly speeds up the process of sampling from complex probability distributions. By combining the physics-inspired mechanics of Hamiltonian Monte Carlo with cutting-edge variance reduction techniques from the optimization world, the authors achieve a theoretical and practical leap in sampling efficiency.

TL;DR

SRVR-HMC is a new sampling algorithm that uses recursive variance reduction to dramatically lower the "gradient complexity" of Hamiltonian Monte Carlo. It converges significantly faster than previous state-of-the-art methods (like SGHMC) when dealing with non-log-concave distributions, making it a powerful tool for large-scale Bayesian learning.

What Problem Does This Paper Address?

In Bayesian machine learning, we often need to sample from a "posterior distribution" to understand uncertainty or make predictions. Hamiltonian Monte Carlo (HMC) is a popular way to do this because it uses gradient information to explore the distribution efficiently.

However, HMC faces two major hurdles in modern applications:

  1. Big Data Scalability: Standard HMC requires calculating the gradient of the entire dataset at every step, which is prohibitively slow for large datasets.
  2. Stochastic Noise: To solve the big data problem, researchers created Stochastic Gradient HMC (SGHMC), which uses small "mini-batches." While faster per step, the random noise introduced by these mini-batches creates high variance, leading to a much slower overall convergence rate—especially for "non-log-concave" distributions (distributions with multiple peaks or complex shapes).

The authors tackle the challenge of reducing this gradient noise without losing the speed of mini-batch processing.

Methods

The core innovation is the Stochastic Recursive Variance-Reduced (SRVR) gradient estimator.

  • Underdamped Langevin Dynamics: The algorithm is built on "underdamped" dynamics, which include a "velocity" (momentum) term. This allows the sampler to "glide" through the distribution more effectively than simpler "overdamped" methods (like SGLD).
  • The Recursive Estimator: Instead of a standard mini-batch gradient, SRVR-HMC uses a multi-epoch structure. At the start of an epoch, it calculates a high-precision gradient. During the epoch, it updates this gradient recursively using the difference between the current and previous iterates. This technique (inspired by the SARAH/SPIDER algorithms in optimization) ensures that the variance of the gradient estimate vanishes as the algorithm converges.
  • Discretization: The authors use a specific numerical integrator (Euler-Maruyama) to turn the continuous physics equations into a discrete computer algorithm.

Datasets

The authors evaluated SRVR-HMC on three types of tasks:

  1. Synthetic Gaussian Mixture Models: Used to test the algorithm's ability to handle non-convex "energy functions" (non-log-concave distributions).
  2. Independent Component Analysis (ICA): Performed on the MEG dataset, which contains 17,730 time-points across 122 channels.
  3. Bayesian Logistic Regression: Tested on standard benchmarks to validate performance on classification tasks.

Key Insights and Ideas

  • Variance is the Enemy: The "aha moment" is that the bottleneck in stochastic HMC isn't the physics of the movement, but the noise in the gradient. By suppressing this noise recursively, you can maintain the "momentum" of HMC without getting knocked off course by mini-batch randomness.
  • Superior Complexity: The paper proves that for a target error $\epsilon$, SRVR-HMC has a gradient complexity of roughly $\tilde{O}(\epsilon^{-4})$. For comparison, the previous state-of-the-art SGHMC required $\tilde{O}(\epsilon^{-8})$. This is a massive theoretical improvement.
Comparison of gradient complexity across different sampling methods.
  • Bridging Optimization and Sampling: The paper successfully ports one of the most effective recent ideas in stochastic optimization (recursive variance reduction) into the realm of probabilistic sampling.

Key Results

  • Faster Convergence: In experiments with Gaussian mixtures, SRVR-HMC reached a low Mean Square Error (MSE) much faster (fewer "data passes") than SGLD, SGHMC, and SVRG-LD.
  • Robustness to Batch Size: The algorithm remains efficient even with very small mini-batch sizes ($B < 20$), which is often where other stochastic methods struggle.
Mean square error vs. data passes comparing SRVR-HMC to baselines (left) and across different batch sizes (right).
  • ICA Performance: On the MEG dataset, SRVR-HMC achieved a lower negative log-likelihood faster than all baseline algorithms, demonstrating its effectiveness on real-world, high-dimensional data.

Limitations and Future Work

  • Spectral Gap Dependency: Like most MCMC theory, the convergence rate depends on the "spectral gap" ($\mu_*$) of the distribution. In very high dimensions or highly complex distributions, this gap can be tiny, meaning the algorithm could still take a long time to converge.
  • Hyperparameter Tuning: The algorithm introduces new parameters, such as the epoch length ($L$) and two different batch sizes ($B_0$ and $B$), which require careful tuning for optimal performance.
  • Memory Overhead: While not explicitly a focus, recursive methods typically require storing previous iterates or gradients, which might increase memory usage compared to simple SGHMC.

Summary updated

BibTeX
@inproceedings{zou2019stochastic,
  author = {Difan Zou and Pan Xu and Quanquan Gu},
  title = {{Stochastic Gradient Hamiltonian Monte Carlo Methods with Recursive Variance Reduction}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2019},
}
Figure