promptdojo_

Loss, forward, backward, step — step 5 of 7

This loop runs three epochs and w never moves — every epoch prints w=0.00, loss=10.00. Read the beat order: the STEP happens before the gradient is computed, using this epoch's zeroed g; the real gradient is computed afterward and thrown away. Reorder the beats: loss, backward, THEN step.

The break is on line 6 — but read the whole snippet first.

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