Weight decay in one sentence
Weight decay nudges parameters toward zero at every step, which prevents any one weight from dominating and acts as a smooth implicit regularizer. In AdamW, it's a separate decoupled step (subtract λw from the parameter directly). In SGD, it's mathematically identical to adding an L2 penalty to the loss.
Default values: weight_decay=0.01 for transformers, weight_decay=1e-4 for vision CNNs trained from scratch. Tune in factors of 10. Apply only to weight matrices, not to biases or LayerNorm parameters.
Early stopping done right
Track validation loss every epoch. Save the model whenever val loss reaches a new low. If val loss doesn't improve for patience epochs, stop training. The saved best checkpoint is what you ship.
Common values: patience=10 for short training, patience=50 for long training. Add a min_delta so noisy 0.0001 improvements don't reset the patience counter.
The interaction
Weight decay and early stopping are roughly equivalent regularizers in practice — they both keep the model from memorizing noise. Use both, but don't expect them to compose linearly. If you have strong augmentation, you can run with less of both.