All notes / Mathematics of machine learning

Gradient Descent: What Converges, and How Fast?

Stationarity, convex rates, and stochastic gradients

Will Gao · March 2025

Contents
  1. 1 Gradient descent for smooth functions
  2. 2 The convex case
  3. 3 The strongly convex case
  4. 4 Stochastic gradient descent
  5. 4.1 Step-size consequences

These notes are adapted from Prof. Alexis Drouot's MATH 480 course at the University of Washington, Seattle (Winter 2025). They are my own notes, not official course materials. I have done my best to ensure correctness, but errors may remain.

The goal is to collect a few basic convergence guarantees for gradient descent under progressively stronger assumptions, and then to see what changes when exact gradients are replaced by stochastic ones. We begin with smooth, possibly nonconvex objectives, then add convexity and strong convexity, and finish with a standard stationarity bound for stochastic gradient descent.

1Gradient descent for smooth functions

We seek to solve

minx∈Rdf(x),f∈C2(Rd;R),

starting from x0∈Rd and applying the fixed-step iteration

xk+1=xk−α∇f(xk),
(1)

where α>0 is small. Under suitable assumptions, the gradient norms converge to zero.

Definition 1.1 (Smoothness). A differentiable function f:Rd→R is L-smooth if
‖∇f(x)−∇f(y)‖≤L‖x−y‖for all x,y∈Rd.
Equivalently, its gradient is L-Lipschitz. If f∈C2(Rd), the bound ‖∇2f(x)‖op≤L for all x implies that f is L-smooth.

Assume throughout this section that f is L-smooth. In the C2 setting above, a sufficient condition is

−LI⪯∇2f(x)⪯LIfor every x∈Rd,
(2)

where, for symmetric matrices, A⪯B means h⊤Ah≤h⊤Bh for every h∈Rd.

Lemma 1.2 (Descent lemma). If f is differentiable and L-smooth, then, for every x,y∈Rd,
|f(y)−f(x)−∇f(x)⊤(y−x)|≤L2‖y−x‖2.
(3)
In particular,
f(y)≤f(x)+∇f(x)⊤(y−x)+L2‖y−x‖2.
Proof. Let d=y−x. By the fundamental theorem of calculus,
f(y)−f(x)−∇f(x)⊤d=∫01(∇f(x+td)−∇f(x))⊤ddt.
Using Cauchy–Schwarz and L-smoothness,
|f(y)−f(x)−∇f(x)⊤d|≤∫01Lt‖d‖2dt=L2‖d‖2,
which is (3).
Theorem 1.3 (Stationarity rate). Let f∗=infxf(x)>−∞, and suppose f is L-smooth. For a fixed step size 0<α≤1/L, the iterates in (1) satisfy, for every integer K≥1,
min0≤k≤K−1‖∇f(xk)‖2≤2(f(x0)−f∗)αK.
(4)
Moreover, ‖∇f(xk)‖→0 as k→∞.
Proof. Apply Lemma 1.2 with y=xk+1=xk−α∇f(xk):
f(xk+1)≤f(xk)−α‖∇f(xk)‖2+Lα22‖∇f(xk)‖2=f(xk)−α(1−Lα2)‖∇f(xk)‖2≤f(xk)−α2‖∇f(xk)‖2.
Hence
α2∑k=0K−1‖∇f(xk)‖2≤f(x0)−f(xK)≤f(x0)−f∗.
Since the minimum is at most the average, (4) follows. Letting K→∞ shows that the nonnegative series ∑k‖∇f(xk)‖2 is finite, so its terms tend to zero.

The conclusion above guarantees convergence to first-order stationarity, but a critical point need not be a global minimizer. Convexity supplies that missing implication.

2The convex case

Definition 2.1. A function f:Rd→R is convex if, for all x,y∈Rd and θ∈[0,1],
f(θx+(1−θ)y)≤θf(x)+(1−θ)f(y).
Lemma 2.2 (First-order characterization). If f is differentiable and convex, then, for every x,y∈Rd,
f(y)≥f(x)+∇f(x)⊤(y−x).
(5)
Thus a differentiable convex function lies above each of its tangent hyperplanes.
Proof. For θ∈(0,1), convexity gives
f(x+θ(y−x))≤(1−θ)f(x)+θf(y).
Rearranging,
f(x+θ(y−x))−f(x)θ≤f(y)−f(x).
Letting θ↓0 yields ∇f(x)⊤(y−x)≤f(y)−f(x).

In particular, if ∇f(x∗)=0, then (5) implies f(y)≥f(x∗) for every y, so x∗ is a global minimizer.

Theorem 2.3 (Function-value rate for convex objectives). Suppose f is convex, differentiable, and L-smooth, and assume a minimizer x∗∈argminf exists. With 0<α≤1/L, gradient descent satisfies
f(xK)−f∗≤‖x0−x∗‖22αK,K≥1,
(6)
where f∗=f(x∗).
Proof. The previous descent estimate gives
f(xk+1)≤f(xk)−α2‖∇f(xk)‖2.
(7)
Let dk=x∗−xk. Since dk+1=dk+α∇f(xk),
∇f(xk)⊤dk=‖dk+1‖2−‖dk‖22α−α2‖∇f(xk)‖2.
By Lemma 2.2, f(xk)≤f∗−∇f(xk)⊤dk. Combining this with (7) gives
f(xk+1)−f∗≤‖dk‖2−‖dk+1‖22α.
Summing from k=0 to K−1 yields
∑k=0K−1(f(xk+1)−f∗)≤‖d0‖2−‖dK‖22α≤‖d0‖22α.
The values f(xk) are nonincreasing by (7); hence the left side is at least K(f(xK)−f∗), proving (6).

Thus K=O(ε−1) iterations suffice to ensure f(xK)−f∗≤ε.

3The strongly convex case

Definition 3.1. A differentiable function f:Rd→R is μ-strongly convex, for μ>0, if
f(y)≥f(x)+∇f(x)⊤(y−x)+μ2‖y−x‖2for all x,y∈Rd.
(8)

The factor 1/2 is the standard normalization. Under this convention, f is μ-strongly convex exactly when x↦f(x)−(μ/2)‖x‖2 is convex. If f∈C2, this is equivalent to ∇2f(x)⪰μI for all x. If f is also L-smooth, then necessarily 0<μ≤L.

Lemma 3.2 (Existence and uniqueness of the minimizer). A continuously differentiable, strongly convex function on Rd has a unique minimizer x∗.
Proof. Set x=0 in (8):
f(y)≥f(0)+∇f(0)⊤y+μ2‖y‖2.
The quadratic term dominates the linear term as ‖y‖→∞, so f(y)→∞; that is, f is coercive. A continuous coercive function on Rd attains its minimum. Strong convexity implies strict convexity, so two distinct minimizers cannot exist.
Lemma 3.3 (Gradient domination). If f is μ-strongly convex and x∗ is its minimizer, then
12‖∇f(x)‖2≥μ(f(x)−f∗)for every x∈Rd.
(9)
Proof. Taking the infimum in y on the right side of (8),
f∗≥infy{f(x)+∇f(x)⊤(y−x)+μ2‖y−x‖2}=f(x)−12μ‖∇f(x)‖2,
where the quadratic is minimized at y=x−μ−1∇f(x). Rearrangement gives (9).
Theorem 3.4 (Linear convergence). Suppose f is μ-strongly convex and L-smooth. If 0<α≤1/L, then gradient descent satisfies
f(xK)−f∗≤(1−αμ)K(f(x0)−f∗).
(10)
If 0<αμ<1 and 0<ε<f(x0)−f∗, it therefore suffices to take
K≥log⁡((f(x0)−f∗)/ε)−log⁡(1−αμ)
(11)
to guarantee f(xK)−f∗≤ε. Thus the iteration complexity is O(log⁡(1/ε)) for fixed α and μ. In the endpoint case αμ=1, (10) already gives f(x1)=f∗.
Proof. By (7) and Lemma 3.3,
f(xk+1)−f∗≤f(xk)−f∗−α2‖∇f(xk)‖2≤(1−αμ)(f(xk)−f∗).
Iterating proves (10); solving the resulting geometric bound for K proves (11).

4Stochastic gradient descent

Large-data objectives often have the finite-sum form

f(a)=1N∑j=1Nfj(a),
(12)

where fj is the loss associated with the jth data point. Computing the full gradient may be expensive. Stochastic gradient descent (SGD) instead uses

ak+1=ak−αk∇fJk(ak),
(13)

where, conditional on the past, Jk is sampled uniformly from {1,…,N}. If Fk denotes the information available before drawing Jk, then

E[∇fJk(ak)∣Fk]=∇f(ak).
(14)
Lemma 4.1 (First and second moments). For uniform sampling and any fixed a,
EJ[∇f(a)⊤∇fJ(a)]=‖∇f(a)‖2,
(15)
EJ[‖∇fJ(a)‖2]=‖∇f(a)‖2+EJ[‖∇fJ(a)−∇f(a)‖2].
(16)
Proof. By (12), EJ[∇fJ(a)]=N−1∑j=1N∇fj(a)=∇f(a), which gives (15). Equation (16) is the vector-valued bias–variance identity E‖G‖2=‖EG‖2+E‖G−EG‖2.

The variance term generally depends on the current iterate. For a uniform theorem, assume that there exists σ≥0 such that, almost surely,

E[‖∇fJk(ak)−∇f(ak)‖2|Fk]≤σ2for every k.
(17)
Theorem 4.2 (Expected stationarity bound for SGD). Assume f is L-smooth and bounded below by f∗, the stochastic gradients are conditionally unbiased as in (14), and (17) holds. If 0<αk≤1/L, then, for every K≥1,
min0≤k≤K−1E‖∇f(ak)‖2≤2(f(a0)−Ef(aK))+Lσ2∑k=0K−1αk2∑k=0K−1αk≤2(f(a0)−f∗)+Lσ2∑k=0K−1αk2∑k=0K−1αk.
(18)
Proof. The descent lemma and (13) give
f(ak+1)≤f(ak)−αk∇f(ak)⊤∇fJk(ak)+Lαk22‖∇fJk(ak)‖2.
Take conditional expectation and apply Lemma 4.1 together with (17):
E[f(ak+1)∣Fk]≤f(ak)−αk‖∇f(ak)‖2+Lαk22(‖∇f(ak)‖2+σ2)≤f(ak)−αk2‖∇f(ak)‖2+Lαk2σ22.
After taking full expectation and summing from k=0 to K−1,
∑k=0K−1αkE‖∇f(ak)‖2≤2(f(a0)−Ef(aK))+Lσ2∑k=0K−1αk2.
Dividing by ∑k=0K−1αk and using that a minimum is no larger than the corresponding weighted average proves (18).

4.1Step-size consequences

For a constant step αk=α≤1/L, Theorem 4.2 becomes

min0≤k≤K−1E‖∇f(ak)‖2≤2(f(a0)−f∗)αK+Lασ2.

The second term is the noise floor. Choosing α on the order of K−1/2 balances the two terms and yields an O(K−1/2) stationarity bound. More generally, if

∑k=0∞αk=∞,∑k=0∞αk2<∞,

then the bound in (18) forces the weighted average of the expected squared gradient norms to vanish asymptotically. In particular,

lim infk→∞E‖∇f(ak)‖2=0.