Asymptotic analyses of stochastic gradient descent Francis Bach published a blog post surveying asymptotic analyses of constant-step-size stochastic gradient descent, extending beyond the simplest quadratic case with additive gradient noise. For quadratics with step size γ below 2/L, the post shows the iterate covariance converges to γC with C = ½H^(-1/2)ΣH^(-1/2), and a central limit theorem gives a stationary Gaussian distribution with mean x* and covariance γC. The post reviews approaches that go beyond additive noise and those studying only the stationary distribution before describing the full trajectory in the general non-quadratic case. There are a huge number of available analyses for stochastic gradient descent SGD , which can account for its behavior in many different scenarios, from convex to non-convex objectives, with or without acceleration, within Euclidean geometry or beyond, with or without pre-conditioning, and with an infinite variation regarding the decay of step sizes. Recently, while these were a bit looked down upon for quite a while, a lot of focus has come back to asymptotic scaling laws see earlier blog posts I https://francisbach.com/scaling-laws-of-optimization/ , II https://francisbach.com/z-transform/ , III https://francisbach.com/scaling-laws-text/ , and references therein . Most of them rely on quadratic objective functions, from extremely too? simple additive noise on gradients as done just below in full detail to less simple least-mean-squares with potentially multiplicative noise, see 24 , with few results beyond in recent work, we were able to obtain scaling laws for the cross-entropy loss in a restricted setting inspired by text data 13 . This post aims to describe existing asymptotic analyses for SGD. Insights from quadratics. In the simplest situation, one wants to minimize the quadratic function $F: \mathbb{R}^d \to \mathbb{R}$, with access to gradients with additive noise whose distribution is independent of the point where the gradient is taken, that is, at iterate $x {k-1}$, we access $F' x {k-1} + \varepsilon k$, where $ \varepsilon k {k \geqslant 1}$ is a sequence of independent zero-mean random vectors in $\mathbb{R}^d$ with covariance matrix $\Sigma$ which we assume to commute with the Hessian matrix $H$ of $F$ for later simplifications . If $x \ast \in \mathbb{R}^d$ is a minimizer of $F$, the iteration with constant step size $\gamma$ the main focus of this blog post $$ x k = x {k-1} – \gamma \big F' x {k-1} + \varepsilon k\big = x {k-1} – \gamma \big H x {k-1}-x \ast + \varepsilon k\big $$ can be unrolled into $$x k -x \ast = I -\gamma H ^k x 0 – x \ast \, – \sum {i=1}^k I- \gamma H ^{k-i} \gamma \varepsilon i. $$ This implies that $\mathbb{E} x k -x \ast = I -\gamma H ^k x 0 – x \ast $ which is the deviation of the gradient descent iterate from $x \ast$ , and, with a slight abuse of notation regarding matrix fractions, we have $${\rm cov} x k = \gamma^2 \Sigma \sum {j=0}^{k-1} I- \gamma H ^{2j} = \frac{\gamma }{2} \frac{I – I – \gamma H ^{2k}}{I – \frac{\gamma H}{2} } H^{-1/2} \Sigma H^{-1/2}.$$ This implies that if $H$ is invertible and $\gamma < 2/L$ so that $\| I – \gamma H \| {\rm op} <1$, where $L = \lambda {\max} H $ , we have a strict separation of two effects, with two distinct phases that are observed in practice: 1. Forgetting of initial conditions like in gradient descent with the expectation being exactly GD , converging to $x \ast$. 2. Residual noise with a known covariance matrix that can be computed in closed form, and that is asymptotically equivalent to $\gamma C$ for $C= \frac{1}{2} H^{-1/2} \Sigma H^{-1/2}$ when $C$ and $H$ commute , when $\gamma$ tends to zero note that there is a general formula for any $\gamma \in 0,2/L $ . Moreover, still when $\gamma$ tends to zero, a central limit theorem https://en.wikipedia.org/wiki/Central limit theorem shows that the stationary distribution is Gaussian with mean $x \ast$ and covariance matrix $\gamma C$ see 8 and 1, Part II, Section 4.6 . See illustration below. The main question I am addressing in this blog post is: What can be asymptotically and quantitatively said for constant-step-size stochastic gradient descent beyond the simplest quadratic case above? There are already several approaches, from going beyond additive noise to studying only the stationary distribution, which we review first, before moving to a full description of the whole trajectory in the general non-quadratic case. Beyond additive noise. As presented in an earlier post https://francisbach.com/z-transform/ , for least-squares regression with linearly parameterized predictors the so-called least-mean-squares https://en.wikipedia.org/wiki/Least mean squares filter setup, which does not correspond to purely additive noise as above 24 , we can also use linear algebra to obtain rates and maximal step sizes, but this time with a recursion on the second-order deviation, $\mathbb{E} x k \, -\, x \ast x k-x \ast ^\top $. In the general case, this requires knowledge of the fourth-order moment of input features, and several simplifying assumptions can be considered to obtain simpler statements. I like the one found out by Alexandre Défossez in our paper 18 , when input features are normalized: for convergence, we need $\gamma < 2 / {\rm tr} H $ instead of $\gamma < 2 / \lambda {\max} H $ thus SGD requires smaller step sizes . Overall, we obtain the same separation between forgetting of initial conditions and residual noise. But this is still for quadratic objectives. In this post, we will move beyond least squares, but remain mostly in the “simple” convex world where gradient descent usually converges to the global optimum of the objective function $F$. We make it even simpler by assuming strong convexity e.g., regularized logistic regression or least-squares with invertible input feature covariance matrix . In this situation, we can still get interesting asymptotic statements. Stationary distribution. In this setup, for a sufficiently small constant step size, provable convergence to a typically non-Gaussian stationary distribution can be obtained this is true with much weaker assumptions but this is not the topic here , with some mean $\mu \gamma$ and covariance matrix $C \gamma$ that can be analyzed when $\gamma$ tends to zero 23 . More precisely, the mean has an asymptotic expansion $\mu \gamma = x \ast + \gamma \Delta + o \gamma $, which makes it a good candidate for Richardson extrapolation https://francisbach.com/richardson-extrapolation/ , and the covariance matrix has the same expansion as for the simple least-squares setup above, where $\Sigma$ is the covariance of the gradients at the optimum $x \ast$. These analyses, however, focus only on the limit behavior with a precise description , but do not tackle the initial transient phase. Note that such analyses can be extended beyond the convex case see the nice study in 25 . Joint asymptotics in step size and horizon. We get asymptotic separation in two terms for a fixed horizon $K$ that is, we know in advance how many iterations we want to perform and when $\gamma K$ tends to a constant, which is the main topic of this post. I will try to look at the simplest analysis, which is interestingly historically among the first ones, and see it as the approximation by an ordinary differential equation ODE , the gradient flow, with stochastic fluctuations characterized by a linear stochastic differential equation SDE . The goals of the post are thus 1 to describe these approximations in the simplest situation strongly-convex , 2 mention classical extensions, in particular in the non-convex case, and 3 show how this can be used to analyse simple modifications here, only averaging . Why does it matter? This is a simple model to understand modifications of SGD, such as acceleration, mirror descent, steepest descent, averaging, or to study the impact of forgetting initial conditions vs. noise. Future posts will probably touch upon these. The key here is that these analyses can be carried out with limits and not with bounds. Why is it not ideal? These results correspond to small step sizes while in practice we aim for large ones and even very large ones in recent work on “edge of stability” 26 , and some behaviors cannot be explained e.g., minibatching, as shown below . Two possible extensions are meant to go beyond: higher-order “modified” equations 4 , or continuized acceleration 14 as presented in an earlier post https://francisbach.com/continuized-acceleration/ . We can now go into more details. Setup We consider the SGD recursion, started from some $x 0 \in \mathbb{R}^d$, $$x k = x {k-1} – \gamma f' x {k-1},c k ,$$ where $f: \mathbb{R}^d \times \mathcal{C} \to \mathbb{R}$ is a fixed deterministic function and $ c k {k \geqslant 1}$ is a sequence of i.i.d. random variables. Here, we only consider gradients with respect to $x$. For each $c \in \mathcal{C}$, the function $f \cdot,c $ is a convex $L$-smooth function from $\mathbb{R}^d$ to $\mathbb{R}$. We consider $F x = \mathbb{E} f x,c $ which has to be convex and $L$-smooth, but which we assume to be strongly-convex for simplicity . We assume that the step size $\gamma 0$ is constant across iterations, with a potential dependence on the horizon that is, we stop the algorithm after $K$ iterations, and we allow $\gamma$ to depend on $K$ . Notation conflict. In this blog post I have chosen the optimization convention where $x$ is used for iterates, and another letter $c$ for data. In much of my work and in my book 31 , I chose $\theta$ for iterates and $x,y,z$ for data, which is more classical in machine learning and statistics. I mostly did it here because uppercase letters are not that practical to use for Greek letters, but I stood my ground and will never use $n$ for the dimension of iterates as this is reserved for the number of observations. I try to have principles Deterministic case We first consider the deterministic case where all functions $f \cdot,c $ are equal to $F$, that is, the gradient descent GD recursion $$x k = x {k-1} – \gamma F x {k-1} .$$ We consider the gradient flow GF $$dX t = \, – F' X t dt,$$ with a natural matching of time $t k = \gamma k$ for the $k$-th iteration. Note that time has a dimension homogeneous to a step size, and thus to an inverse Hessian , while the iteration number does not. We thus see that gradient descent is exactly the Euler discretization https://en.wikipedia.org/wiki/Euler method of the gradient flow, but our goal is not to approximate GF by GD, but to study GD through GF , keeping in mind that at the end, the goal is to find the global minimizer. Convergence for convex functions. For convex $L$-smooth functions, we can show see elementary proof at the end of the post $$\sup {k \in \{0,\dots,K\}} | x k \, – X {\gamma k} | \leqslant \frac{K \gamma L ^2}{2} \frac{ \| F' x 0 \|}{L}.$$ Thus, if $ \gamma L ^2 K$ tends to zero on top of $\gamma L$ tending to zero and $K$ tending to $+\infty$ , the gradient flow is a good match to gradient descent between iterations $0$ and $K$. In particular, when $\gamma L K$ tends to a constant, we get convergence in $1/K$. Note that strong convexity is not needed here we only care about approximation of GD by the gradient flow, not about convergence to the global optimum . Convergence for potentially non-convex functions. When we only assume smoothness and not convexity, we get an extra exponential term, that is, we can show $$\sup {k \in \{0,\dots,K\}} | x k\, – X {\gamma k} | \leqslant e^{ \gamma L K } \frac{K \gamma L ^2}{2} \frac{ \| F' x 0 \|}{L}.$$ Note here that for a good approximation, we need the stronger condition that $\gamma L K$ remains bounded, and an exponential term appears. A proof is given at the end of the post. This is a standard estimate for the explicit Euler method see 20, Section II.3 : without some form of contraction argument, errors may accumulate exponentially. Stochastic case In the stochastic case, we need to characterize the noise. A nice feature but also a “bug” since it prevents further analysis that depends on higher-order moments is that only second-order moments are needed. Define $$ \Sigma x = \mathbb{E} \big f' x,c -F' x f' x,c -F' x ^\top\big \in \mathbb{R}^{d \times d}$$ the local covariance of the gradient noise remember that $\mathbb{E} f' x,c = F' x $ . Our goal is to extend the deterministic analysis and be able to analyze two effects: 1. Forgetting of initial conditions like in gradient descent. 2. Oscillations around the global optimum that should disappear when all $\Sigma x $ are zero . An old surprising result is that because the gradient noise is multiplied by the step size $\gamma$, at first order, the limit of SGD for vanishing step size, that is, when $\gamma L $ tends to zero, and $K$ tends to infinity, is still gradient flow , and only at the next order in $\sqrt{\gamma}$, we can see fluctuations. For the general non-convex case, if $\gamma$ tends to zero and $K$ tends to infinity while $\gamma K$ converges to a constant, then $$x k \approx X {k\gamma} + \sqrt{\gamma} U {k\gamma}$$ with $X \in \mathbb{R}^d$ the deterministic gradient flow, and $U\in \mathbb{R}^d$ satisfying the “tangent” non-homogeneous linear SDE started at $U 0=0$ , that depends on noise covariance matrices and Hessians along the gradient flow: $$ dU t = -F^{\prime \prime} X t U t dt + \Sigma X t ^{1/2} dB t.$$ More precisely, when $\gamma \to 0$, we have when $K \to +\infty$ such that $\gamma K$ converges to a constant: $$ \frac{x k- X {k\gamma} }{\sqrt{\gamma}} \to U {\gamma k}$$ in distribution uniformly for $k \in \{0,\dots,K\}$. See 1 for the classical account from a more general stochastic approximation point of view. In terms of bounds, it is possible to show a convergence rate for the proper metric, in $ \gamma L ^2 K$ for the convex case, and with an extra exponential dependence in $e^{ \gamma L K}$ for the generic case. See after the references for a proof sketch. Note that these approximation results require neither strong convexity nor uniqueness of minimizers of $F$ no claim about convergence to a minimizer is yet made . Limiting distribution. Assuming that the gradient flow converges to a unique minimizer $x \ast$ with positive-definite Hessian e.g., when $F$ is strongly-convex , the distribution of $U t$ converges to a Gaussian distribution with mean zero and covariance matrix $C \ast$ defined as $F^{\prime \prime} x \ast C \ast + C \ast F^{\prime \prime} x \ast = \Sigma x \ast $ the stationary covariance for the solution $U$ of the linear SDE . This is simply obtained as the stationary distribution of the homogeneous SDE $dV t = -F^{\prime \prime} x \ast V t dt + \Sigma x \ast ^{1/2} dB t.$ This is a classical continuous-time Lyapunov equation https://en.wikipedia.org/wiki/Lyapunov equation which itself is a special case of the Sylvester equation https://en.wikipedia.org/wiki/Sylvester equation . Note that in the “interpolating regime” where $\Sigma x \ast = 0$, the limiting distribution of SGD is then a Dirac at $x \ast$ see 30 for more results . Single SDE. The same two leading-order effects can also be represented by a single small-noise SDE, as developed in 10, 4, 17, 19 : $$dY t =\, \, – F' Y t dt + \sqrt{\gamma} \Sigma Y t ^{1/2} dB t,$$ but with the same approximation properties as the tangent SDE that is, the difference is $o \sqrt{\gamma} $ and can be shown to be of order $O \gamma $ . Therefore, it is not a better approximation; better ones exist with error $O \gamma^2 $ 10, 4 , but they “miss the point” in understanding SGD’s converging behavior, because SGD is already off by $O \gamma $. Historical note. These approximations are classical in stochastic approximation. The ODE method describes the average trajectory, while a linear SDE describes the fluctuations around it; see Benveniste, Métivier, and Priouret 1 . For constant step sizes near a stable optimum, related stationary Gaussian approximations go back at least to Kushner and Huang 8 . Finnoff 9 used a similar transient decomposition for constant-learning-rate backpropagation. The nonlinear SDE above corresponds to the stochastic-modified-equation formulation developed in the modern SGD literature by Li, Tai, and E 10, 4 ; Mandt, Hoffman, and Blei 17 used a local Ornstein–Uhlenbeck model to study stationarity. Taking into account the two effects. The analysis as “gradient flow + fluctuations” already puts forward two main often contradicting effects that were already mentioned: 1 forgetting of initial conditions which needs to be as fast as possible and 2 non-vanishing fluctuations which need to be diminished in some way . These two effects need to be taken care of simultaneously. Over the years and across communities, one of these two effects has taken over. In a caricatural way, the optimization community focuses a lot on forgetting initial conditions, with the largest possible step size and several notions of acceleration at the expense of final fluctuations . The statistics community focuses on the final fluctuations, which are asymptotically what matters at the end of estimation, proposing diminishing step sizes or averaging at the expense of forgetting initial conditions . These two effects matter and most of the modern literature take them into account. Averaging In order to dampen the oscillations around the optimum, various forms of averaging have been introduced 21, 32, 33 . Classical averaging is $$ \bar{x} k = \frac{1}{k+1} \sum {i=0}^k x i, $$ which can be updated online as $\bar{x} 0 =x 0$, and $$ \bar{x} k = \Big 1 \, – \frac{1}{k+1} \Big \bar{x} {k-1} + \frac{1}{k+1} x k.$$ We can then view $\bar{x} k$ as the approximation of $\bar{X} {k\gamma}$ for $ \bar{X} {t \geqslant 0}$ a continuous-time process satisfying the ODE $$ d \bar{X} t = \frac{1}{t} X t – \bar{X} t dt.$$ More generally, we can consider any averaging of the form $$ \bar{x} k = 1 -\alpha k \bar{x} {k-1} + \alpha k x k,$$ with $\alpha k \in 0,1 $. With the identification $\alpha k \sim \rho {k\gamma} \gamma$ for a function $\rho t = \kappa’ t / \kappa t$ with $\kappa’ t 0$, we get the ODE $$ d \bar{X} t = \rho t X t\, – \bar{X} t dt.$$ This leads to a low-pass filter with $$\bar{X} t = \frac{\kappa 0}{\kappa t} x 0 + \frac{1}{\kappa t} \int 0^t \kappa’ u X u du.$$ The deterministic limiting system is $$ \left\{ \begin{array} {rcl}dX t & = & -F' X t \,dt \\ d\bar X t & = & \rho t X t-\bar X t \,dt. \end{array} \right. $$ At the fluctuation scale, the tangent system is $$ \left\{ \begin{array} {rcl} dU t & = & -F^{\prime \prime} X t U t\,dt + \Sigma X t ^{1/2}dB t \\ d\bar U t & = & \rho t U t-\bar U t \,dt. \end{array} \right. $$ A single nonlinear system containing the same two leading orders is $$\left\{ \begin{array} {rcl} dY t & = & -F' Y t \,dt + \sqrt{\gamma}\, \Sigma Y t ^{1/2}dB t, \\ d\bar Y t & = & \rho t Y t-\bar Y t \,dt, \end{array} \right. $$ still with averaging done “on the side”. Non-uniform averaging. For $\alpha k = \frac{\beta}{k+\beta}$ with $\beta 0$ , we get $\rho t = \beta / t$, with $\kappa u = u^\beta$, that is, more weight is put on later iterates. Then the covariance matrix of $\bar{U} t$ satisfies, for $\beta 1/2$ 27 : $$ {\rm cov} \bar{U} t = \frac{1}{t} \frac{\beta^2}{2\beta – 1} F^{\prime\prime} x \ast ^{-1} \Sigma x \ast F^{\prime\prime} x \ast ^{-1} + o t^{-1} .$$ The covariance of the fluctuations then vanishes at rate $O 1/t $. This notably shows that $\beta=1$ uniform averaging leads to the smallest asymptotic covariance, corresponding to the usual sandwich covariance matrix, which coincides with the Cramér-Rao lower bound https://en.wikipedia.org/wiki/Cram%C3%A9r%E2%80%93Rao bound for correctly specified likelihood models 2 . Another interesting benefit is that increasing $\beta$ beyond 1 only increases the variance term by a constant factor, while the forgetting of initial conditions is typically improved significantly. Constant averaging . We consider $\bar{x} k = 1 -\alpha \bar{x} {k-1} + \alpha x k$ with $\alpha \in 0,1 $. In order to obtain limiting ODEs/SDEs, we need to scale $\alpha$ with the step size $\gamma$ as $$\alpha = \rho \gamma,$$ for $\rho 0$ thus $\alpha$ tends to zero with the horizon . Constant averaging then becomes a continuous-time exponential low-pass filter with memory $1/\rho$: $$ \bar X t = e^{-\rho t}\bar x 0 + \rho \int 0^t e^{-\rho t-s }X s\,ds. $$ Moreover, the stationary covariance matrix can be shown to tend to $$ \frac{\rho}{2} \big F^{\prime\prime} x \ast + \rho I ^{-1} C \ast + C \ast F^{\prime\prime} x \ast + \rho I ^{-1} \big .$$ When $\rho$ tends to zero, it tends to zero, that is, fluctuations vanish. Effects of averaging. We thus see two effects: - Slowing down of gradient flow: in the case of convergence, if $X t – x \ast \sim \frac{1}{t^\alpha} \Delta$, then $\bar{X} t$ has the same expansion for exponential moving averaging, but is significantly slowed down for $\rho t = \beta /t$, that is, one can check that $$ \displaystyle \bar{X} t-x \ast=\begin{cases} \frac{\beta}{\beta-\alpha}t^{-\alpha}\Delta+o t^{-\alpha} & \text{if } \beta \alpha,\\ \beta t^{-\alpha}\log t \Delta+o t^{-\alpha}\log t & \text{if } \beta=\alpha,\\ t^{-\beta}\bar{\Delta} \beta+o t^{-\beta} & \text{if } \beta<\alpha. \end{cases}$$ with, for $\beta<\alpha$, $\displaystyle \bar{\Delta} \beta=\beta \int 0^\infty s^{\beta-1} X s-x \ast ds$ a constant. Thus, after averaging, convergence is always slower, in the constant or worse in the exponent. - Dampening of oscillations: as shown earlier, the limiting covariance matrix can be made significantly smaller. Mini-batching In the minibatch set-up, we consider at time $k$, $b$ independent samples $c {k,1},\dots,c {k,b}$ and the sum of the $b$ gradients $$ x k = x {k-1} – \gamma \sum {i=1}^b f' x {k-1},c {k,i} .$$ For a fixed $b$, we obtain the exact same gradient flow limit with $x k \sim X {bk \gamma}$, thus, with $b$ gradients, the SGD recursion advances $b$ times faster, which provides no gain in terms of gradient evaluations we traverse the gradient flow with the same speed per accessed gradient . Moreover, in terms of fluctuations, the variance happens to be exactly the same as before. From the asymptotic limit, it would seem that minibatching leads to the same per iteration complexity, and thus significant gains once taking into account that accessing blocks of data is in practice much faster. However, this hides the fact that for non-vanishing step sizes, the situation differs. For example, for least-mean-squares with normalized features, the largest step size for $b=1$ is $\gamma = 2/{\rm tr} H $, while for $b 1$, a typical maximal step size see 29 is $$ \frac{2}{ b-1 \lambda {\max} H + {\rm tr} H }.$$ Thus, when $b$ gets large the step size is significantly smaller for minibatching, and the traversal of the gradient flow is thus slower, but this cannot be seen from the asymptotic limit. Going beyond A common misconception is that SGD with vanishing step size converges to an SDE. It in fact converges to the gradient flow ODE, and the SDE is only a first-order expansion in $\sqrt{\gamma}$ around this gradient flow. The classical asymptotic result presented in this blog post clearly establishes, beyond the usual quadratic case, that SGD has two properties: 1 it forgets initial conditions and 2 oscillates around the optimum. These two effects are characterized by letting the step size $\gamma$ go to zero with the horizon $K$, with $\gamma K$ tending to a constant, thus approximating ODEs and SDEs over a finite interval. Further insights can be obtained using such asymptotic analyses and limiting ODEs and SDEs: - Acceleration 4, 5, 11 : second-order SDEs can then be obtained, using a different time discretization with discrete step $\sqrt{\gamma}$. The bias-variance trade-offs can also be analyzed, in particular the potential noise explosion due to acceleration. A link with first-order gradient flow can also be established through multistep integration schemes 16 . - Mirror descent 3, 6, 7 : the mirror descent https://en.wikipedia.org/wiki/Mirror descent recursion also leads to a similar analysis that can highlight the link between the mirror geometry and initialization 12 . - Continuized analysis 14 : instead of relying on vanishing step sizes, if gradient steps are taken at independent Poisson times, then we obtain a continuous-time Markov jump process that can be analyzed. - Performance estimation 15 : for aficionados of performance estimation https://francisbach.com/computer-aided-analyses/ , the framework can be extended to continuous time as well. References 1 Albert Benveniste, Michel Métivier and Pierre Priouret, Adaptive Algorithms and Stochastic Approximations https://link.springer.com/book/10.1007/978-3-642-75894-2 , Stochastic Modelling and Applied Probability, vol. 22, Springer, 1990. 2 Aad W. van der Vaart. Asymptotic Statistics https://doi.org/10.1017/CBO9780511802256.006?utm source=chatgpt.com . Cambridge University Press, 1998. 3 Panayotis Mertikopoulos and Mathias Staudigl. Stochastic mirror descent dynamics and their convergence in monotone variational inequalities https://arxiv.org/abs/1710.01551 . Journal of Optimization Theory and Applications 179.3 2018 : 838-867. 4 Qianxiao Li, Cheng Tai, and Weinan E. Stochastic Modified Equations and Dynamics of Stochastic Gradient Algorithms I: Mathematical Foundations https://jmlr.csail.mit.edu/papers/volume20/17-526/17-526.pdf . Journal of Machine Learning Research , 20 40 :1–47, 2019. 5 Pan Xu, Tianhao Wang, and Quanquan Gu. Continuous and Discrete-time Accelerated Stochastic Mirror Descent for Strongly Convex Functions https://proceedings.mlr.press/v80/xu18g/xu18g.pdf . International Conference on Machine Learning , 2018. 6 Pan Xu, Tianhao Wang, and Quanquan Gu. Accelerated Stochastic Mirror Descent: From Continuous-time Dynamics to Discrete-time Algorithms https://proceedings.mlr.press/v84/xu18e/xu18e.pdf . International Conference on Artificial Intelligence and Statistics , 2018. 7 Walid Krichene and Peter L. Bartlett. Acceleration and Averaging in Stochastic Descent Dynamics https://proceedings.neurips.cc/paper files/paper/2017/file/643de7cf7ba769c7466ccbc4adfd7fac-Paper.pdf . Advances in Neural Information Processing Systems , 2017. 8 Harold J. Kushner and Hai Huang. Asymptotic Properties of Stochastic Approximations with Constant Coefficients https://epubs.siam.org/doi/10.1137/0319007 . SIAM Journal on Control and Optimization , 19 1 :87–105, 1981. 9 William Finnoff. Diffusion Approximations for the Constant Learning Rate Backpropagation Algorithm and Resistence to Local Minima https://proceedings.neurips.cc/paper files/paper/1992/file/884d247c6f65a96a7da4d1105d584ddd-Paper.pdf . Advances in Neural Information Processing Systems , 1992. 10 Qianxiao Li, Cheng Tai, and Weinan E. Stochastic Modified Equations and Adaptive Stochastic Gradient Algorithms https://proceedings.mlr.press/v70/li17f/li17f.pdf . International Conference on Machine Learning , 2017. 11 Weijie Su, Stephen Boyd, and Emmanuel J. Candès. A Differential Equation for Modeling Nesterov’s Accelerated Gradient Method: Theory and Insights https://jmlr.org/papers/volume17/15-084/15-084.pdf . Journal of Machine Learning Research , 17 153 :1–43, 2016. 12 Belinda Tzen, Anant Raj, Maxim Raginsky, and Francis Bach. Variational Principles for Mirror Descent and Mirror Langevin Dynamics https://arxiv.org/pdf/2303.09532 . IEEE Control Systems Letters , 7:1542–1547, 2023. 13 Adélie Benhaim, Francis Bach, Frederik Kunstner. The Cross-Entropy Gap: Scaling Laws for Sign and Gradient Descent https://arxiv.org/pdf/2612.02334 . arXiv:2612.02334, 2026. 14 Mathieu Even, Raphaël Berthier, Francis Bach, Nicolas Flammarion, Pierre Gaillard, Hadrien Hendrikx, Laurent Massoulié, and Adrien Taylor. A Continuized View on Nesterov Acceleration for Stochastic Gradient Descent and Randomized Gossip https://proceedings.neurips.cc/paper/2021/file/ec26fc2eb2b75aece19c70392dc744c2-Paper.pdf . Advances in Neural Information Processing Systems , 2021. 15 Céline Moucer, Adrien Taylor, and Francis Bach. A Systematic Approach to Lyapunov Analyses of Continuous-Time Models in Convex Optimization https://arxiv.org/pdf/2205.12772 . SIAM Journal on Optimization , 33 3 :1558–1586, 2023. 16 Damien Scieur, Vincent Roulet, Francis Bach, and Alexandre d’Aspremont. Integration Methods and Optimization Algorithms https://proceedings.neurips.cc/paper files/paper/2017/file/bf62768ca46b6c3b5bea9515d1a1fc45-Paper.pdf . Advances in Neural Information Processing Systems , 2017. 17 Stephan Mandt, Matthew Hoffman, and David Blei. A Variational Analysis of Stochastic Gradient Algorithms https://proceedings.mlr.press/v48/mandt16.pdf . International Conference on Machine Learning , 2016. 18 Alexandre Défossez and Francis Bach. Averaged Least-Mean-Squares: Bias-Variance Trade-offs and Optimal Sampling Distributions https://proceedings.mlr.press/v38/defossez15.pdf . International Conference on Artificial Intelligence and Statistics , 38:205–213, 2015. 19 Xavier Fontaine, Valentin De Bortoli, and Alain Durmus. Convergence rates and approximation results for SGD and its continuous-time counterpart https://proceedings.mlr.press/v134/fontaine21a.html?utm source=chatgpt.com . Conference on Learning Theory , 2021. 20 Ernst Hairer, Syvert P. Nørsett, and Gerhard Wanner. Solving Ordinary Differential Equations I: Nonstiff Problems https://link.springer.com/book/10.1007/978-3-540-78862-1 . Second edition, Springer Series in Computational Mathematics, vol. 8, Springer, 1993. 21 David Ruppert. Efficient Estimations from a Slowly Convergent Robbins-Monro Process https://scispace.com/pdf/efficient-estimations-from-a-slowly-convergent-robbins-monro-30i4orzao2.pdf . Technical Report 781, Cornell University, 1988. 22 Peter E. Kloeden and Eckhard Platen. Numerical Solution of Stochastic Differential Equations https://link.springer.com/book/10.1007/978-3-662-12616-5 . Stochastic Modelling and Applied Probability, vol. 23, Springer, 1992. 23 Aymeric Dieuleveut, Alain Durmus, and Francis Bach. Bridging the Gap between Constant Step Size Stochastic Gradient Descent and Markov Chains https://arxiv.org/pdf/1707.06386 . Annals of Statistics , 48 3 :1348-1382, 2020. 24 Aymeric Dieuleveut, Nicolas Flammarion, and Francis Bach. Harder, Better, Faster, Stronger Convergence Rates for Least-Squares Regression https://jmlr.org/papers/volume18/16-335/16-335.pdf . Journal of Machine Learning Research , 18 101 :1-51, 2017. 25 Waïss Azizian, Franck Iutzeler, Jérôme Malick, Panayotis Mertikopoulos. What is the long-run distribution of stochastic gradient descent? A large deviations analysis https://arxiv.org/pdf/2406.09241 . International Conference on Machine Learning , 2024. 26 Jeremy Cohen, Simran Kaur, Yuanzhi Li, J. Zico Kolter, Ameet Talwalkar. Gradient Descent on Neural Networks Typically Occurs at the Edge of Stability https://openreview.net/pdf?id=jh-rTtvkGeM . International Conference on Learning Representations , 2021. 27 Ziyang Wei, Wanrong Zhu, and Wei Biao Wu. General Weighted Averaging in Stochastic Gradient Descent: CLT and Adaptive Optimality https://raw.githubusercontent.com/mlresearch/v300/main/assets/wei26b/wei26b.pdf . International Conference on Artificial Intelligence and Statistics , 2026. 28 Harold J. Kushner and Hai Huang. On the Weak Convergence of a Sequence of General Stochastic Difference Equations to a Diffusion. https://epubs.siam.org/doi/10.1137/0140044 SIAM Journal on Applied Mathematics , 40 3 :528–541, 1981. 29 Prateek Jain, Sham M. Kakade, Rahul Kidambi, Praneeth Netrapalli, Aaron Sidford. Parallelizing Stochastic Gradient Descent for Least Squares Regression: Mini-batching, Averaging, and Model Misspecification https://jmlr.org/papers/volume18/16-595/16-595.pdf . Journal of Machine Learning Research , 18 223 ,1-42, 2018. 30 Sharan Vaswani, Francis Bach, and Mark Schmidt. Fast and Faster Convergence of SGD for Over-Parameterized Models and an Accelerated Perceptron https://proceedings.mlr.press/v89/vaswani19a.html?utm source=chatgpt.com . International Conference on Artificial Intelligence and Statistics , 2019. 31 Francis Bach. Learning theory from first principles https://www.di.ens.fr/~fbach/ltfp book.pdf . MIT Press, 2024. 32 Boris T. Polyak. A New Method of Stochastic Approximation Type https://www.mathnet.ru/links/81eb2e23ac402fb7fd74c8540ba4a612/at5521.pdf . Automation and Remote Control , 51 7 :937–946, 1990. 33 Boris T. Polyak and Anatoli B. Juditsky. Acceleration of Stochastic Approximation by Averaging https://epubs.siam.org/doi/10.1137/0330046 . SIAM Journal on Control and Optimization , 30 4 :838–855, 1992. Acknowledgements. AI tools were used for proofreading, generating the figures, and assisting with the proofs below. Proof for gradient flow approximations Convex functions. The argument below is a standard in the analysis of the explicit Euler method; see 20, Section II.3 for the general numerical-ODE framework. Let $T \gamma x =x-\gamma F' x $ be the gradient descent recursion operator. For a convex $L$-smooth function and $\gamma L\leqslant 2$, the map $T \gamma$ is non-expansive, that is, $\| T \gamma x -T \gamma y \| \leqslant \| x\, – y\|$ for all $x,y$. Define the local discretization error $$ r k = X {\gamma k}-T \gamma X {\gamma k-1 } = \int 0^\gamma \left F' X {\gamma k-1 } \, – F' X {\gamma k-1 +s} \right ds. $$ Along the gradient flow, $$ \frac{d}{dt}\Big \frac{1}{2}\|F' X t \|^2 \Big = -F' X t ^\top F^{\prime \prime} X t F' X t \leqslant 0, $$ so $t\mapsto \|F' X t \|$ is non-increasing. Therefore, using $L$-Lipschitz-continuity of the gradient $F’$, we get $$ \|r k\| \leqslant L\int 0^\gamma \|X {\gamma k-1 +s}-X {\gamma k-1 }\|\,ds \leqslant L\int 0^\gamma\int 0^s \|F' X {\gamma k-1 +u} \|\,du\,ds, $$ which leads to $$ \|r k\| \leqslant \frac{L\gamma^2}{2}\|F' x 0 \|. $$ Since $x k=T \gamma x {k-1} $, non-expansiveness gives $$ \|x k-X {\gamma k}\| \leqslant \| T \gamma x {k-1} \, – T \gamma X {\gamma k-1 } \| + \| T \gamma X {\gamma k-1 } \, – X {\gamma k}\|,$$ which leads to $$ \|x k-X {\gamma k}\| \leqslant \|x {k-1}-X {\gamma k-1 }\| + \|r k\|. $$ Summing these inequalities yields $$ \sup {k\in\{0,\ldots,K\}} \|x k-X {\gamma k}\| \leqslant \frac{K\gamma^2L}{2}\|F' x 0 \| = \frac{K \gamma L ^2}{2} \frac{\|F' x 0 \|}{L}. $$ Non-convex functions. Let $T \gamma x =x-\gamma F' x $ and define $e k=x k-X {\gamma k}.$ Since $F’$ is $L$-Lipschitz-continuous, without convexity, we can only use, for all $x,y$, $$ \|T \gamma x -T \gamma y \| \leqslant \|x-y\| + \gamma\|F' x -F' y \| \ \leqslant 1+\gamma L \|x-y\| \ \leqslant e^{\gamma L}\|x-y\|. $$ We first bound the norm of the gradient along the flow. Since $$ X t-x 0 = -\int 0^t F' X s \,ds, $$ we have $$ \|F' X t \| \leqslant \|F' x 0 \| + L\int 0^t\|F' X s \|\,ds. $$ Gronwall’s inequality https://en.wikipedia.org/wiki/Gr%C3%B6nwall%27s inequality therefore gives $\|F' X t \| \leqslant e^{Lt}\|F' x 0 \|.$ Define the local discretization error like in the convex case $$ r k =X {\gamma k}-T \gamma X {\gamma k-1 } =\int 0^\gamma \left F' X {\gamma k-1 } \, – F' X {\gamma k-1 +s} \right ds. $$ Using the $L$-Lipschitz continuity of $F’$ and the preceding bound, $$ \|r k\| \leqslant L\int 0^\gamma \|X {\gamma k-1 +s}-X {\gamma k-1 }\|\,ds \ \leqslant L\int 0^\gamma\int 0^s \|F' X {\gamma k-1 +u} \|\,du\,ds, $$ which leads to $$ |r k| \leqslant \frac{L\gamma^2}{2} e^{L\gamma k} \|F' x 0 \|. $$ Since $x k=T \gamma x {k-1} $, $$ \|e k\| \leq \|T \gamma x {k-1} \, – T \gamma X {\gamma k-1 } \| + \|r k\| \ \leqslant e^{\gamma L}\|e {k-1}\| + \frac{L\gamma^2}{2} e^{L\gamma k} \|F' x 0 \|. $$ An induction on $k$ gives \ \|e k\| \leqslant k e^{L\gamma k} \frac{L\gamma^2}{2} \|F' x 0 \|,\ which leads to the desired bound. Partial proof for gradient flow + tangent SDE approximation In order to show that $\frac{x k- X {k\gamma} }{\sqrt{\gamma}}$ converges to $U {\gamma k}$ in distribution, a number of extra assumptions need to be made, and a specific notion of convergence in distribution has to be used. Unfortunately, obtaining a bound in Wasserstein distance is difficult for the full Gaussian approximation the linear SDE $U$ is a Gaussian process , and authors typically show convergence of expectations of functions $\varphi$ for $\varphi$ from a large class of “regular enough” functions, but not as large as simply Lipschitz-continuous which would typically lead to a bound in Wasserstein distance . To obtain a formal result such as done in 28 , one typically needs regularity assumptions such as $F$ being three-times continuously differentiable, $f' x,c – F' x $ with uniformly bounded and smooth with respect to $x$ moments. The classical proof technique has two parts, and we only give a sketch here in the convex case. First part. The first part is close to the one above and provides an explicit coupling between $x k$ and $X {k\gamma} + \sqrt{\gamma} u k$ with $u k$ following a time-varying stochastic linear recursion, that is, $u 0 = 0$, and $$ u k = I – \gamma F^{\prime \prime} X { k-1 \gamma} u {k-1} – \sqrt{\gamma} \big f' X { k-1 \gamma},c k \, – F' X { k-1 \gamma} \big .$$ The key is to use the same noise as the SGD recursion of $x k$ that is, using the same $c k$ , around the corresponding gradient flow iterate. We thus need to show that $\| x k – X {k\gamma} – \sqrt{\gamma} u k\| $ is small enough. We first show a bound that shows that the gradient flow is close, that is $x k – X {k \gamma}$ is small. Reusing notations from the gradient flow proof above, we have: $$x k = T {\gamma} x {k-1} \, – \gamma \big f' x {k-1},c k \, – F' x {k-1} \big , $$ leading to the decomposition $$ \displaystyle x k-X {k\gamma}=T \gamma x {k-1} -T \gamma X { k-1 \gamma} -\gamma f' x {k-1},c k -F' x {k-1} - X {k\gamma}-T \gamma X { k-1 \gamma} .$$ From the gradient flow proof above, we have $$ \big\| X {k\gamma} – T {\gamma} X { k-1 \gamma} \big\| \leqslant \frac{L\gamma^2}{2}\|F' x 0 \|.$$ Moreover $T \gamma$ is non-expansive. Therefore, using Minkowski’s inequality https://en.wikipedia.org/wiki/Minkowski inequality , $$ \big \mathbb{E} \| x k – X {k \gamma} \|^2 \big ^{1/2} \leqslant \big \mathbb{E} \| x {k-1} – X { k-1 \gamma} \|^2 + \gamma^2 \sigma^2 \big ^{1/2} +\frac{L\gamma^2}{2}\|F' x 0 \|,$$ if $\mathbb{E} \| f' x,c – F' x \|^2 \leqslant \sigma^2$ for all $x$. A simple induction on $k$ then leads to $$ \big \mathbb{E} \| x k – X {k \gamma} \|^2 \big ^{1/2} \leqslant \frac{\sigma}{L} \gamma L \sqrt{k} + \frac{k L^2\gamma^2}{2}\frac{\|F' x 0 \|}{L}= \Delta k.$$ This shows that if $\gamma L k$ is bounded, the gradient flow is within $O \sqrt{\gamma L} $ of the SGD recursion. We then need to bound $x k – X {k \gamma} – \sqrt{\gamma} u k$. We have $$ F' x {k-1} – F' X { k-1 \gamma} = F^{\prime \prime} X { k-1 \gamma} x {k-1} -X { k-1 \gamma} + \eta k,$$ with $\| \eta k \| \leqslant \frac{M}{2} \| x {k-1} -X { k-1 \gamma}\|^2$, if $F^{\prime \prime}$ is $M$-Lipschitz-continuous in operator norm. With $\delta k = x k – X {k \gamma} – \sqrt{\gamma} u k$, we then have the decomposition, for $\xi x,c = f' x,c – F' x $, $$\delta k = I – \gamma F^{\prime\prime} X { k-1 \gamma} \delta {k-1} – \gamma \eta k – \gamma \xi x {k-1}, c k – \xi X { k-1 \gamma},c k – \big X {k\gamma} – T {\gamma} X { k-1 \gamma} \big .$$ We then need to use the assumption that for all $x,y$, $$ \mathbb{E} \| \xi x,c -\xi y,c \|^2 \leqslant N^2 \| x – y \|^2.$$ We can then unroll the recursion above, as $$ \delta k = -\gamma \sum {i=1}^k M {i,k} \eta i – \gamma \sum {i=1}^k M {i,k} \xi x {i-1}, c i – \xi X { i-1 \gamma},c i – \sum {i=1}^k M {i,k} \big X {i\gamma} – T {\gamma} X { i-1 \gamma} \big ,$$ where $M {i,k}$ are matrices with operator norms less than one. For the first term, we have, by using results above, $$ \mathbb{E} \bigg \bigg\| -\gamma \sum {i=1}^k M {i,k} \eta i \bigg\| \bigg \leqslant \frac{M \gamma k}{2} \Delta k^2, $$ with a similar result for the third term. For the second term we use martingale calculus to get $$ \mathbb{E} \bigg \bigg\| \gamma \sum {i=1}^k M {i,k} \xi x {i-1}, c i – \xi X { i-1 \gamma},c i \bigg\| \bigg \leqslant \Big \gamma^2 N^2 k \Delta k^2 \Big ^{1/2}.$$ We then have shown that $$ \mathbb{E} \| \delta k \| \leqslant \frac{Mk \gamma}{2} \Delta k^2 + N \gamma \sqrt{k} \Delta k + \frac{Lk\gamma^2}{2}\|F' x 0 \|.$$ If we only keep the dependence on $\gamma L $ and $k$, we get $$ \mathbb{E} \| \delta k \| = O \big \gamma L ^2 k 1 + k \gamma L ^3 \big = O \gamma . $$ Second part. This requires a form of central limit theorem for martingales. See 28 and 1, Part II, Chapter 4 . This can also be made quantitative see 4, 10 . The key thing to notice is that a discretization of the SDE $$ dU t = -F^{\prime \prime} X t U t dt + \Sigma X t ^{1/2} dB t $$ is obtained as $$ \tilde{u} k = I\, – \gamma F^{\prime \prime} X { k-1 \gamma} \tilde{u} {k-1} – \sqrt{\gamma} \xi k,$$ with $\xi k$ with conditional mean zero and covariance matrix $\Sigma X { k-1 \gamma} $. The sequence $u k$ exactly corresponds to $$\xi k = f' X { k-1 \gamma},c k \, – F' X { k-1 \gamma} .$$