Skip to content

The training loop

The loop over epochs and batches, computing the loss and updating parameters.

  • @node-llm/core → src/train/trainer.ts — trainModel
Book (PyTorch) Here (tfjs)
loss.backward() + optimizer.step() optimizer.minimize(fn, returnCost)
optimizer.zero_grad() handled inside minimize
autograd tape tf.variableGrads / minimize