TL;DRRegularization (L1, L2, dropout) curbs overfitting so models generalize.
Overfit models memorize training noise. L2 (weight decay) penalizes large weights, encouraging smoother functions; L1 pushes weights to zero (feature selection / sparsity); dropout randomly disables neurons during training so the net can't rely on any one path. Each constrains the model to generalize rather than memorize — essential whenever training accuracy outpaces validation.
Key points
L2 penalizes large weights (smoothness)
L1 zeros weights (sparsity/selection)
Dropout disables random neurons in training
Use when train ≫ validation accuracy
Common mistakes
No regularization on a high-capacity model
Dropout left on at inference time
Over-regularizing → underfitting
Try it: Match L1, L2, and dropout to what each one does.
Example code
<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>L2 → smaller weights (smooth)
L1 → zero weights (sparse)
dropout → randomly drop neurons in training</pre></body></html>