Convergence of stochastic gradient method

Shuvomoy Das Gupta

December 27, 2022

In this blog, we study convergence of stochastic gradient method.

Problem setup

We are interested in solving the problemNotation

p⋆ = ( minimizex ∈Rdf(x) subject to x ∈ C, ) (𝒫)

where we have the following assumptions regarding the nature of the problem.

Assumption 1

We assume:

  • f : Rd →(−∞, ∞] is a closed, proper, and convex function,
  • C is a nonempty, closed, convex set, with C ⊆intdom f, and
  • argminf(C) = X⋆≠∅.

Stochastic gradient descent

The stochastic gradient descent (SGD) algorithm to solve (𝒫) is described by Algorithm 1 , where we make the following assumption regarding the nature of the oracle.

Assumption 2

We assume that given an iterate xk, the stochastic oracle is capable of producing a random vector gkwith the following properties:

  • (unbiased) ∀ ⁡k≥0E [gk∣xk] ∈ ∂f(xk), and
  • (bounded variance) ∃ ⁡G>0∀ ⁡k≥0E [∥gk∥2∣xk] ≤ G2.

___________________________________________________________

___________________________________________________________

input: f, C, iteration limit K

___________________________________________________________

algorithm:

1. initialization:

pick x0 ∈C arbitrarily

2. main iteration:

for k = 0, 1, 2, … ⁡, K−1

pick stepsizes αk > 0 and random gk ∈Rd satisfying Assumption ??

xk+1 ←ΠC (xk −αkgk) /*ΠC: projection onto the set C/*

end for

3. return xK

___________________________________________________________

Algorithm 1: SGD to solve (𝒫)
___________________________________________________________

Convergence analysis

First, note that, for all k ≥ 0:

E [∥xk+1︷ =ΠC(xk−αkgk) −x⋆︷=ΠC(x⋆)∥2∣xk] = E [∥ΠC (xk −αkgk) −ΠC(x⋆)∥2︷ ≤∥xk−αkgk−x⋆∥2∣xk] ≤ E [∥xk −αkgk −x⋆∥2︷ =∥xk−x⋆∥2+αk2∥gk∥2−2αk ⟨xk−x⋆;gk⟩∣xk] = E [∥xk −x⋆∥2 + αk2∥gk∥2 − 2αk ⟨xk −x⋆; gk⟩∣xk] = E [∥xk −x⋆∥2∣xk] + αk2E [∥gk∥2∣xk] − 2αkE [ ⟨xk −x⋆; gk⟩∣xk] ▹using linearity of expectation = ∥xk −x⋆∥2 + αk2E [∥gk∥2∣xk] − 2αk ⟨xk −x⋆; E [gk∣xk]⟩ ▹using "taking out what’s known" rule E [h(X)Y∣X] = h(X)E [Y∣X] ≤ ∥xk −x⋆∥2 + αk2G2 − 2αk ⟨xk −x⋆; E [gk∣xk]⟩ /* we have E [∥gk∥2∣xk] ≤ G2 ⇔∀ ⁡yf(y) ≥ f(xk) + ⟨E [gk∣xk] ; y−xk⟩ ⇒y ← x⋆f(x⋆) ≥ f(xk) − ⟨E [gk∣xk] ; xk −x⋆⟩ ⇒− ⟨E [gk∣xk] ; xk −x⋆⟩ ≤ f(x⋆) −f(xk) */ = ∥xk −x⋆∥2 + αk2G2 − 2αk (f(xk) −f(x⋆)) ,

So, we have proved

E [∥xk+1 −x⋆∥2∣xk] ≤∥xk −x⋆∥2 + αk2G2 − 2αk (f(xk) −f(x⋆)) ,

so taking expectation with respect to xk on both sides, we get:

E [E [∥xk+1 −x⋆∥2∣xk]] = E [∥xk+1 −x⋆∥2 ] ▹using Adam’s lawE [E [Y∣X]] = E [Y ] ≤ E [∥xk −x⋆∥2 + αk2G2 − 2αk (f(xk) −f(x⋆))] = E [∥xk −x⋆∥2 ] − 2αkE [f(xk) −f(x⋆)] + αk2G2,

so

E [∥xk+1 −x⋆∥2 ] −E [∥xk −x⋆∥2 ] ≤−2αkE [f(xk) −f(x⋆)] + αk2G2.

Now, let us do a telescoping sum:

E [∥xk+1 −x⋆∥2 ] −E [∥xk −x⋆∥2 ] ≤−2αkE [f(xk) −f(x⋆)] + αk2G2 E [∥xk −x⋆∥2 ] −E [∥xk−1 −x⋆∥2 ] ≤−2αkE [f(xk−1) −f(x⋆)] + αk−12G2 ⋮ ⁡ ⋮ ⁡ E [∥xm+1 −x⋆∥2 ] −E [∥xm −x⋆∥2 ] ≤−2αmE [f(xm) −f(x⋆)] + αm2G2,

and adding the equations above, we get:

E [∥xk+1 −x⋆∥2 ] −E [∥xm −x⋆∥2 ] ≤−2 ∑i=mkαiE [f(xi) −f(x⋆)] + G2 ∑i=mkαi2 ⇔0 ≤E [∥xk+1 −x⋆∥2 ] ≤E [∥xm −x⋆∥2 ] − 2 ∑i=mkαiE [f(xi) −f(x⋆)] + G2 ∑i=mkαi2 ⇒0 ≤E [∥xm −x⋆∥2 ] − 2 ∑i=mkαiE [f(xi) −f(x⋆)] + G2 ∑i=1mαi2 ⇔∑i=mkαiE [f(xi) −f(x⋆)] ≤1 2 (E [∥xm −x⋆∥2 ] + G2 ∑i=mkαi2 ) ⇒ (∑i=mkαi) (min ⁡ i∈{m,… ⁡ ,k}E [f(xi) −f(x⋆)]) ≤1 2 (E [∥xm −x⋆∥2 ] + G2 ∑i=mkαi2 ) ▹ for bk ≥ 0, we have (min ⁡ kak)∑kbk ≤∑kakbk ⇒E [min ⁡ i∈{m,… ⁡ ,k} {f(xi) −f(x⋆)}] ≤ min ⁡ i∈{m,… ⁡ ,k}E [f(xi) −f(x⋆)] ≤E [∥xm −x⋆∥2 ] + G2 ∑i=mkαi2 2 ∑i=mkαi . ▹ using E [min ⁡ iXi] ≤min ⁡ iE [Xi]

In the last inequality, m is arbitrary, so set m ← 0, which leads to:

E [min ⁡ i∈{0,… ⁡ ,k}f(xi)] −f(x⋆) ≤E [∥x0 −x⋆∥2 ] + G2 ∑i=0kαi2 2 ∑i=0kαi ,

so if we have ∑ ⁡i=0kαi2 < ∞ and ∑ ⁡i=0kαi = ∞, then we have

E [min ⁡ i∈{0,… ⁡ ,k}f(xi)] → f(x⋆).

Pdf

A pdf of the blog is available here.