2026/07/21 by Lenore Mulin, Gaetan Hains
#cs.LG #cs.AI
We derive four memory-optimal inference artifacts for transformer attention using the Mathematics of Arrays (MoA), each following directly from the forward-pass Denotational Normal Form (DNF) of with the query-row index fixed to the current decode step. The artifacts are: (1)~a single-query decode DNF in which the ψ-reduction eliminates the K^\top buffer algebraically, achieving (dk + ndk+ ndv+ dv)×4 B Dynamic Random Access Memory (DRAM) traffic result numerically verified to ‖err‖_≤2×10-7; (2)~a C/OpenACC Graphics Processing Unit (GPU) kernel with Operational Normal Form (ONF) stride arithmetic and hardware-coalesced memory access, verified to ‖err‖_∞=0 (exact IEEE-754 floating-point arithmetic); (3)~a multi-step KV-cache with O(dk+dv) per-step append via MoA concatenation #; and (4)~Grouped-Query Attention (GQA) and Multi-Query Attention (MQA) derived via ψ-selection, achieving a proven \frac hq hkv reduction in KV traffic. All programs are verified against PyTorch scaleddotproductattention.