Source-linked AI summary

The True Cost of Stochastic Gradient Langevin Dynamics

Tigran Nagapetyan, Andrew B. Duncan, Leonard Hasenclever, Sebastian J. Vollmer, Lukasz Szpruch, Konstantinos Zygalakis

arXiv:1706.02692v1stat.MEcs.NAmath.NA

TL;DR

Posterior inference needs scalable sampling as datasets grow, but constant-step stochastic-gradient methods incur bias that has received little quantification in the big-data limit. The paper analyzes mean-squared error and computational cost for Lipschitz functionals in strongly log-concave models, finding that subsampling does not improve cost scaling with dataset size. Its analysis also distinguishes this setting from classic ergodic-average estimators.

  • Problem

    Stochastic-gradient MCMC bias from stochastic gradients and discretization has been little quantified, especially as dataset size grows.

    Source: §1 · p. 2
  • Method

    The paper analyzes mean-squared error and computational cost for Lipschitz-function expectations in growing-data strongly log-concave models.

    Source: §1 · p. 2, §2.1 · p. 6
  • Results

    Subsampling does not improve the scaling of SGLD’s cost with dataset size, and its advantage over full-gradient Euler discretization is at most a constant factor.

    Source: §1 · p. 3, §6 · pp. 26–27
  • Takeaways & Limitations

    Stochastic-gradient MCMC is not a silver bullet; the same cost-scaling conclusion holds for stochastic-gradient HMC, and the analysis extends to strongly log-concave targets.

    Source: §6 · p. 27

    The analysis uses many independent simulations rather than classic ergodic-average estimators, which the paper leaves for future work.

    Source: §2.1 · p. 7

Abstract

from arXiv · show

The problem of posterior inference is central to Bayesian statistics and a wealth of Markov Chain Monte Carlo (MCMC) methods have been proposed to obtain asymptotically correct samples from the posterior. As datasets in applications grow larger and larger, scalability has emerged as a central problem for MCMC methods. Stochastic Gradient Langevin Dynamics (SGLD) and related stochastic gradient Markov Chain Monte Carlo methods offer scalability by using stochastic gradients in each step of the simulated dynamics. While these methods are asymptotically unbiased if the stepsizes are reduced in an appropriate fashion, in practice constant stepsizes are used. This introduces a bias that is often ignored. In this paper we study the mean squared error of Lipschitz functionals in strongly log- concave models with i.i.d. data of growing data set size and show that, given a batchsize, to control the bias of SGLD the stepsize has to be chosen so small that the computational cost of reaching a target accuracy is roughly the same for all batchsizes. Using a control variate approach, the cost can be reduced dramatically. The analysis is performed by considering the algorithms as noisy discretisations of the Langevin SDE which correspond to the Euler method if the full data set is used. An important observation is that the 1scale of the step size is determined by the stability criterion if the accuracy is required for consistent credible intervals. Experimental results confirm our theoretical findings.

1. Introduction

The introduction frames constant-step stochastic-gradient MCMC as a scalable but biased approach whose accuracy and computational cost are insufficiently quantified in the big-data limit. It motivates studying step-size choice and reports that SGLD gains at most a constant factor over full-gradient Euler discretization while dataset-size dependence dominates.

1. Introduction

  • Stochastic-gradient MCMC scales through subset-based gradients, but constant step sizes used in practice introduce bias.These methods are asymptotically exact with decreasing step-size schemes.Source: §1 · p. 2
  • Despite broad applications, little work quantifies bias from stochastic gradients and discretization, especially as dataset size tends to infinity.The cited applications include matrix factorization, topic models, and neural networks.Source: §1 · p. 2
  • The analysis focuses on step-size accuracy for globally Lipschitz drift from a strongly log-concave potential, where stability and bias impose constraints.Euler discretizations can be unstable for some light-tailed distributions, and step size also affects accuracy.Source: §1 · p. 2
  • The paper studies mean-squared error and computational cost for expectations of Lipschitz functions as dataset size grows.The required accuracy depends on the functional and posterior width; for posterior means, the natural scale is the standard deviation, typically shrinking with dataset size.Source: §1 · pp. 2–3
  • SGLD is at most better by a constant factor than full-gradient Euler discretization, while dataset-size dependence dominates in big-data settings.The introduction asks whether stochastic-gradient methods’ performance reflects averaging different models rather than faithful posterior simulation.Source: §1 · p. 3
  • The paper proceeds from SGLD notation and main results to strongly log-concave analyses, another subsampling scheme, experiments, and conclusions.The experiments cover a Gaussian toy model and logistic regression.Source: §1 · p. 3

2. Background and Main Results

The section analyzes SGLD as a stochastic-gradient discretization of Langevin dynamics and compares its cost with full-gradient Euler and control-variate variants. It finds that stability constrains the step size enough to erase naive minibatching’s cost advantage, while control variates can reduce cost, especially at high accuracy.

2. Background and Main Results

  • SGLD replaces the full-data likelihood-gradient sum with a randomly sampled minibatch, while the analysis estimates posterior expectations using independent simulated paths.Computational cost is defined as the expected number of operations; the estimator is not the classic MCMC ergodic average.Source: §2 · p. 4, §2.1 · pp. 6–7

2.1 Main Results

  • The control-variate scheme uses the posterior mode, so its analysis depends heavily on knowing that mode, although computable control variates may help at high accuracy.The paper identifies finding the mode as an excluded cost in its log N complexity result.Source: §2 · p. 4, §2.1 · p. 7

2. Background and Main Results

  • For posterior-mean estimation, bias vanishes as the number of steps grows under stable Euler updates, but estimator variance depends on minibatch size.The stated stability condition is Nh < 1; the variance contribution motivates careful cost analysis and may be mitigated by control variates.Source: §2 · pp. 5–6

2.1 Main Results

  • The cost conclusions concern estimators from many independent simulations, not the classic MCMC estimator based on ergodic averages.The authors defer study of traditional ergodic-average estimators to future work.Source: §2.1 · pp. 6–7
  • As N grows, the stability condition determines the step-size scale; Richardson–Romberg extrapolation can make the accuracy constraint negligible at that scale.The stability condition is tied to the explicit Euler scheme.Source: §2.1 · p. 7
  • The overall cost is proportional to N log N, while SGLD with control variates achieves log(N) cost when the cost of finding the mode is disregarded.The analysis indicates that computable control variates can lead to substantial gains in very high-accuracy-demand regimes.Source: §2.1 · p. 7
  • At ϵ ≍ N^-1/2, naive SGLD provides no computational-cost gain over full-gradient Euler because the required minibatch size offsets subsampling.The analysis relates the minimum minibatch size to the step size and target accuracy.Source: §2.1 · p. 7

2.2 Assumptions

  • The analysis assumes a one-sided Lipschitz condition associated with strongly concave potentials, alongside a uniform gradient bound.Source: §2.2 · p. 8

3. Euler method for strongly log-concave case with full gradients

This section analyzes Euler discretization with full gradients for strongly log-concave models, controlling bias and variance to derive computational-cost bounds. It also considers estimating posterior standard deviation, although that target involves a non-Lipschitz functional.

3. Euler method for strongly log-concave case with full gradients

  • The Euler scheme's mean squared error is decomposed into finite-time bias and discretization error contributions.The first term compares expectations under the invariant measure and the finite-time process.Source: §3 · p. 9

3.1 Controlling the bias

  • Under Assumptions S1 and S2, the diffusion's Lipschitz-function bias decays exponentially in time at rate m.The bound is stated for functions with Lipschitz constant at most 1.Source: §3.1 · p. 10

Proof

  • When the mode is at the origin, the continuous-time process's second moment is bounded proportionally to 1/N for sufficiently large t.The mode is often unknown in practice, and locating it may require expensive optimization.Source: Proof · pp. 10–11

3.2 Controlling the variance of Euler discretisation

  • The Euler variance result applies to Lipschitz functionals when h ≤ m/M2, with its bound's constant depending only on process dimensionality.The supplied theorem passage states the step-size condition and the dimensionality dependence.Source: §3.2 · p. 14

3.3 Cost bounds

  • For target accuracy ϵ^-1 ≍ N, the stated machine-learning regime has cost around N log ϵ^-1.The passage motivates this accuracy scale through Equation (14).Source: §3.3 · p. 15

3.4 Estimating the posterior standard deviation.

  • Standard-deviation estimation is also considered, but its expectation involves a non-Lipschitz functional that violates the stated assumptions.The authors describe estimating its error through additional calculations.Source: §3.4 · p. 15

4. Euler method for strongly log-concave case with subsampling

This section compares naive and control-variate subsampling for Euler-based SGLD, deriving error and cost bounds under the stated assumptions. It also gives batch-size guidance and notes that the control-variate cost analysis assumes the mode is known exactly.

4. Euler method for strongly log-concave case with subsampling

  • Lemma 11 gives a batch-size guideline for keeping E Eτ |Xk − x∗|2 proportional to 1.The supplied passage does not include the remainder of the proportionality expression.Source: §4 · p. 19
  • For the two schemes, the error bounds gain additive terms n·h^2 for naive subsampling and (N−n)/n·h^2 for control-variate subsampling.These are the additional terms stated for schemes (30) and (31), respectively.Source: §4 · p. 19
  • Under M ≍ m ≍ m0 ≍ N, naive subsampling should use n ≍ N, or at least n ≥ N^2 · h, to keep squared bias of order 1.Source: §4 · p. 20
  • For a Lipschitz functional with coefficient L, Theorem 14 states a result for process θk given by (31) when h ≤ m 4M2 and θ0 = x∗, with c depending only on process dimensionality.Source: §4 · p. 20
  • The control-variate subsampling cost analysis relies on knowing the mode exactly; at ϵ ∼ 1/√N, its cost is log N, disregarding mode-finding.The passage says Newton's algorithm makes finding the mode cost proportional to N with a small constant.Source: §4 · p. 21

5. Numerical experiments

Across the Gaussian and logistic-regression experiments, choices of batchsize and stepsize with the same computational cost yield similar accuracy at fixed dataset size. The experiments also show that small batches can inflate variance or bias, and Richardson–Romberg extrapolation does not remove the stochastic-gradient bias.

5.1 Gaussian case

  • When N^2h/n ≍ 1 does not hold while estimating a nonlinear functional, both bias and variance grow drastically; in the Gaussian toy model, variance blows up as batch size decreases.The Gaussian toy-model simulations used N = 10000, h = 10−5, and T = 5 log ϵ−1/N; its single-sample bias vanishes because of the model’s specific properties.Source: §5.1 · pp. 21–22
  • For each dataset size, RMSE stays roughly constant across batchsize–stepsize choices at constant computational cost, with all Gaussian estimates below the accuracy demand.The comparison uses estimators of |sin x − µ| across dataset sizes.Source: §5.1 · p. 22, Figure 3 · p. 23

5.1.1 Relative bias of the standard deviation/variance estimator

  • For the standard-deviation/variance estimator, stochastic gradients consistently overestimate posterior variance, and subsampling yields no gain along constant-cost lines.The reported relative bias is for long simulation times.Source: §5.1.1 · p. 23, Figure 4 · p. 24

5.1.2 Richardson-Romberg extrapolation for SGLD

  • Richardson–Romberg cancels the linear discretisation-bias term but not stochastic-gradient bias; in this experiment, subsampling performs worse than full gradients.Under appropriate assumptions, the paper says the stability-based stepsize observation generalises to log-concave targets as N grows.Source: §5.1.2 · pp. 23, 25, Figure 5 · p. 25

5.2 Logistic regression

  • In logistic regression, matched-cost batchsize and stepsize choices yield the same RMSE at fixed dataset size for parameter means and standard deviations.The model is strictly but not strongly log-concave, so it is outside the stated theoretical results.Source: §5.2 · pp. 25–26, Figure 6 · p. 26

6. Conclusion

The conclusion is that subsampling does not improve the scaling of SGLD's computational cost with dataset size for a given accuracy relative to posterior width. It also points to parallelization and stepsize choices as practical considerations.

6. Conclusion

  • Subsampling does not improve SGLD's computational-cost scaling with dataset size at a given accuracy relative to posterior width.The paper also reports similar behavior for stochastic gradient Hamiltonian Monte Carlo and extends its analysis to strongly log-concave targets.Source: §6 · pp. 26–27
  • Although small batches require many sequential updates, larger batches or full gradients offer greater scope for parallelization per update; hardware affects wall-clock-optimal batchsize.The overall computation needed for the same accuracy remains roughly constant.Source: §6 · p. 27
  • With constant batchsize, the analysis requires stepsizes at most O(N^-2); the authors say stepsizes typical in machine-learning applications seem large by this criterion.They suggest such methods may average over stochastic-gradient-descent behavior rather than faithfully sample from the posterior.Source: §6 · p. 27

7. Outlook

For standard subsampling, batchsize and stepsize can be chosen freely at fixed batchsize, while the best practical choice depends on parallelization and hardware. With constant batchsize, reaching a given accuracy requires h = O(N^-2).

7. Outlook

  • At fixed batchsize, batchsize–stepsize choices leave overall computation roughly constant, but larger batches may better exploit parallelization depending on the model and hardware.The authors conjecture that large batches will be preferable in many scenarios.Source: §7 · p. 27
  • With constant batchsize, SGLD requires h = O(N^-2) to reach a given accuracy.Similar behavior was observed for stochastic gradient Hamiltonian Monte Carlo.Source: §7 · p. 27
Loading 1706.02692v1…