Skip to main content
© 2026 ePowerAI — free, open courseware. No login required.
CoursesContact
ePOWERAI
CoursesContact
Week 13: Nonconvex Deep Learning
Optimization

Foundations

  1. 01Week 1: Optimization for Learning
  2. 02Week 2: Convex Sets and Functions
  3. 03Week 3: Gradient Descent Theory

Model problems

  1. 04Week 4: Least Squares and Conditioning
  2. 05Week 5: Classification Losses

First-order stack

  1. 06Week 6: Stochastic Gradient Descent
  2. 07Week 7: Momentum and Acceleration
  3. 08Week 8: Adaptive First-Order Methods
  4. 09Week 9: Practical Training Dynamics

Structure

  1. 10Week 10: Nonsmooth and Composite Objectives
  2. 11Week 11: Constraints: Projections and Penalties
  3. 12Week 12: Duality for Practitioners

Nonconvex practice

  1. 13Week 13: Nonconvex Deep Learning
  2. 14Week 14: Capstone — Theory Meets Training
Week 13· Optimization· Nonconvex practice8 min read

Week 13: Nonconvex Deep Learning

Learning Outcomes
  • Classify a critical point as a minimum, saddle or maximum from its Hessian
  • Compute how many extra steps gradient descent spends near a saddle, and explain why a plateau is not a minimum
  • State what overparameterization does to local minima, and which part is proven
  • State how initialization (He, Xavier) and normalization shape the loss surface, and which convex tools still transfer
Prerequisites

Background: Weeks 3, 6–9 (GD theory, SGDStochastic Gradient Descent, AdamAdaptive Moment Estimation (optimizer), training dynamics). The convex theory from Weeks 2–3 is the baseline we now depart from.

Later weeks: The capstone (Week 14) applies the diagnostic lens from this week to real training scenarios in RL and generative models.

Your training loss falls, goes flat, then falls again. The flat stretch was not a local minimum. Descent passed close to a saddle point. The surface below is f(u,v)=(u2−1)2+12(v2−1)2f(u, v) = (u^2 - 1)^2 + \tfrac{1}{2}(v^2 - 1)^2f(u,v)=(u2−1)2+21​(v2−1)2: four minima with f=0f = 0f=0, four saddles and a peak at the origin. Each run starts on the circle of radius 1.6, with step size η=0.05\eta = 0.05η=0.05.

The surface f(u, v) = (u² − 1)² + (v² − 1)²/2 has four minima at (±1, ±1), saddles at (±1, 0) and (0, ±1), and a maximum at the origin. Gradient descent with step size η = 0.05 starts on the circle of radius 1.6 at angle φ. From φ = 10°, gradient descent takes 48 steps and stops at the minimum (1, 1), where f = 0.

From φ = 10°, gradient descent takes 48 steps and stops at the minimum (1, 1), where f = 0.

Drag the start angle φ\varphiφ. From φ=45°\varphi = 45°φ=45° the path reaches the minimum (1,1)(1, 1)(1,1) in 28 steps. Near φ=0°\varphi = 0°φ=0° it heads first for the saddle at (1,0)(1, 0)(1,0), and the dots pile up before the path turns away. At exactly φ=0°\varphi = 0°φ=0° it stops on the saddle.

Why the path stalls near a saddle#

The coordinates descend independently, and the Hessian is diagonal, ∇2f=diag(12u2−4,  6v2−2)\nabla^2 f = \mathrm{diag}(12u^2 - 4,\; 6v^2 - 2)∇2f=diag(12u2−4,6v2−2). A point with ∇f=0\nabla f = 0∇f=0 is a minimum when every eigenvalue is positive, a maximum when every one is negative, and a saddle when the signs are mixed. The origin, with diag(−4,−2)\mathrm{diag}(-4, -2)diag(−4,−2), is a maximum. The point (1,0)(1, 0)(1,0), with diag(8,−2)\mathrm{diag}(8, -2)diag(8,−2), is a saddle.

Near (1,0)(1, 0)(1,0) one step multiplies the offsets:

u−1↦(1−8η)(u−1)=0.6 (u−1),v↦(1+2η) v=1.1 vu - 1 \mapsto (1 - 8\eta)(u - 1) = 0.6\,(u - 1), \qquad v \mapsto (1 + 2\eta)\,v = 1.1\,vu−1↦(1−8η)(u−1)=0.6(u−1),v↦(1+2η)v=1.1v

The uuu offset dies fast, but the vvv offset grows only 10% per step, so the time near the saddle grows as ln⁡(1/v0)/ln⁡1.1\ln(1/v_0) / \ln 1.1ln(1/v0​)/ln1.1. Every factor of 10 closer to the axis costs ln⁡10/ln⁡1.1≈24\ln 10 / \ln 1.1 \approx 24ln10/ln1.1≈24 extra steps. From φ=10°\varphi = 10°φ=10° (v0=0.28v_0 = 0.28v0​=0.28) the scene takes 48 steps. From φ=1°\varphi = 1°φ=1° (v0=0.028v_0 = 0.028v0​=0.028) it takes 72.

At φ=0°\varphi = 0°φ=0°, vvv stays 0. The path converges to the saddle, where the gradient is zero, and a test on ∥∇f∥\|\nabla f\|∥∇f∥ reports success at f=0.5f = 0.5f=0.5. A random start almost never lands on the axis, but nearby starts pay the toll.

at a saddle, ∇f = 0 but curvature changes sign escape attract in high dimensions, most critical points are saddles gradient flow slides off them

At a saddle the Hessian is indefinite. Descent is pulled in along one axis and pushed out along the other.

The common mistake. A flat stretch in the loss curve is read as a local minimum, and the run is stopped. From φ=1°\varphi = 1°φ=1° the loss sits within 0.05 of the saddle value 0.5 for 22 steps, then drops to 0 on its own. A flat loss, or even a zero gradient, does not certify a minimum. A negative Hessian eigenvalue rules one out.

Saddles in high dimensions#

In DDD dimensions a critical point is a minimum only if all DDD Hessian eigenvalues are positive. For random Gaussian landscapes that chance decays exponentially with DDD, and critical points well above the lowest loss are almost all saddles. Dauphin et al. (2014) measured the same pattern in small networks. The scene's arithmetic carries over. A negative eigenvalue −λ-\lambda−λ escapes by a factor 1+ηλ1 + \eta\lambda1+ηλ per step, so a saddle costs time, not convergence. SGD noise also knocks the iterate off the stalling set.

Overparameterization#

A model is overparameterized when it can interpolate its training data, often with more parameters than examples (d≫nd \gg nd≫n). In practice its local minima are mostly near-global. That is a theorem only in special cases, such as deep linear nets (Kawaguchi, 2016), and an empirical finding elsewhere.

Initialization picks the basin#

The scene's start angle is an initialization. It picks the basin. In a network the weight scale also decides whether signal survives: too small and activations vanish, too large and they explode.

  • Xavier/Glorot (tanh, sigmoid): Wij∼U[−a,a]W_{ij} \sim \mathcal{U}[-a, a]Wij​∼U[−a,a] with a=6/(nin+nout)a = \sqrt{6/(n_{\text{in}} + n_{\text{out}})}a=6/(nin​+nout​)​, which keeps activation variance steady across layers.
  • He/Kaiming (ReLU): Wij∼N(0,2/nin)W_{ij} \sim \mathcal{N}(0, 2/n_{\text{in}})Wij​∼N(0,2/nin​). The factor 2 compensates for ReLU zeroing half the units.

Normalization as loss-surface shaping#

Batch Normalization (BNBatch Normalization) normalizes activations over a mini-batch. It was introduced against internal covariate shift (Ioffe & Szegedy, 2015), but its gain survives when that shift is re-injected (Santurkar et al., 2018). The benefit is a smoother loss, with a smaller LLL that allows larger steps. Layer Normalization (LNLayer Normalization) normalizes across the features of each example, at any batch size.

What transfers from convex theory#

Transfers as diagnosis: the step-size scale η≈1/L\eta \approx 1/Lη≈1/L, momentum (Week 7), adaptive methods (Week 8), gradient clipping (Week 9) and early stopping (Week 10).

Does not transfer: global optimality, predicted convergence rates and convex reformulation.

Knowledge check#

Question 1 of 4

Set φ = 0°. Where does gradient descent stop, and why does the stopping test pass?

At the minimum (1, 1)
At the saddle (1, 0), where the gradient is zero
At the peak (0, 0)
It never stops

Browser lab: initialization on XOR#

Train a 2-layer MLP on XOR from He and from tiny initial weights. All-zero weights are a stationary point but not a minimum, so watch for a plateau at ln⁡2≈0.69\ln 2 \approx 0.69ln2≈0.69.

python · runs in browser
import numpy as np
import matplotlib.pyplot as plt

# Try np.random.seed(1): He init stalls at ln 2 / 2 = 0.35. One unit dies and no unit fires on two inputs.
# A 4-unit net is not overparameterized.
np.random.seed(0)

def relu(x): return np.maximum(0, x)
def drelu(x): return (x > 0).astype(float)
def sigmoid(x): return 1 / (1 + np.exp(-x))

X = np.array([[0, 0], [0, 1], [1, 0], [1, 1]]).T
y = np.array([[0, 1, 1, 0]])

def init_weights(d_in, d_hid, d_out, scale_fn):
    W1 = scale_fn(d_in, d_hid)
    b1 = np.zeros((d_hid, 1))
    W2 = scale_fn(d_hid, d_out)
    b2 = np.zeros((d_out, 1))
    return W1, b1, W2, b2

def forward(W1, b1, W2, b2, X):
    z1 = W1 @ X + b1; a1 = relu(z1)
    z2 = W2 @ a1 + b2; a2 = sigmoid(z2)
    return z1, a1, z2, a2

def compute_loss(a2, y):
    return -np.mean(y * np.log(a2 + 1e-12) + (1 - y) * np.log(1 - a2 + 1e-12))

def train(W1, b1, W2, b2, X, y, eta, K):
    losses = []
    for _ in range(K):
        z1, a1, z2, a2 = forward(W1, b1, W2, b2, X)
        losses.append(compute_loss(a2, y))
        dz2 = a2 - y
        dW2 = dz2 @ a1.T / 4; db2 = np.mean(dz2, axis=1, keepdims=True)
        dz1 = (W2.T @ dz2) * drelu(z1)
        dW1 = dz1 @ X.T / 4; db1 = np.mean(dz1, axis=1, keepdims=True)
        W1 -= eta * dW1; b1 -= eta * db1
        W2 -= eta * dW2; b2 -= eta * db2
    return losses

d_in, d_hid, d_out = 2, 4, 1
K, eta = 2000, 0.5

loss_he = train(*init_weights(d_in, d_hid, d_out,
    lambda i, o: np.random.randn(o, i) * np.sqrt(2.0 / i)), X, y, eta, K)

loss_small = train(*init_weights(d_in, d_hid, d_out,
    lambda i, o: np.random.randn(o, i) * 0.01), X, y, eta, K)

plt.figure(figsize=(8, 5))
plt.plot(loss_he, label="He init (√(2/n_in))", linewidth=1.5)
plt.plot(loss_small, label="Small randn × 0.01", linewidth=1.5)
plt.xscale("log"); plt.yscale("log"); plt.xlabel("Iteration"); plt.ylabel("Loss")
plt.title("XOR: He vs tiny init")
plt.legend(); plt.grid(True, alpha=0.3); plt.show()

print(f"Plateau: {sum(abs(l - np.log(2)) < 0.01 for l in loss_small)} steps within 0.01 of ln 2")
print(f"Final loss  He={loss_he[-1]:.4f}  small-init={loss_small[-1]:.4f}")
print("Notice: the tiny-weight run starts next to the all-zero stationary point. It sits on a plateau near ln 2 before it leaves.")

Key takeaways#

  • A critical point is a saddle when its Hessian has eigenvalues of both signs. Gradient descent stalls near one but leaves along the negative direction.
  • Near a saddle with curvature −λ-\lambda−λ, each factor of 10 closer to its stable set costs about ln⁡10/ln⁡(1+ηλ)\ln 10 / \ln(1 + \eta\lambda)ln10/ln(1+ηλ) extra steps. A plateau is not a minimum.
  • In high dimensions saddles outnumber minima. In overparameterized nets most minima are near-global in practice.
  • Initialization picks the basin, normalization smooths the surface, and convex theory transfers as diagnosis, not as guarantees.

Further reading#

  • Ian Goodfellow, Yoshua Bengio & Aaron Courville, Deep Learning (MIT Press, 2016). Chapter 8 covers nonconvex optimization, saddle points and initialization.
  • Yann Dauphin et al., "Identifying and Attacking the Saddle Point Problem in High-Dimensional Non-Convex Optimization" (NeurIPS 2014). Why saddles dominate high-dimensional landscapes.
  • Kaiming He, Xiangyu Zhang, Shaoqing Ren & Jian Sun, "Delving Deep into Rectifiers" (ICCV 2015). He initialization for ReLU networks.
  • Shibani Santurkar, Dimitris Tsipras, Andrew Ilyas & Aleksander Madry, "How Does Batch Normalization Help Optimization?" (NeurIPS 2018). The loss-smoothing account of BatchNorm.

Reading is free. PDF and ePub unlock with the newsletter. Join once and every lesson opens in this browser.

← Previous
Week 12: Duality for Practitioners
Next →
Week 14: Capstone — Theory Meets Training
On this page
  • Why the path stalls near a saddle
  • Saddles in high dimensions
  • Overparameterization
  • Initialization picks the basin
  • Normalization as loss-surface shaping
  • What transfers from convex theory
  • Knowledge check
  • Browser lab: initialization on XOR
  • Key takeaways
  • Further reading