Abstract
Applying standard Markov chain Monte Carlo (MCMC) algorithms to large data sets is computationally infeasible. The recently proposed stochastic gradient Langevin dynamics (SGLD) method circumvents this problem in three ways: it generates proposed moves using only a subset of the data, it skips the Metropolis-Hastings accept-reject step, and it uses sequences of decreasing step sizes. In this work, we provide the mathematical foundations for the decreasing step size SGLD, including consistency and a central limit theorem. However, in practice the SGLD is run for a relatively small number of iterations, and its step size is not decreased to zero. The present article investigates the behaviour of the SGLD with fixed step size. In particular we characterise the asymptotic bias explicitly, along with its dependence on the step size and the variance of the stochastic gradient. On that basis a modified SGLD which removes the asymptotic bias due to the variance of the stochastic gradients up to first order in the step size is derived. Moreover, we are able to obtain bounds on the finite-time bias, variance and mean squared error (MSE). The theory is illustrated with a Gaussian toy model for which the bias and the MSE for the estimation of moments can be obtained explicitly. For this toy model we study the gain of the SGLD over the standard Euler method in the limit of large data sets.
Introduction
Stochastic Gradient Langevin Dynamics (SGLD) has emerged as a cornerstone algorithm for Bayesian inference on massive datasets. Standard MCMC methods, like the Metropolis-Hastings (MH) sampler, require a full pass over the entire dataset to evaluate every proposed move, making them computationally prohibitive for "Big Data." SGLD addresses this by utilizing mini-batching to estimate gradients and skipping the expensive MH accept-reject step.
While the original theoretical framework for SGLD relied on step sizes that decrease to zero, practitioners almost exclusively use a fixed step size to maintain convergence speed. This shift creates a gap between theory and practice. This paper bridges that gap by providing a rigorous analysis of the bias and variance introduced by fixed-step SGLD and introducing mSGLD, a modified version designed to cancel the primary source of asymptotic bias.
Methodology
The authors utilize a combination of stochastic calculus and numerical analysis to dissect SGLD performance. Key analytical tools include:
- The Poisson Equation: Employed to bridge the gap between the continuous-time "ideal" Langevin diffusion and the discrete-time "noisy" SGLD updates.
- Weak Error Expansion: A Taylor expansion of the error in terms of the step size ($h$) is derived, revealing the specific terms that contribute to asymptotic bias.
- mSGLD (Modified SGLD): A novel update rule is proposed. By estimating the covariance of the stochastic gradient and subtracting a corresponding amount of noise from the injected Gaussian noise, the authors "pre-cancel" the first-order bias term.
- Finite-Time Analysis: Moving beyond infinite-time limits, the paper provides explicit bounds on the Mean Squared Error (MSE) for a finite number of iterations ($K$).
Key Theoretical Insights
- The "Stochastic" Penalty: The bias in SGLD arises from two sources: discretization (the step-like nature of the algorithm) and the variance of the mini-batch gradient. This "stochasticity bias" often dominates the error.
- Bias-Variance Trade-off: Larger step sizes ($h$) facilitate faster exploration of the state space (reducing variance) but increase discretization error (increasing bias). The authors identify an optimal scaling where $h \approx K^{-1/3}$.
- Efficiency Parity: Surprisingly, fixed-step SGLD achieves the same efficiency scaling ($K^{-2/3}$ MSE) as the more complex decreasing-step-size version, justifying its widespread use in practice.
- Complexity Gains: For specific tasks, such as moment estimation, SGLD can reduce computational complexity from $O(N^2)$ to $O(N)$ as the dataset size $N$ grows, compared to standard Euler methods.
Experimental Results
The theoretical findings were validated using a 1D Gaussian toy model and Bayesian Logistic Regression. The toy model allowed for exact analytical verification of bias and variance formulas.
As shown in the figure above, mSGLD significantly outperforms standard SGLD in high-accuracy regimes. By removing the $O(h)$ bias term, mSGLD achieves a lower asymptotic bias that scales as $O(h^2)$, similar to the standard Euler method but with the computational benefits of mini-batching. The results also demonstrate that as the dataset size $n$ increases, the performance gap between SGLD and its modified counterpart becomes more pronounced.
Conclusion and Future Work
This work provides a roadmap for choosing the number of steps $K$ and step size $h$ to reach target accuracy in SGLD. While mSGLD offers superior bias properties, it requires estimating the gradient's covariance at each step, which introduces some computational overhead. Future research may explore applying similar bias-canceling techniques to other advanced samplers, such as Stochastic Gradient Hamiltonian Monte Carlo (SGHMC), and relaxing ergodicity assumptions for more complex, non-convex landscapes like those found in deep learning.
Summary updated