Regularization, Initialization and Normalization
Dropout, weight decay, early stopping, data augmentation, weight initialization and batch/layer normalization for stable, generalizing networks.
Intermediate · about 5 hours · difficulty 3/5
Learn first: Optimizers and Learning Rate Schedules, Bias, Variance and Generalization
Deep networks have enough capacity to memorize training data. Regularization pushes them toward solutions that generalize, while initialization and normalization keep training numerically stable.
Regularization
- Weight decay: penalizes large weights.
- Dropout: randomly zeroes activations during training; disabled at evaluation time (
model.eval()). - Early stopping: stop when validation loss stops improving; keep the best checkpoint.
- Data augmentation: often the most effective regularizer for images, audio and text.
- Label smoothing: softens one-hot targets to reduce overconfidence.
Initialization
Random weights must be scaled so activations neither vanish nor explode through layers: Xavier/Glorot for tanh-like activations, He/Kaiming for ReLU. Frameworks choose sensible defaults, but know why.
Normalization
- Batch normalization: normalizes activations using batch statistics; speeds up CNN training; behaves differently in train and eval mode, and struggles with tiny batches.
- Layer normalization: normalizes per example; the standard in transformers and RNNs.
- Residual connections (preview): skip paths that let gradients flow through very deep networks.
Good enough to move on when you can show on a validation curve how dropout, weight decay and augmentation each reduce overfitting, and explain the train/eval behaviour of batch norm.
Key concepts
- Weight decay
- Dropout
- Early stopping and checkpoints
- Xavier and He initialization
- Batch normalization
- Layer normalization
- Label smoothing
Mini project
Deliberately overfit an MLP on a 5,000-image subset of Fashion-MNIST, then add weight decay, dropout, batch norm and early stopping one at a time and chart the validation accuracy after each change.
Check yourself
What goes wrong if you forget to call model.eval() before evaluating a network with dropout and batch norm?
Free resources
- Deep Learning (regularization chapter) (Goodfellow, Bengio, Courville)
- Dive into Deep Learning (d2l.ai)