Training Deep Networks
The practical knobs that decide whether a network trains well - batches, learning rate, optimizers, initialisation, normalisation - and how to debug a run that does not.
The training loop, again
You have a model, a loss and gradients from backprop. Training is the loop around them:
- Take a small chunk of the data, called a mini-batch.
- Forward pass: compute predictions and the loss on that batch.
- Backward pass: compute gradients.
- Optimizer step: update the weights.
- Repeat. One full pass over the data is an epoch.
Why mini-batches instead of the whole dataset or one example at a time?
- The whole dataset per step is slow and often does not fit in memory.
- One example per step gives a noisy gradient and wastes hardware that is built for parallel work.
- A batch of 32 to 512 gives a decent gradient estimate at a fair cost. The noise even helps the model escape poor spots.
This is SGD (stochastic gradient descent): gradient descent where each gradient comes from a random mini-batch.
Estimate
A dataset has 50,000 training images and you use batch size 128. How many optimizer steps are in one epoch?
steps
1 of 7