Bring the mental model from Backpropagation; this page will reuse it instead of restarting from zero.
Optimization
Batch Normalization
Normalize activations using batch statistics to stabilize deep training (and understand the train vs inference mismatch).
Concept Structure
Batch Normalization
Start with the picture, metaphor, or geometric mechanism.
Make the objects explicit and connect them with notation.
Mirror the equations with runnable implementation details.
Manipulate the mechanism and watch the idea respond.
Learning map
Batch NormalizationConceptual Bridge
What should feel connected as you move through this page.
Normalize activations using batch statistics to stabilize deep training (and understand the train vs inference mismatch).
The next edge should feel earned: use the demo prediction here before following Layer Normalization & RMSNorm.
01
Intuition
Build the mental picture first so the rest of the page has something to attach to.
BatchNorm was one of the key tricks that made very deep convolutional networks train reliably.
The basic idea is simple: for each feature channel, normalize activations using the mean and variance computed over the current mini-batch. This keeps activations in a stable numeric range and often makes optimization easier.
But BatchNorm has an important downside: it introduces a train vs inference mismatch. During training you use batch statistics; at inference you use running averages. This is one reason transformers prefer LayerNorm/RMSNorm.
02
Math
Translate the story into symbols, assumptions, and a derivation you can inspect.
For a batch of activations (batch size , features ), BatchNorm normalizes each feature dimension:
where
Then apply learned scale and shift:
The learned and are important: normalization gives the optimizer a stable coordinate system, but the model can still recover whatever feature scale and offset are useful. During backpropagation, each example's normalized value depends on the other examples in the same mini-batch through and , so the layer is not example-independent while training.
At inference, you typically use running averages of accumulated during training instead of per-batch values.
03
Code
Keep the implementation aligned with the notation so the algorithm is legible.
import numpy as np
rs = np.random.RandomState(0)
x = rs.randn(6, 4) * 3.0 + 5.0 # batch activations with nonzero mean/scale
eps = 1e-5
mu = x.mean(axis=0, keepdims=True)
var = ((x - mu) ** 2).mean(axis=0, keepdims=True)
xhat = (x - mu) / np.sqrt(var + eps)
print("per-feature mean before:", np.round(x.mean(axis=0), 3))
print("per-feature mean after :", np.round(xhat.mean(axis=0), 3))
print("per-feature var after :", np.round(xhat.var(axis=0), 3))
04
Interactive Demo
Use direct manipulation to connect the explanation to a moving system.
No interactive demo yet for this concept. A good next step is a small visualization that shows:
- how batch size affects the noise in batch statistics,
- why small batches can destabilize BatchNorm,
- why LayerNorm avoids the batch coupling.
No live visualization is registered for this concept yet.
The page still supports explanatory demo notes above; when a viz.tsx exists, it will render here without changing the route.
After The First Pass
Turn the concept into an inspected object.
Once the invariant is visible in the intuition, math, code, and demo, use these panels to inspect the mechanism visually, check source support, practice the idea, and attach a grounded research question.
Mechanism Storyboard
See the idea move before the page explains it
Normalize activations using batch statistics to stabilize deep training (and understand the train vs inference mismatch).
Start with the picture, metaphor, or geometric mechanism.
Before reading further, choose the kind of change Batch Normalization should make visible.
Visual Inquiry
Make the image answer a mathematical question
Normalize activations using batch statistics to stabilize deep training (and understand the train vs inference mismatch).
Which visible object should carry the first intuition?
Pick the cue that should make Batch Normalization easier to reason about before the page gives the answer.
Claim Review
Normalize activations using batch statistics to stabilize deep training (and understand the train vs inference mismatch).
Source IDs and witness objects are attached for review; they are not proof by themselves.
Add source metadata before claiming support.
Use equation, code, and demo objects to check whether the source support is operational.
Source support candidates
No structured source note is attached yet.
Practice Loop
Try the idea before it explains itself
Normalize activations using batch statistics to stabilize deep training (and understand the train vs inference mismatch).
Before touching the demo, predict one visible change that should happen in Batch Normalization.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
Reveal when your model needs a nudge.
A concrete answer is on the canvas.
The answer names why the claim should hold.
It touches the page context or a neighboring idea.
Research Room
Attach the question to an exact object
Pick the concept, equation, source, code witness, claim, misconception, or demo state before asking for help. The handoff stays grounded to that object.Open the draft below to save one note and next action in this browser.
Batch Normalization
What is the smallest example that makes Batch Normalization click without losing the math?
Local action draftNo local draft saved yetExpand only when ready to capture one local next action
This draft stays locally in this browser for concept:optimization/batch-normalization.
- Definition, prerequisite, and contrast concept links
- The equation or code witness that makes the concept operational
- One demo state that shows the invariant instead of a slogan
- The learner can state the mechanism in their own words
- The learner can name the prerequisite that would repair confusion
- The learner can predict how the mechanism changes under one perturbation
I am working in Continuous Function's research reading room. Object: concept - Batch Normalization Object key: concept:optimization/batch-normalization Context: Optimization Anchor id: concept/concept-notebook/optimization/batch-normalization Open question: What is the smallest example that makes Batch Normalization click without losing the math? Evidence to inspect: - Definition, prerequisite, and contrast concept links - The equation or code witness that makes the concept operational - One demo state that shows the invariant instead of a slogan What would resolve this: - The learner can state the mechanism in their own words - The learner can name the prerequisite that would repair confusion - The learner can predict how the mechanism changes under one perturbation Answer as a careful research tutor: stay source-grounded, separate verified evidence from assumptions, name the relevant math objects, and end with one next action.
concept/concept-notebook/optimization/batch-normalization
concept:optimization/batch-normalization