promptdojo_

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

Checkpoint

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

Make the loop batched: split the 4 rows into the two given batches, and each epoch take one gradient STEP PER BATCH (gradients averaged within the batch only). After each epoch compute the loss over the FULL dataset and print f"epoch {epoch}: loss={epoch_loss:.3f} (2 batch steps)"; finish with f"w={w:.2f} b={b:.2f}". Two noisy-but-cheap steps per epoch instead of one exact one — that's the real training loop's shape.

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