liveBook · Manning

Training loop

A training loop is an iterative procedure that processes training data, evaluates a model objective, and updates model parameters to improve performance.

How 3 Manning books explain it

Deep Learning with R, Third Edition

A training loop is a repeated process that evaluates examples, adjusts model parameters, and progressively minimizes the loss function.

How it is used
Trains neural networks by repeatedly reducing prediction loss through weight updates on batches of data.
How deep it goes
Details batches, forward passes, loss, gradients, updates, and epochs, then extends to custom loops.
Examples
Uses MNIST digit classification and a pure-JAX linear classifier whose logged loss falls over 40 steps.
What you can do after
Build it from scratch with backend-native gradients, or apply it via Keras `fit()` for standard training.

Read how Deep Learning with R, Third Edition explains training loop →

LLMs in Production

A training loop is the repeated process of computing model outputs, evaluating loss, calculating gradients, and updating parameters.

How it is used
Organizes model training from data preparation through repeated prediction, loss, backpropagation, and parameter updates.
How deep it goes
Explains the loop from batches to gradients and implementation components, then extends into speed-memory tradeoffs without deriving optimization theory.
Examples
Uses a generative CBoW model, Hamlet tokens, a GPT built from scratch, and a speed-memory comparison table.
What you can do after
Build it from scratch with modular model components, batched data, loss calculation, backpropagation, and resource-aware training choices.

Read how LLMs in Production explains training loop →

Graph Neural Networks in Action

A training loop is an iterative procedure that processes data through a model and updates its parameters across training iterations.

How it is used
Trains graph and spatiotemporal models while monitoring validation behavior and comparing generalization.
How deep it goes
Explains initialization, forward and backward passes, validation, scheduling, and testing, without deriving optimization mathematics.
Examples
Uses parallel GCN and GraphSAGE classification plus NRI trajectory prediction with scheduled learning rates and future-horizon MSE.
What you can do after
Apply it via PyTorch to train models, track losses, tune schedules, and evaluate predictions on held-out data.

Read how Graph Neural Networks in Action explains training loop →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.