AI Regularization Tutorial: L1, L2, Dropout

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

Common mistakes

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>
Open the interactive lesson →
Optimizers · Sgd · Adam · Adamw Batch Norm · Layer Norm · Group Norm