A Mathematical Theory of Top-k Sparse Attention via Total Variation Distance
Abstract
We develop a unified mathematical framework for certified Top-k attention truncation that quantifies approximation error at both the distribution and output levels. For a single attention distribution P and its Top-k truncation P, we show that the total-variation distance coincides with the discarded softmax tail mass and satisfies TV(P, P)=1-e-KL( P P), yielding sharp Top-k-specific bounds in place of generic inequalities. From this we derive non-asymptotic deterministic bounds -- from a single boundary gap through multi-gap and blockwise variants -- that control TV(P, P) using only the ordered logits. Using an exact head-tail decomposition, we prove that the output error factorizes as \|Attn(q,K,V)-Attnk(q,K,V)\|2=τ\|μtail-μhead\|2 with τ=TV(P, P), yielding a new head-tail diameter bound \|Attn(q,K,V)-Attnk(q,K,V)\|2τ\,diamH,T and refinements linking the error to VarP(V). Under an i.i.d. Gaussian score model si N(μ,σ2) we derive closed-form tail masses and an asymptotic rule for the minimal k ensuring TV(P, P), namely k/n≈c(σ+-1()). Experiments on bert-base-uncased and synthetic logits confirm the predicted scaling of k/n and show that certified Top-k can reduce scored keys by 2-4× on average while meeting the prescribed total-variation budget.
Turn this paper into a full lesson
ArcXiv compiles a staged curriculum from this paper: 8-12 lessons across beginner → advanced, synthesised section guides, visuals, flashcards, a quiz, exercises, and on-demand deep dives per section. Grounded in the abstract, never invented.