Foundations to Frontier
Tests
A. Mathematical Foundations › A6 Optimization › Optimization for ML

Convergence Rates of GD and SGD, with Proofs

How many iterations does an optimizer need? This topic proves the core rates of first-order optimization: O(1/k) for gradient descent on smooth convex functions, the linear rate (1 − μ/L)^k under strong convexity or the Polyak–Łojasiewicz inequality, O(1/√k) for stochastic or subgradient methods on convex problems, and O(1/k) for SGD on strongly convex problems with decaying steps. You will translate rates into iteration counts, see the lower bounds that make Nesterov's method optimal, and verify every rate numerically.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

How fast is fast?

Suppose an algorithm halves its error every step. After 10 steps the error is 1000× smaller, and after 20 a million times smaller. That’s linear (geometric) convergence: each step buys a fixed number of new digits.

A slower algorithm might only make the error shrink like 1/k: twice the steps, half the error. Going from 1% to 0.1% then takes ten times as many steps. That’s sublinear convergence.

Which one you get depends on the shape of the problem (how curved it is) and on whether your gradients are exact or noisy.

How fast does the gap shrink? Linear, sublinear and noisy rates
1e-81e-61e-41e-21e01/k1/√k1101001000
■ GD, strongly convex (κ = 20): 1.1e-134■ GD, convex (no μ): 1.1e-5■ SGD, constant η = 0.05: 1.2e-3■ SGD, η = 1/(μk): 1.5e-5
On log–log axes, O(1/kᵖ) rates are straight lines of slope −p (dashed references). Linear (geometric) convergence plunges off the bottom, faster for smaller κ. Without strong convexity, GD is only polynomial. SGD with a constant step flattens at a noise floor ∝ ησ². The 1/(μk) schedule follows the O(1/k) line. Set σ = 0 and constant-step SGD becomes plain GD again, with linear convergence.
Why engineers care

Rates turn into budgets. An MPC solver must finish in 5 ms, a training run must fit in a week of GPU time. Knowing whether you’re in a linear or a sublinear regime tells you whether more iterations will help, whether to improve conditioning, or whether to reduce gradient noise.

📝 Quick check (Level 0)
0/3 answered
  1. 1. Halving the error every step is…
  2. 2. With a 1/k rate, doubling the steps…
  3. 3. Noisy gradients usually make convergence…

Level 1: Beginner

★★☆☆☆ Basic⏱ 25 minSecondary-school mathematics: arithmetic and elementary algebra.

The headline rates (η = 1/L unless noted)

Setting Method Rate Iterations to ε
L-smooth, convex GD L R²/(2k) O(1/ε)
L-smooth, μ-strongly convex (or PL) GD (1 − μ/L)ᵏ O(κ log 1/ε)
convex, G-Lipschitz, noisy SGD / subgradient, η ∝ 1/√k RG/√k O(1/ε²)
μ-strongly convex, noisy SGD, η = 1/(μk) O(σ²/(μk)) O(1/ε)
L-smooth, convex Nesterov (A6.3-3) O(L R²/k²) O(1/√ε)

Here R=∥x0−x⋆∥R = \|x_0 - x^\star\|, κ=L/μ\kappa = L/\mu, and σ2\sigma^2 is the gradient-noise variance.

Reading a rate

  • Convex GD: L=R=1L = R = 1, ε=10−3\varepsilon = 10^{-3}: k≥500k\ge500. Each additional digit costs 10× more.
  • Strongly convex: κ=10\kappa = 10: 132 steps per factor of 10610^6. Each digit costs about 2.3κ2.3\kappa more steps.
  • Noisy convex: each digit costs 100× more.
📝 Quick check (Level 1)
0/3 answered
  1. 1. GD on convex L-smooth f has gap ≤
  2. 2. Iterations for ε accuracy under strong convexity scale as…
  3. 3. Noisy convex optimization needs…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 45 minUndergraduate students and practising engineers.

Three tools behind every proof

  1. Descent lemma (smoothness): f(xk+1)≤f(xk)−12L∥∇f(xk)∥2f(x_{k+1})\le f(x_k) - \frac1{2L}\|\nabla f(x_k)\|^2.
  2. Convexity: f(xk)−f⋆≤∇f(xk)⊤(xk−x⋆)f(x_k) - f^\star\le\nabla f(x_k)^\top(x_k - x^\star).
  3. Expanding a square: ∥xk+1−x⋆∥2=∥xk−x⋆∥2−2ηg⊤(xk−x⋆)+η2∥g∥2\|x_{k+1} - x^\star\|^2 = \|x_k - x^\star\|^2 - 2\eta g^\top(x_k - x^\star) + \eta^2\|g\|^2.

Combine them and telescope.

Variants of the setting

  • PL instead of strong convexity: 12∥∇f∥2≥μ(f−f⋆)\frac12\|\nabla f\|^2\ge\mu(f - f^\star) still gives the linear rate (A6.2-2). This covers some non-convex problems.
  • Non-convex smooth: GD finds an ε-stationary point (∥∇f∥≤ε\|\nabla f\|\le\varepsilon) in O(1/ε2)O(1/\varepsilon^2) iterations; SGD needs O(1/ε4)O(1/\varepsilon^4) (Ghadimi and Lan, 2013).
  • SGD with a constant step: linear convergence to a neighbourhood of radius O(ησ2/μ)O(\eta\sigma^2/\mu), the noise ball (A6.3-1).
  • Polyak–Ruppert averaging: averaging the iterates of a slowly decaying schedule achieves the optimal O(1/k)O(1/k) robustly, without knowing μ\mu.

Lower bounds

For any first-order method whose iterates lie in the span of past gradients, there are smooth convex functions where f(xk)−f⋆≥3LR232(k+1)2f(x_k) - f^\star\ge\frac{3LR^2}{32(k + 1)^2} (Nesterov, 2004). GD’s O(1/k)O(1/k) is therefore not optimal, while Nesterov’s accelerated O(1/k2)O(1/k^2) is. For strongly convex functions the optimal rate is (1−1/κ)k(1 - 1/\sqrt\kappa)^k.

🐍 Exercise 1: verify GD's rates
Compute GD gaps in closed form on diagonal quadratics. Check the convex bound LR²/(2k) at every step on a spectrum λⱼ = 1/j², measure the log–log slope, and confirm the factor (1 − μ/L)² per step in the strongly convex case.
📝 Quick check (Level 2)
0/3 answered
  1. 1. The optimal first-order rate on smooth convex functions is…
  2. 2. The PL inequality gives GD…
  3. 3. Polyak–Ruppert averaging means…

Level 3: Advanced

★★★★☆ Advanced⏱ 50 minGraduate level, with full derivations and proofs.

Proof: GD on convex L-smooth f (η = 1/L)

Using the descent lemma and convexity, with gk=∇f(xk)g_k = \nabla f(x_k):

f(xk+1)≤f⋆+gk⊤(xk−x⋆)−12L∥gk∥2=f⋆+L2(∥xk−x⋆∥2−∥xk+1−x⋆∥2)f(x_{k+1})\le f^\star + g_k^\top(x_k - x^\star) - \tfrac1{2L}\|g_k\|^2 = f^\star + \tfrac L2\big(\|x_k - x^\star\|^2 - \|x_{k+1} - x^\star\|^2\big)

The last step expands ∥xk−x⋆−gk/L∥2\|x_k - x^\star - g_k/L\|^2. Sum over k=0..K−1k = 0..K-1; the right side telescopes. Since f(xk)f(x_k) is non-increasing, K(f(xK)−f⋆)≤L2∥x0−x⋆∥2K(f(x_K) - f^\star)\le\frac L2\|x_0 - x^\star\|^2. ∎

Proof: linear rate under strong convexity

The descent lemma gives f(xk+1)−f⋆≤f(xk)−f⋆−12L∥gk∥2f(x_{k+1}) - f^\star\le f(x_k) - f^\star - \frac1{2L}\|g_k\|^2. Strong convexity implies PL: ∥gk∥2≥2μ(f(xk)−f⋆)\|g_k\|^2\ge2\mu(f(x_k) - f^\star). Hence f(xk+1)−f⋆≤(1−μ/L)(f(xk)−f⋆)f(x_{k+1}) - f^\star\le(1 - \mu/L)(f(x_k) - f^\star). ∎

Proof: SGD on convex, G-Lipschitz f

Let E[gk]∈∂f(xk)\mathbb E[g_k] \in \partial f(x_k) with E∥gk∥2≤G2\mathbb E\|g_k\|^2\le G^2 and a constant step η\eta. Expanding the square and taking expectations:

E∥xk+1−x⋆∥2≤E∥xk−x⋆∥2−2η E[f(xk)−f⋆]+η2G2\mathbb E\|x_{k+1} - x^\star\|^2\le\mathbb E\|x_k - x^\star\|^2 - 2\eta\,\mathbb E[f(x_k) - f^\star] + \eta^2G^2

Sum and divide by 2ηK2\eta K, then use Jensen for the average iterate: Ef(xˉK)−f⋆≤R22ηK+ηG22\mathbb E f(\bar x_K) - f^\star\le\frac{R^2}{2\eta K} + \frac{\eta G^2}2. With η=R/(GK)\eta = R/(G\sqrt K) this is RG/KRG/\sqrt K. ∎

SGD O(1/k) on strongly convex quadratics

For μ2x2\frac\mu2x^2 with ηk=1/(μk)\eta_k = 1/(\mu k): mk+1=(1−1/k)2mk+σ2/(μ2k2)m_{k+1} = (1 - 1/k)^2m_k + \sigma^2/(\mu^2k^2). Induction gives mk≈σ2/(μ2k)m_k\approx\sigma^2/(\mu^2k), so Ef≈σ2/(2μk)\mathbb E f\approx\sigma^2/(2\mu k).

Exercise 3.1: Why can’t SGD with any schedule beat O(1/k) on strongly convex problems?

Even knowing the exact problem structure, estimating a mean from kk noisy samples has variance σ2/k\sigma^2/k (the Cramér–Rao bound, A5.1-4). The optimizer is at least estimating the minimizer from noisy data, so Ω(1/k)\Omega(1/k) is information-theoretically unavoidable (Nemirovski and Yudin, 1983).

📝 Quick check (Level 3)
0/3 answered
  1. 1. The convex GD proof telescopes…
  2. 2. The SGD convex bound balances…
  3. 3. SGD can't beat O(1/k) on strongly convex problems because…

Level 4: Expert

★★★★★ Expert⏱ 35 minResearchers: original papers and open problems.

SGD schedules, measured

On f=μ2x2f = \frac\mu2x^2 with gradient noise σ = 1, averaging 2000 runs:

  • A constant step 0.1 stalls at exactly the predicted floor μ2⋅ησ2μ(2−ημ)≈0.026\frac\mu2\cdot\frac{\eta\sigma^2}{\mu(2 - \eta\mu)}\approx0.026.
  • ηk=1/(μk)\eta_k = 1/(\mu k) tracks σ2/(2μk)\sigma^2/(2\mu k) to within a few percent.
  • Polyak–Ruppert averaging of the more forgiving 0.5/k0.5/\sqrt k schedule matches the optimal rate without needing μ\mu.

This is why practitioners use decaying or averaged schedules (and SWA, stochastic weight averaging, in deep learning).

🐍 Exercise 2 (research): SGD rates and averaging
Simulate SGD on a noisy quadratic with constant, 1/(μk) and averaged 1/√k schedules. Compare with the theoretical noise floor and the σ²/(2μk) rate.

Rates in AI, robotics and aerospace

  • Real-time MPC certification: iteration bounds from linear rates guarantee a solver meets its deadline (Richter, Jones and Morari, 2012).
  • Training budgets: scaling laws and learning-rate schedules are designed around the noise-floor and averaging behaviour (Izmailov et al., 2018, SWA).
  • Non-convex guarantees: O(1/ε²) and O(1/ε⁴) stationarity rates underpin analyses of GD and SGD on neural networks (Ghadimi and Lan, 2013).
  • Distributed/federated training analyses extend these proofs with communication and heterogeneity terms (Stich, 2019).

References

  1. Y. Nesterov (2004). Introductory Lectures on Convex Optimization: A Basic Course. Kluwer.
  2. S. Bubeck (2015). “Convex optimization: algorithms and complexity.” Foundations and Trends in Machine Learning, 8(3–4).
  3. A. Nemirovski, D. Yudin (1983). Problem Complexity and Method Efficiency in Optimization. Wiley.
  4. B. Polyak, A. Juditsky (1992). “Acceleration of stochastic approximation by averaging.” SIAM Journal on Control and Optimization, 30(4).
  5. S. Ghadimi, G. Lan (2013). “Stochastic first- and zeroth-order methods for nonconvex stochastic programming.” SIAM Journal on Optimization, 23(4).
  6. H. Karimi, J. Nutini, M. Schmidt (2016). “Linear convergence of gradient and proximal-gradient methods under the Polyak–Łojasiewicz condition.” ECML-PKDD.
  7. F. Bach, E. Moulines (2011). “Non-asymptotic analysis of stochastic approximation algorithms for machine learning.” NeurIPS.
  8. P. Izmailov et al. (2018). “Averaging weights leads to wider optima and better generalization.” UAI.
  9. S. Stich (2019). “Local SGD converges fast and communicates little.” ICLR.
  10. S. Richter, C. Jones, M. Morari (2012). “Computational complexity certification for real-time MPC with input constraints based on the fast gradient method.” IEEE Transactions on Automatic Control, 57(6).