part 2 boss 👾
Part 2 Boss: Diagnose the Training Run
the hook
Two training runs, two planted bugs — a flipped gradient sign and a learning rate way too high. Diagnose each from the loss curve, then fix it for real.
the idea
You've read loss curves before (ch8) — now use that skill to diagnose a broken training run without anyone telling you what's wrong first.
Below are two training runs, each with ONE planted bug. Look at the SHAPE of the loss curve before you touch any code — the shape itself is the clue.
Then fix each bug for real, in Python, and watch the curve behave the way it should.
playground — your hands now
what: diagnose 2 broken training runs from their loss curve shape, then fix each bug in code.
why: reading a loss curve's shape to guess what's wrong is a real, everyday debugging skill for anyone who trains models.
how: look at each curve, guess the bug, then fix it in the matching code cell.
start here → look at each curve's shape and diagnose the bug before touching any code.
run A
what: fix the flipped gradient sign so the loss actually decreases.
why: this exact bug — a plus where a minus should be — silently turns training into un-training. it's one character.
how: run it first, see the loss climb, then flip the sign in the update line.
predict first: once you fix the sign, will x move toward 0 or away from it?
the loss should DECREASE each step. run it, find the sign bug, fix it.
run B
what: fix the learning rate so training actually converges.
why: this exact failure mode — loss exploding instead of shrinking — is the #1 symptom of a learning rate set too high.
how: run it first, watch loss explode, then lower lr to something stable (try 0.1).
predict first: will lowering the learning rate make training more stable or less?
the loss should shrink toward 0, not explode. run it, then fix the learning rate.
try this
Before running either fixed cell, predict what the FIXED curve should look like — smoothly decreasing, converging toward the minimum. Then verify your fix actually produces that shape.
checkpoint
1. A loss curve that grows steadily upward, run after run, most likely indicates:
2. A loss curve that wildly oscillates with growing magnitude most likely indicates:
recap card — keep this
a loss curve's SHAPE is diagnostic information — climbing steadily means a sign error, wild growing oscillation means the learning rate is too high.