Provedunbiased-attentionrandomized-algorithmssoftmaxeasy-side
SNIS mean-square error: E[(Ŷ − o)²] ≤ 16·F²·(Σ π²/r)/N for N i.i.d. draws from r
For all , and , if , , , , and , then
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
- n, N range over natural numbers: the statement must hold for every choice. (
(n N : ℕ)) - <Less than
- 0 is strictly smaller than N. (
0 < 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 n. Lean writes f x; papers write f(x). (
Fin n) - ⟹Implies
- If Fin(n), then ℝ. (Between types, A → B is the type of functions from A to B.) (
Fin n → ℝ) - x : TVariables
- r, π, v range over Fin n → ℝ: the statement must hold for every choice. (
(r π v : Fin n → ℝ)) - ∀For all
- The statement after the comma holds for every j. (
∀ j, 0 < r j) - ∑Summation
- Add up r(j) for every j. (
∑ j, r j) - =Equality
- ∑ j, r(j) and 1 are the same. (
∑ j, r j = 1) - |x|Absolute value
- The size of v(j) without its sign. (
|v j|) - ≤At most
- |v(j)| is less than or equal to F. (
|v j| ≤ F) - RReal numbers
- The real numbers: every point on the number line. (
ℝ) - πPi
- The ratio of a circle's circumference to its diameter, ≈ 3.14159. (
π) - ∏Product
- Multiply together r(f(k)) for every k. (
∏ k, r (f k)) - aᵇPower
- (∑ i, π(f(i))/r(f(i)) · v(f(i)))/(∑ i, π(f(i))/r(f(i))) − … raised to the power 2. (
((∑ i, π (f i) / r (f i) * v (f i)) / (…) - -Subtraction
- (∑ i, π(f(i))/r(f(i)) · v(f(i)))/(∑ i, π(f(i))/r(f(i))) minus ∑ j, π(j) · v(j). On ℕ, Lean's subtraction stops at 0: 2 − 5 = 0. (
(∑ i, π (f i) / r (f i) * v (f i)) / (∑…) - a/bDivision
- π(f(i)) divided by r(f(i)). In Lean, dividing by 0 gives 0. (
π (f i) / r (f i)) - ·Multiplication
- π(f(i))/r(f(i)) times v(f(i)). (
π (f i) / r (f i) * v (f i))
theorem ua-snis-mse-bound {n N : ℕ} (hN : 0 < N) (r π v : Fin n → ℝ) (F : ℝ) (hr : ∀ j, 0 < r j) (hrs : ∑ j, r j = 1) (hπ : ∀ j, 0 < π j) (hπs : ∑ j, π j = 1) (hv : ∀ j, |v j| ≤ F) :
∑ f : Fin N → Fin n, (∏ k, r (f k)) * ((∑ i, π (f i) / r (f i) * v (f i)) / (∑ i, π (f i) / r (f i)) - ∑ j, π j * v j) ^ 2 ≤ 16 * F ^ 2 * (∑ j, π j ^ 2 / r j) / NSelf-normalized importance sampling of a softmax row π with values |v| ≤ F, N i.i.d. keys from any proposal r > 0: the MSE is at most 16 F² (1 + χ²(π‖r))/N. Proven over the exact finite product space (no measure theory needed), with the i.i.d. identity inlined. Part of 'Unbiased randomized attention: cost x variance thresholds' (open theory problem), round 2.
How it was proved
- Proved
- 4 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
- 160 lines of Lean
Sign in to see the proofThe proof, its signed report and its history.