文章

Convergence Analysis of GD and SGD

·

In this blog, we won't talk about various optimization algorithms, but focus on the two basic algorithms: Gradient Descent and Stochastic Gradient Descent. We w

Convergence of Optimization Algorithms

Mipha
(August 17, 2026)

1 Introduction

We often analyze the convergence rate of optimization algorithms from theoretical perspective. These proofs are often based on some assumptions while the practical scenarios may not satisfy these assumptions. However, these theretical analysis can still provide us some insights of the convergence in application. In this chapter, we won’t talk about various optimization algorithms, but focus on the two basic algorithms: Gradient Descent and Stochastic Gradient Descent. We will analyze the convergence of these two algorithms under different assumptions because many optimization algorithms can be viewed as extensions of these two, and the techniques used in the convergence analysis of these two algorithms can be applied to other optimization algorithms just with some subtle modifications.

References

2 Assumptions and Properties

We can often see some assumptions in the analysis of optimization algorithms in textbooks and research papers. These assumptions are often related to the properties of the objective function or variables. In this section, we will introduce some common assumptions and properties that are often used in the convergence analysis of optimization algorithms.

Assumption 1 (L-Smooth).

A function 𝑓 is L-smooth if it is differentiable and its gradient is L-Lipschitz continuous, i.e., there exists a constant 𝐿>0 such that for all 𝑥,𝑦∈ℝ𝑑,

‖∇𝑓(𝑥)−∇𝑓(𝑦)‖2≤𝐿‖𝑥−𝑦‖2.
Lemma 2 (Descent Lemma).

If 𝑓 is L-smooth, then for all 𝑥,𝑦∈ℝ𝑑,

𝑓(𝑦)≤𝑓(𝑥)+∇𝑓(𝑥)𝑇(𝑦−𝑥)+𝐿2‖𝑦−𝑥‖22.

Proposition 3 (Hessian Characterization of L-Smoothness).

A function 𝑓 is L-smooth if and only if it is differentiable and for all 𝑥∈ℝ𝑑,

∇2𝑓(𝑥)⪯𝐿𝐼.

Assumption 4 (Strongly Convex).

A function 𝑓 is 𝜇-strongly convex if it is convex and there exists a constant 𝜇>0 such that for all 𝑥,𝑦∈ℝ𝑑,

𝑓(𝑦)≥𝑓(𝑥)+∇𝑓(𝑥)𝑇(𝑦−𝑥)+𝜇2‖𝑦−𝑥‖22.
Proposition 5 (Hessian Characterization of Strong Convexity).

A function 𝑓 is 𝜇-strongly convex if and only if it is twice differentiable and for all 𝑥∈ℝ𝑑,

∇2𝑓(𝑥)⪰𝜇𝐼.

All above are definitions and basic properties of L-smoothness and strongly convexity which can be viewed in many textbooks. Following we will introduce some other properties that are often used in the convergence analysis of optimization algorithms.

Proposition 6 (Convexity and L-Smoothness).

For a function 𝑓 that is convex and L-smooth, suppose 𝑥∗ is a minimizer of 𝑓, then for all 𝑥∈ℝ𝑑,

𝑓(𝑥)−𝑓(𝑥∗)≥12𝐿‖∇𝑓(𝑥)‖22.

Proposition 7 (Strongly Convexity and L-Smoothness).

For a function 𝑓 that is 𝜇-strongly convex and L-smooth, suppose 𝑥∗ is a minimizer of 𝑓, then for all 𝑥∈ℝ𝑑,

𝜇2‖𝑥−𝑥∗‖22≤𝑓(𝑥)−𝑓(𝑥∗)≤12𝜇‖∇𝑓(𝑥)‖22.

Proposition 8 (co-coercivity of the gradient).

For a function 𝑓 that is convex and L-smooth, for all 𝑥,𝑦∈ℝ𝑑,

⟨∇𝑓(𝑥)−∇𝑓(𝑦),𝑥−𝑦⟩≥1𝐿‖∇𝑓(𝑥)−∇𝑓(𝑦)‖22.

Proposition 9 (strengthened co-coercivity).

For a function 𝑓 that is 𝜇-strongly convex and L-smooth, for all 𝑥,𝑦∈ℝ𝑑,

⟨∇𝑓(𝑥)−∇𝑓(𝑦),𝑥−𝑦⟩≥𝜇𝐿𝜇+𝐿‖𝑥−𝑦‖22+1𝜇+𝐿‖∇𝑓(𝑥)−∇𝑓(𝑦)‖22.

Assumption 10 (Bounded Second Moment of Stochastic Gradient).

For a function 𝑓 that is differentiable, we assume that the stochastic gradient 𝑔(𝑥,𝜉) satisfies

𝔼[‖𝑔(𝑥,𝜉)‖22]≤𝐺2,

for some constant 𝐺>0.

It is the most common assumption in the convergence analysis of stochastic gradient descent. However, it is not a realistic assumption in many practical scenarios. For example, if 𝑓 is L-smooth, then ‖∇𝑓(𝑥)‖2 can be arbitrarily large when ‖𝑥‖2 is large. In this case, the stochastic gradient 𝑔(𝑥,𝜉) can also be arbitrarily large. Therefore, the bounded second moment assumption may not hold in practice.

Assumption 11 (Bounded Variance of Stochastic Gradient).

For a function 𝑓 that is differentiable, we assume that the stochastic gradient 𝑔(𝑥,𝜉) satisfies

𝔼[‖𝑔(𝑥,𝜉)−∇𝑓(𝑥)‖22]≤𝜎2,

for some constant 𝜎>0.

Under the assumption of bounded variance of stochastic gradient, we can derive the following bias-variance decomposition.

Proposition 12 (Bias-Variance Decomposition).

For a function 𝑓 that is differentiable, we have

𝔼[‖𝑔(𝑥,𝜉)‖22]=‖∇𝑓(𝑥)‖22+𝔼[‖𝑔(𝑥,𝜉)−∇𝑓(𝑥)‖22].

And furthermore, if the stochastic gradient 𝑔(𝑥,𝜉) satisfies the bounded variance assumption, then we have

𝔼[‖𝑔(𝑥,𝜉)‖22]≤‖∇𝑓(𝑥)‖22+𝜎2.

3 Get One-step Inequalities

3.1 Smooth and Convex GD

By the update rule of GD:

𝑥𝑡+1=𝑥𝑡−𝜂∇𝑓(𝑥𝑡)

Expanding the squared distance to the optimal solution 𝑥∗:

‖𝑥𝑡+1−𝑥∗‖22=‖𝑥𝑡−𝜂∇𝑓(𝑥𝑡)−𝑥∗‖22=‖𝑥𝑡−𝑥∗‖22−2𝜂⟨∇𝑓(𝑥𝑡),𝑥𝑡−𝑥∗⟩+𝜂2‖∇𝑓(𝑥𝑡)‖22

By Proposition 8, we have

⟨∇𝑓(𝑥𝑡),𝑥𝑡−𝑥∗⟩≥𝑓(𝑥𝑡)−𝑓(𝑥∗)+12𝐿‖∇𝑓(𝑥𝑡)‖22

Substituting this into the previous inequality, we get

‖𝑥𝑡+1−𝑥∗‖22≤‖𝑥𝑡−𝑥∗‖22−2𝜂(𝑓(𝑥𝑡)−𝑓(𝑥∗))−𝜂𝐿‖∇𝑓(𝑥𝑡)‖22+𝜂2‖∇𝑓(𝑥𝑡)‖22=‖𝑥𝑡−𝑥∗‖22−2𝜂(𝑓(𝑥𝑡)−𝑓(𝑥∗))+(𝜂2−𝜂𝐿)‖∇𝑓(𝑥𝑡)‖22

Take 𝜂=1𝐿, we have

‖𝑥𝑡+1−𝑥∗‖22≤‖𝑥𝑡−𝑥∗‖22−2𝐿(𝑓(𝑥𝑡)−𝑓(𝑥∗)).

3.2 Smooth and Strongly Convex GD

Function Value Convergence:

By Lemma 2, we have

𝑓(𝑥𝑡+1)≤𝑓(𝑥𝑡)+∇𝑓(𝑥𝑡)𝑇(𝑥𝑡+1−𝑥𝑡)+𝐿2‖𝑥𝑡+1−𝑥𝑡‖22

Substituting the update rule of GD into the above inequality, we get

𝑓(𝑥𝑡+1)≤𝑓(𝑥𝑡)−𝜂‖∇𝑓(𝑥𝑡)‖22+𝐿𝜂22‖∇𝑓(𝑥𝑡)‖22=𝑓(𝑥𝑡)−(𝜂−𝐿𝜂22)‖∇𝑓(𝑥𝑡)‖22

Applying Proposition 7, we have

𝑓(𝑥𝑡+1)−𝑓(𝑥∗)≤𝑓(𝑥𝑡)−𝑓(𝑥∗)−(𝜂−𝐿𝜂22)2𝜇(𝑓(𝑥𝑡)−𝑓(𝑥∗))=(1−2𝜇𝜂+𝐿𝜇𝜂2)(𝑓(𝑥𝑡)−𝑓(𝑥∗))

Take 𝜂=1𝐿, we have

𝑓(𝑥𝑡+1)−𝑓(𝑥∗)≤(1−𝜇𝐿)(𝑓(𝑥𝑡)−𝑓(𝑥∗))

Distance Convergence: By Propositon 9, we have

⟨∇𝑓(𝑥𝑡),𝑥𝑡−𝑥∗⟩≥𝜇𝐿𝜇+𝐿‖𝑥𝑡−𝑥∗‖22+1𝜇+𝐿‖∇𝑓(𝑥𝑡)‖22.

Take 𝜂=2𝜇+𝐿, we have

‖𝑥𝑡+1−𝑥∗‖22=‖𝑥𝑡−𝑥∗‖22−2𝜂⟨∇𝑓(𝑥𝑡),𝑥𝑡−𝑥∗⟩+𝜂2‖∇𝑓(𝑥𝑡)‖22≤‖𝑥𝑡−𝑥∗‖22−4𝜇+𝐿(𝜇𝐿𝜇+𝐿‖𝑥𝑡−𝑥∗‖22+1𝜇+𝐿‖∇𝑓(𝑥𝑡)‖22)+4(𝜇+𝐿)2‖∇𝑓(𝑥𝑡)‖22=(1−4𝜇𝐿(𝜇+𝐿)2)‖𝑥𝑡−𝑥∗‖22−4(𝜇+𝐿)2‖∇𝑓(𝑥𝑡)‖22+4(𝜇+𝐿)2‖∇𝑓(𝑥𝑡)‖22=(1−4𝜇𝐿(𝜇+𝐿)2)‖𝑥𝑡−𝑥∗‖22=(𝜇−𝐿𝜇+𝐿)2‖𝑥𝑡−𝑥∗‖22

3.3 Convex and Possibly Non-smooth SGD

The update rule of SGD is

𝑥𝑡+1=𝑥𝑡−𝜂𝑔(𝑥𝑡,𝜉𝑡)

where 𝑔(𝑥𝑡,𝜉𝑡) is the stochastic gradient at 𝑥𝑡 with respect to the random variable 𝜉𝑡. We assume that 𝑔(𝑥𝑡,𝜉𝑡) is an unbiased estimator of the true gradient ∇𝑓(𝑥𝑡), i.e.,

𝔼[𝑔(𝑥𝑡,𝜉𝑡)]=∇𝑓(𝑥𝑡)

and that the stochastic gradient is bounded, i.e. Assumption 10 holds. Consider the squared distance to the optimal solution 𝑥∗:

‖𝑥𝑡+1−𝑥∗‖22=‖𝑥𝑡−𝜂𝑔(𝑥𝑡,𝜉𝑡)−𝑥∗‖22=‖𝑥𝑡−𝑥∗‖22−2𝜂⟨𝑔(𝑥𝑡,𝜉𝑡),𝑥𝑡−𝑥∗⟩+𝜂2‖𝑔(𝑥𝑡,𝜉𝑡)‖22

Taking expectation with respect to 𝜉𝑡, we have

𝔼[‖𝑥𝑡+1−𝑥∗‖22]=‖𝑥𝑡−𝑥∗‖22−2𝜂⟨∇𝑓(𝑥𝑡),𝑥𝑡−𝑥∗⟩+𝜂2𝔼[‖𝑔(𝑥𝑡,𝜉𝑡)‖22]≤‖𝑥𝑡−𝑥∗‖22−2𝜂(𝑓(𝑥𝑡)−𝑓(𝑥∗))+𝜂2𝐺2

Take 𝜂=1√𝑡, we have

𝔼[‖𝑥𝑡+1−𝑥∗‖22]≤‖𝑥𝑡−𝑥∗‖22−2√𝑡(𝑓(𝑥𝑡)−𝑓(𝑥∗))+𝐺2𝑡

3.4 Strongly Convex and Possibly Non-smooth SGD

We assume that 𝑓 is 𝜇-strongly convex and that the stochastic gradient is bounded, i.e. Assumption 10 holds. Consider the squared distance to the optimal solution 𝑥∗:

‖𝑥𝑡+1−𝑥∗‖22=‖𝑥𝑡−𝜂𝑔(𝑥𝑡,𝜉𝑡)−𝑥∗‖22=‖𝑥𝑡−𝑥∗‖22−2𝜂⟨𝑔(𝑥𝑡,𝜉𝑡),𝑥𝑡−𝑥∗⟩+𝜂2‖𝑔(𝑥𝑡,𝜉𝑡)‖22

Taking expectation with respect to 𝜉𝑡, we have

𝔼[‖𝑥𝑡+1−𝑥∗‖22]=‖𝑥𝑡−𝑥∗‖22−2𝜂⟨∇𝑓(𝑥𝑡),𝑥𝑡−𝑥∗⟩+𝜂2𝔼[‖𝑔(𝑥𝑡,𝜉𝑡)‖22]≤‖𝑥𝑡−𝑥∗‖22−2𝜂(𝑓(𝑥𝑡)−𝑓(𝑥∗))+𝜂2𝐺2≤‖𝑥𝑡−𝑥∗‖22−2𝜂𝜇2‖𝑥𝑡−𝑥∗‖22+𝜂2𝐺2=(1−𝜇𝜂)‖𝑥𝑡−𝑥∗‖22+𝜂2𝐺2

Take 𝜂=1𝜇𝑡, we have

𝔼[‖𝑥𝑡+1−𝑥∗‖22]≤(1−1𝑡)‖𝑥𝑡−𝑥∗‖22+𝐺2𝜇2𝑡2

3.5 Smooth and Non-convex SGD

We assume that 𝑓 is L-smooth and that the stochastic gradient has bounded variance, i.e. Assumption 11 holds. By descent lemma, we have

𝑓(𝑥𝑡+1)≤𝑓(𝑥𝑡)+∇𝑓(𝑥𝑡)𝑇(𝑥𝑡+1−𝑥𝑡)+𝐿2‖𝑥𝑡+1−𝑥𝑡‖22=𝑓(𝑥𝑡)−𝜂∇𝑓(𝑥𝑡)𝑇𝑔(𝑥𝑡,𝜉𝑡)+𝐿𝜂22‖𝑔(𝑥𝑡,𝜉𝑡)‖22

Taking expectation with respect to 𝜉𝑡, we have

𝔼[𝑓(𝑥𝑡+1)]≤𝑓(𝑥𝑡)−𝜂‖∇𝑓(𝑥𝑡)‖22+𝐿𝜂22𝔼[‖𝑔(𝑥𝑡,𝜉𝑡)‖22]≤𝑓(𝑥𝑡)−𝜂‖∇𝑓(𝑥𝑡)‖22+𝐿𝜂22(‖∇𝑓(𝑥𝑡)‖22+𝜎2)=𝑓(𝑥𝑡)−(𝜂−𝐿𝜂22)‖∇𝑓(𝑥𝑡)‖22+𝐿𝜂2𝜎22

Take 𝜂=1𝐿, we have

𝔼[𝑓(𝑥𝑡+1)]≤𝑓(𝑥𝑡)−12𝐿‖∇𝑓(𝑥𝑡)‖22+𝜎22𝐿.

3.6 Smooth and Strongly Convex SGD

We assume that 𝑓 is L-smooth and 𝜇-strongly convex, and that the stochastic gradient has bounded variance, i.e. Assumption 11 holds. By descent lemma, we have

𝑓(𝑥𝑡+1)≤𝑓(𝑥𝑡)+∇𝑓(𝑥𝑡)𝑇(𝑥𝑡+1−𝑥𝑡)+𝐿2‖𝑥𝑡+1−𝑥𝑡‖22=𝑓(𝑥𝑡)−𝜂∇𝑓(𝑥𝑡)𝑇𝑔(𝑥𝑡,𝜉𝑡)+𝐿𝜂22‖𝑔(𝑥𝑡,𝜉𝑡)‖22

Taking expectation with respect to 𝜉𝑡, we have

𝔼[𝑓(𝑥𝑡+1)]≤𝑓(𝑥𝑡)−𝜂‖∇𝑓(𝑥𝑡)‖22+𝐿𝜂22𝔼[‖𝑔(𝑥𝑡,𝜉𝑡)‖22]≤𝑓(𝑥𝑡)−𝜂‖∇𝑓(𝑥𝑡)‖22+𝐿𝜂22(‖∇𝑓(𝑥𝑡)‖22+𝜎2)=𝑓(𝑥𝑡)−(𝜂−𝐿𝜂22)‖∇𝑓(𝑥𝑡)‖22+𝐿𝜂2𝜎22

Applying Proposition 7, we have

𝔼[𝑓(𝑥𝑡+1)]−𝑓(𝑥∗)≤𝑓(𝑥𝑡)−𝑓(𝑥∗)−(𝜂−𝐿𝜂22)2𝜇(𝑓(𝑥𝑡)−𝑓(𝑥∗))+𝐿𝜂2𝜎22=(1−2𝜇𝜂+𝐿𝜇𝜂2)(𝑓(𝑥𝑡)−𝑓(𝑥∗))+𝐿𝜂2𝜎22

Take 𝜂=1𝐿, we have

𝔼[𝑓(𝑥𝑡+1)]−𝑓(𝑥∗)≤(1−𝜇𝐿)(𝑓(𝑥𝑡)−𝑓(𝑥∗))+𝜎22𝐿.

4 Solve the Recursion

In last section, we have derived some one-step inequalities for different scenarios. In this section, we will solve these recursions to get the convergence rates of GD and SGD. For the recursion of smooth and convex GD, we have

‖𝑥𝑡+1−𝑥∗‖22≤‖𝑥𝑡−𝑥∗‖22−2𝐿(𝑓(𝑥𝑡)−𝑓(𝑥∗))

Summing up the above inequality from 𝑡=0 to 𝑡=𝑇−1, we have

‖𝑥𝑇−𝑥∗‖22≤‖𝑥0−𝑥∗‖22−2𝐿𝑇−1∑𝑡=0(𝑓(𝑥𝑡)−𝑓(𝑥∗))

Thus, we have

1𝑇𝑇−1∑𝑡=0(𝑓(𝑥𝑡)−𝑓(𝑥∗))≤𝐿2𝑇‖𝑥0−𝑥∗‖22

By convexity of 𝑓, we have

𝑓(1𝑇𝑇−1∑𝑡=0𝑥𝑡)−𝑓(𝑥∗)≤1𝑇𝑇−1∑𝑡=0(𝑓(𝑥𝑡)−𝑓(𝑥∗))≤𝐿2𝑇‖𝑥0−𝑥∗‖22

Thus, we have the convergence rate of smooth and convex GD:

𝑓(1𝑇𝑇−1∑𝑡=0𝑥𝑡)−𝑓(𝑥∗)≤O(1𝑇)

For the recursion of smooth and strongly convex GD, we have

𝑓(𝑥𝑡+1)−𝑓(𝑥∗)≤(1−𝜇𝐿)(𝑓(𝑥𝑡)−𝑓(𝑥∗))

By induction, we have

𝑓(𝑥𝑡)−𝑓(𝑥∗)≤(1−𝜇𝐿)𝑡(𝑓(𝑥0)−𝑓(𝑥∗))

Thus, we have the convergence rate of smooth and strongly convex GD:

𝑓(𝑥𝑡)−𝑓(𝑥∗)≤O((1−𝜇𝐿)𝑡)

For the distance convergence of smooth and strongly convex GD, we have

‖𝑥𝑡+1−𝑥∗‖22≤(𝜇−𝐿𝜇+𝐿)2‖𝑥𝑡−𝑥∗‖22

By induction, we have

‖𝑥𝑡−𝑥∗‖22≤(𝜇−𝐿𝜇+𝐿)2𝑡‖𝑥0−𝑥∗‖22

Thus, we have the distance convergence rate of smooth and strongly convex GD:

‖𝑥𝑡−𝑥∗‖22≤O((𝜇−𝐿𝜇+𝐿)2𝑡)

For the recursion of convex and possibly non-smooth SGD, we have

𝔼[‖𝑥𝑡+1−𝑥∗‖22]≤‖𝑥𝑡−𝑥∗‖22−2√𝑡(𝑓(𝑥𝑡)−𝑓(𝑥∗))+𝐺2𝑡

Summing up the above inequality from 𝑡=0 to 𝑡=𝑇−1, we have

𝔼[‖𝑥𝑇−𝑥∗‖22]≤‖𝑥0−𝑥∗‖22−2𝑇−1∑𝑡=01√𝑡(𝑓(𝑥𝑡)−𝑓(𝑥∗))+𝐺2𝑇−1∑𝑡=01𝑡

Thus, we have the convergence rate of convex and possibly non-smooth SGD:

𝔼[𝑓(𝑥𝑇)−𝑓(𝑥∗)]≤O(1√𝑇)

For the recursion of strongly convex and possibly non-smooth SGD, we have

𝔼[‖𝑥𝑡+1−𝑥∗‖22]≤(1−1𝑡)‖𝑥𝑡−𝑥∗‖22+𝐺2𝜇2𝑡2

By induction, we have

𝔼[‖𝑥𝑡−𝑥∗‖22]≤𝐺2𝜇2𝑡

Thus, we have the convergence rate of strongly convex and possibly non-smooth SGD:

𝔼[𝑓(𝑥𝑇)−𝑓(𝑥∗)]≤O(1𝑇)

For the recursion of smooth and non-convex SGD, we have

𝔼[𝑓(𝑥𝑡+1)]≤𝑓(𝑥𝑡)−12𝐿‖∇𝑓(𝑥𝑡)‖22+𝜎22𝐿

Summing up the above inequality from 𝑡=0 to 𝑡=𝑇−1, we have

𝔼[𝑓(𝑥𝑇)]≤𝑓(𝑥0)−12𝐿𝑇−1∑𝑡=0‖∇𝑓(𝑥𝑡)‖22+𝑇𝜎22𝐿

Thus, we have the convergence rate of smooth and non-convex SGD:

1𝑇𝑇−1∑𝑡=0𝔼[|∇𝑓(𝑥𝑡)‖22]≤O(1√𝑇)

For the recursion of smooth and strongly convex SGD, we have

𝔼[𝑓(𝑥𝑡+1)]−𝑓(𝑥∗)≤(1−𝜇𝐿)(𝑓(𝑥𝑡)−𝑓(𝑥∗))+𝜎22𝐿

By induction, we have

𝔼[𝑓(𝑥𝑡)]−𝑓(𝑥∗)≤(1−𝜇𝐿)𝑡(𝑓(𝑥0)−𝑓(𝑥∗))+𝜎22𝐿𝑡−1∑𝑖=0(1−𝜇𝐿)𝑖

Thus, we have the convergence rate of smooth and strongly convex SGD:

𝔼[𝑓(𝑥𝑡)]−𝑓(𝑥∗)≤O((1−𝜇𝐿)𝑡)+O(𝜎2𝜇)