Dive into Deep Learning · §35.1
Gradient Descent and Curvature
steepest descent · L-smoothness · descent lemma · condition number · heavy-ball & Nesterov momentum
Motivation
On f(x, y) = \tfrac12(x^2 + 10y^2) from \mathbf{x}_0 = (2, 1) (f = 7, \nabla f = (2, 10)), -\nabla f fixes the direction while \eta sets the step length:
Steepest Descent
Expanding f around \mathbf{x} along a unit vector \|\mathbf{d}\| = 1 for small \eta > 0:
f(\mathbf{x} + \eta\,\mathbf{d}) = f(\mathbf{x}) + \eta\,\nabla f(\mathbf{x})^\top \mathbf{d} + o(\eta)
Steepest Descent
On f(x, y) = \tfrac12(x^2 + 10y^2) at (2, 1), the normalized negative gradient is (-0.196, -0.981) with directional slope -\|\nabla f\| = -10.198. Over a short step \eta = 0.01, actual loss changes track \eta \nabla f^\top \mathbf{d} within 1\%:
steepest -grad/|grad|: slope = -10.1980, f(x + eta d) - f(x) = -0.101498
diagonal -(1,1)/sqrt(2): slope = -8.4853, f(x + eta d) - f(x) = -0.084578
axis (-1,0): slope = -2.0000, f(x + eta d) - f(x) = -0.019950
uphill +(1,1)/sqrt(2): slope = +8.4853, f(x + eta d) - f(x) = +0.085128
Differentiability alone guarantees descent only for infinitesimally small steps. To certify a finite step size \eta > 0, we must bound how rapidly the gradient itself can change along the step.
Smoothness
A differentiable function f is L-smooth if its gradient is L-Lipschitz (\|\nabla f(\mathbf{x}) - \nabla f(\mathbf{y})\| \le L\|\mathbf{x} - \mathbf{y}\|):
f(\mathbf{y}) \le f(\mathbf{x}) + \nabla f(\mathbf{x})^\top(\mathbf{y} - \mathbf{x}) + \tfrac{L}{2}\|\mathbf{y} - \mathbf{x}\|^2
Smoothness
Substituting the gradient descent update \mathbf{x}_{k+1} = \mathbf{x}_k - \eta\,\mathbf{g}_k (where \mathbf{g}_k = \nabla f(\mathbf{x}_k)) into the quadratic ceiling yields the descent lemma:
f(\mathbf{x}_{k+1}) \le f(\mathbf{x}_k) - \eta\,\|\mathbf{g}_k\|^2 + \tfrac{L}{2}\eta^2\|\mathbf{g}_k\|^2 = f(\mathbf{x}_k) - \eta\left(1 - \tfrac{L\eta}{2}\right)\|\mathbf{g}_k\|^2
Smoothness
On f(x,y) = \tfrac12(x^2 + 10y^2) from (2, 1), we have L = 10 and \|\mathbf{g}_0\|^2 = 104:
eta = 0.01: bound 6.0120, actual 6.0102
eta = 0.10: bound 1.8000, actual 1.6200
eta = 0.25: bound 13.5000, actual 12.3750
Nonconvex Guarantees
Even on nonconvex landscapes, the descent lemma alone prevents the gradient norm from staying large indefinitely when f is bounded below by f_{\mathrm{low}}:
Among the first K iterates, at least one has gradient norm \|\nabla f(\mathbf{x}_k)\| = O(1/\sqrt{K}), requiring only L-smoothness and a lower bound on the objective.
Nonconvex Pitfalls
Without convexity, \nabla f(\mathbf{x}) = \mathbf{0} cannot distinguish a minimum from a saddle point:
Adaptive Step Sizes
When L is unknown or varies locally (e.g., f(x) = \tfrac14 x^4), backtracking line search halves a trial step \eta \leftarrow \eta/2 until the Armijo condition holds (c \in (0, 1)):
f\big(\mathbf{x}_k - \eta\,\nabla f(\mathbf{x}_k)\big) \le f(\mathbf{x}_k) - c\,\eta\,\|\nabla f(\mathbf{x}_k)\|^2
Adaptive Step Sizes
On f(x) = \tfrac14 x^4 from x_0 = 3 with c = \tfrac12, the update x \mapsto x(1 - \eta x^2) contracts |x| if and only if \eta x_0^2 < 2 (\eta < 2/9 \approx 0.22), whereas local curvature at x_0 = 3 is f''(3) = 27:
fixed eta = 0.3 from x0 = 3: |x_6| = 6.52e+103 (diverged)
accepted steps: [0.03125 0.0625 0.125 0.25 0.5 1. 1. 1. ] ...
backtracking from x0 = 3: f(x_25) = 1.09e-04 (monotone descent)
A fixed step \eta = 0.3 (safe near the origin) explodes to 6.5 \times 10^{103} in 6 steps from x_0 = 3. Backtracking starts at \eta = 0.031 < 1/27 and automatically doubles \eta as the iterate enters flatter regions near zero.
Quadratic Geometry
Near any strict local minimizer \mathbf{x}^\star with positive-definite Hessian \mathbf{A} = \nabla^2 f(\mathbf{x}^\star) \succ \mathbf{0}, shifting \mathbf{x}^\star to the origin yields the canonical quadratic model:
f(\mathbf{x}) = \tfrac12\,\mathbf{x}^\top \mathbf{A}\,\mathbf{x}
Quadratic Geometry
Because \nabla f(\mathbf{x}) = \mathbf{A}\mathbf{x}, gradient descent applies the linear operator \mathbf{x}_{k+1} = (\mathbf{I} - \eta\mathbf{A})\mathbf{x}_k. Expanding \mathbf{x}_k in the orthonormal eigenbasis of \mathbf{A} with coordinates u_i^{(k)} decouples the d variables completely:
u_i^{(k+1)} = (1 - \eta\lambda_i)\,u_i^{(k)} \implies u_i^{(k)} = (1 - \eta\lambda_i)^k\,u_i^{(0)}
Quadratic Geometry
On \mathbf{A} = \mathrm{diag}(1, 10) from \mathbf{x}_0 = (1, 1), the stability ceiling is 2/\lambda_{\max} = 0.20:
eta |1-eta*1| |1-eta*10| spectral radius |x_60|
0.020 0.980 0.800 0.980 3.0e-01
0.100 0.900 0.000 0.900 1.8e-03
0.182 0.818 0.818 0.818 8.3e-06
0.190 0.810 0.900 0.900 1.8e-03
0.200 0.800 1.000 1.000 1.0e+00
0.210 0.790 1.100 1.100 3.0e+02
Quadratic Geometry
Because \lambda \mapsto |1 - \eta\lambda| is V-shaped on [\lambda_{\min}, \lambda_{\max}], \rho(\eta) is minimized by equalizing the contraction magnitudes at the two endpoints:
1 - \eta^\star\lambda_{\min} = \eta^\star\lambda_{\max} - 1 \implies \eta^\star = \frac{2}{\lambda_{\min} + \lambda_{\max}}
Deep Learning Dynamics
Rate Hierarchy
Adding structural assumptions on f upgrades gradient descent (\eta = 1/L) from local stationarity to global optimality and geometric convergence:
| Objective Class | Mathematical Assumption | Guaranteed Rate at \eta = 1/L | Steps for Accuracy \epsilon |
|---|---|---|---|
| Smooth Nonconvex | \nabla f is L-Lipschitz, f \ge f_{\mathrm{low}} | \min_{k < K}\|\nabla f(\mathbf{x}_k)\|^2 \le \frac{2L(f_0 - f_{\mathrm{low}})}{K} | O(1/\epsilon^2) for \|\nabla f\| \le \epsilon |
| Smooth Convex | L-smooth and \nabla^2 f(\mathbf{x}) \succeq \mathbf{0} | f(\mathbf{x}_k) - f^\star \le \frac{L\|\mathbf{x}_0 - \mathbf{x}^\star\|^2}{2k} | O(1/\epsilon) for f - f^\star \le \epsilon |
| Strongly Convex | \mu\mathbf{I} \preceq \nabla^2 f(\mathbf{x}) \preceq L\mathbf{I} (\kappa = L/\mu) | f(\mathbf{x}_k) - f^\star \le (1 - 1/\kappa)^k(f_0 - f^\star) | O(\kappa \log(1/\epsilon)) |
| Quadratic at \eta^\star | f(\mathbf{x}) = \tfrac12\mathbf{x}^\top\mathbf{A}\mathbf{x}, \eta^\star = \frac{2}{\mu + L} | f(\mathbf{x}_k) - f^\star \le \bigl(\frac{\kappa - 1}{\kappa + 1}\bigr)^{2k}(f_0 - f^\star) | \approx \frac{\kappa}{4}\log(1/\epsilon) for f - f^\star |
Momentum
Gradient descent takes O(\kappa) steps because a memoryless step cannot damp steep oscillations without starving flat directions. Polyak’s heavy-ball momentum maintains an exponentially weighted velocity \mathbf{v}_k and updates \mathbf{x}_{k+1} = \mathbf{x}_k + \mathbf{v}_{k+1}:
\mathbf{v}_{k+1} = \beta\,\mathbf{v}_k - \eta\,\nabla f(\mathbf{x}_k)
Momentum Analysis
In the eigenbasis of a quadratic \tfrac12\mathbf{x}^\top\mathbf{A}\mathbf{x}, each mode u_k with eigenvalue \lambda obeys the second-order linear recurrence u_{k+1} = (1 + \beta - \eta\lambda)u_k - \beta u_{k-1}. Substituting u_k = z^k yields the characteristic equation:
z^2 - (1 + \beta - \eta\lambda)\,z + \beta = 0
Momentum Analysis
Placing the extreme eigenvalues \lambda_{\min} and \lambda_{\max} right at the endpoints of the complex-root interval, \eta\lambda_{\min} = (1 - \sqrt{\beta})^2 and \eta\lambda_{\max} = (1 + \sqrt{\beta})^2, forces every mode onto the circle of radius \sqrt{\beta^\star} with step size \eta_{\mathrm{HB}} = 4 / (\sqrt{\lambda_{\max}} + \sqrt{\lambda_{\min}})^2:
\beta^\star = \left(\frac{\sqrt{\kappa} - 1}{\sqrt{\kappa} + 1}\right)^{\!2}
Accelerated Methods
Nesterov’s accelerated gradient evaluates \nabla f at the look-ahead point \tilde{\mathbf{x}}_k = \mathbf{x}_k + \beta\mathbf{v}_k:
\mathbf{v}_{k+1} = \beta\,\mathbf{v}_k - \eta\,\nabla f(\mathbf{x}_k + \beta\,\mathbf{v}_k)
Empirical Verification
Measuring the exact number of iterations required to reach \|\mathbf{x}_k\| \le 10^{-6}\|\mathbf{x}_0\| on \mathrm{diag}(1, \kappa) from (1, 1) confirms the linear \kappa vs. \sqrt{\kappa} scaling laws:
kappa GD heavy ball Nesterov GD/kappa HB/sqrt(kappa)
10 69 27 43 6.9 8.5
100 691 93 155 6.9 9.3
1000 6908 315 508 6.9 10.0
Concept Check
Consider the quadratic objective f(x_1, x_2) = \tfrac12(x_1^2 + 100\,x_2^2) with eigenvalues \lambda_{\min} = 1, \lambda_{\max} = 100 (\kappa = 100):
Answers: (1) Stability ceiling: 2/L = 0.02. Optimal step: \eta^\star = 2/(1 + 100) = 2/101 \approx 0.0198. Contraction factor: \rho(\eta^\star) = 99/101 \approx 0.9802. (2) \log(10^6)/\log(101/99) \approx \frac{100}{2}\ln(10^6) \approx 691 steps. (3) With \sqrt{\kappa} = 10, \rho_{\mathrm{HB}} = (10 - 1)/(10 + 1) = 9/11 \approx 0.818. Pure geometric decay predicts 69 steps, and the double-root factor k\rho_{\mathrm{HB}}^k adds \frac{\sqrt{\kappa}}{2}\ln k \approx 24 steps, matching the measured 93 steps.
Key Takeaways
| Method / Concept | Step Rule / Formula | Contraction / Guarantee | Core Takeaway |
|---|---|---|---|
| Descent Lemma | \mathbf{x}_{k+1} = \mathbf{x}_k - \eta\mathbf{g}_k, 0 < \eta < 2/L | \Delta f \le -\eta(1 - L\eta/2)\|\mathbf{g}_k\|^2 | Steepest curvature L caps the safe step at 2/L |
| Backtracking (Armijo) | Halve \eta until f(\mathbf{x} - \eta\mathbf{g}) \le f(\mathbf{x}) - c\eta\|\mathbf{g}\|^2 | Finds \eta \ge \min(\eta_0, (1-c)/L_{\mathrm{loc}}) | Adapts to local curvature without knowing L |
| Optimal Fixed-Step GD | \eta^\star = \frac{2}{\lambda_{\min} + \lambda_{\max}} | \rho_{\mathrm{GD}} = \frac{\kappa - 1}{\kappa + 1} \approx 1 - \frac{2}{\kappa} | Iteration count scales linearly with \kappa = L/\mu |
| Heavy-Ball Momentum | \mathbf{v}_{k+1} = \beta^\star\mathbf{v}_k - \eta_{\mathrm{HB}}\mathbf{g}_k | \rho_{\mathrm{HB}} = \frac{\sqrt{\kappa} - 1}{\sqrt{\kappa} + 1} \approx 1 - \frac{2}{\sqrt{\kappa}} | Complex roots equalize all modes at modulus \sqrt{\beta^\star} |
| Nesterov Look-Ahead | \mathbf{v}_{k+1} = \beta\mathbf{v}_k - \frac{1}{L}\nabla f(\mathbf{x}_k + \beta\mathbf{v}_k) | \rho_{\mathrm{NAG}} = 1 - \frac{1}{\sqrt{\kappa}} (O(1/k^2) if \mu=0) | Achieves optimal O(\sqrt{\kappa}) globally beyond quadratics |