Lesson 4.7core2 h 30 min⚡ live demo

Regularization in deep nets

Dropout, weight decay, augmentation and why huge models still generalize

Deep networks have enough capacity to memorize their training sets with random labels, yet in practice they generalize — and the techniques in this lesson are how you tilt the odds. Dropout and weight decay are in every architecture config; augmentation is the single biggest lever in vision (5.4 Transfer learning and training CNNs in practice); and the modern picture of double descent and grokking explains why "make it bigger and train on more data" so often beats classical regularization (7.9 Scaling laws and compute-optimal training). You will reuse all of it when fine-tuning LLMs (8.2 Fine-tuning and PEFT).

You'll be able to

  • Derive why inverted dropout rescales by 1/(1−p) and explain its ensemble and noise interpretations
  • Implement weight decay correctly (decoupled, excluding norms and biases) and relate it to L2 regularization
  • Use early stopping, data augmentation, mixup/CutMix and label smoothing appropriately
  • Describe double descent and grokking and what they imply about capacity and data
  • Build a regularization plan for a new problem, in the right order

Key ideas

  1. Deep nets can memorize random labels, so generalization relies on implicit regularization (SGD, architecture, data) plus explicit regularizers.
  2. Dropout multiplies activations by Bernoulli(1−p) masks; inverted dropout divides by 1−p during training so inference is the identity (E[h̃] = h).
  3. Dropout ≈ an ensemble of 2ⁿ weight-sharing sub-networks and ≈ multiplicative noise; modern LLM pretraining uses p = 0.
Show 4 more key ideas
  1. Weight decay = L2 for SGD but must be decoupled for Adam; on scale-invariant (normalized) layers it mostly controls the effective learning rate; don't decay biases/norms.
  2. Early stopping with best-checkpoint saving is free regularization; for linear models it is equivalent to L2 with λ ≈ 1/(ηT).
  3. Data augmentation encodes known invariances and is the strongest regularizer in vision; mixup/CutMix mix inputs and labels; label smoothing augments targets.
  4. Double descent: test error peaks at the interpolation threshold and falls again with more capacity; grokking: generalization can arrive long after memorization, helped by weight decay.

Suggested path through this lesson