Provedalphabaguettermsnormdeferred-normalization
Deferred RMSNorm: dW = g ⊙ dW_g and the gain gradient dg_j = Σᵢ W_ij·(dW_g)_ij, with no token-axis reduction
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
- T, m, n range over natural numbers: the statement must hold for every choice. (
(T 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) - ∧And
- Both hold: (∑ t, dy(t, i) · (g(j) · (r(t) · x(t, j)))) = g(j) · (∑ t,…, and (∑ t, (∑ i', W(i', j) · dy(t, i')) · (r(t) · x(t, j))) = (…. (
(∑ t, dy t i * (g j * (r t * x t j)) = …) - ∑Summation
- Add up dy(t, i) · (g(j) · (r(t) · x(t, j))) for every t. (
∑ t, dy t i * (g j * (r t * x t j))) - =Equality
- ∑ t, dy(t, i) · (g(j) · (r(t) · x(t, j))) and g(j) · (∑ t, r(t) · dy(t, i) · x(t, j)) are the same. (
∑ t, dy t i * (g j * (r t * x t j)) = g…) - ⟹Implies
- If Fin(n), then ℝ. (Between types, A → B is the type of functions from A to B.) (
Fin n → ℝ) - RReal numbers
- The real numbers: every point on the number line. (
ℝ) - ·Multiplication
- r(t) times x(t, j). (
r t * x t j)
theorem drn-parameter-gradients {T m n : ℕ} (W : Fin m → Fin n → ℝ) (g : Fin n → ℝ) (x : Fin T → Fin n → ℝ) (dy : Fin T → Fin m → ℝ) (r : Fin T → ℝ) (i : Fin m) (j : Fin n) :
(∑ t, dy t i * (g j * (r t * x t j)) = g j * ∑ t, (r t * dy t i) * x t j) ∧ (∑ t, (∑ i', W i' j * dy t i') * (r t * x t j) = ∑ i', W i' j * ∑ t, (r t * dy t i') * x t j)Let dW_g = Σ_t (r_t·dy_t)·x_tᵀ, one weight GEMM over row-scaled cotangents and raw inputs. First conjunct: the projection-weight gradient Σ_t dy_ti·(g_j·r_t x_tj) is g_j·(dW_g)_ij. Second conjunct: the gain gradient Σ_t (Wᵀdy_t)_j·(r_t x_tj), which Alpha's sumGainCotangentsWith currently reduces over all T rows of an activation-sized tensor, equals Σᵢ W_ij·(dW_g)_ij. That is a weight-shaped contraction the AdamW kernel can compute while it reads W and its gradient. Part of the idea 'Deferred RMS normalization for Baguette'.
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
- 16 lines of Lean
Sign in to see the proofThe proof, its signed report and its history.