Provedalphabaguettermsnormdeferred-normalization
Deferred RMSNorm, backward: norm VJP ∘ linear VJP = r·(W_gᵀdy) − (r²/n)·⟨dy, y⟩·x
For all , , , , and :
What the notation means · or point at any symbol
- NNatural numbers
- The natural numbers 0, 1, 2, …. In Lean they start at 0. (
ℕ) - x ∈ TVariables
- m, n range over natural numbers: the statement must hold for every choice. (
(m n : ℕ)) - Fin
- Fin: a definition from the library, not special notation. Its name is its meaning; open it in Lean to see how it is defined. (
Fin) - f(x)Function application
- Fin applied to m. Lean writes f x; papers write f(x). (
Fin m) - x : TVariables
- g, x range over Fin n → ℝ: the statement must hold for every choice. (
(g x : Fin n → ℝ)) - =Equality
- r · (g(k) · (∑ i, W(i, k) · dy(i)) − r · x(k) · ((∑ j, g(j… and r · (∑ i, W(i, k) · g(k) · dy(i)) − r^2/n · (∑ i, dy(i) · … are the same. (
r * (g k * (∑ i, W i k * dy i) - r * x …) - -Subtraction
- g(k) · (∑ i, W(i, k) · dy(i)) minus r · x(k) · ((∑ j, g(j) · (∑ i, W(i, j) · dy(i)) · (r · x(j…. On ℕ, Lean's subtraction stops at 0: 2 − 5 = 0. (
g k * (∑ i, W i k * dy i) - r * x k * (…) - ⟹Implies
- If Fin(n), then ℝ. (Between types, A → B is the type of functions from A to B.) (
Fin n → ℝ) - ∑Summation
- Add up W(i, k) · dy(i) for every i. (
∑ i, W i k * dy i) - RReal numbers
- The real numbers: every point on the number line. (
ℝ) - ·Multiplication
- W(i, k) times dy(i). (
W i k * dy i) - a/bDivision
- ∑ j, g(j) · (∑ i, W(i, j) · dy(i)) · (r · x(j)) divided by n. In Lean, dividing by 0 gives 0. (
(∑ j, g j * (∑ i, W i j * dy i) * (r * …) - aᵇPower
- r raised to the power 2. (
r ^ 2)
theorem drn-input-pullback {m n : ℕ} (W : Fin m → Fin n → ℝ) (g x : Fin n → ℝ) (dy : Fin m → ℝ) (r : ℝ) (k : Fin n) :
r * (g k * (∑ i, W i k * dy i) - r * x k * ((∑ j, g j * (∑ i, W i j * dy i) * (r * x j)) / n)) = r * (∑ i, (W i k * g k) * dy i) - r ^ 2 / n * (∑ i, dy i * (r * ∑ j, (W i j * g j) * x j)) * x kLeft side: Alpha's RMSNorm input pullback r·(v_k − z_k·mean(v⊙z)) with v = g ⊙ Wᵀdy and z = r·x, i.e. the composed pullback through the gain and the projection. Right side: the deferred form, one data-GEMM output r·(W_gᵀdy) corrected by a single scalar per row s = ⟨dy, y⟩ with y = r·W_g x, the forward output. dx therefore becomes a GEMM epilogue and needs no normalized activations. Part of the idea 'Deferred RMS normalization for Baguette'. Prior art for the row-statistic move: CODA (arXiv:2605.19269).
How it was proved
- Proved
- 3 October 2026
- By
- Ajax, with the agent “Baguette math & proofs (Claude Code, 2026-10-03)”
- Checked by
- Lean's kernel (Lean 4.33.1, with Mathlib); the proof is signed and replays offline
- Axioms
- Classical.choice, Quot.sound, propext
- Proof
- 20 lines of Lean
Sign in to see the proofThe proof, its signed report and its history.