The residual adds and ReLU MLP are exact, while the layernorm example shows where a general square root becomes named outside this perfect-square path.

highlighted = computed this step

Through the block

The first residual add gives (2,0). In this pass, layernorm has variance 1 and std 1, so it stays exact in this tiny pass.

residualone=(2,0)\operatorname{residual}_{\text{one}}=(2,0)
Through the blockExact block path plus the general layernorm boundary.Through the blockExact block path plus the general layernorm boundary.tiny transformer exact-or-named forwarddiscrete spine exact; softmax/layernorm sqrt become named only at the boundaryinput: a b; E[a]=(1,0), E[b]=(0,1), E[c]=(1,1); P0=(0,0), P1=(1,0)weights: Wq=Wk=Wv=I; MLP=I+ReLU+I; gamma=(1,1), beta=(0,0); unembed tied to Eposition 0: fully exact pathx0=(1,0); Q0=K0=V0=(1,0)score S00=1; softmax=[1] exactattn0=(1,0); residual1=(2,0)ln1 mean=1; centered=(1,-1); var=1; std=1ln1 output=(1,-1)MLP ReLU=(1,0); mlp=(1,0)residual2=(2,-1)ln2 mean=1/2; centered=(3/2,-3/2); var=9/4; std=3/2ln2 output=(1,-1)logits: a=1, b=-1, c=0argmax=a; output token=aposition 1: named softmax boundaryx1=(1,1); Q1=(1,1)K0=(1,0); K1=(1,1)scores=[1, 2]softmax=[e^1/(e^1+e^2), e^2/(e^1+e^2)]named after multi-entry softmaxordered pipelinetokens -> embed -> +pos -> attention -> +residual-> layernorm -> MLP -> +residual -> layernorm-> unembed -> logits -> argmax -> output tokenpos0 remains exact; pos1 stops at named softmaxlayernorm sqrt boundarythis transformer's 2-D layernorms are exact here; in general layernorm's square root is namednamed 3-vectorv=(1,2,3); mean=2centered=(-1,0,1)var=2/3; std=√(2/3); register=namednormalized=(-1,0,1)/√(2/3)degenerate exact 3-vectorv=(2,2,2); mean=2centered=(0,0,0)var=0; std=0; register=exactnormalized=zero-variance exact std; normalization not divided

Layernorm's square root

In general, layernorm crosses a square-root boundary. The rendered three-vector v=(1,2,3) has variance 2/3 and std named as the square root of that fraction. That example marks the general named boundary.

var=2/3,std=2/3\operatorname{var}=2/3,\quad \operatorname{std}=\sqrt{2/3}
Through the blockExact block path plus the general layernorm boundary.Through the blockExact block path plus the general layernorm boundary.tiny transformer exact-or-named forwarddiscrete spine exact; softmax/layernorm sqrt become named only at the boundaryinput: a b; E[a]=(1,0), E[b]=(0,1), E[c]=(1,1); P0=(0,0), P1=(1,0)weights: Wq=Wk=Wv=I; MLP=I+ReLU+I; gamma=(1,1), beta=(0,0); unembed tied to Eposition 0: fully exact pathx0=(1,0); Q0=K0=V0=(1,0)score S00=1; softmax=[1] exactattn0=(1,0); residual1=(2,0)ln1 mean=1; centered=(1,-1); var=1; std=1ln1 output=(1,-1)MLP ReLU=(1,0); mlp=(1,0)residual2=(2,-1)ln2 mean=1/2; centered=(3/2,-3/2); var=9/4; std=3/2ln2 output=(1,-1)logits: a=1, b=-1, c=0argmax=a; output token=aposition 1: named softmax boundaryx1=(1,1); Q1=(1,1)K0=(1,0); K1=(1,1)scores=[1, 2]softmax=[e^1/(e^1+e^2), e^2/(e^1+e^2)]named after multi-entry softmaxordered pipelinetokens -> embed -> +pos -> attention -> +residual-> layernorm -> MLP -> +residual -> layernorm-> unembed -> logits -> argmax -> output tokenpos0 remains exact; pos1 stops at named softmaxlayernorm sqrt boundarythis transformer's 2-D layernorms are exact here; in general layernorm's square root is namednamed 3-vectorv=(1,2,3); mean=2centered=(-1,0,1)var=2/3; std=√(2/3); register=namednormalized=(-1,0,1)/√(2/3)degenerate exact 3-vectorv=(2,2,2); mean=2centered=(0,0,0)var=0; std=0; register=exactnormalized=zero-variance exact std; normalization not divided

MLP weighted sum, term by term

This SHOWS the first hidden unit with the shared weighted-sum walkthrough. Its weight row times the first layernorm output (1,-1) plus zero bias gives the exact pre-activation 1. ReLU keeps it because it is positive, so the MLP arithmetic stays exact.

z=wLNone+b=1z=\mathbf{w}\cdot\operatorname{LN}_{\text{one}}+b=1
MLP hidden pre-activation, term by termExact rational weighted sum of the first hidden unit: w·LN1 + b = 1.hidden pre-activation z = w·x + b (first MLP unit)Ac1c210·xentry1-1products1·1=1Σ=1+0·-1=0Σ=1result 1 + b 0z = 1 + (0) = 1one exact weighted sum for the first MLP hidden unit on this tiny rational model; NOTtraining, NOT learning, NOT a generalization claim

Exact MLP and second residual

ReLU keeps the positive coordinate and zeroes the negative coordinate, giving MLP output (1,0). The second residual becomes (2,-1).

MLP=(1,0),rtwo=(2,1)\operatorname{MLP}=(1,0),\quad r_{\text{two}}=(2,-1)
Through the blockExact block path plus the general layernorm boundary.Through the blockExact block path plus the general layernorm boundary.tiny transformer exact-or-named forwarddiscrete spine exact; softmax/layernorm sqrt become named only at the boundaryinput: a b; E[a]=(1,0), E[b]=(0,1), E[c]=(1,1); P0=(0,0), P1=(1,0)weights: Wq=Wk=Wv=I; MLP=I+ReLU+I; gamma=(1,1), beta=(0,0); unembed tied to Eposition 0: fully exact pathx0=(1,0); Q0=K0=V0=(1,0)score S00=1; softmax=[1] exactattn0=(1,0); residual1=(2,0)ln1 mean=1; centered=(1,-1); var=1; std=1ln1 output=(1,-1)MLP ReLU=(1,0); mlp=(1,0)residual2=(2,-1)ln2 mean=1/2; centered=(3/2,-3/2); var=9/4; std=3/2ln2 output=(1,-1)logits: a=1, b=-1, c=0argmax=a; output token=aposition 1: named softmax boundaryx1=(1,1); Q1=(1,1)K0=(1,0); K1=(1,1)scores=[1, 2]softmax=[e^1/(e^1+e^2), e^2/(e^1+e^2)]named after multi-entry softmaxordered pipelinetokens -> embed -> +pos -> attention -> +residual-> layernorm -> MLP -> +residual -> layernorm-> unembed -> logits -> argmax -> output tokenpos0 remains exact; pos1 stops at named softmaxlayernorm sqrt boundarythis transformer's 2-D layernorms are exact here; in general layernorm's square root is namednamed 3-vectorv=(1,2,3); mean=2centered=(-1,0,1)var=2/3; std=√(2/3); register=namednormalized=(-1,0,1)/√(2/3)degenerate exact 3-vectorv=(2,2,2); mean=2centered=(0,0,0)var=0; std=0; register=exactnormalized=zero-variance exact std; normalization not divided