Gradient Descent

If wee initialize the parameters at some w0∈Rdw_0 \in \mathbb{R}^d, the gradient descent algorithm updates the parameters as follows:

wt+1=wt−η∇L(wt)w_{t+1} = w_t - \eta \nabla L(w_t)

where η\eta is the learning rate and ∇L(wt)\nabla L(w_t) is the gradient of the loss function LL at wtw_t.

It decreases the value of the loss at each iteration, as long as the learning rate is small enough and the value of the gradient is nonzero. Eventually, this should result in gradient descent coming close to a point where the gradient is zero.

We can prove that gradient descent works under the assumption that the second derivative of the objective is bounded. Suppose that for some constant μ>0\mu > 0, for all xx in the space and for any vector vv in Rd\mathbb{R}^d,

∣vT∇2L(x)v∣≤μ∥v∥2.|v^T \nabla^2 L(x) v| \leq \mu \|v\|^2. Here, ∇2L(x)\nabla^2 L(x) denotes the matrix of partial derivatives of the loss function LL. This is equivalent to the condition that ∥∇2L(x)∥2≤μ\| \nabla^2 L(x) \|_2 \leq \mu

Starting from this condition, let’s look at how the objective changes over time as we run gradient descent with a fixed step size. From Taylor’s theorem, there exists a ξ\xi such that

L(wt+1)=L(wt−η∇L(wt))L(w_{t+1}) = L(w_t - \eta \nabla L(w_t)) =L(ut)−η(∇f(ut))T∇L(ut)+12η2(∇L(ut))T∇2L(ξt)(∇L(ut))= L(u_t) - \eta (\nabla f(u_t))^T \nabla L(u_t) + \frac{1}{2} \eta^2 (\nabla L(u_t))^T \nabla^2 L(\xi_t) (\nabla L(u_t)) ≤L(ut)−η∥∇L(ut)∥2+η2L2∥∇L(ut)∥2=f(ut)−η(1−ηL2)∥∇f(ut)∥2.\leq L(u_t) - \eta \|\nabla L(u_t)\|^2 + \frac{\eta^2 L}{2} \|\nabla L(u_t)\|^2 = f(u_t) - \eta ( 1 - \frac{\eta L}{2} ) \|\nabla f(u_t)\|^2.

If we choose our step size η\eta to be small enough that 1>ηL1 > \eta L, then,

L(ut+1)≤L(ut)−η2∥∇L(ut)∥2L(u_{t+1}) \leq L(u_t) - \frac{\eta}{2} \|\nabla L(u_t)\|^2 η2∥∇L(ut)∥2≤L(ut)−L(ut+1)\frac{\eta}{2} \|\nabla L(u_t)\|^2 \leq L(u_t) - L(u_{t+1})

The objective is guaranteed to decrease at each iteration.

Now, if we sum this up across TT iterations of gradient descent, we get

η2∑t=0T−1∥∇L(ut)∥2≤∑t=0T−1(L(ut)−L(ut+1))=L(u0)−f(uT)≤L(u0)−L∗\frac{\eta}{2 } \sum_{t=0}^{T-1} \|\nabla L(u_t)\|^2 \leq \sum_{t=0}^{T-1} (L(u_t) - L(u_{t+1})) = L(u_0) - f(u_T) \leq L(u_0) - L^*

where L∗L^* is the global minimum value of the loss function LL. From here, we can get

min⁡t∈{0,...,T}∥∇L(ut)∥2≤1T∑t=0T−1∥∇L(ut)∥2≤2(L(u0)−L∗)ηT.\min_{t \in \{0, ..., T\}} \|\nabla L(u_t)\|^2 \leq \frac{1}{T} \sum_{t=0}^{T-1} \|\nabla L(u_t)\|^2 \leq \frac{2(L(u_0) - L^*)}{\eta T}.

This means that the smallest gradient we observe after TT iterations is getting smaller proportional to 1/T1/T. So gradient descent converges (as long as we look at the smallest observed gradient).

We have a metric to measure the rate of this convergence. It is called the condition number (kfk_f) of the function. The condition number is the ratio of the largest eigenvalue of the Hessian matrix to the smallest eigenvalue of the kernel function. If the condition number is large, the function is ill-conditioned and the convergence of gradient descent is slow.

kf=λmax⁡Hλmin⁡Kk_f = \frac{\lambda_{\max} H}{\lambda_{\min} K}

If we take the step size(η\eta) to the inverse of the maximum curvature of the hessian matrix. We have an exponential convergence of the gradient descent algorithm.

L(wt)≤(1−1kf)TL(w0)L(w_t) \leq (1-\frac{1}{k_f})^T L(w_0)

A condition number which is big would mean the loss barely changes each step and a small condition number would mean the loss changes a lot each step.

Proof of this is pretty complicated, take a look here

Stochastic Gradient Descent (SGD)

Mini-Batch Gradient Descent

Adaptive Learning Rates

AdaGrad

RMSProp

Adam

Search notes
Graph View