Unit 4 of 8 · about 4 hours · explain, derive

Regularization: dropout, label smoothing, augmentation and weight decay

Regularization trades training fit for held-out behavior. Each method changes a different part of the objective or the data, and conflating them leads to double-counted or cancelled effects.

You'll be able to

  • Derive the SGD weight-decay update from the L2-penalized objective and state exactly where the Adam equivalence breaks.
  • Explain dropout scaling, label-smoothing targets and augmentation policy as separate generalization levers.
  • Choose which parameters escape decay and defend the choice.

Covers

Dropout, label smoothing and data augmentationWeight decay versus an L2 penalty
1

Read

In this order, only the parts listed

0 of 5 done

  1. Explicit and implicit regularizationUnderstanding Deep Learning - fitting, gradients and regularization

    Chapter 9, Sections 9.1 through 9.2 (pp. 138 to 143): L2 regularization and implicit regularization in gradient descent and SGD

  2. Dropout, label smoothing and augmentationUnderstanding Deep Learning - fitting, gradients and regularization

    Chapter 9, Sections 9.3.3, 9.3.4 and 9.3.8 (pp. 147 to 154): dropout, applying noise with label smoothing, and augmentation

    Read Sections 9.3.3, 9.3.4 and 9.3.8 only. Skip Bayesian inference, transfer learning and self-supervised learning.

  3. Dropout scaling and behaviorD2L - optimization and regularization slice

    Dropout in Practice and Implementation from Scratch: inverted scaling and the train and eval split

  4. Weight decay under SGDD2L - optimization and regularization slice

    Norms and Weight Decay and Implementation from Scratch: penalized objective, SGD shrinkage update, and bias exclusion

  5. Decoupled weight decayPyTorch torch.optim.AdamW reference

    AdamW algorithm box: the decoupled decay line and its defaults

2

Focus on

  • L2 adds to the loss, and SGD turns it into per-step shrinkage . The cancels the square's derivative.
  • Adam normalizes the whole gradient, L2 term included, by its adaptive denominator, so the penalty no longer shrinks weights by a fixed fraction. AdamW applies the shrinkage outside the adaptive update.
  • Inverted dropout divides kept activations by during training, so test time needs no scaling and the expectation stays exact.
  • Label smoothing replaces hard targets with a blend of the true class and uniform. Augmentation enlarges the data, but its transforms must not change the label.
Common mistakes · 3
  • Adding L2 to Adam and calling it weight decay. The adaptive denominator rescales the penalty per coordinate; use the optimizer's decoupled decay instead.
  • Decaying biases and normalization scales by default. They hold offsets, not feature weights; D2L excludes the bias from the penalty, and the same argument covers normalization scales.
  • Reading UDL's implicit-regularization equations as exact. The modified loss is a first-order approximation in the step size; it explains tendencies, not exact trajectories.
3

Try it yourself

Closed-book, before checking anything

Closed-book, derive from the penalized loss. Then write the AdamW two-line update, decoupled decay plus bias-corrected adaptive step, and state the default decay 0.01.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.Loss plus under SGD with step . What is the update?Answer

    .

  2. 2.Why does the same penalty fail to shrink weights by a fixed fraction under Adam?Answer

    Adam divides the total gradient, penalty included, by . The penalty's effect is rescaled per coordinate by gradient history instead of applying a fixed factor.

  3. 3.Dropout 0.3, activation 10. What values can the next layer see during training, and what is the mean?Answer

    0 with probability 0.3, or 10/0.7 = 14.29 with probability 0.7. Mean 0.7 times 14.29 = 10.

  4. 4.10 classes, smoothing 0.1. What target values do the true class and each other class get?Answer

    True class 0.9 + 0.1/10 = 0.91; each other class 0.01.

5

Practice

  • D2L Dropout: Exercises

    Exercises: layer-probability swaps, the dropout versus no-dropout comparison, activation variance plots, and the dropout plus weight-decay interaction

  • D2L Weight Decay: Exercises

    Exercises: the sweep on training and validation accuracy and the validation-optimum question

  • TrenTorch: Label Smoothing

    Implement smooth_labels(one_hot, smoothing, num_classes) for one target and for a batch

    The true class ends at and every other class at , the same targets torch.nn.CrossEntropyLoss(label_smoothing=...) uses.

You're done when

You write both the SGD shrinkage update and the AdamW decoupled update without notes, and your sweep on the D2L regression task shows training loss rising with while validation loss first falls, then rises.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 9 more in the section
  • Understanding Deep Learning - fitting, gradients and regularizationSimon J. D. Prince · primary

    Use Chapters 6-9 and targeted parts of Chapter 20 for optimization, initialization, measurement, regularization and why training works. Re-derive the update rules you keep in the trainer.

  • D2L - optimization and regularization sliceD2L authors · required

    Use MLP implementation, dropout, deep generalization, numerical stability, optimization introduction, SGD, minibatch SGD, momentum, AdaGrad, RMSProp, Adam and learning-rate scheduler. Implement momentum, AdamW, initialization, dropout, one normalization, clipping and one schedule.

  • PyTorch torch.optim.AdamW referencePyTorch · reference

    Read the AdamW algorithm box for the decoupled weight-decay step, the bias-corrected moments and the defaults, and follow the Decoupled Weight Decay Regularization link for the argument.

Also in this section