freecoding.school100% FREE · NO SIGNUP
Tensor TownISSUE #28 of 120

batch norm · layer norm · group norm

NeuraVSThe Overfit Ogre
Neura saysNormalization layers (batch, layer norm) stabilize and speed up training.

Deep nets train better when activations stay well-scaled. Batch norm normalizes across a batch (great for CNNs, but batch-dependent). Layer norm normalizes across features within one example (batch-independent — the standard in transformers). They reduce sensitivity to initialization and learning rate, letting you train deeper, faster. Layer norm is why transformers train stably at scale.

Power-ups you unlock

The Overfit Ogre attacks — common mistakes

Boss battleExplain why transformers prefer layer norm over batch norm.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre>batch norm: normalize across the batch (CNNs)
layer norm: normalize across features (one example)
→ transformers use layer norm (batch-independent)</pre></body></html>
▶ Open the interactive comic issue
‹ Regularization · L1 · L2 · DropoutOverfitting · The Bias-Variance Trade ›