Chapter C23 · Interactive Course
One training step at a time
Predict, measure, adjust — and which numbers are which.
Core Learning Concept
Trace one full learning step: predict outputs, evaluate loss, compute gradients, and update weights. Distinguish measurement from parameter modification, keeping batch aggregations, chosen learning rates, and saved checkpoint weights clearly separated.
What You’ll Learn in This Chapter
-
Start with an imperfect prediction
Identify the forward pass in training.
A forward pass computes predictions from inputs using current model parameters. During training, this output is compared against target labels. "Forward" simply describes the direction of computation through successive layers.
-
Measure the mismatch
Explain loss as a chosen measure of prediction error.
Loss is a chosen numerical metric measuring disagreement between predictions and targets. Different loss formulas penalize errors differently. Lower loss indicates closer agreement on measured targets, rather than general correctness across all tasks.
-
Find a direction to improve
Interpret a gradient as a local direction signal.
A gradient describes how a small parameter change would locally affect the loss. In one dimension it resembles a slope; with many parameters it contains a component for each one. Gradient-based training uses this local information to choose updates. It does not provide a map proving where the global best solution lies.
-
Send the error signal backward
Explain backpropagation's role in assigning parameter-change information.
Backpropagation determines how each weight influenced the overall loss by moving backward through layers using the chain rule. Calculating these gradient values measures sensitivity, but does not alter parameters until the optimizer runs.
-
Take a learning step
Identify the parameter update performed by an optimizer.
An optimizer applies a parameter-update rule. In basic gradient descent, the new weight equals the old weight minus the learning rate times its gradient. If the weight is 1, the gradient is 2, and the rate is 0.1, the updated weight is 0.8. Other optimizers modify this procedure.
-
Choose the step size
Explain the learning rate as a training setting.
The learning rate multiplier scales parameter updates during training. Excessive step sizes cause erratic overshooting, whereas tiny steps make convergence sluggish. This chosen hyperparameter balances overall training speed against numerical stability.
-
A batch is a group of examples
Recognize which examples contribute to one update.
A batch is a group of examples used together to calculate an update or an intermediate gradient estimate. With batch size four, the system processes four examples before that update. Batch size affects memory, computation, and learning behavior; it is different from the total number of examples in the dataset.
-
An epoch is one pass through the examples
Identify an epoch in a finite training dataset.
An epoch is one pass through the training dataset under the stated sampling setup. If there are one hundred examples and batches contain ten, one simple epoch contains ten batches. More epochs repeat exposure to the data; they do not automatically add new independent examples or guarantee better generalization.
-
A checkpoint saves a model state
Recognize a saved training snapshot.
A checkpoint saves current training parameters and optimizer state to disk. Checkpoints allow recovering interrupted runs and selecting the best performing intermediate model rather than blindly keeping the final epoch.
-
Animate a training step
Order prediction, loss, backward gradient calculation and update; identify the learning-rate control and the saved settings.