Alphabeta Math
TheoremStatement: Literature-sourcedProof: AI-generatedPipeline-generatedprecheck passjudge pass (gpt-6-luna)
How statement and proof provenance work

The first chip identifies the source of the statement or construction; the second identifies the source of its local proof or verification.

  • Literature-sourced: the exact statement appears in a cited source; only wording and notation differ.
  • AI-adapted: a semantically identical restatement of literature-sourced material, modulo indexing, notation, and boundary cases adopted by the library.
  • AI-generated: a genuinely novel statement formulated by AI, with no source for the claim itself.

These labels describe origin, not correctness: citations and verification chips remain separate evidence.

Tiled attention and its recomputed reverse pass are exact

Statement

Let n,d,v be positive integers, Q,K∈Rn×d and V∈Rn×v be finite real matrices, c∈R, b a positive integer, and Ai⊆{1,…,n} a fixed nonempty set of allowed keys for every query row i. Write Qi for row i of Q, and Kj,Vj for row j of K,V. Let Y,mi,ℓi be the forward outputs and row statistics of the exact tiled softmax attention algorithm, and fix an upstream matrix G∈Rn×v. Then each row of Y equals the dense masked attention row

Yi=∑j∈AiecQiKjTVj∑j∈AiecQiKjT,

and the algorithm's recomputed reverse procedure returns the Euclidean gradients of the scalar function Φ(Q,K,V)=∑i=1n∑a=1vGiaYia with respect to Q,K,V, while holding c, the sets Ai, and G fixed. Its reverse rule treats the stored maxima as fixed normalization shifts, so the conclusion also holds when scores tie at a row maximum. Every row is defined because Ai is nonempty; no convention for an all-masked row is asserted.

Facts & Assumptions

Given: The finite real inputs, the fixed nonempty allowed-key sets, the positive block size, the forward and reverse procedures, and the upstream matrix G.

[F1]

Scaled dot-product attention: masked attention uses row softmax of the scaled query-key scores and is defined only when each row has an allowed key.

[F2]

Stable summary of an attention key block: for nonempty S, the summary coordinates are max⁡j∈Ssij, ∑j∈Sesij−mi(S), and ∑j∈Sesij−mi(S)Vj; the empty set is the separate symbol ⊥.

[F3]

Exact tiled softmax attention with block-recomputed vector-Jacobian products: the forward pass skips empty allowed blocks, copies the first nonempty block summary, merges later summaries, and the reverse pass recomputes pij and accumulates the stated dQ,dK,dV entries.

[F4]

Finite straight-line computational programs and real-arithmetic tapes: a finite topologically ordered real-arithmetic graph has differentiable primitive maps on open domains and repeated input uses are separate parent slots.

[F5]

Reverse mode computes the exact gradient of the real-arithmetic graph: for a finite C1 program with one scalar output on a fixed strict branch, reverse mode returns the exact derivative of that output.

[F6]

The chain rule for total derivatives: D(g∘f)(a)=Dg(f(a))∘Df(a): for totally differentiable finite-dimensional maps, the derivative of a composition is the ordered composition of the derivatives.

[F7]

Backpropagation through a finite shared-parameter recurrence: the same parameter vector is supplied to every transition.

[F8]

Reverse accumulation sums gradients over shared parameter uses: the gradient formula includes a pullback term for each transition using the shared parameter.

Proof

technique · identify the exact summary invariant, then differentiate the equivalent dense masked attention map and group repeated input contributions
1.1F2F3givenconstruct

Fix a query row i and let S be the union of the allowed keys in the blocks processed so far. Initially S=∅ and the algorithm's state is ⊥. An empty allowed block leaves both S and the state unchanged. If S=∅ and the next allowed block I is nonempty, copying Σi(I) gives the defining summary of S∪I. If S and I are both nonempty, the merged maximum is max⁡(mi(S),mi(I))=mi(S∪I), and emi(S)−mi(S∪I)ℓi(S)=∑j∈Sesij−mi(S∪I) while emi(I)−mi(S∪I)ℓi(I)=∑j∈Iesij−mi(S∪I). The same two identities with Vj inside each sum give the merged z coordinate. Disjoint blocks therefore preserve the summary invariant.

2.1F1F2F3step 1.1algebra

The key blocks partition {1,…,n}, so after the last block S=Ai≠∅. The maximum mi is finite and at least one term in ℓi=∑j∈Aiesij−mi equals 1, hence ℓi>0. Dividing zi by ℓi and multiplying numerator and denominator by emi gives the displayed dense masked attention row. This also proves every retained mi,ℓi is defined.

3.1F4F5F6step 2.1given

With the allowed sets fixed, every score is a polynomial in the entries of Q,K; finite exponentials, sums, and division by the strictly positive dense denominator make the dense row map smooth on all of Rn(2d+v). Its scalarization Φ is therefore a finite C1 real-arithmetic graph. The reverse-mode theorem and chain rule apply to this dense graph; the maximum used only to scale the tiled forward computation is not a primitive of this graph.

4.1F5F6step 2.1step 3.1algebra

For j,k∈Ai, write pij=esij/∑ℓ∈Aiesiℓ, as justified by step 2.1. Direct quotient differentiation gives ∂pik∂sij=pik(1{k=j}−pij). Thus for Φi=∑aGiaYia the score derivative is ∂Φi∂sij=∑k∈Ai(∑aGiaVka)∂pik∂sij=pij(∑aGiaVja−∑aGiaYia)=γij. The direct value derivative is ∇VjΦi=pijGi.

5.1F6step 4.1algebra

Since sij=c∑rQirKjr, its coordinate derivatives are ∂sij/∂Qir=cKjr and ∂sij/∂Kjr=cQir. The chain rule therefore gives the row-i contributions c∑j∈AiγijKj to Qi, cγijQi to Kj, and pijGi to Vj. Entries of other query rows receive no contribution from this row.

6.1F7F8step 3.1step 5.1algebra

Set Θ=R2nd+nv, H=R, h0(θ)=0, Fi(θ,h)=h+∑aGiaYia(θ) for i=1,…,n, and terminal loss λ(θ,h)=h. Step 3.1 makes every Fi continuously differentiable on the open domain Θ×H. By induction on i, the recurrence state after i transitions is hi=∑r=1i∑aGraYra(θ): the formula holds at i=0 because h0=0, and adding the ith transition term proves it at i from its value at i−1. Thus its scalar output is hn=Φ(θ). The same parameter θ=(Q,K,V) is supplied at every transition, and the shared-parameter gradient formula sums each transition's parameter pullback. It therefore adds each row's pullback at the common K,V inputs, while the row-specific Qi pullbacks occupy their corresponding rows. There is no direct loss or initial-state parameter term because λ is h and h0 is constant. Thus the algorithm's reverse updates give ∇QΦ,∇KΦ,∇VΦ.

7.1F2F3step 2.1step 3.1step 4.1step 5.1step 6.1algebra∎

At the forward values, the summary invariant in steps 1.1–2.1 gives ℓi=∑j∈Aiesij−mi. Therefore, for each j∈Ai, pij=esij−miℓi=esij∑ℓ∈Aiesiℓ. This is the dense softmax probability evaluated at the current scores. Steps 4.1–6.1 differentiate the smooth dense attention map and show that substituting these probabilities into the reverse updates gives its exact gradient at these inputs. The stored mi and ℓi are used as normalization shifts in those updates; no derivative of either statistic is needed. The argument applies whether or not the maximum score is tied.

Depends on

Used by

Dependency tree · two levels

15 results within two dependency steps of this one, each drawn at its shortest distance from it. An arrow runs from a result to what uses it, so the chart reads left to right and ends at this result, which carries a heavier outline. Every node is a link to that result. Click elsewhere on the chart to enlarge it.

Sources