Stochastic Gradient Langevin Dynamics for Scalable Bayesian Inference

82 concepts71 papers1 proposal

In machine learning, we often face a stark trade-off between computational speed and statistical certainty. Stochastic Gradient Descent (SGD) scales effortlessly to massive datasets by computing gradients on small, random mini-batches, but it only yields a single point estimate—the "best fit" parameters. Conversely, traditional Markov Chain Monte Carlo (MCMC) methods capture the full posterior distribution, providing robust uncertainty quantification, but they require evaluating the likelihood over the entire dataset at every single step.

To bridge this gap, Max Welling et al. introduced a breakthrough framework in Bayesian Learning via Stochastic Gradient Langevin Dynamics. Known as Stochastic Gradient Langevin Dynamics (SGLD), this approach injects a precisely calibrated amount of Gaussian noise into mini-batch gradient updates. As the step size is annealed, the algorithm automatically transitions from rapid optimization to full posterior sampling, unlocking scalable Bayesian inference for big data.

The Core Intuition: Balancing Two Sources of Noise

To understand why adding noise to an optimization trajectory yields a valid posterior sampler, we can look to continuous-time physics. Langevin dynamics describe the motion of a particle moving through a fluid under the influence of a potential field (the loss landscape) and random thermal fluctuations (noise). The key insight is that the stationary distribution of this stochastic differential equation is exactly proportional to the target posterior distribution.

When we compute gradients over a mini-batch rather than the full dataset, we introduce an inherent "subsampling noise." SGLD balances this by explicitly adding independent Gaussian noise at each step:

$$\Delta \theta_t = \frac{\epsilon_t}{2} \left[ \nabla \log p(\theta_t) + \frac{N}{n} \sum_{i=1}^n \nabla \log p(x_{t,i} | \theta_t) \right] + \eta_t$$

where $\eta_t \sim \mathcal{N}(0, \epsilon_t I)$, $N$ is the total dataset size, and $n$ is the mini-batch size.

Why does this work? The variance introduced by the mini-batch approximation scales with the square of the step size ($\epsilon_t^2$), whereas the variance of the injected Gaussian noise scales linearly with the step size ($\epsilon_t$). As the step size $\epsilon_t$ is annealed toward zero, the injected noise completely dominates the mini-batch subsampling noise. Consequently, the system stops converging to a single point and instead begins tracing out valid samples from the true posterior distribution. As reviewed by Christopher Nemeth et al. in Stochastic gradient Markov chain Monte Carlo, this mechanism allows the per-step computational complexity to remain constant regardless of the total dataset size.

Advanced Variants: Momentum, Variance Reduction, and Geometry

While vanilla SGLD is elegant, the variance from mini-batching can introduce asymptotic bias or require painfully small step sizes. To handle complex, high-dimensional probability landscapes, several advanced variants have emerged:

Applications Across High-Dimensional Domains

Because SGLD integrates seamlessly with modern deep learning infrastructure—supported by specialized software ecosystems like the one presented by Jack Baker et al. in sgmcmc: An R Package for Stochastic Gradient Markov Chain Monte Carlo—it has become a cornerstone for scalable Bayesian inference across diverse domains:

Key Foundational Work

Bayesian Learning via Stochastic Gradient Langevin Dynamics (2011) — contributed 1 concept elements to this direction.
History & citationVersion 1 · 2026-10-04

Current · Permanent link

View frozen version 1

Cite this direction

Latest version (a living page):

@misc{lacuna_stochastic_gradient_langevin_dynamics_7f2248a4,
  title = {stochastic gradient Langevin dynamics},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/stochastic-gradient-langevin-dynamics/rdr_7f2248a4852049c3a25ac32138cdd826},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-23},
}

This exact version (version 1, frozen text):

@misc{lacuna_stochastic_gradient_langevin_dynamics_7f2248a4_v1,
  title = {stochastic gradient Langevin dynamics},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/stochastic-gradient-langevin-dynamics/rdr_7f2248a4852049c3a25ac32138cdd826/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-11-23},
}
About

These directions overlap with this one through shared papers.

See something wrong? Report a mistake