promptdojo_
Checkpoint

One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.

Checkpoint. Feel the learning-rate tradeoff. Write converges(w, x, y, lr, steps) returning True if the final loss is lower than the starting loss, else False. Then the harness prints the verdict for a small lr and a big lr on the same problem:

lr 0.1: converged, lr 0.6: diverged

Loss is (w*x - y)**2; each step uses grad = 2*(pred-y)*x, w = w - lr*grad.

full-screen editor opens — close anytime to keep reading.