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 be positive integers, and be finite real matrices, , a positive integer, and a fixed nonempty set of allowed keys for every query row . Write for row of , and for row of . Let be the forward outputs and row statistics of the exact tiled softmax attention algorithm, and fix an upstream matrix . Then each row of equals the dense masked attention row
and the algorithm's recomputed reverse procedure returns the Euclidean gradients of the scalar function with respect to , while holding , the sets , and 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 is nonempty; no convention for an all-masked row is asserted.
Statement references
Dao et al., §3.1 and Appendix C: exactness of the online tiled attention recurrence
Dao et al., Appendix B.2–B.4: reverse-mode derivatives and block recomputation
Milakov and Gimelshein, §3: online normalizer recurrence and its induction proof
MIT OCW, Chapter 8 §§8.3–8.4: finite-graph reverse-mode chain rule
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 .
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.
Stable summary of an attention key block: for nonempty , the summary coordinates are , , and ; the empty set is the separate symbol .
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 and accumulates the stated entries.
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.
Reverse mode computes the exact gradient of the real-arithmetic graph: for a finite program with one scalar output on a fixed strict branch, reverse mode returns the exact derivative of that output.
The chain rule for total derivatives: : for totally differentiable finite-dimensional maps, the derivative of a composition is the ordered composition of the derivatives.
Backpropagation through a finite shared-parameter recurrence: the same parameter vector is supplied to every transition.
Reverse accumulation sums gradients over shared parameter uses: the gradient formula includes a pullback term for each transition using the shared parameter.
Proof
Fix a query row and let be the union of the allowed keys in the blocks processed so far. Initially and the algorithm's state is . An empty allowed block leaves both and the state unchanged. If and the next allowed block is nonempty, copying gives the defining summary of . If and are both nonempty, the merged maximum is , and while . The same two identities with inside each sum give the merged coordinate. Disjoint blocks therefore preserve the summary invariant.
The key blocks partition , so after the last block . The maximum is finite and at least one term in equals , hence . Dividing by and multiplying numerator and denominator by gives the displayed dense masked attention row. This also proves every retained is defined.
With the allowed sets fixed, every score is a polynomial in the entries of ; finite exponentials, sums, and division by the strictly positive dense denominator make the dense row map smooth on all of . Its scalarization is therefore a finite 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.
For , write , as justified by step 2.1. Direct quotient differentiation gives . Thus for the score derivative is . The direct value derivative is .
Since , its coordinate derivatives are and . The chain rule therefore gives the row- contributions to , to , and to . Entries of other query rows receive no contribution from this row.
Set , , , for , and terminal loss . Step 3.1 makes every continuously differentiable on the open domain . By induction on , the recurrence state after transitions is : the formula holds at because , and adding the th transition term proves it at from its value at . Thus its scalar output is . The same parameter 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 inputs, while the row-specific pullbacks occupy their corresponding rows. There is no direct loss or initial-state parameter term because is and is constant. Thus the algorithm's reverse updates give .
At the forward values, the summary invariant in steps 1.1–2.1 gives . Therefore, for each , 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 and 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
- Exact tiled softmax attention with block-recomputed vector-Jacobian products
- Stable summary of an attention key block
- Scaled dot-product attention
- Finite straight-line computational programs and real-arithmetic tapes
- The chain rule for total derivatives: $D(g\circ f)(a)=Dg(f(a))\circ Df(a)$
- Reverse mode computes the exact gradient of the real-arithmetic graph
- Backpropagation through a finite shared-parameter recurrence
- Reverse accumulation sums gradients over shared parameter uses
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
- Tri Dao et al., FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awareness, §§3.1, Appendix B.2–B.4, and Appendix C (standard reference, not scraped)
- Maxim Milakov and Natalia Gimelshein, Online normalizer calculation for softmax, §3 (standard reference, not scraped)
- MIT OpenCourseWare 18.S096, Matrix Calculus for Machine Learning and Beyond, Chapter 8 §§8.3–8.4 (standard reference, not scraped)