3.2.11 · D3Training Deep Networks

Worked examples — Early stopping

2,527 words11 min readBack to topic

This is the drill-ground for Early stopping. The parent note built the idea; here we hammer every possible shape of question it can throw at you — noisy curves, flat plateaus, the exact math linking stopping-time to weight decay, degenerate validation sets, and an exam twist. Guess each answer before reading the steps.


The scenario matrix

Every early-stopping problem lands in one of these cells. The worked examples that follow are tagged with the cell they cover.

# Case class What makes it tricky Example
A Clean U-curve textbook: clear min, clear rise Ex 1
B Noisy curve, blip below patience a false uptick you must ignore Ex 2
C min-delta matters tiny "improvements" that don't count Ex 3
D Degenerate: monotone-down curve val loss never rises — when do you stop? Ex 4
E High-curvature direction ( large) fits almost fully, fast Ex 5
F Low-curvature direction ( small) barely moves — effectively pruned Ex 5
G Solve for (steps ⇄ weight decay) invert the matching formula Ex 6
H Solve for (how many steps for a target shrink) logs appear Ex 7
I Limiting behaviour (, ) edges of the formula Ex 8
J Real-world word problem noisy tiny val set, choose knobs Ex 9
K Exam twist learning rate too big → divergence Ex 10

Prerequisites you may want open: Gradient Descent, Hessian and Curvature, L2 Regularization (Weight Decay), Overfitting and Generalization, Validation and Cross-Validation, Learning Rate Schedules.


Part 1 — Reading validation curves (cells A–D)

Before any math, fix the two counters we carry epoch to epoch.

Figure — Early stopping

Look at the figure: the cyan curve dips to a bottom (the amber dot = best), then climbs. Patience is the horizontal amber bracket after the bottom — we only quit once that bracket fills up with non-improving epochs.


Part 2 — Steps as regularization strength (cells E–I)

Now the math engine. Recall from the parent, in one eigen-direction with eigenvalue (curvature of the loss bowl, from the Hessian), learning rate , starting from :

Figure — Early stopping

The figure plots for a high-curvature direction (steep cyan, snaps to 1) and a low-curvature direction (flat amber, crawls). Early stopping = drawing a vertical line at your stop-time : it reads off "keep the steep ones, suppress the flat ones."


Part 3 — Word problem and exam twist (cells J, K)


Recall Self-test: name the cell, then solve

Curve 1:0.7, 2:0.5, 3:0.52, 4:0.48, 5:0.49, 6:0.50, 7:0.51, . Which epoch restored & when do we stop? ::: best = 0.48 at epoch 4; epochs 5,6,7 fail → counter 1,2,3 → stop at epoch 7, restore epoch 4. (Cell B, noisy.) , . Fit? ::: . (Cell E/F.) Want fit with . Steps? ::: steps. (Cell H.) , : equivalent ? ::: , so . (Cell G.)