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.
Exact tiled softmax attention with block-recomputed vector-Jacobian products
Definition
Inputs: Positive integers , finite real matrices and , a real scale , a positive integer key-block size , and fixed nonempty allowed-key sets . The algorithm reads membership in each on demand; any caller-owned representation of the mask is input storage. All operations below are in exact real arithmetic. Set for .
Forward procedure:
- For each query row , set the current summary to .
- For , form . If , skip this block and leave the summary unchanged. Otherwise compute . If the current summary is , copy ; otherwise merge the current summary with using .
- After the final block, write and retain the final and for a later reverse pass.
- Return and the retained row statistics.
Reverse procedure: Given a forward run with the same and an upstream matrix , initialize to zero. For each query row , compute . For every block and each , recompute from and set
Then, for , add to the query and key gradient arrays, and for , add to the value gradient array:
Return . Do not store a full score or probability matrix: the reverse procedure recomputes one block's scores from the same inputs and fixed allowed-key sets. The prescribed reverse procedure treats the forward maxima and normalizers as frozen scaling statistics; it does not differentiate a maximum operation. The base algorithm has no dropout. Any dropout extension must replay the same realized dropout mask in its reverse pass.
Definition references
Summary state and merge convention
Masked scaled dot-product attention
Addition of contributions from repeated uses of shared inputs
Exact reverse-mode differentiation of a finite smooth real-arithmetic graph
Milakov and Gimelshein, §§2–3: stable online softmax normalizer
MIT OCW, Chapter 8 §§8.3–8.4: reverse-mode chain rule and accumulation at shared inputs
Depends on
Used by
- A different dropout mask changes the reverse result Example
- An empty first masked key block Example
- One-key tiled attention Example
- The scalar workspace result is not a hardware I/O bound Remark
- Tiled attention and its recomputed reverse pass are exact Theorem
- Tiled attention uses linear retained memory and quadratic arithmetic Theorem
Dependency tree · two levels
7 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, §§2–3, Appendix B.2–B.4, and Appendix C (standard reference, not scraped)
- Maxim Milakov and Natalia Gimelshein, Online normalizer calculation for softmax, §§2–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)