← All models

MODEL EXPLORER / MODERN LLMS

Where the normalization goes

What happens to the shortcut when normalization moves?

Curated by TensorVizPre-LN / Post-LN · 4-step tour
Static architecture
What happens to the shortcut when normalization moves?
Opening the interactive graph…
Architecture snapshot · No Python requiredDownload graph ↓

RECORDED NUMERICAL EXAMPLE

Move the normalization. Keep F fixed.

Recorded CPU calculations with the same eight-feature input, matching branch weights, and matching LayerNorm parameters.

Both branches have the same F weights and LayerNorm parameters. Only the placement changes: x + F(Norm(x)) versus Norm(x + F(x)).

Input
1
2
3
4
5
6
7
8
Pre-norm output
1.497
1.665
3.291
4.117
6.349
6.587
7.031
8.461
Post-norm output
-0.8701
-2.007
0.4661
-0.3149
0.2972
0.2168
1.503
0.709

Bars share one scale within this example. Values are rounded to four significant digits.

Pre-norm distance from input
1.684
Post-norm distance from input
13.55
Verified by the local recipe
  • Both placements use identical branch weights
  • Zeroing F leaves pre-norm's identity path intact but post-norm still normalizes
  • The zero-branch pre-norm path has the identity derivative

Download the source and run.py to reproduce these checks. Choosing an example here replays recorded values.

ABOUT THIS EXAMPLE

Keep the learned branch fixed while comparing pre-norm and post-norm, then zero the branch to expose the identity path.

Component · 2020

Pre-LN / Post-LN

An eight-feature residual sublayer with a linear F isolates normalization placement. The cited 2020 paper analyzes the already proposed pre-LN design.

Source, capture & limitations +

Both branches use LayerNorm. This comparison changes placement, not RMSNorm versus LayerNorm. Forward values and a local derivative do not establish training stability for a full network.

Original TensorViz teaching example. PyTorch provides the underlying operators.

No separate redistribution license has been declared for these project examples.

Content revision
498438923bc427aa
Source SHA-256
cb5e47f19519d2dba172bb95821ca71583e7123cd9c3f3b92618ee3a58436a62
Captured
2026-09-17 · Python 3.13.13 / Torch 2.7.1

One seeded CPU forward plus identical-weight, zero-branch and local-derivative checks. No optimization or training-speed benchmark.

Read the model manifest ↗