The original article is in Chinese. The English version is automatically translated by AI.
0x00 Preface# This article focuses on convergence analysis in deep learning. As the third part, it mainly covers convergence proofs for stochastic gradient descent in deep learning . Compared with gradient descent in the previous post (Part 2) , proving convergence for stochastic gradient descent is more involved because the gradient is random, so we need to introduce random variables and assumptions. Several definitions for SGD were already covered in Part 1 .
Copy the previous definitions below:
Gradient Unbiased Estimate Assumption# $$
\mathbb{E}[g(w;\xi)] = \nabla f(w)
$$
Gradient Bounded Variance Assumption# $$
\mathrm {Var}(\nabla f(w;\xi)) \leq \sigma^2
$$
Combined with the calculation above, we get
$$
\mathbb{E}_{\xi}[||g(w; \xi)||^2] \leq ||\nabla f(w)||^{2} + \frac{\sigma^2}{b}
$$
0x01 Smooth and Strongly Convex with mini-batch SGD# defination
Suppose the objective $f$ is $\mu$-strongly convex and $L$-smooth on $R^{d}$, and satisfies the unbiased gradient estimate and bounded gradient variance assumptions. When the step size satisfies $\eta \leq \frac{1}{L}$ and the starting point is $w_0$, after $t$ steps of mini-batch SGD, $\mathbb{E}[f(w_{t})]$ is bounded as:$$
\mathbb{E}[f(w_{t})] - f(w^{*}) - \frac{\eta L \sigma^{2}}{2\mu b} \leq (1- \eta \mu)^{t}\left (\mathbb{E}[f(w_{0})] - f(w^{*}) - \frac{\eta L \sigma^{2}}{2\mu b} \right )
$$
Proof :
By smoothness:
$$
\begin{align}
f(w_{t+1}) - f(w_{t})&\leq \nabla f(w_{t})^{\top}(w_{t+1} - w_{t}) + \frac{L}{2}||w_{t+1} - w_{t}||^{2} \\
&= -\eta \nabla f(w_{t})^{\top}g(w_{t}; \xi_{t}) + \frac{L}{2}||-\eta g(w_{t}; \xi_{t})||^{2} \\
&= -\eta \nabla f(w_{t})^{\top}g(w_{t}; \xi_{t}) + \frac{L\eta^{2}}{2} ||g(w_{t}; \xi_{t})||^{2} \\
\end{align}
$$
Taking expectations on both sides:
$$
\begin{align}
\mathbb{E}[f(w_{t+1}) - f(w_{t})] &\leq -\eta \mathbb{E}[\nabla f(w_{t})^{\top}g(w_{t}; \xi_{t})] + \frac{L\eta^{2}}{2} \mathbb{E}[||g(w_{t}; \xi_{t})||^{2}] \\
\mathbb{E}[f(w_{t+1})] - \mathbb{E}[f(w_{t})] &\leq -\eta \mathbb{E}[||\nabla f(w_{t})||^{2}] + \frac{L\eta^{2}}{2}\mathbb{E}[||\nabla f(w_{t})||^{2}] + \frac{L\eta^{2} \sigma^{2}}{2b} \\
&= (\eta-\frac{L\eta^{2}}{2}) (-\mathbb{E}[||\nabla f(w_{t})||^{2}]) + \frac{L\eta^{2} \sigma^{2}}{2b}
\end{align}
$$
This is pretty similar to GD: taking $\eta\leq\frac{1}{L}$ and applying strong convexity gives:
$$
\begin{align}
\mathbb{E}[f(w_{t+1})] - \mathbb{E}[f(w_{t})] &\leq \frac{\eta}{2}(-\mathbb{E}[||\nabla f(w_{t})||^{2}]) + \frac{L\eta^{2} \sigma^{2}}{2b} \\
&\leq \frac{\eta}{2}(-2\mu(\mathbb{E}[f(w_{t})]-f^{*})) + \frac{L\eta^{2} \sigma^{2}}{2b} \\
&= -\eta\mu(\mathbb{E}[f(w_{t})]-f^{*}) + \frac{L\eta^{2} \sigma^{2}}{2b} \\
\end{align}
$$
Adding $+f^{}-f^{ }$ to both sides gives
$$
\mathbb{E}[f(w_{t+1})] - f^{*} \leq (1-\eta\mu)(\mathbb{E}[f(w_{t})]-f^{*}) + \frac{L\eta^{2} \sigma^{2}}{2b}
$$
Next we need to shift the constant term; again let an unknown $x$ satisfy
$$
\mathbb{E}[f(w_{t+1})] - f^{*} + x \leq (1-\eta\mu)(\mathbb{E}[f(w_{t})]-f^{*} + x)
$$
That is,
$$
(1-\eta\mu)x - x = \frac{L\eta^{2} \sigma^{2}}{2b} \\
x = - \frac{L\eta \sigma^{2}}{2\mu b}
$$
So
$$
\mathbb{E}[f(w_{t+1})] - f^{*} - \frac{L\eta \sigma^{2}}{2\mu b} \leq (1-\eta\mu)(\mathbb{E}[f(w_{t})]-f^{*} - \frac{L\eta \sigma^{2}}{2\mu b})
$$
Which yields
$$
\mathbb{E}[f(w_{t})] - f(w^{*}) - \frac{\eta L \sigma^{2}}{2\mu b} \leq (1- \eta \mu)^{t}\left (\mathbb{E}[f(w_{0})] - f(w^{*}) - \frac{\eta L \sigma^{2}}{2\mu b} \right )
$$
Q.E.D.
0x02 Non-convex with mini-batch SGD# defination
Suppose the objective $f$ is $L$-smooth on $R^{d}$ and satisfies the unbiased gradient estimate and bounded gradient variance assumptions. When the step size satisfies $\eta \leq \frac{1}{L}$ and the starting point is $w_0$, after $t$ steps of mini-batch SGD, the expected average squared gradient norm of $f$ is bounded as:$$
\mathbb{E}\left[\frac{1}{t}\sum_{i=0}^{t-1} ||\nabla f(w_{i})||^{2}\right] \leq \frac{L \eta \sigma^{2}}{b} + \frac{2(f(w_{0})-f(w_{\inf}))}{t\eta}
$$
Proof :
Starting directly from the $L$-smoothness inequality above with $\eta \leq \frac{1}{L}$:
$$
\mathbb{E}[f(w_{t+1})] - \mathbb{E}[f(w_{t})] \leq -\frac{\eta}{2} \mathbb{E}[||\nabla f(w_{t})||^{2}] + \frac{L\eta^{2} \sigma^{2}}{2b}
$$
Summing both sides and dividing by $t$ gives
$$
\begin{align}
\frac{1}{t}\sum_{i=0}^{t-1} (\mathbb{E}[f(w_{i+1})] - \mathbb{E}[f(w_{i})]) &\leq -\frac{\eta }{2t}\sum_{i=0}^{t-1} \mathbb{E}[||\nabla f(w_{i})||^{2}] + \frac{L\eta^{2} \sigma^{2}}{2b} \\
\frac{1}{t} \sum_{i=0}^{t-1} \mathbb{E}[||\nabla f(w_{i})||^{2}] &\leq -\frac{2\mathbb{E}[f(w_{t})-f(w_{0})]}{\eta t} + \frac{L\eta \sigma^{2}}{b} \\
&\leq \frac{2(f(w_{0})-f(w_{\inf}))}{\eta t} + \frac{L\eta \sigma^{2}}{b}
\end{align}
$$
Q.E.D.
Reference#