NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Subsampling Error in Stochastic Gradient Langevin Diffusions

Kexin Jin, Chenguang Liu, Jonas Latz

Abstract

The Stochastic Gradient Langevin Dynamics (SGLD) are popularly used to approximate Bayesian posterior distributions in statistical learning procedures with large-scale data. As opposed to many usual Markov chain Monte Carlo (MCMC) algorithms, SGLD is not stationary with respect to the posterior distribution; two sources of error appear: The first error is introduced by an Euler–Maruyama discretisation of a Langevin diffusion process, the second error comes from the data subsampling that enables its use in large-scale data settings. In this work, we consider an idealised version of SGLD to analyse the method’s pure subsampling error that we then see as a best-case error for diffusion-based subsampling MCMC methods. Indeed, we introduce and study the Stochastic Gradient Langevin Diffusion (SGLDiff), a continuous-time Markov process that follows the Langevin diffusion corresponding to a data subset and switches this data subset after exponential waiting times. There, we show the exponential ergodicity of SLGDiff and that the Wasserstein distance between the posterior and the limiting distribution of SGLDiff is bounded above by a fractional power of the mean waiting time. We bring our results into context with other analyses of SGLD.

Introduction

In Bayesian machine learning, approximating posterior distributions for large-scale datasets often requires a trade-off between accuracy and computational efficiency. Stochastic Gradient Langevin Dynamics (SGLD) has emerged as a standard tool for this task. However, SGLD is inherently "dirty" because it introduces two distinct types of error:

  1. Discretization Error: Arising from the Euler–Maruyama time-stepping.
  2. Subsampling Error: Arising from using stochastic gradients calculated on data subsets.

While these errors are typically analyzed together, isolating them is crucial for understanding the fundamental limits of the method. This paper introduces Stochastic Gradient Langevin Diffusion (SGLDiff) to isolate the subsampling error by maintaining continuous time, thereby eliminating discretization effects.

The SGLDiff Framework

SGLDiff is modeled as a switched diffusion process. Instead of taking discrete steps, the process follows the exact Langevin diffusion of a specific data subset for a random duration (modeled by an exponential distribution) before switching to another subset. This theoretical construction allows for a "best-case" analysis of subsampling.

Visualizing the behavior of SGLDiff across different switching frequencies. As the switching rate increases (bottom rows), the process better approximates the target distribution.

As shown in the figure above, when the switching frequency is low (top rows), the process clearly oscillates between the local modes of the data subsets. As the switching frequency increases (moving towards the bottom rows), the stationary distribution of the process converges toward the true posterior.

Key Theoretical Results

The authors provide a rigorous mathematical treatment of SGLDiff, yielding several key insights:

  • Strong Convergence Bound: Theorem 2.1 establishes that as the switching rate $\eta$ (representing the mean waiting time) approaches zero, SGLDiff converges to the true Langevin diffusion at a rate of $O(\eta^{1/4})$.
  • Exponential Ergodicity: Theorem 2.2 proves that SGLDiff converges to a unique stationary distribution exponentially fast, ensuring the stability of the sampler.
  • Asymptotic Error: Theorem 2.3 quantifies the Wasserstein distance between the SGLDiff limit and the true posterior, confirming that the method recovers the target distribution as $\eta \to 0$.

Importantly, the error behavior of this continuous-time model mirrors that of discrete-time SGLD. This suggests that the subsampling itself, rather than the discretization method, is the primary driver of the algorithm's error structure. Furthermore, the convergence rate is largely independent of the dimension $d$, making it suitable for high-dimensional deep learning applications.

Conclusion and Future Directions

By isolating the subsampling error, this work validates the robustness of SGLD-based methods. The results show that even with perfect time-stepping, an intrinsic error remains due to data subsetting. Future research could extend this framework to analyze non-Markovian dependencies (subsampling without replacement) or "underdamped" dynamics that incorporate momentum, potentially providing even tighter bounds for modern optimizers.

Summary updated

BibTeX
@inproceedings{jin2024subsampling,
  author = {Kexin Jin and Chenguang Liu and Jonas Latz},
  title = {{Subsampling Error in Stochastic Gradient Langevin Diffusions}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2024},
  url = {https://openreview.net/forum?id=tgErlX6k13},
}
Figure