promptdojo_

Mission: overfit, then recover — step 1 of 7

Mission: overfit, then recover

The shape of this one is deliberate sabotage: cause the failure on purpose, learn its signature from the curves, then build the machinery that catches it for you next time.

The job: deliberately produce overfitting, catch it from the curves, and recover with early stopping — the workflow every real training run uses, practiced end to end. (Deliberately overfitting a tiny set first is also a standard sanity check that your loop can learn — a model that can't reach ~zero loss on 10 memorizable examples has a bug, not a capacity problem.)

The stages:

  1. Read the signature — run the starter: train loss falls forever; validation falls, bottoms out, and turns upward. That divergence is chapter 39's train/test gap drawn as curves.
  2. Produce it for real — take the one-parameter trainer from lesson 01, shrink the data to a few points, add noise, and add a validation split; train long and log both losses per epoch.
  3. Early stopping — track best-validation-so-far and stop after patience epochs without improvement, restoring the best checkpoint (lesson 04's machinery earns its keep).
  4. Stress case — noisy validation loss that jitters upward for one epoch then improves: show that patience=1 stops too early and patience=5 rides through it. There's the reason the knob exists.
  5. One improvement — a second regularization lever from chapter 39 (smaller model / more data / penalty), a curve printout as rows of # bars, or a "sanity: can it overfit 5 points?" pre-check: pick one, note why.

You arrive with a training setup. You leave with the judgment to say "stop here, keep that checkpoint" — backed by curves instead of hope.