Elastic Threshold Attention:用于长上下文解码的学习上下文稀疏性
摘要
Elastic Threshold Attention (ETA) 是一种可训练的稀疏注意力架构,它通过使用从查询表示中预测的动态阈值,在不降低质量的情况下提高长上下文解码速度。
arXiv:2609.20888v1 Announce Type: new
Abstract: Massive KV caches can cause severe memory-bandwidth bottlenecks during long-context decoding. Sparse attention methods mitigate this via selective loading, but that comes at a cost: rigid heuristics drop necessary context, leading to quality degradation. We introduce \textbf{Elastic Threshold Attention (ETA)}, an end-to-end trainable architecture that achieves hardware-accelerated decoding speed without sacrificing dense model quality. ETA predicts dynamic, contextual thresholds directly from query representations, allowing the model to allocate dense-like context to difficult retrieval or reasoning steps while pruning routine tokens. To learn this policy from scratch without representation collapse, ETA \emph{multiplicatively suppresses} sub-threshold logits toward zero during training rather than deleting them. Training against this smooth uniform attention floor provides a distributed probability reservoir that \textbf{causes localized attention sinks on initial tokens to disappear}. It also enables the model to hard-prune uninformative KV blocks at inference time and absorb incidental tokens co-admitted by coarse GPU block selection. As a result, a 1.45B pretrained ETA model rivals dense attention across language modeling, commonsense reasoning, and long-context needle retrieval at $\approx 85\%$ training sparsity and $\approx 38\%$ active decode density. At inference time, we implement a custom decode kernel in Triton that screens KV blocks in $O(1)$ time using cached geometric-probabilistic bounds, delivering up to $2.5\times$ wall-clock decode speedups over FlashAttention-2 on sequences up to 512K tokens. Finally, we introduce an offline calibration algorithm for domain-specific deployments that freezes per-head constant thresholds to eliminate predictor overhead, cutting attention compute by an additional $27\%$.
查看缓存全文
缓存时间: 2026/09/21 09:12
# Elastic Threshold Attention: Learned Contextual Sparsity for Long-Context Decoding
Source: [https://arxiv.org/html/2609.20888](https://arxiv.org/html/2609.20888)
\\uselogo
Henry LiAffiliation:\\thepaMaryam KarimzadehganAffiliation:\\thepa
###### Abstract
Massive KV caches can cause severe memory\-bandwidth bottlenecks during long\-context decoding\. Sparse attention methods mitigate this via selective loading, but that comes at a cost: rigid heuristics drop necessary context, leading to quality degradation\. We introduceElastic Threshold Attention \(ETA\), an end\-to\-end trainable architecture that achieves hardware\-accelerated decoding speed without sacrificing dense model quality\. ETA predicts dynamic, contextual thresholds directly from query representations, allowing the model to allocate dense\-like context to difficult retrieval or reasoning steps while pruning routine tokens\. To learn this policy from scratch without representation collapse, ETA*multiplicatively suppresses*sub\-threshold logits toward zero during training rather than deleting them\. Training against this smooth uniform attention floor provides a distributed probability reservoir thatcauses localized attention sinks on initial tokens to disappear\. It also enables the model to hard\-prune uninformative KV blocks at inference time and absorb incidental tokens co\-admitted by coarse GPU block selection\. As a result, a 1\.45B pretrained ETA model rivals dense attention across language modeling, commonsense reasoning, and long\-context needle retrieval at≈85%\\approx 85\\%training sparsity and≈38%\\approx 38\\%active decode density\. At inference time, we implement a custom decode kernel in Triton that screens KV blocks in𝒪\(1\)\\mathcal\{O\}\(1\)time using cached geometric\-probabilistic bounds, delivering up to2\.5×2\.5\\timeswall\-clock decode speedups over FlashAttention\-2 on sequences up to 512K tokens\. Finally, we introduce an offline calibration algorithm for domain\-specific deployments that freezes per\-head constant thresholds to eliminate predictor overhead, cutting attention compute by an additional27%27\\%\.
###### keywords
sparse attention, inference optimization, adaptive sparsity, threshold attention
## 1Introduction
The attention mechanism is the core computational and memory bottleneck of long\-context Transformer language models\([Vaswani et al\., 2017](https://arxiv.org/html/2609.20888#bib.bib1)\)\. While prompt prefilling is quadratic in compute, autoregressive decoding is strictly memory\-bound\. Generating each new token requires loading the entire Key\-Value \(KV\) cache from High\-Bandwidth Memory \(HBM\) to on\-chip SRAM\. For long sequences and large batch sizes, repeated cache transfers saturate memory bandwidth, limiting serving throughput and driving up inference costs\.
To reduce cache transfers, existing sparse attention methods implicitly accept a steep trade\-off between decoding speed and dense model quality\.*Post\-hoc heuristic eviction and fixed\-kkrouting*methods\([Xiao et al\., 2024](https://arxiv.org/html/2609.20888#bib.bib13);[Zhang et al\., 2023](https://arxiv.org/html/2609.20888#bib.bib11);[Tang et al\., 2024](https://arxiv.org/html/2609.20888#bib.bib30)\)prune historical keys without training awareness and enforce rigid, input\-blind token budgets\. When a query requires broad synthesis or long\-range retrieval, fixed budgets starve the attention head of necessary context, causing severe reasoning degradation and catastrophic retrieval failure\. Conversely,*trainable sparse architectures*like Native Sparse Attention \(NSA\)\([Yuan et al\., 2025](https://arxiv.org/html/2609.20888#bib.bib5)\)or SeerAttention\([Gao et al\., 2024](https://arxiv.org/html/2609.20888#bib.bib23)\)introduce complex multi\-branch routing or enforce hard top\-kkpruning during training\. On top of requiring drastic architectural changes and tuning throughout training, these methods also delete keys outright in training by setting logits to−∞\-\\infty\. As a result, the learned attention distribution becomes brittle, so when deployed on GPU hardware, any block\-level over\-inclusion unpredictably shifts the softmax denominator and degrades generation quality\.
xtℓx\_\{t\}^\{\\ell\}Q, K Projections\+ RoPELinear ThresholdPredictorRaw AttentionScores \(SS\)Dynamic Maskσ\(β\(S−τt\)\)\\sigma\\big\(\\beta\(S\-\\tau\_\{t\}\)\\big\)Final AttentionS⊙σS\\odot\\sigmaSparsityRegularizationq¯t\\bar\{q\}\_\{t\}ScoresMultiplyGradient Flow
\(\(a\)\)Training Flow: Multiplicative Gating
xtℓx\_\{t\}^\{\\ell\}Query \(q¯t\\bar\{q\}\_\{t\}\)Predictor \(τt\\tau\_\{t\}\)\>τt\>\\\!\\tau\_\{t\}Block ScreenB1B\_\{1\}B2B\_\{2\}B3B\_\{3\}B4B\_\{4\}B5B\_\{5\}KV Cache Blocks
\(\(b\)\)Inference Flow: Block\-Sparse Kernel
Figure 1:Overview of Elastic Threshold Attention \(ETA\)\.\(a\) During training, a lightweight linear predictor emits dynamic thresholds; sub\-threshold scores are multiplicatively contracted toward zero, preserving background entropy\. \(b\) During autoregressive decoding, cached block statistics filter uninformative KV blocks via a Triton kernel, bypassing HBM transfers\.In this work, we introduceElastic Threshold Attention \(ETA\), an end\-to\-end trainable architecture that addresses this speed\-quality trade\-off through*fine\-grained contextuality*and*trainable multiplicative suppression*\. ETA attaches a single linear projection per layer \(<0\.1%<0\.1\\%parameter overhead\) that maps post\-RoPE queries to dynamic, per\-head scalar thresholds\. Because thresholds are conditioned directly on query representations, each token selects an attention budget tailored to its specific semantic difficulty\.
To learn this contextual policy from scratch without losing dense representational fidelity, ETA redefines how sub\-threshold tokens are treated\. Whereas prior sparse mechanisms delete unselected tokens by pushing logits to−∞\-\\infty, we find that hard deletion is counterproductive for end\-to\-end training\. ETA instead suppresses sub\-threshold keys*multiplicatively*: raw scores are scaled by an annealed sigmoid gate,S⊙σ\(β\(S−τ\)\)S\\odot\\sigma\(\\beta\(S\-\\tau\)\)\. Contracting unselected logits toward zero rather than−∞\-\\inftyestablishes a smooth, uniform attention floor across suppressed keys\.
In standard softmax attention, when a query lacks strong semantic matches in the context, normalization forces excess probability mass onto initial anchor tokens, creating persistent*attention sinks*\([Xiao et al\., 2024](https://arxiv.org/html/2609.20888#bib.bib13)\)\. In ETA, the uniform attention floor instead distributes unused softmax mass evenly,causing localized attention sinks on initial tokens to disappear entirely\. Simultaneously, this uniform floor acts as an essential buffer at inference time: when deployed on GPU hardware, a model trained against this baseline absorbs incidental sub\-threshold tokens co\-admitted by coarse memory tiles without distribution shift\. In contrast, an identical model trained with hard additive masking suffers a16\.6%16\.6\\%perplexity penalty while remaining1\.84×1\.84\\timesdenser\.
To turn algorithmic sparsity into wall\-clock speed, we design a custom block\-sparse Triton decode kernel\. The kernel maintains a compact running cache of block centroids, variances, and maximum norms, screening non\-significant KV blocks in𝒪\(1\)\\mathcal\{O\}\(1\)time without transferring key\-value tensors from HBM\. This allows ETA to rival dense attention in inference time while exhibiting much higher decoding throughput due to its contextual, dynamic sparsity\.
Furthermore, while contextual thresholding provides essential runtime adaptivity for general\-purpose reasoning and long\-range retrieval, we also introduce an offline calibration algorithm for stationary, domain\-specific deployments\. When serving a fixed target domain, calibrating static per\-head thresholds matches dynamic perplexity while cutting attention compute by an additional27%27\\%\.
#### Our Contributions
- •Suppress, not Prune & Elimination of Attention Sinks:We demonstrate that multiplicative logit suppression during training creates a uniform attention floor that absorbs unused probability mass, making the model resilient to inference\-time block pruning and over\-inclusion\. It also leads localized attention sinks on initial anchor tokens to disappear\.
- •Contextual Sparsity & Domain\-Specific Calibration:We show that runtime query\-conditioned thresholds preserve dense model quality, while also supporting optional offline calibration into static per\-head constants for stationary, domain\-specific serving\.
- •Hardware\-Co\-Designed Decoding:We develop a GQA\-aware fused Triton decode kernel that evaluates geometric\-probabilistic block bounds in𝒪\(1\)\\mathcal\{O\}\(1\)time, eliminating KV cache memory traffic for pruned blocks\.
- •Dense\-Quality Retention & Wall\-Clock Speedup:Pretrained on≈42\\approx 42B tokens at 1\.45B parameters, ETA rivals dense attention across perplexity benchmarks, commonsense reasoning, and long\-context needle retrieval, while achieving up to2\.5×2\.5\\timesdecode speedups over FlashAttention\-2 at context lengths up to 512K\.
### 1\.1Related Work
The literature of efficient attention methods is vast with techniques spanning both theoretical and practical considerations\.
#### Heuristic Eviction and Windowing\.
Early subquadratic attention methods relied on structural heuristics like sliding windows\([Child et al\., 2019](https://arxiv.org/html/2609.20888#bib.bib6)\), random routing\([Zaheer et al\., 2020](https://arxiv.org/html/2609.20888#bib.bib7)\), or low\-rank kernel approximations\([Choromanski et al\., 2020](https://arxiv.org/html/2609.20888#bib.bib15);[Shen et al\., 2021](https://arxiv.org/html/2609.20888#bib.bib8)\)\. For long\-context generation, modern KV cache management methods such asH2O\\text\{H\}\_\{2\}\\text\{O\}\([Zhang et al\., 2023](https://arxiv.org/html/2609.20888#bib.bib11)\)and StreamingLLM\([Xiao et al\., 2024](https://arxiv.org/html/2609.20888#bib.bib13)\)evict past tokens dynamically by tracking cumulative attention scores or preserving initial sink tokens\. While effective at reducing cache footprints, these heuristics decouple pruning from model training, frequently evicting non\-recent information and degrading long\-context reasoning\.
#### Dynamic Routing and Block\-Sparse Selectors\.
To bridge theoretical FLOP reductions and practical GPU acceleration\([Jiang et al\., 2024](https://arxiv.org/html/2609.20888#bib.bib28);[Tang et al\., 2024](https://arxiv.org/html/2609.20888#bib.bib30)\), dynamic selection methods identify salient context on the fly viakk\-nearest neighbor search\([Roy et al\., 2021](https://arxiv.org/html/2609.20888#bib.bib14);[Haris, 2025](https://arxiv.org/html/2609.20888#bib.bib26)\), Locality Sensitive Hashing\([Chen et al\., 2025](https://arxiv.org/html/2609.20888#bib.bib12)\), or learned projections\([Desai et al\., 2024](https://arxiv.org/html/2609.20888#bib.bib27)\)\. Hardware\-aligned variants further structure selection into memory tiles: Quest\([Tang et al\., 2024](https://arxiv.org/html/2609.20888#bib.bib30)\)screens KV pages using min/max bounds, SpargeAttention\([Zhang et al\., 2025](https://arxiv.org/html/2609.20888#bib.bib24)\)filters blocks via compressed inner products, and SeerAttention\([Gao et al\., 2024](https://arxiv.org/html/2609.20888#bib.bib23)\)distills a 2D block gate from a dense teacher\. While[Hu et al\. \(2022\)](https://arxiv.org/html/2609.20888#bib.bib16)explored differentiable score thresholding for encoder NER, their formulation relies on a tuned top\-kkhyperparameter, hard\-masks unselected tokens to−∞\-\\infty, and lacks a custom kernel to avoid quadratic materialization\. In contrast, ETA trains end\-to\-end from scratch without a teacher, replaces−∞\-\\inftydeletion with multiplicative tail suppression to preserve background entropy, and translates dynamic per\-query thresholds into wall\-clock speedups via a fused block\-sparse Triton kernel\.
#### Trainable Sparse Attention\.
Recent architectures seek to incorporate sparsity natively into pretraining\. HiRE\([Yerram et al\., 2024](https://arxiv.org/html/2609.20888#bib.bib3)\)explores learnable compression for low\-rank attention, and DMA\([Shi et al\., 2025](https://arxiv.org/html/2609.20888#bib.bib29)\)mixes fixed masking patterns using learned gates\. Native Sparse Attention \(NSA\)\([Yuan et al\., 2025](https://arxiv.org/html/2609.20888#bib.bib5)\)achieves notable quality by combining sliding\-window, compressed\-coarse, and selected\-fine branches\. However, NSA’s multi\-branch design requires substantial architectural reconfiguration and tuning\. In contrast, ETA introduces a minimal, drop\-in modification \(<0\.1%<0\.1\\%parameter overhead\) that preserves standard single\-branch Transformer execution while unlocking hardware\-aligned decoding\.
## 2Background and Motivation
We consider a standard decoder\-only Transformer withLLlayers andHHattention heads \(full preliminaries in[Appendix A](https://arxiv.org/html/2609.20888#A1)\)\. For a sequence of lengthTT, letqt,ks,vs∈ℝdhq\_\{t\},k\_\{s\},v\_\{s\}\\in\\mathbb\{R\}^\{d\_\{h\}\}denote the query, key, and value vectors at positionst,s≤Tt,s\\leq T, with head dimensiondhd\_\{h\}\. Standard dense attention computes outputoto\_\{t\}as:
Ats=exp\(⟨qt,ks⟩/dh\)∑j=1texp\(⟨qt,kj⟩/dh\),ot=∑s=1tAtsvsA\_\{ts\}=\\frac\{\\exp\\left\(\\langle q\_\{t\},k\_\{s\}\\rangle/\\sqrt\{d\_\{h\}\}\\right\)\}\{\\sum\_\{j=1\}^\{t\}\\exp\\left\(\\langle q\_\{t\},k\_\{j\}\\rangle/\\sqrt\{d\_\{h\}\}\\right\)\},\\quad o\_\{t\}=\\sum\_\{s=1\}^\{t\}A\_\{ts\}v\_\{s\}During the prefill stage, computing this full causal attention matrix requiresΘ\(T2dh\)\\Theta\(T^\{2\}d\_\{h\}\)FLOPs\. In the autoregressive decoding stage, generating each new tokenttattends to all cached past keys and values\. Because this requires streaming the accumulated KV cache from GPU High\-Bandwidth Memory \(HBM\) to SRAM at every single step, decoding is strictly memory\-bandwidth bound\.
Sparse attention algorithms address this bottleneck by restricting attention to an active subset of indicesℐt⊆\{1,…,t\}\\mathcal\{I\}\_\{t\}\\subseteq\\\{1,\\dots,t\\\}:
ot=∑s∈ℐtAtsvso\_\{t\}=\\sum\_\{s\\in\\mathcal\{I\}\_\{t\}\}A\_\{ts\}v\_\{s\}When\|ℐt\|≪t\|\\mathcal\{I\}\_\{t\}\|\\ll t, skipping unselected keys can dramatically reduce memory traffic\. However, converting theoretical index sparsity into wall\-clock speedups requires two conditions: \(1\) token selection must align with coalesced memory blocks on hardware, and \(2\) the model must remain accurate when unselected context is omitted\.
## 3Elastic Threshold Attention
We propose Elastic Threshold Attention \(ETA\), an end\-to\-end trainable sparse attention mechanism where the model predicts its own query\-conditioned sparsity thresholds at inference time\.
### 3\.1Threshold Prediction
ETA learns sparsity patterns by quantifying key relevance through query\-key inner products⟨qt,ks⟩/dh\\langle q\_\{t\},k\_\{s\}\\rangle/\\\!\\sqrt\{d\_\{h\}\}\. Tokens falling below an adaptive thresholdτt\\tau\_\{t\}are suppressed\. We predictτt\\tau\_\{t\}using a per\-layer linear projection on post\-RoPE query vectors across allHHattention heads:
q¯tℓ=\[qt,1ℓ‖…‖qt,Hℓ\]∈ℝHdh,τtℓ=q¯tℓWτℓ\+bτℓ\\bar\{q\}\_\{t\}^\{\\ell\}=\\big\[\\,q\_\{t,1\}^\{\\ell\}\\,\\big\\\|\\,\\dots\\,\\big\\\|\\,q\_\{t,H\}^\{\\ell\}\\,\\big\]\\in\\mathbb\{R\}^\{Hd\_\{h\}\},\\qquad\\tau\_\{t\}^\{\\ell\}=\\bar\{q\}\_\{t\}^\{\\ell\}W\_\{\\tau\}^\{\\ell\}\+b\_\{\\tau\}^\{\\ell\}\(1\)whereWτℓ∈ℝHdh×HW\_\{\\tau\}^\{\\ell\}\\in\\mathbb\{R\}^\{Hd\_\{h\}\\times H\}andbτℓ∈ℝHb\_\{\\tau\}^\{\\ell\}\\in\\mathbb\{R\}^\{H\}are learnable parameters\. Conditioning on concatenated post\-RoPE queries provides two essential benefits: \(1\) rotary positional information is preserved, and \(2\) all heads within a layer coordinate jointly, allowing dynamic allocation of attention budgets across heads\.
To ensure training stability and avoid premature pruning, we employ a*start\-dense*initialization: projection weights are zero\-initialized \(Wτℓ=0W\_\{\\tau\}^\{\\ell\}=0\) and biases are set tobτℓ=−8\.0b\_\{\\tau\}^\{\\ell\}=\-8\.0\. Initially,100%100\\%of keys pass the attention mask, enabling a smooth transition from dense to sparse attention\.
### 3\.2Differentiable Masking and Tail Suppression
To allow gradient propagation toWτℓW\_\{\\tau\}^\{\\ell\}, we formulate a continuous relaxation using an annealed sigmoid gate\. For queryttand keyssat headhh, letStsh=⟨qt,ks⟩/dhS\_\{ts\}^\{h\}=\\langle q\_\{t\},k\_\{s\}\\rangle/\\sqrt\{d\_\{h\}\}denote the pre\-softmax score\. The soft inclusion probabilitymtsh∈\(0,1\)m\_\{ts\}^\{h\}\\in\(0,1\)is:
mtsh=σ\(β⋅\(Stsh−τt,hℓ\)\)m\_\{ts\}^\{h\}=\\sigma\\Big\(\\beta\\cdot\(S\_\{ts\}^\{h\}\-\\tau\_\{t,h\}^\{\\ell\}\)\\Big\)\(2\)where temperatureβ≥1\\beta\\geq 1is annealed linearly from1\.01\.0to5\.05\.0over pre\-training\. Annealing provides high gradient flow early in training to escape initialization, while progressively sharpening the decision boundary to bridge the train\-to\-test gap\.
Using these inclusion probabilities, we apply multiplicative score gating:
Atsh=softmax\(\(Stsh⊙Mts\)\+Mtscausal\),Mts=\{1ifs=tmtshotherwiseA\_\{ts\}^\{h\}=\\text\{softmax\}\\left\(\(S\_\{ts\}^\{h\}\\odot M\_\{ts\}\)\+M\_\{ts\}^\{\\text\{causal\}\}\\right\),\\quad M\_\{ts\}=\\begin\{cases\}1&\\text\{if \}s=t\\\\ m\_\{ts\}^\{h\}&\\text\{otherwise\}\\end\{cases\}\(3\)
Thresholdτ\\tauStsS\_\{ts\}Weightexp\(S~ts\)\\exp\(\\tilde\{S\}\_\{ts\}\)−4\-4−2\-200τ\\tau\+1\.7\+1\.7001\.01\.04\.04\.0Uniform Floor \(exp\(0\)=1\\exp\(0\)=1\)ETA MultiplicativeAdditive HardDense
\(\(a\)\)Two\-Sided Contraction to a Uniform Floor
KeysWeightexp\(S~ts\)\\exp\(\\tilde\{S\}\_\{ts\}\)Floor \(1\.01\.0\)BlockB1B\_\{1\}\(Pruned\)k1k\_\{1\}k2k\_\{2\}k3k\_\{3\}MultiplicativeAdditiveBlockB2B\_\{2\}\(Loaded\)Salientk4∗k\_\{4\}^\{\*\}k5k\_\{5\}k6k\_\{6\}
\(\(b\)\)Block Pruning and Co\-Admitted Keys
Figure 2:Multiplicative tail suppression vs\. additive deletion\.\(a\)Multiplying sub\-threshold scores \(S<τS<\\tau\) bym→0m\\to 0pulls positive scores*down*and negative scores*up*to00\.\(b\)At decode time, skipping pruned blocks \(B1B\_\{1\}\) rescales the softmax denominator uniformly without distorting relative weights among salient keys \(k4∗k\_\{4\}^\{\*\}\), while co\-admitted sub\-threshold keys \(k5,k6k\_\{5\},k\_\{6\}\) in loaded blocks \(B2B\_\{2\}\) sit at the expected1\.01\.0floor\.#### Multiplicative gating flattens the tail into a uniform attention floor\.
In standard attention, exponentiating raw scores \(exp\(Sts\)\\exp\(S\_\{ts\}\)\) produces a jagged tail where uninformative tokens vary by orders of magnitude, while additive hard masking crushes them toexp\(−∞\)=0\\exp\(\-\\infty\)=0\. In contrast, ETA’s multiplicative gate \(Sts⋅mtsS\_\{ts\}\\cdot m\_\{ts\}\) acts as atwo\-sided contraction toward zero\([2\(a\)](https://arxiv.org/html/2609.20888#S3.F2.sf1)\): asmts→0m\_\{ts\}\\to 0, positive sub\-threshold scores are pulled*downward*and negative scores are pulled*upward*toward00\. Becauseexp\(0\)=1\\exp\(0\)=1, all sub\-threshold keys converge to an identical unnormalized weight, leveling the tail into aflat, uniform attention floor\(normalized tail entropy rises from0\.7900\.790to0\.9160\.916and max\-to\-mean weight ratio drops from15\.615\.6to2\.032\.03;[Table 6](https://arxiv.org/html/2609.20888#A3.T6)\)\.
#### Invariance to block pruning and over\-inclusion\.
This uniform attention floor makes block\-sparse inference robust to both*dropping*pruned blocks \(B1B\_\{1\};[2\(b\)](https://arxiv.org/html/2609.20888#S3.F2.sf2)\) and*co\-admitting*incidental sub\-threshold keys inside fetched blocks \(B2B\_\{2\};[2\(b\)](https://arxiv.org/html/2609.20888#S3.F2.sf2)\)\. Because suppressed keys form a flat plateau during training, their collective contribution to the attention output is an approximately constant background vector\. Consequently, hard\-pruning non\-significant blocks at decode time simply rescales the softmax denominator without altering relative weights among salient keys \([Subsection G\.1](https://arxiv.org/html/2609.20888#A7.SS1)\), while RMSNorm and the output softmax absorb the constant offset\. We verify this in[Subsection G\.2](https://arxiv.org/html/2609.20888#A7.SS2)\([Figure 7](https://arxiv.org/html/2609.20888#A7.F7)\), where block\-sparse decoding maintains𝒮cos=0\.9691\\mathcal\{S\}\_\{\\cos\}=0\.9691residual stream alignment with training\. Conversely, when coarse GPU blocks co\-admit incidental sub\-threshold keys alongside heavy hitters, the model experiences virtually no distribution shift \(0\.240\.24PPL difference between block\-level and exact token pruning;[Table 13](https://arxiv.org/html/2609.20888#A10.T13)\), whereas additive hard\-masked models suffer severe degradation \(\+16\.6%\+16\.6\\%PPL at1\.84×1\.84\\timeshigher density;[Table 6](https://arxiv.org/html/2609.20888#A3.T6)\)\.
#### Sparsity regularization\.
To incentivize sparsity during pre\-training, we penalize the mean inclusion probability across layersLL, headsHH, and positionsTT:
ℒsparsity=λsparsityLHT∑ℓ=1L∑h=1H∑t=1T1t∑s≤tmtsh\\mathcal\{L\}\_\{\\text\{sparsity\}\}=\\frac\{\\lambda\_\{\\text\{sparsity\}\}\}\{LHT\}\\sum\_\{\\ell=1\}^\{L\}\\sum\_\{h=1\}^\{H\}\\sum\_\{t=1\}^\{T\}\\frac\{1\}\{t\}\\sum\_\{s\\leq t\}m\_\{ts\}^\{h\}\(4\)Becausemtshm\_\{ts\}^\{h\}is smooth,ℒsparsity\\mathcal\{L\}\_\{\\text\{sparsity\}\}supplies direct gradients∂ℒsparsity/∂τ\\partial\\mathcal\{L\}\_\{\\text\{sparsity\}\}/\\partial\\tau, balancing predictive loss against computational budget\.
### 3\.3Efficient Fused Training Kernel
To prevent materializing the denseT×TT\\times Tattention matrix in HBM, we implement a custom fused Triton kernel\([Tillet et al\., 2019](https://arxiv.org/html/2609.20888#bib.bib4)\)\. The kernel fuses score computation, dynamic threshold evaluation, multiplicative gating, online softmax accumulation, and sparsity regularizer reduction directly in SRAM\. ETA pre\-training incurs the exact same𝒪\(T2d\)\\mathcal\{O\}\(T^\{2\}d\)FLOPs,𝒪\(Td\)\\mathcal\{O\}\(Td\)HBM footprint, and𝒪\(T2d2M−1\)\\mathcal\{O\}\(T^\{2\}d^\{2\}M^\{\-1\}\)I/O complexity as dense FlashAttention\-2\([Dao et al\., 2022](https://arxiv.org/html/2609.20888#bib.bib9)\)\. Pseudocode, gradient derivations and complexity analyses are detailed in[Appendix E](https://arxiv.org/html/2609.20888#A5)\.
## 4Hardware\-Aligned Inference Flow
During autoregressive decoding, ETA leverages its dynamic thresholding mechanism to filter uninformative tokens before loading them from High\-Bandwidth Memory \(HBM\)\. For an incoming queryqtq\_\{t\}, the linear predictor outputs per\-head thresholdsτt\\tau\_\{t\}\. With operating offsetaa, the effective threshold isτ~t=τt−a\\tilde\{\\tau\}\_\{t\}=\\tau\_\{t\}\-a\. The token\-level inference mask is thenMtsinfer,h=0M\_\{ts\}^\{\\text\{infer\},h\}=0ifStsh≥τ~tS\_\{ts\}^\{h\}\\geq\\tilde\{\\tau\}\_\{t\}and−∞\-\\inftyotherwise\. To achieve a decoding speedup, non\-significant blocks must be identified in𝒪\(1\)\\mathcal\{O\}\(1\)time without computing individual dot products\.
### 4\.1Block\-Based Scanning via Dual Metadata Caching
To align with GPU memory layouts, we partition the KV cache into contiguous blocks of sizebb\. A block is termed*significant*if it contains at least one token with attention scoreStsh≥τ~tS\_\{ts\}^\{h\}\\geq\\tilde\{\\tau\}\_\{t\}\. Incidental sub\-threshold keys within significant blocks are naturally absorbed by the model due to multiplicative tail suppression\.
To filter non\-significant blocks in𝒪\(1\)\\mathcal\{O\}\(1\)time, we cache a lightweightDual Probabilistic\-Geometric Block Indexstoring population centroids𝝁B∈ℝdh\\boldsymbol\{\\mu\}\_\{B\}\\in\\mathbb\{R\}^\{d\_\{h\}\}, coordinate\-wise variances𝝈B2∈ℝdh\\boldsymbol\{\\sigma\}\_\{B\}^\{2\}\\in\\mathbb\{R\}^\{d\_\{h\}\}, and maximum normsMB=maxk∈B‖k‖2M\_\{B\}=\\max\_\{k\\in B\}\\\|k\\\|\_\{2\}\. For queryqq, the dual screening score combines a moment\-based tail bound with a Cauchy\-Schwarz geometric ceiling:
Scoredual\(q,B\)=1dhmin\(⟨q,𝝁B⟩\+z⋅σS\(q,B\),‖q‖2⋅MB\)\\operatorname\{Score\}\_\{\\text\{dual\}\}\(q,B\)=\\frac\{1\}\{\\sqrt\{d\_\{h\}\}\}\\min\\left\(\\langle q,\\boldsymbol\{\\mu\}\_\{B\}\\rangle\+z\\cdot\\sigma\_\{S\}\(q,B\),\\;\\\|q\\\|\_\{2\}\\cdot M\_\{B\}\\right\)\(5\)whereσS\(q,B\)=∑i=1dhqi2𝝈B,i2\\sigma\_\{S\}\(q,B\)=\\sqrt\{\\sum\_\{i=1\}^\{d\_\{h\}\}q\_\{i\}^\{2\}\\boldsymbol\{\\sigma\}\_\{B,i\}^\{2\}\}with screening confidencezz\. Any block whereScoredual\(q,B\)<τ~t\\operatorname\{Score\}\_\{\\text\{dual\}\}\(q,B\)<\\tilde\{\\tau\}\_\{t\}is bypassed during HBM loading, reducing decode complexity from𝒪\(n⋅d\)\\mathcal\{O\}\(n\\cdot d\)to𝒪\(\(⌈n/b⌉\+m⋅b\)d\)\\mathcal\{O\}\\big\(\(\\lceil n/b\\rceil\+m\\cdot b\)d\\big\)form≪⌈n/b⌉m\\ll\\lceil n/b\\rceilretrieved blocks\. See[Appendix K](https://arxiv.org/html/2609.20888#A11)for a rigorous treatment\.
### 4\.2Fused Triton Kernel Implementation with Top\-1 Rescue
We implement block\-sparse decoding as a custom fused Triton kernel\([Tillet et al\., 2019](https://arxiv.org/html/2609.20888#bib.bib4)\)\. As illustrated in[Figure 3](https://arxiv.org/html/2609.20888#S4.F3)\(with full algorithmic details in[Appendix F](https://arxiv.org/html/2609.20888#A6)\), the kernel streams only block metadata into SRAM to evaluateScoredual\(q,B\)\\operatorname\{Score\}\_\{\\text\{dual\}\}\(q,B\)on the fly, skipping HBM transfers for pruned blocks\. To maximize Streaming Multiprocessor \(SM\) occupancy, the sequence is partitioned into independent block chunks processed in parallel and merged via associative online\-softmax reduction\. If an aggressive threshold prunes all candidate blocks in chunk 0, a localizedTop\-1 Rescue Mechanismunconditionally admits the single highest\-scoring block, guaranteeing numerical stability without cross\-SM synchronization \([Appendix F](https://arxiv.org/html/2609.20888#A6)\)\. Because metadata is indexed per KV head \(HKVH\_\{KV\}\), the footprint scales as𝒪\(1/b\)\\mathcal\{O\}\(1/b\), adding merely1\.6%1\.6\\%memory overhead atb=64b=64in a side table compatible with paged caches\. Context extrapolation up to81928192tokens \(4×Ltrain4\\times L\_\{\\text\{train\}\}\) is preserved via NTK\-aware RoPE scaling\([bloc97, 2023](https://arxiv.org/html/2609.20888#bib.bib25)\)\.
SRAM / RegistersHBMQueryqt∈ℝdq\_\{t\}\\in\\mathbb\{R\}^\{d\}Thresholdτt\\tau\_\{t\}Scoredual\(qt,B\)≥τt\\text\{Score\}\_\{\\text\{dual\}\}\(q\_\{t\},B\)\\geq\\tau\_\{t\}?St,B=qtKB⊤/dS\_\{t,B\}=q\_\{t\}K\_\{B\}^\{\\top\}/\\sqrt\{d\}acc←OnlineSoftmax\(S,VB\)\\text\{acc\}\\leftarrow\\text\{OnlineSoftmax\}\(S,V\_\{B\}\)Outputoto\_\{t\}\(Next Token\)Pass \(≥τt\\geq\\tau\_\{t\}\)BlockB1B\_\{1\}KB1,VB1K\_\{B\_\{1\}\},V\_\{B\_\{1\}\}\[PRUNED\]BlockB2B\_\{2\}KB2,VB2K\_\{B\_\{2\}\},V\_\{B\_\{2\}\}\[ACTIVE\]BlockB3B\_\{3\}KB3,VB3K\_\{B\_\{3\}\},V\_\{B\_\{3\}\}\[PRUNED\]⋯\\cdotsBlockBMB\_\{M\}KBM,VBMK\_\{B\_\{M\}\},V\_\{B\_\{M\}\}\[ACTIVE\]CentroidμB\\mu\_\{B\}Skip \(00I/O\)Skip \(00I/O\)LoadK,VK,V
Figure 3:Inference\-time block\-sparse selective loading mechanism\.Unimportant blocks are pruned in SRAM via lightweight metadata screening, while active blocks are loaded from HBM for fused online softmax accumulation\.
## 5Experiments
### 5\.1Training Dynamics and Regularization Scheduling
We train a 1\.45B parameter ETA language model from scratch on FineWeb\([Penedo et al\., 2024](https://arxiv.org/html/2609.20888#bib.bib20)\)using a LLaMA\-style backbone\([AI@Meta, 2024](https://arxiv.org/html/2609.20888#bib.bib2)\): 22 decoder layers,dmodel=2048d\_\{\\text\{model\}\}=2048, 32 query heads and 4 key/value heads \(GQA\) withdh=64d\_\{h\}=64, SwiGLU intermediate width 8192, and context length 2048 \([Appendix B](https://arxiv.org/html/2609.20888#A2)\)\. To isolate the effect of trainable thresholding, we train an identical dense baseline under matching hyperparameters and optimizer settings\.
The regularization coefficientλsparsity\\lambda\_\{\\text\{sparsity\}\}follows a three\-phase schedule:750750warmup steps at zero penalty, a linear ramp to5×10−45\\times 10^\{\-4\}to progressively prune attention, and a sharp reduction to2\.5×10−52\.5\\times 10^\{\-5\}\(5%5\\%of peak\) for the remaining steps\. As illustrated in[Figure 4](https://arxiv.org/html/2609.20888#S5.F4), ETA converges to pretraining loss parity with the dense baseline while achieving85%85\\%effective soft sparsity \(1−mtsh¯1\-\\overline\{m\_\{ts\}^\{h\}\}\) across all heads and layers\. Although start\-dense initialization \(bτℓ=−8b\_\{\\tau\}^\{\\ell\}=\-8\) begins in a low\-gradient regime \(σ′\(8\)=3\.35×10−4\\sigma^\{\\prime\}\(8\)=3\.35\\times 10^\{\-4\}\), Adam’s scale\-invariant updates combined with theβ\\beta\-annealing strategy drive rapid threshold migration into the score distribution within∼102\\sim 10^\{2\}optimizer steps \([Subsection B\.1](https://arxiv.org/html/2609.20888#A2.SS1)\)\.

Figure 4:Training dynamics of ETA against standard dense attention\.ETA achieves loss parity with dense attention while maintaining≈85%\\approx 85\\%average soft sparsity across all heads and layers\.
### 5\.2Inference\-Time Quality and Knowledge Benchmarks
We evaluate the 1\.45B model on an NVIDIA A100 GPU across five benchmarks: WikiText\-2\([Merity et al\., 2016](https://arxiv.org/html/2609.20888#bib.bib18)\), FineWeb, and C4\([Raffel et al\., 2020](https://arxiv.org/html/2609.20888#bib.bib22)\)for perplexity \(mean and standard deviation over250250test sequences each\), and ARC\-Easy\([Clark et al\., 2018](https://arxiv.org/html/2609.20888#bib.bib21)\)and HellaSwag\([Zellers et al\., 2019](https://arxiv.org/html/2609.20888#bib.bib19)\)for zero\-shot reasoning accuracy\. We benchmark against dense attention \(FlashAttention\-2 / SDPA\), Sliding Window Attention \(SWA\),H2O\\text\{H\}\_\{2\}\\text\{O\}\([Zhang et al\., 2023](https://arxiv.org/html/2609.20888#bib.bib11)\), StreamingLLM\([Xiao et al\., 2024](https://arxiv.org/html/2609.20888#bib.bib13)\), and BigBird\([Zaheer et al\., 2020](https://arxiv.org/html/2609.20888#bib.bib7)\)\.
Table 1:Performance benchmarks comparing perplexity and accuracy\.Lower sub\-text in each cell indicates attended token fraction \(hardware density\)\. Bold indicates the best sparse method per column\. Because ARC\-Easy and HellaSwag sequences are shorter than window sizeW=256W=256, fixed\-window baselines default to100%100\\%dense attention, whereas ETA prunes dynamically within short contexts\.As reported in[Table 1](https://arxiv.org/html/2609.20888#S5.T1), block\-sparse ETA achieves language modeling parity with dense attention across all corpora \(FineWeb14\.8314\.83vs\.14\.7014\.70; C418\.9918\.99vs\.18\.9618\.96\) while operating at≈38%\{\\approx\}38\\%per\-head token density \(2\.5×2\.5\\timescompute reduction\), substantially outperforming heuristic eviction and sliding\-window baselines at comparable density\. On reasoning benchmarks, ETA outperforms dense attention on ARC\-Easy \(44\.5%44\.5\\%vs\.44\.0%44\.0\\%\) and HellaSwag \(40\.0%40\.0\\%vs\.36\.0%36\.0\\%\), exhibiting an attentional denoising effect where suppressing low\-relevance historical tokens regularizes against attention dilution\.
### 5\.3Block Granularity and GQA Union Loading
Deploying block\-sparse attention on modern GPUs introduces three systems considerations beyond token\-level sparsity \([Appendix J](https://arxiv.org/html/2609.20888#A10)\)\. First, coarsening exact token\-level hard selection \(b=1b=1\) into contiguous GPU blocks \(b=4b=4\) alters perplexity by merely0\.240\.24points despite co\-admitting neighbor tokens \([Table 13](https://arxiv.org/html/2609.20888#A10.T13)\)\. Second, in Grouped\-Query Attention \(G=HQ/HKVG=H\_\{Q\}/H\_\{KV\}\), physical hardware loads the group union of active blocks𝒰g=⋃q∈𝒢g𝒮q\\mathcal\{U\}\_\{g\}=\\bigcup\_\{q\\in\\mathcal\{G\}\_\{g\}\}\\mathcal\{S\}\_\{q\}\. Because query heads within a group attend to correlated semantic anchors, empirical measurements on C4 show that the union expands by onlyDunion/Dhead=1\.49×D\_\{\\text\{union\}\}/D\_\{\\text\{head\}\}=1\.49\\timesrather thanG×G\\times, preserving49\.23%49\.23\\%physical HBM I/O savings \([Figure 9](https://arxiv.org/html/2609.20888#A10.F9)\)\.
Third, block sizebbgoverns a trade\-off between*per\-head token selectivity*and*GQA union amortization*\. Evaluated at a matched per\-head token density \([Table 14](https://arxiv.org/html/2609.20888#A10.T14)\), smaller blocks \(b=4b=4\) minimize over\-inclusion and achieve higher token recall \(98\.3%98\.3\\%vs\.95\.3%95\.3\\%\), yielding lower perplexity \(17\.3817\.38vs\.19\.1519\.15\)\. However, when evaluated at a fixed*physical HBM union transfer budget*\(Dunion≈51%D\_\{\\text\{union\}\}\\approx 51\\%;[Table 2](https://arxiv.org/html/2609.20888#S5.T2)\), coarser blocks \(b=64b=64\) naturally coalesce nearby token selections from different query heads in a GQA group into the same shared memory tile, compressing the union expansion ratio from1\.48×1\.48\\timesdown to1\.17×1\.17\\times\. Consequently, for the exact same HBM memory transfer, each individual query head attends to\+9\.5%\+9\.5\\%more tokens \(44\.3%44\.3\\%vs\.34\.8%34\.8\\%head density\), improving perplexity by8\.88\.8points overb=4b=4while enabling coalesced Tensor Core execution\.
Table 2:Block size at matched GQA\-union HBM bandwidth,126126M Normal ETA, C4,L=2048L=2048, batch44,200200batches,a=0\.4a=0\.4\. For eachbb,zzis selected so that physical GQA union density lands nearest51%51\\%\.
### 5\.4Comparison with Native Sparse Attention \(NSA\)
We benchmark ETA against Native Sparse Attention \(NSA\)\([Yuan et al\., 2025](https://arxiv.org/html/2609.20888#bib.bib5)\)on a 126M backbone \(163\.8163\.8M tokens; see[Appendix I](https://arxiv.org/html/2609.20888#A9)for more details\)\. ETA optimizes faster and converges to a lower pretraining loss, saving10%10\\%wall\-clock training time \([Figure 8](https://arxiv.org/html/2609.20888#A9.F8)\)\. In downstream generation \(L=2048L=2048\), ETA achieves lower perplexity on FineWeb \(99\.8099\.80vs\.103\.55103\.55\) and WikiText\-2 \(158\.64158\.64vs\.161\.65161\.65\) at53%53\\%sparsity \([Table 11](https://arxiv.org/html/2609.20888#A9.T11)\)\. Furthermore, ETA’s fused single\-pass decode kernel eliminates multi\-kernel launch overhead, achieving up to2\.72×2\.72\\timeslower step latency and2\.72×2\.72\\timeshigher throughput with1\.63×1\.63\\timesspeedup at32K32\\text\{K\}context \([Table 12](https://arxiv.org/html/2609.20888#A9.T12)\)\.
### 5\.5Long\-Context Retrieval: Needle\-in\-a\-Haystack
We evaluate factual retrieval across context lengths up toL=8192L=8192\(4×4\\timespretraining window\) across 9 depth positions \([Table 3](https://arxiv.org/html/2609.20888#S5.T3)\) following the Needle\-in\-a\-Haystack benchmark\([Kamradt, 2023](https://arxiv.org/html/2609.20888#bib.bib17)\)\. ETA matches or exceeds dense attention across all sequence lengths\. Notably, atL=8192L=8192, dense attention suffers retrieval collapse \(0\.0%0\.0\\%\), whereas ETA retains22\.2%22\.2\\%accuracy by dynamically expanding active density from30\.1%30\.1\\%to69\.3%69\.3\\%to preserve salient context\. In contrast, heuristic eviction and sliding\-window baselines \(H2O, StreamingLLM, SWA\) collapse completely \(0\.0%0\.0\\%\) beyondL=2048L=2048because fixed capacity budgets permanently discard historical needles embedded outside their local window\.
Table 3:Needle\-in\-a\-Haystack retrieval accuracy across context lengths\.Accuracy averaged over99needle depths \(𝚗𝚎𝚎𝚍𝚕𝚎\_𝚙𝚘𝚜∈\{0%,12\.5%,…,100%\}\\mathtt\{needle\\\_pos\}\\in\\\{0\\%,12\.5\\%,\\dots,100\\%\\\}\)\. Density reports position\-averaged head density at shortest and longest context lengths\.
### 5\.6Mechanistic Interpretation
#### Elimination of Attention Sinks\.
In standard transformers, excess probability mass is deposited onto initial anchor tokens, creating persistent*attention sinks*\([Xiao et al\., 2024](https://arxiv.org/html/2609.20888#bib.bib13)\)\. Consequently, post\-hoc eviction methods \(e\.g\., StreamingLLM,H2O\\text\{H\}\_\{2\}\\text\{O\}\) must explicitly pin initial sink tokens to avoid catastrophic collapse\. Under ETA,localized attention sinks disappear entirely: probability mass allocated to initial anchor tokens drops from\>50%\>50\\%in dense models to near zero \(<2%<2\\%\)\. Mechanistically, ETA learns to route unallocated probability mass into a diffuse background rather than onto specific anchor positions\. See[Appendix H](https://arxiv.org/html/2609.20888#A8)for more information\.
\(\(a\)\)Disappearance of attention sinks under ETA\.\(\(b\)\)Autonomous layer specialization across depth\.
Figure 5:Mechanistic Dynamics of Attention in ETA\.\(a\) Localized attention sinks disappear under ETA’s uniform background floor \(<2%<2\\%mass\)\. \(b\) Layer\-wise active density across Transformer depth, showing autonomous specialization\.
#### Autonomous Layer Specialization\.
Alongside sink elimination, ETA discovers distinct layer\-wise sparsity allocations autonomously \([5\(b\)](https://arxiv.org/html/2609.20888#S5.F5.sf2)\): Layer 0 operates as a broad context aggregator, retaining≈96%\\approx 96\\%active density to construct initial sequence representations; intermediate layers compress context aggressively, reaching peak sparsity at Layer 7 \(<8%<8\\%active density\); and deeper layers selectively restore attention capacity to synthesize final token predictions\.
### 5\.7Runtime Contextuality and Domain\-Specific Offline Calibration
#### Why Contextuality Matters and What It Encodes\.
To test whether dynamic threshold prediction \(Wτℓqt\+bτℓW\_\{\\tau\}^\{\\ell\}q\_\{t\}\+b\_\{\\tau\}^\{\\ell\}\) is necessary, we pretrain an input\-independent baseline with static per\-head thresholdsτhℓ\\tau\_\{h\}^\{\\ell\}\. Without query conditioning, the baseline converges to2\.13×2\.13\\timeshigher active density than ETA: unable to distinguish routine tokens from complex synthesis steps, optimization lowers thresholds globally to safeguard difficult predictions\. Regressing realized thresholdsτt,hℓ\\tau\_\{t,h\}^\{\\ell\}against eight query and score\-distribution statistics on held\-out C4 explains at most32\.7%32\.7\\%of variance, confirming that ETA captures genuine semantic context rather than surface heuristics\. Furthermore,≈70%\\approx 70\\%of threshold variance occurs*within*individual documents rather than across them \([Subsection D\.1](https://arxiv.org/html/2609.20888#A4.SS1)\), demonstrating fine\-grained, token\-level budget modulation\.
#### Distilling Static Thresholds for Stationary Deployments\.
While dynamic conditioning is crucial during pretraining and open\-ended retrieval, stationary deployments with stable score distributions permit distilling the predictor post\-hoc into frozen constantscℓhc^\{\\ell h\}to remove runtime overhead\. Our offline calibration \([Algorithm 1](https://arxiv.org/html/2609.20888#alg1),[Appendix D](https://arxiv.org/html/2609.20888#A4)\) accumulates a1/t1/t\-weighted score histogram over1616sequences and solves via bisection for the scalar threshold matching each head’s training density\. On held\-out C4 with our block\-sparse kernel \([Table 8](https://arxiv.org/html/2609.20888#A4.T8),[Subsection D\.3](https://arxiv.org/html/2609.20888#A4.SS3)\), calibrated static thresholds match dynamic perplexity in\-distribution \(91\.6091\.60vs\.91\.9691\.96\) at22\.4%22\.4\\%density\. Notably, calibration mitigates*length\-extrapolation density drift*on the 126M model \(Ltrain=1024L\_\{\\text\{train\}\}=1024\): atL=2048L=2048\(2×Ltrain2\\times L\_\{\\text\{train\}\}\), out\-of\-distribution RoPE rotations inflate dynamic density by1\.85×1\.85\\times\(24\.14%→44\.77%24\.14\\%\\to 44\.77\\%\)\. Because score magnitudes remain stable despite query rotation drift, static thresholds curb this inflation \(32\.83%32\.83\\%density\), reducing attention compute by27%27\\%relative to dynamic thresholds with zero perplexity loss \(100\.48100\.48vs\.100\.52100\.52\)\.
### 5\.8Wall\-Clock Decoding Latency vs\. FlashAttention\-2
To verify whether theoretical sparsity translates into wall\-clock speedups, we benchmark single decode\-step latency \(qlen=1q\_\{\\text\{len\}\}=1\) against FlashAttention\-2\([Dao, 2023](https://arxiv.org/html/2609.20888#bib.bib10)\)on an NVIDIA H100 SXM8080GB GPU infloat16\.
#### Experimental Protocol\.
We evaluate at the attention shape of our 1\.45B model:HQ=32H\_\{Q\}=32query heads,HKV=4H\_\{KV\}=4KV heads \(G=8G=8\), head dimensiondh=64d\_\{h\}=64\. Sequence lengths range from64K64\\text\{K\}to512K512\\text\{K\}tokens across batch sizesB∈\{32,64,128\}B\\in\\\{32,64,128\\\}\. Activations are extracted from real FineWeb sequences processed by the 1\.45B checkpoint\. The ETA timing region encompasses the full grouped decode kernel and chunk\-reduction pass, strictly including all block\-metadata loads\.
Table 4:Single decode\-step attention latency, ETA versus FlashAttention\-2\.NVIDIA H100 SXM8080GB,float16,HQ=32H\_\{Q\}=32,HKV=4H\_\{KV\}=4\(G=8G=8\),dh=64d\_\{h\}=64,b=64b=64with128128blocks per chunk\. Metadata reads are inside the timed region\. Regimes report GQA union density \(fraction of KV cache transferred from HBM\) with per\-head density in parentheses; the38%38\\%head\-density regime corresponds to the operating point of our 1\.45B model\. Speedup \(×\\times\) istFA2/tETAt\_\{\\text\{FA2\}\}/t\_\{\\text\{ETA\}\}\.
#### Latency and Speedup Analysis\.
As reported in[Table 4](https://arxiv.org/html/2609.20888#S5.T4), ETA outperforms FlashAttention\-2 across batch sizes and sequence lengths\. At the operating point of our trained 1\.45B model \(51\.2%51\.2\\%union,38%38\\%head density, matching dense perplexity in[Table 1](https://arxiv.org/html/2609.20888#S5.T1)\), ETA achieves speedups for allB≥64B\\geq 64, reaching1\.12×1\.12\\timesatB=64,L=512KB=64,L=512\\text\{K\}\. In sparser regimes, advantages scale substantially: at35\.5%35\.5\\%union density \(25%25\\%head density\), ETA is faster in99of1111evaluated configurations \(up to1\.48×1\.48\\timesatB=64,L=256KB=64,L=256\\text\{K\}\)\. At16\.0%16\.0\\%union density \(10%10\\%head density\), ETA delivers consistent2\.01×–2\.36×2\.01\\times\\text\{\-\-\}2\.36\\timesspeedups across all sequence lengths forB≥64B\\geq 64, reaching up to2\.50×2\.50\\timeswith coarse block tiling \(b=128b=128,[Table 9](https://arxiv.org/html/2609.20888#A6.T9)\)\. AtB≥64B\\geq 64, saturated memory channels translate physical cache savings directly into wall\-clock speedups \([Appendix F](https://arxiv.org/html/2609.20888#A6)\)\.
## 6Conclusion and Future Directions
We introduced Elastic Threshold Attention \(ETA\), an end\-to\-end differentiable architecture that replaces hard key deletion with multiplicative score suppression to establish a uniform attention floor—eliminating attention sinks while providing natural resilience to hardware block over\-inclusion\. Paired with our𝒪\(1\)\\mathcal\{O\}\(1\)GQA\-grouped Triton decode kernel, ETA rivals dense attention quality at≈38%\{\\approx\}38\\%active decode density while achieving up to2\.50×2\.50\\timeswall\-clock speedups over FlashAttention\-2 on sequences up to 512K tokens\.
Looking ahead, three primary directions appear promising: \(1\)*Scaling model capacity:*extending end\-to\-end ETA pretraining and continued\-pretraining adaptation to frontier scales \(7B–70B\+7\\text\{B\}\\text\{\-\-\}70\\text\{B\}\+parameters\); \(2\)*Broadening domain coverage:*evaluating dynamic contextual thresholding across multimodal sequences, repository\-scale code generation, and long\-horizon reasoning trajectories; and \(3\)*Next\-generation kernel co\-design:*closing the hardware bandwidth gap via custom CUDA/Cutlass kernels that integrate asynchronous Hopper TMA pipelines, warp specialization, FP8/INT4 KV quantization, and block\-sparse prefill acceleration\.
## Statement on the Use of Large Language Models
Large language models \(Gemini\) were used in the preparation of this work as general\-purpose assistants: for editing and tightening prose and as a coding aid when implementing and debugging the Triton kernels and the evaluation harness\. All theoretical and experimental design, all analysis, and all claims are the authors’\. The authors take full responsibility for the content, including for any errors that remain\.
## References
- AI@Meta \(2024\)AI@MetaLlama 3 model card\.External Links:[Link](https://github.com/meta-llama/llama3/blob/main/MODEL_CARD.md)Cited by:[§5\.1](https://arxiv.org/html/2609.20888#S5.SS1.p1.1)\.
- bloc97 \(2023\)bloc97NTK\-aware scaled rope allows llama models to have extended \(8k\+\) context size…\.External Links:[Link](https://www.reddit.com/r/LocalLLaMA/comments/14lz7j5/ntkaware_scaled_rope_allows_llama_models_to_have/)Cited by:[§4\.2](https://arxiv.org/html/2609.20888#S4.SS2.p1.1)\.
- Chenet al\.\(2025\)Z\. Chen, R\. Sadhukhan, Z\. Ye, Y\. Zhou, J\. Zhang, N\. Nolte, Y\. Tian, M\. Douze, L\. Bottou, Z\. Jia,et al\.Magicpig: lsh sampling for efficient llm generation\.InInternational Conference on Learning Representations,Vol\.2025,pp\. 44169–44190\.Cited by:[§1\.1](https://arxiv.org/html/2609.20888#S1.SS1.SSS0.Px2.p1.1)\.
- Childet al\.\(2019\)R\. Child, S\. Gray, A\. Radford, and I\. SutskeverGenerating long sequences with sparse transformers\.arXiv preprint arXiv:1904\.10509\.Cited by:[§1\.1](https://arxiv.org/html/2609.20888#S1.SS1.SSS0.Px1.p1.1)\.
- Choromanskiet al\.\(2020\)K\. Choromanski, V\. Likhosherstov, D\. Dohan, X\. Song, A\. Gane, T\. Sarlos, P\. Hawkins, J\. Davis, A\. Mohiuddin, L\. Kaiser,et al\.Rethinking attention with performers\.arXiv preprint arXiv:2009\.14794\.Cited by:[§1\.1](https://arxiv.org/html/2609.20888#S1.SS1.SSS0.Px1.p1.1)\.
- Clarket al\.\(2018\)P\. Clark, I\. Cowhey, O\. Etzioni, T\. Khot, A\. Sabharwal, C\. Schoenick, and O\. TafjordThink you have solved question answering? try arc, the ai2 reasoning challenge\.arXiv preprint arXiv:1803\.05457\.Cited by:[§5\.2](https://arxiv.org/html/2609.20888#S5.SS2.p1.1)\.
- Daoet al\.\(2022\)T\. Dao, D\. Fu, S\. Ermon, A\. Rudra, and C\. RéFlashattention: fast and memory\-efficient exact attention with io\-awareness\.Advances in neural information processing systems35,pp\. 16344–16359\.Cited by:[§E\.4](https://arxiv.org/html/2609.20888#A5.SS4.p1.1),[§3\.3](https://arxiv.org/html/2609.20888#S3.SS3.p1.1),[footnote 1](https://arxiv.org/html/2609.20888#footnote1)\.
- Dao \(2023\)T\. DaoFlashattention\-2: faster attention with better parallelism and work partitioning\.arXiv preprint arXiv:2307\.08691\.Cited by:[§5\.8](https://arxiv.org/html/2609.20888#S5.SS8.p1.1)\.
- Desaiet al\.\(2024\)A\. Desai, S\. Yang, A\. Cuadron, M\. Zaharia, J\. E\. Gonzalez, and I\. StoicaHashattention: semantic sparsity for faster inference\.arXiv preprint arXiv:2412\.14468\.Cited by:[§1\.1](https://arxiv.org/html/2609.20888#S1.SS1.SSS0.Px2.p1.1)\.
- Gaoet al\.\(2024\)Y\. Gao, Z\. Zeng, D\. Du, S\. Cao, P\. Zhou, J\. Qi, J\. Lai, H\. K\. So, T\. Cao, F\. Yang,et al\.Seerattention: learning intrinsic sparse attention in your llms\.arXiv preprint arXiv:2410\.13276\.Cited by:[§1\.1](https://arxiv.org/html/2609.20888#S1.SS1.SSS0.Px2.p1.1),[§1](https://arxiv.org/html/2609.20888#S1.p2.1)\.
- Haris \(2025\)T\. HarisKnn attention demystified: a theoretical exploration for scalable transformers\.InInternational Conference on Learning Representations,Vol\.2025,pp\. 47576–47603\.Cited by:[§1\.1](https://arxiv.org/html/2609.20888#S1.SS1.SSS0.Px2.p1.1)\.
- Huet al\.\(2022\)B\. Hu, Z\. Huang, M\. Hu, Z\. Zhang, and Y\. DouAdaptive threshold selective self\-attention for chinese ner\.InProceedings of the 29th International Conference on Computational Linguistics,pp\. 1823–1833\.Cited by:[§1\.1](https://arxiv.org/html/2609.20888#S1.SS1.SSS0.Px2.p1.1)\.
- Jianget al\.\(2024\)H\. Jiang, Y\. Li, C\. Zhang, Q\. Wu, X\. Luo, S\. Ahn, Z\. Han, A\. H\. Abdi, D\. Li, C\. Lin,et al\.Minference 1\.0: accelerating pre\-filling for long\-context llms via dynamic sparse attention\.Advances in Neural Information Processing Systems37,pp\. 52481–52515\.Cited by:[§1\.1](https://arxiv.org/html/2609.20888#S1.SS1.SSS0.Px2.p1.1)\.
- Kamradt \(2023\)G\. KamradtNeedle in a haystack \- pressure testing llms\.GitHub\.Note:[https://github\.com/gkamradt/needle\-in\-a\-haystack](https://github.com/gkamradt/needle-in-a-haystack)Accessed: 2026\-07\-29Cited by:[§5\.5](https://arxiv.org/html/2609.20888#S5.SS5.p1.1)\.
- Merityet al\.\(2016\)S\. Merity, C\. Xiong, J\. Bradbury, and R\. SocherPointer sentinel mixture models\.External Links:1609\.07843Cited by:[§5\.2](https://arxiv.org/html/2609.20888#S5.SS2.p1.1)\.
- Penedoet al\.\(2024\)G\. Penedo, H\. Kydlíček, A\. Lozhkov, M\. Mitchell, C\. Raffel, L\. Von Werra, T\. Wolf,et al\.The fineweb datasets: decanting the web for the finest text data at scale\.Advances in Neural Information Processing Systems37,pp\. 30811–30849\.Cited by:[Appendix B](https://arxiv.org/html/2609.20888#A2.p1.1),[§5\.1](https://arxiv.org/html/2609.20888#S5.SS1.p1.1)\.
- Raffelet al\.\(2020\)C\. Raffel, N\. Shazeer, A\. Roberts, K\. Lee, S\. Narang, M\. Matena, Y\. Zhou, W\. Li, and P\. J\. LiuExploring the limits of transfer learning with a unified text\-to\-text transformer\.Journal of Machine Learning Research21\(140\),pp\. 1–67\.External Links:[Link](http://jmlr.org/papers/v21/20-074.html)Cited by:[§5\.2](https://arxiv.org/html/2609.20888#S5.SS2.p1.1)\.
- Royet al\.\(2021\)A\. Roy, M\. Saffar, A\. Vaswani, and D\. GrangierEfficient content\-based sparse attention with routing transformers\.Transactions of the Association for Computational Linguistics9,pp\. 53–68\.Cited by:[§1\.1](https://arxiv.org/html/2609.20888#S1.SS1.SSS0.Px2.p1.1)\.
- Shenet al\.\(2021\)Z\. Shen, M\. Zhang, H\. Zhao, S\. Yi, and H\. LiEfficient attention: attention with linear complexities\.InProceedings of the IEEE/CVF winter conference on applications of computer vision,pp\. 3531–3539\.Cited by:[§1\.1](https://arxiv.org/html/2609.20888#S1.SS1.SSS0.Px1.p1.1)\.
- Shiet al\.\(2025\)J\. Shi, Y\. Wu, Y\. Peng, B\. Wu, L\. Wang, G\. Liu, and Y\. LuoTrainable dynamic mask sparse attention\.arXiv preprint arXiv:2508\.02124\.Cited by:[§1\.1](https://arxiv.org/html/2609.20888#S1.SS1.SSS0.Px3.p1.1)\.
- Tanget al\.\(2024\)J\. Tang, Y\. Zhao, K\. Zhu, G\. Xiao, B\. Kasikci, and S\. HanQuest: query\-aware sparsity for efficient long\-context llm inference\.arXiv preprint arXiv:2406\.10774\.Cited by:[§1\.1](https://arxiv.org/html/2609.20888#S1.SS1.SSS0.Px2.p1.1),[§1](https://arxiv.org/html/2609.20888#S1.p2.1)\.
- Tilletet al\.\(2019\)P\. Tillet, H\. Kung, and D\. CoxTriton: an intermediate language and compiler for tiled neural network computations\.InProceedings of the 3rd ACM SIGPLAN International Workshop on Machine Learning and Programming Languages,pp\. 10–19\.Cited by:[Appendix F](https://arxiv.org/html/2609.20888#A6.p1.1),[§3\.3](https://arxiv.org/html/2609.20888#S3.SS3.p1.1),[§4\.2](https://arxiv.org/html/2609.20888#S4.SS2.p1.1)\.
- Vaswaniet al\.\(2017\)A\. Vaswani, N\. Shazeer, N\. Parmar, J\. Uszkoreit, L\. Jones, A\. N\. Gomez, Ł\. Kaiser, and I\. PolosukhinAttention is all you need\.InAdvances in Neural Information Processing Systems,Vol\.30,pp\.\.External Links:[Link](https://proceedings.neurips.cc/paper_files/paper/2017/file/3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf)Cited by:[§1](https://arxiv.org/html/2609.20888#S1.p1.1)\.
- Xiaoet al\.\(2024\)G\. Xiao, Y\. Tian, B\. Chen, S\. Han, and M\. LewisEfficient streaming language models with attention sinks\.InInternational Conference on Learning Representations,Vol\.2024,pp\. 21875–21895\.Cited by:[Appendix H](https://arxiv.org/html/2609.20888#A8.SS0.SSS0.Px1.p1.2),[§1\.1](https://arxiv.org/html/2609.20888#S1.SS1.SSS0.Px1.p1.1),[§1](https://arxiv.org/html/2609.20888#S1.p2.1),[§1](https://arxiv.org/html/2609.20888#S1.p5.1),[§5\.2](https://arxiv.org/html/2609.20888#S5.SS2.p1.1),[§5\.6](https://arxiv.org/html/2609.20888#S5.SS6.SSS0.Px1.p1.1)\.
- Yerramet al\.\(2024\)V\. Yerram, C\. You, S\. Bhojanapalli, S\. Kumar, P\. Jain, P\. Netrapalli,et al\.HiRE: high recall approximate top\-kkestimation for efficient llm inference\.arXiv preprint arXiv:2402\.09360\.Cited by:[§1\.1](https://arxiv.org/html/2609.20888#S1.SS1.SSS0.Px3.p1.1)\.
- Yuanet al\.\(2025\)J\. Yuan, H\. Gao, D\. Dai, J\. Luo, L\. Zhao, Z\. Zhang, Z\. Xie, Y\. Wei, L\. Wang, Z\. Xiao,et al\.Native sparse attention: hardware\-aligned and natively trainable sparse attention\.InProceedings of the 63rd Annual Meeting of the Association for Computational Linguistics \(Volume 1: Long Papers\),pp\. 23078–23097\.Cited by:[§1\.1](https://arxiv.org/html/2609.20888#S1.SS1.SSS0.Px3.p1.1),[§1](https://arxiv.org/html/2609.20888#S1.p2.1),[§5\.4](https://arxiv.org/html/2609.20888#S5.SS4.p1.1)\.
- Zaheeret al\.\(2020\)M\. Zaheer, G\. Guruganesh, K\. A\. Dubey, J\. Ainslie, C\. Alberti, S\. Ontanon, P\. Pham, A\. Ravula, Q\. Wang, L\. Yang,et al\.Big bird: transformers for longer sequences\.Advances in neural information processing systems33,pp\. 17283–17297\.Cited by:[§1\.1](https://arxiv.org/html/2609.20888#S1.SS1.SSS0.Px1.p1.1),[§5\.2](https://arxiv.org/html/2609.20888#S5.SS2.p1.1)\.
- Zellerset al\.\(2019\)R\. Zellers, A\. Holtzman, Y\. Bisk, A\. Farhadi, and Y\. ChoiHellaswag: can a machine really finish your sentence?\.InProceedings of the 57th annual meeting of the association for computational linguistics,pp\. 4791–4800\.Cited by:[§5\.2](https://arxiv.org/html/2609.20888#S5.SS2.p1.1)\.
- Zhanget al\.\(2025\)J\. Zhang, C\. Xiang, H\. Huang, J\. Wei, H\. Xi, J\. Zhu, and J\. ChenSpargeattention: accurate and training\-free sparse attention accelerating any model inference\.arXiv preprint arXiv:2502\.18137\.Cited by:[§1\.1](https://arxiv.org/html/2609.20888#S1.SS1.SSS0.Px2.p1.1)\.
- Zhanget al\.\(2023\)Z\. Zhang, Y\. Sheng, T\. Zhou, T\. Chen, L\. Zheng, R\. Cai, Z\. Song, Y\. Tian, C\. Ré, C\. Barrett,et al\.H2o: heavy\-hitter oracle for efficient generative inference of large language models\.Advances in Neural Information Processing Systems36,pp\. 34661–34710\.Cited by:[§1\.1](https://arxiv.org/html/2609.20888#S1.SS1.SSS0.Px1.p1.1),[§1](https://arxiv.org/html/2609.20888#S1.p2.1),[§5\.2](https://arxiv.org/html/2609.20888#S5.SS2.p1.1)\.
## Appendix ATransformer Preliminaries
We focus on the Decoder\-only Transformer architecture, viewed as a mapping from sequences\(x1,…,xn\)∈ℝn×d\(x\_\{1\},\.\.\.,x\_\{n\}\)\\in\\mathbb\{R\}^\{n\\times d\}of token embeddings to sequences of latent embeddings\(h1L,…,hnL\)∈ℝn×d\(h\_\{1\}^\{L\},\.\.\.,h\_\{n\}^\{L\}\)\\in\\mathbb\{R\}^\{n\\times d\}, withLLbeing the total number of layers andddbeing the embedding dimension\. Letht0:=xt∈ℝdh\_\{t\}^\{0\}:=x\_\{t\}\\in\\mathbb\{R\}^\{d\}\.
The processing flow of a single tokenttthrough a specific layerℓ\\ellmapshtℓ−1h\_\{t\}^\{\\ell\-1\}tohtℓh\_\{t\}^\{\\ell\}\. LetHHbe the number of attention heads anddh=dHd\_\{h\}=\\frac\{d\}\{H\}be the head dimension\. We compute the queryqtq\_\{t\}, keyktk\_\{t\}, and valuevtv\_\{t\}embeddings via linear projectionsWQ,WK,WV∈ℝdh×dW\_\{Q\},W\_\{K\},W\_\{V\}\\in\\mathbb\{R\}^\{d\_\{h\}\\times d\}on the normalized inputh^=RMSNorm\(htℓ−1\)\\hat\{h\}=\\text\{RMSNorm\}\(h\_\{t\}^\{\\ell\-1\}\)\. Rotary positional embeddings \(RoPE\) are applied as follows:
qt=ℛt\(WQ⋅h^\),kt=ℛt\(WK⋅h^\),vt=WV⋅h^q\_\{t\}=\\mathcal\{R\}\_\{t\}\(W\_\{Q\}\\cdot\\hat\{h\}\),\\quad k\_\{t\}=\\mathcal\{R\}\_\{t\}\(W\_\{K\}\\cdot\\hat\{h\}\),\\quad v\_\{t\}=W\_\{V\}\\cdot\\hat\{h\}whereℛt∈ℝdh×dh\\mathcal\{R\}\_\{t\}\\in\\mathbb\{R\}^\{d\_\{h\}\\times d\_\{h\}\}is a fixed unitary rotation matrix depending on positiontt\.
The model computes the attention output by having queryqtq\_\{t\}attend to keys\{ks\}s≤t\\\{k\_\{s\}\\\}\_\{s\\leq t\}and values\{vs\}s≤t\\\{v\_\{s\}\\\}\_\{s\\leq t\}\. The scores are computed via scaled dot\-product:
Ats=softmax\(⟨qt,ks⟩dh\+Mts\)A\_\{ts\}=\\text\{softmax\}\\left\(\\frac\{\\langle q\_\{t\},k\_\{s\}\\rangle\}\{\\sqrt\{d\_\{h\}\}\}\+M\_\{ts\}\\right\)whereMtsM\_\{ts\}is a causal mask \(00ifs≤ts\\leq t,−∞\-\\inftyotherwise\)\.
The layer outputhtℓh\_\{t\}^\{\\ell\}is formed via residual connections and a Multi\-Layer Perceptron \(MLP\), with output projectionWO∈ℝd×dhW\_\{O\}\\in\\mathbb\{R\}^\{d\\times d\_\{h\}\}:
zt=htℓ−1\+WO⋅otz\_\{t\}=h\_\{t\}^\{\\ell\-1\}\+W\_\{O\}\\cdot o\_\{t\}htℓ=zt\+MLP\(RMSNorm\(zt\)\)h\_\{t\}^\{\\ell\}=z\_\{t\}\+\\text\{MLP\}\(\\text\{RMSNorm\}\(z\_\{t\}\)\)
During inference, Transformer\-based LLMs operate in two distinct stages:
1. 1\.Pre\-fill: A prompt of sizeLLis processed in a single forward pass\. This iscompute\-heavy, requiringΘ\(L2d\)\\Theta\(L^\{2\}d\)FLOPS\.
2. 2\.Decoding: Subsequent tokens are autoregressively predicted\. The keys and values of previous tokens are stored in aKV Cacheto avoid recomputation, making decoding a strictlymemory\-boundoperation\.
## Appendix BTraining Details and Hyperparameters
We train our 1\.45B\-parameter ETA model on a slice of the FineWeb dataset \(CC\-MAIN\-2018\-26\)\([Penedo et al\., 2024](https://arxiv.org/html/2609.20888#bib.bib20)\)at sequence lengthL=2048L=2048for10,00010\{,\}000steps across88NVIDIA H100 GPUs \(effective global batch size20482048sequences,≈42\{\\approx\}42B tokens total, exceeding Chinchilla\-optimal compute by1\.4×1\.4\\times\)\. The backbone comprises2222Transformer decoder layers withdmodel=2048d\_\{\\text\{model\}\}=2048, intermediate SwiGLU dimension81928192,HQ=32H\_\{Q\}=32query heads \(dk=64d\_\{k\}=64\), andHKV=4H\_\{KV\}=4GQA key\-value heads\. Optimization uses AdamW \(β1=0\.9,β2=0\.95,ϵ=10−8\\beta\_\{1\}=0\.9,\\beta\_\{2\}=0\.95,\\epsilon=10^\{\-8\}, weight decay0\.10\.1, gradient clipping1\.01\.0\) with cosine learning rate decay from4×10−44\\times 10^\{\-4\}to4×10−54\\times 10^\{\-5\}after300300warmup steps\.
Per\-layer linear threshold predictors \(Wτℓ∈ℝ2048×32W\_\{\\tau\}^\{\\ell\}\\in\\mathbb\{R\}^\{2048\\times 32\}, zero\-initialized weights with start\-dense biasbτℓ=−8\.0b\_\{\\tau\}^\{\\ell\}=\-8\.0\) act on concatenated post\-RoPE query heads\. The inverse temperatureβ\\betais linearly annealed from1\.01\.0to5\.05\.0over steps0–7,0000\\text\{\-\-\}7\{,\}000and held constant thereafter\. To prevent premature pruning before stable representations form, sparsity regularization is zero for the first750750steps, ramps linearly over1,6901\{,\}690steps to a peak ofλsparse=5×10−4\\lambda\_\{\\text\{sparse\}\}=5\\times 10^\{\-4\}, and is then reduced to2\.5×10−52\.5\\times 10^\{\-5\}\(5%5\\%of peak\) for the remainder of training\.
### B\.1Optimizer Dynamics and Escape from Start\-Dense Initialization
With start\-dense initialization \(bτℓ=−8\.0,Wτℓ=0b\_\{\\tau\}^\{\\ell\}=\-8\.0,W\_\{\\tau\}^\{\\ell\}=0\) and initial attention logits centered near zero, terminal sharpness \(β=5\\beta=5\) would evaluate toσ\(40\)\\sigma\(40\), stalling gradient descent \(σ′\(40\)≈4\.3×10−18\\sigma^\{\\prime\}\(40\)\\approx 4\.3\\times 10^\{\-18\}\)\. Two mechanisms can explain the observed threshold migration without gradient starvation: \(1\)*temperature annealing*starts atβ=1\.0\\beta=1\.0, keeping the initial sigmoid derivative fourteen orders of magnitude higher \(σ′\(8\)=3\.35×10−4\\sigma^\{\\prime\}\(8\)=3\.35\\times 10^\{\-4\}\) until thresholds enter the score bulk; \(2\)*Adam’s scale normalization*\(m^/\(v^\+ϵ\)≈±1\\hat\{m\}/\(\\sqrt\{\\hat\{v\}\}\+\\epsilon\)\\approx\\pm 1\) converts the monotone directional pressure ofℒsparsity\\mathcal\{L\}\_\{\\text\{sparsity\}\}into steady step\-size drift independent of small gradient magnitude\.
## Appendix CAdditive vs Multiplicative Masking
In this section we examine additive masking as a substitute to multiplicative masking in ETA\. We first compare the pretraining trajectories of ETA under additive \(Strict Mode,qki,jmasked=qki,j\+100σi,j−100qk^\{\\text\{masked\}\}\_\{i,j\}=qk\_\{i,j\}\+100\\sigma\_\{i,j\}\-100\) and multiplicative \(Normal Mode,qki,jmasked=qki,j⋅σi,jqk^\{\\text\{masked\}\}\_\{i,j\}=qk\_\{i,j\}\\cdot\\sigma\_\{i,j\}\) formulations under identical regularization schedules \(λ=0\.05\\lambda=0\.05, ramping over steps750750–20502050\)\. Both models have≈\\approx126M parameters\.
As illustrated in Figure[6](https://arxiv.org/html/2609.20888#A3.F6)\(a\), both formulations exhibit nearly similar cross\-entropy loss trajectories on Fineweb, with multiplicative masking gaining a slight edge\. However, Figure[6](https://arxiv.org/html/2609.20888#A3.F6)\(b\) reveals distinct sparsity steady states\. Under multiplicative masking, sub\-threshold logits scale towards00, leaving residual baseline softmax probabilities that allow the threshold predictor to push sparsity aggressively to83\.14%83\.14\\%\(16\.86%16\.86\\%active density\) without severe language modeling loss penalties\. Conversely, Strict Mode imposes true exponential zero\-weight suppression \(eqk−100≈0e^\{qk\-100\}\\approx 0\), eliminating masked key\-value states entirely from the attention context\.
Figure 6:Pretraining dynamics and sparsity evolution across ETA masking formulations \(126M parameters, 10k steps\)\.#### Inference Performance and Masking Mode Comparison\.
As reported in Table[5](https://arxiv.org/html/2609.20888#A3.T5), additive masking proves inferior to multiplicative masking across all downstream evaluation benchmarks when deployed with block\-sparse inference kernels\. Specifically, the former incurs higher perplexity across FineWeb \(116\.38116\.38vs\.99\.8099\.80\), C4 \(117\.93117\.93vs\.100\.73100\.73\), and Wikitext\-2 \(177\.16177\.16vs\.158\.64158\.64\) while concurrently retaining significantly lower compute sparsity \(∼35–38%\\sim 35\\text\{\-\-\}38\\%vs\.65\.91%65\.91\\%pruned\)\.
Table 5:Downstream perplexity and sparsity comparison between Normal and Strict ETA \(126M parameters, 10k pretraining steps\)\.Evaluated using 1% prefill and 99% autoregressive decode under the block\-sparse inference kernel \(b=4b=4, threshold adjustmenta=0\.4a=0\.4,z=2\.0z=2\.0\)\.Table 6:Mechanistic and downstream comparison of masking formulations \(126M parameters, FineWeb\)\.Tail statistics are measured over the sub\-threshold key set \(n=24n=24sequences,L=1024L=1024\)\. Downstream metrics reflect block\-sparse decode \(b=4,z=2\.0,a=0\.4b=4,z=2\.0,a=0\.4\)\. Multiplicative gating flattens sub\-threshold keys into a uniform background, achieving superior perplexity and density over additive deletion\.
## Appendix DAnalysis of Runtime Contextuality and Offline Threshold Calibration
This appendix provides the complete empirical and mathematical analysis supporting Section[5\.7](https://arxiv.org/html/2609.20888#S5.SS7): \(1\) testing whether query conditioning is necessary during pretraining and probing what the learned thresholds encode \([Subsection D\.1](https://arxiv.org/html/2609.20888#A4.SS1)\), \(2\) deriving the1/t1/t\-weighted score histogram formulation for exact density\-matched calibration \([Algorithm 1](https://arxiv.org/html/2609.20888#alg1)\), and \(3\) evaluating distilled static thresholds in\-distribution and under length extrapolation \([Subsection D\.3](https://arxiv.org/html/2609.20888#A4.SS3)\)\.
### D\.1Empirical Analysis of Runtime Contextuality
#### Necessity of Query Conditioning During Pretraining\.
To test whether input\-dependent thresholds \(τt,hℓ=wτ,hℓ⊤qt\+bτ,hℓ\\tau\_\{t,h\}^\{\\ell\}=w\_\{\\tau,h\}^\{\\ell\\top\}q\_\{t\}\+b\_\{\\tau,h\}^\{\\ell\}\) are required to learn sparse attention representations from scratch, we trained an ablated baseline where each head’s threshold is parameterized as a single learnable, input\-independent scalarτhℓ\\tau\_\{h\}^\{\\ell\}\. Under identical sparsity regularization \(λ=0\.05\\lambda=0\.05\), the input\-independent baseline fails to sparsify effectively, converging to2\.13×2\.13\\timeshigher active density than contextual ETA\. Because a static threshold applies uniformly across all sequence positions, any threshold high enough to prune routine tokens inevitably starves complex synthesis tokens of required context; consequently, gradient descent pushes the shared scalar downward to protect high\-loss predictions\.
#### Probing Whatτt,hℓ\\tau\_\{t,h\}^\{\\ell\}Encodes\.
Given that query conditioning is essential, we next ask whether the learned linear predictorWτℓW\_\{\\tau\}^\{\\ell\}merely computes a proxy for simple surface statistics \(such as query norm or sequence position\), or whether it captures higher\-order semantic context\. We evaluate our 126M ETA checkpoint on held\-out C4 sequences and regress the realized per\-token thresholdsτt,hℓ\\tau\_\{t,h\}^\{\\ell\}\(separately for each layer, head, and position\) against eight candidate summary statistics: the query Euclidean norm‖qt‖\\\|q\_\{t\}\\\|, the log\-sum\-exp of the pre\-softmax attention row \(lse\), the row score maximum \(smaxs\_\{\\max\}\), standard deviation \(sstds\_\{\\text\{std\}\}\), mean \(smeans\_\{\\text\{mean\}\}\), and Shannon entropy \(HH\), the logarithmic sequence position \(logt\\log t\), and the input hidden\-state norm \(‖xt‖\\\|x\_\{t\}\\\|\)\.
Table 7:Proportion of variance \(R2R^\{2\}\) in learned thresholdsτt,hℓ\\tau\_\{t,h\}^\{\\ell\}explained by surface query and score\-distribution statisticson held\-out C4 across all layers and heads\. Even when combined in a joint multiple regression, all eight statistics account for less than one\-third of threshold variance\.As shown in[Table 7](https://arxiv.org/html/2609.20888#A4.T7), the strongest individual feature \(‖qt‖\\\|q\_\{t\}\\\|\) accounts for only18\.7%18\.7\\%of the variance inτt,hℓ\\tau\_\{t,h\}^\{\\ell\}, and a joint linear regression combining all eight statistics explains only32\.7%32\.7\\%\. More than two\-thirds \(67\.3%67\.3\\%\) of the variance in the learned threshold is irreducible to surface summary statistics, confirming thatWτℓW\_\{\\tau\}^\{\\ell\}exploits fine\-grained directional information inqtq\_\{t\}\.
#### Within\- vs\. Between\-Document ANOVA Decomposition\.
To test whether ETA’s threshold variations merely reflect global document\-level domain shifts \(e\.g\., allocating higher density to technical passages and lower density to conversational text\) rather than local token\-by\-token difficulty, we decompose the variance of realized active densitiesdi,t=1t∑s=1t𝕀\(Si,t,s\>τi,t\)d\_\{i,t\}=\\frac\{1\}\{t\}\\sum\_\{s=1\}^\{t\}\\mathbb\{I\}\(S\_\{i,t,s\}\>\\tau\_\{i,t\}\)acrossNNheld\-out C4 documents of lengthTT\. Because active density naturally decays with sequence positiontt\(as a fixed number of relevant tokens represents a smaller fraction of a growing causal window\), we first remove this mechanical positional trend by subtracting the cross\-document positional meand¯⋅,t=1N∑i=1Ndi,t\\bar\{d\}\_\{\\cdot,t\}=\\frac\{1\}\{N\}\\sum\_\{i=1\}^\{N\}d\_\{i,t\}, yielding position\-detrended residual densitiesd~i,t=di,t−d¯⋅,t\\tilde\{d\}\_\{i,t\}=d\_\{i,t\}\-\\bar\{d\}\_\{\\cdot,t\}\. Applying a one\-way analysis of variance \(ANOVA\) partitions the total sum of squares across allN×TN\\times Ttokens into orthogonal between\-document and within\-document components:
∑i=1N∑t=1T\(d~i,t−d~¯\)2⏟SStotal=T∑i=1N\(d~¯i,⋅−d~¯\)2⏟SSbetween\(≈30%\)\+∑i=1N∑t=1T\(d~i,t−d~¯i,⋅\)2⏟SSwithin\(≈70%\),\\underbrace\{\\sum\_\{i=1\}^\{N\}\\sum\_\{t=1\}^\{T\}\(\\tilde\{d\}\_\{i,t\}\-\\bar\{\\tilde\{d\}\}\)^\{2\}\}\_\{\\text\{SS\}\_\{\\text\{total\}\}\}\\;=\\;\\underbrace\{T\\sum\_\{i=1\}^\{N\}\(\\bar\{\\tilde\{d\}\}\_\{i,\\cdot\}\-\\bar\{\\tilde\{d\}\}\)^\{2\}\}\_\{\\text\{SS\}\_\{\\text\{between\}\}\\;\(\\approx 30\\%\)\}\\;\+\\;\\underbrace\{\\sum\_\{i=1\}^\{N\}\\sum\_\{t=1\}^\{T\}\(\\tilde\{d\}\_\{i,t\}\-\\bar\{\\tilde\{d\}\}\_\{i,\\cdot\}\)^\{2\}\}\_\{\\text\{SS\}\_\{\\text\{within\}\}\\;\(\\approx 70\\%\)\},whered~¯i,⋅=1T∑t=1Td~i,t\\bar\{\\tilde\{d\}\}\_\{i,\\cdot\}=\\frac\{1\}\{T\}\\sum\_\{t=1\}^\{T\}\\tilde\{d\}\_\{i,t\}is the mean detrended density of documentii\. If ETA functioned merely as a coarse document\-level register switch, document meansd~¯i,⋅\\bar\{\\tilde\{d\}\}\_\{i,\\cdot\}would dominate and the between\-document share would approach100%100\\%\. Instead,≈70%\\approx 70\\%of the variance occurs*within*individual documents \(SSwithin/SStotal≈0\.70\\text\{SS\}\_\{\\text\{within\}\}/\\text\{SS\}\_\{\\text\{total\}\}\\approx 0\.70\), demonstrating that ETA continuously expands and contracts its attention window token by token—pruning aggressively on predictable syntax tokens while widening context on semantically demanding retrieval steps\.
### D\.2Offline Threshold Calibration via1/t1/t\-Weighted Histograms
At decoding steptt, an attention head’s active density is the fraction of itsttavailable causal keys retained by the soft gate,1t∑s=1tmtsh\\frac\{1\}\{t\}\\sum\_\{s=1\}^\{t\}m\_\{ts\}^\{h\}\. Averaged over a small, disjoint validation/calibration split𝒟\\mathcal\{D\}\(\|𝒟\|=16\|\\mathcal\{D\}\|=16sequences of lengthTT\), the dynamic predictorτt,hℓ\\tau\_\{t,h\}^\{\\ell\}realizes a target head density
d¯ℓh=1\|𝒟\|T∑x∈𝒟∑t=1T1t∑s=1tmtsh\(x\)\.\\bar\{d\}^\{\\,\\ell h\}=\\frac\{1\}\{\|\\mathcal\{D\}\|T\}\\sum\_\{x\\in\\mathcal\{D\}\}\\sum\_\{t=1\}^\{T\}\\frac\{1\}\{t\}\\sum\_\{s=1\}^\{t\}m\_\{ts\}^\{h\}\(x\)\.For stationary deployments, our goal is to replace the dynamic predictor with a single static constantcℓhc^\{\\ell h\}per head that yields this exact same empirical density on𝒟\\mathcal\{D\}:g\(cℓh\)=d¯ℓhg\(c^\{\\ell h\}\)=\\bar\{d\}^\{\\,\\ell h\}, where
g\(c\)=1\|𝒟\|T∑x∈𝒟∑t=1T1t∑s=1tσ\(β⋅\(Stsℓh\(x\)−c\)\)g\(c\)=\\frac\{1\}\{\|\\mathcal\{D\}\|T\}\\sum\_\{x\\in\\mathcal\{D\}\}\\sum\_\{t=1\}^\{T\}\\frac\{1\}\{t\}\\sum\_\{s=1\}^\{t\}\\sigma\(\\beta\\cdot\(S\_\{ts\}^\{\\ell h\}\(x\)\-c\)\)denotes the head’s expected density on𝒟\\mathcal\{D\}under thresholdcc\. Becauseg\(c\)g\(c\)decreases strictly and monotonically from11to00asccincreases, we can find the unique rootcℓhc^\{\\ell h\}via continuous binary search\.
#### Score Histograms and1/t1/tRow\-Weighting\.
Evaluatingg\(c\)g\(c\)directly over millions of raw attention scoresStshS\_\{ts\}^\{h\}across𝒟\\mathcal\{D\}at every binary search iteration would require repeatedly scanning the calibration split\. Instead, during a single pass over𝒟\\mathcal\{D\}, we bin raw scoresStsℓhS\_\{ts\}^\{\\ell h\}into a 1D histogramHℓhH^\{\\ell h\}\(BBbins with centerssbs\_\{b\}\)\. When building this histogram, we increment bin counts by\+1t\+\\frac\{1\}\{t\}rather than\+1\+1to account for the causal weighting\. OnceHℓhH^\{\\ell h\}is built, evaluating any candidate threshold during binary search reduces to a fastBB\-element dot product:
g\(c\)=∑b=1BHℓh\[b\]σ\(β\(sb−c\)\)\.g\(c\)=\\sum\_\{b=1\}^\{B\}H^\{\\ell h\}\[b\]\\,\\sigma\\\!\\big\(\\beta\(s\_\{b\}\-c\)\\big\)\.AssumingBBis large enough, binary search approximates the optimal value ofccwithin machine precision \(residual<2×10−16<2\\times 10^\{\-16\}\)\. See Algorithm[1](https://arxiv.org/html/2609.20888#alg1)for more details\.
Algorithm 1Density\-Matched Offline Threshold Calibration1:Trained ETA model
MMwith dynamic predictor
τ\(⋅\)\\tau\(\\cdot\); calibration split
𝒟\\mathcal\{D\}; bin count
BB; inverse temperature
β\\beta
2:
Hℓh←𝟎∈ℝBH^\{\\ell h\}\\leftarrow\\mathbf\{0\}\\in\\mathbb\{R\}^\{B\},
d¯ℓh←0\\bar\{d\}^\{\\,\\ell h\}\\leftarrow 0for all
\(ℓ,h\)\(\\ell,h\)
3:foreach calibration sequence
x∈𝒟x\\in\\mathcal\{D\}do
4:Forward pass
M\(x\)M\(x\)with dynamic thresholds, recording raw scores
SℓhS^\{\\ell h\}and gates
mℓhm^\{\\ell h\}
5:foreach layer
ℓ\\elland head
hhdo
6:
d¯ℓh\+=1\|𝒟\|⋅rowmean\(mℓh\)\\bar\{d\}^\{\\,\\ell h\}\\mathrel\{\+\}=\\tfrac\{1\}\{\|\\mathcal\{D\}\|\}\\cdot\\operatorname\{rowmean\}\\big\(m^\{\\ell h\}\\big\)⊳\\trianglerightAccumulate target per\-head density
7:foreach causal pair
\(t,s\)\(t,s\)with
s≤ts\\leq tdo
8:
Hℓh\[bin\(Stsℓh\)\]\+=1tH^\{\\ell h\}\\big\[\\operatorname\{bin\}\(S^\{\\ell h\}\_\{ts\}\)\\big\]\\mathrel\{\+\}=\\frac\{1\}\{t\}⊳\\trianglerightAccumulate1/t1/tcausal row weight
9:endfor
10:endfor
11:endfor
12:foreach layer
ℓ\\elland head
hhdo
13:
Hℓh←Hℓh/∑b=1BHℓh\[b\]H^\{\\ell h\}\\leftarrow H^\{\\ell h\}/\\textstyle\\sum\_\{b=1\}^\{B\}H^\{\\ell h\}\[b\]⊳\\trianglerightNormalize weighted score histogram
14:Define
g\(c\)=∑b=1BHℓh\[b\]σ\(β\(sb−c\)\)g\(c\)=\\sum\_\{b=1\}^\{B\}H^\{\\ell h\}\[b\]\\,\\sigma\\\!\\big\(\\beta\(s\_\{b\}\-c\)\\big\)⊳\\trianglerightMonotonically decreasing incc
15:
cℓh←Bisect\(g\(c\)=d¯ℓh\)c^\{\\ell h\}\\leftarrow\\textsc\{Bisect\}\\big\(g\(c\)=\\bar\{d\}^\{\\,\\ell h\}\\big\)⊳\\trianglerightExact root\-finding via bisection
16:endfor
17:returnStatic threshold table
\{cℓh\}\\\{c^\{\\ell h\}\\\}
### D\.3Distillation Evaluation and Length\-Extrapolation Stability
We evaluate calibrated static thresholds\{cℓh\}\\\{c^\{\\ell h\}\\\}against dynamic per\-token thresholdsτt,hℓ\\tau\_\{t,h\}^\{\\ell\}on held\-out C4 sequences executed directly through our fused block\-sparse Triton kernel \(b=4b=4\)\.
Table 8:Dynamic per\-token thresholds \(τt,hℓ\\tau\_\{t,h\}^\{\\ell\}\) versus calibrated static per\-\(layer, head\) thresholds \(cℓhc^\{\\ell h\}\), evaluated on held\-out C4 via the block\-sparse decode kernel \(b=4b=4\)\. Constants are calibrated on a disjoint1616\-sequence split\. In\-distribution evaluations are paired at the batch level \(ρ=0\.9996\\rho=0\.9996,t=8\.64t=8\.64\)\.Both in\-distribution and length\-extrapolated experiments show that our calibrated static thresholds achieve slightly better perplexity and higher sparsity than the dynamic thresholds when evaluated on the target domain used for calibration\.
## Appendix EHardware\-Aligned Kernel Implementation
To train our model efficiently without materializingT×TT\\times Tmatrices, we implement a custom fused attention kernel in Triton\. Our implementation extends the block\-based online softmax algorithm of FlashAttention\-2 by tightly integrating the differentiable thresholding mechanism and the gradient tracking for the sparsity regularizer\.
### E\.1Forward Pass Formulation
In the forward pass, the kernel divides the query sequence into blocks of sizeBMB\_\{M\}and the key/value sequences into blocks of sizeBNB\_\{N\}\. The outer loop iterates over query blocks, loading queriesQblockQ\_\{block\}and their corresponding predicted thresholdsτblock\\tau\_\{block\}from HBM to SRAM\. The inner loop iterates causally over key/value blocks \(Kblock,VblockK\_\{block\},V\_\{block\}\)\.
For a given queryqiq\_\{i\}and keykjk\_\{j\}within these blocks, the scaled attention score is computed asSij=scale⋅⟨qi,kj⟩S\_\{ij\}=\\text\{scale\}\\cdot\\langle q\_\{i\},k\_\{j\}\\rangle\. Concurrently, the kernel computes the inclusion probability via the sigmoid relaxation:
σij=σ\(β\(Sij−τi\)\)\\sigma\_\{ij\}=\\sigma\(\\beta\(S\_\{ij\}\-\\tau\_\{i\}\)\)In particular, the sum of these probabilities is accumulated directly in SRAM to compute the sparsity regularizerℒsparsity\\mathcal\{L\}\_\{\\text\{sparsity\}\}without allocating an explicit full sequence tensor:
Ri=∑j≤iσijR\_\{i\}=\\sum\_\{j\\leq i\}\\sigma\_\{ij\}
The kernel then applies the selected dynamic mask operation \(additive or multiplicative\) to yield the masked scoresS~ij\\tilde\{S\}\_\{ij\}\. To prevent numerical overflow, we track the running maximummim\_\{i\}and the running exponential sumlil\_\{i\}via a standard online softmax update111A familiar formulation from the original FlashAttention\([Dao et al\., 2022](https://arxiv.org/html/2609.20888#bib.bib9)\)\.:
minew\\displaystyle m\_\{i\}^\{\\text\{new\}\}=max\(mi,maxjS~ij\)\\displaystyle=\\max\(m\_\{i\},\\max\_\{j\}\\tilde\{S\}\_\{ij\}\)linew\\displaystyle l\_\{i\}^\{\\text\{new\}\}=liemi−minew\+∑jeS~ij−minew\\displaystyle=l\_\{i\}e^\{m\_\{i\}\-m\_\{i\}^\{\\text\{new\}\}\}\+\\sum\_\{j\}e^\{\\tilde\{S\}\_\{ij\}\-m\_\{i\}^\{\\text\{new\}\}\}The attention output is accumulated as a weighted sum ofVblockV\_\{block\}and normalized bylinewl\_\{i\}^\{\\text\{new\}\}before being written back to HBM\. We additionally store the final log\-sum\-exp vectorsLi=mi\+ln\(li\)L\_\{i\}=m\_\{i\}\+\\ln\(l\_\{i\}\)and the row\-wise sumsRiR\_\{i\}to facilitate the backward pass\.[Algorithm 2](https://arxiv.org/html/2609.20888#alg2)gives the full forward pass\.
Algorithm 2Hardware\-Aligned Forward Kernel1:Queries
QQ, Keys
KK, Values
V∈ℝT×dV\\in\\mathbb\{R\}^\{T\\times d\}
2:Thresholds
τ∈ℝT\\tau\\in\\mathbb\{R\}^\{T\}, Scale
ss, Temperature
β\\beta
3:Output
O∈ℝT×dO\\in\\mathbb\{R\}^\{T\\times d\}, Regularizer Sums
Σsums∈ℝT\\Sigma\_\{\\text\{sums\}\}\\in\\mathbb\{R\}^\{T\}, Log\-Sum\-Exp
L∈ℝTL\\in\\mathbb\{R\}^\{T\}
4:foreach query block
iifrom
11to
T/BMT/B\_\{M\}do
5:Load
Qi,τiQ\_\{i\},\\tau\_\{i\}from HBM to SRAM
6:Initialize
mi←−∞m\_\{i\}\\leftarrow\-\\infty,
li←0l\_\{i\}\\leftarrow 0,
acci←0acc\_\{i\}\\leftarrow 0,
Σsums,i←0\\Sigma\_\{\\text\{sums\},i\}\\leftarrow 0
7:foreach key/value block
jjfrom
11to
iido⊳\\trianglerightIterate up to causal limit
8:Load
Kj,VjK\_\{j\},V\_\{j\}from HBM to SRAM
9:
Sij←s⋅QiKjTS\_\{ij\}\\leftarrow s\\cdot Q\_\{i\}K\_\{j\}^\{T\}⊳\\trianglerightCompute pre\-softmax scores
10:
σij←sigmoid\(β⋅\(Sij−τi\)\)\\sigma\_\{ij\}\\leftarrow\\text\{sigmoid\}\(\\beta\\cdot\(S\_\{ij\}\-\\tau\_\{i\}\)\)⊳\\trianglerightCompute inclusion gates
11:
Σsums,i←Σsums,i\+row\_sum\(σij\)\\Sigma\_\{\\text\{sums\},i\}\\leftarrow\\Sigma\_\{\\text\{sums\},i\}\+\\text\{row\\\_sum\}\(\\sigma\_\{ij\}\)⊳\\trianglerightAccumulate regularizer
12:ifadditivethen
13:
S~ij←Sij\+C⋅σij−C\\tilde\{S\}\_\{ij\}\\leftarrow S\_\{ij\}\+C\\cdot\\sigma\_\{ij\}\-C⊳\\trianglerightAdditive masking
14:else
15:
S~ij←Sij⊙σij\\tilde\{S\}\_\{ij\}\\leftarrow S\_\{ij\}\\odot\\sigma\_\{ij\}⊳\\trianglerightMultiplicative masking
16:endif
17:Apply causal mask to
S~ij\\tilde\{S\}\_\{ij\}; for diagonal blocks \(
j=ij=i\), restore token diagonal
diag\(S~ii\)←diag\(Sii\)\\mathrm\{diag\}\(\\tilde\{S\}\_\{ii\}\)\\leftarrow\\mathrm\{diag\}\(S\_\{ii\}\)⊳\\trianglerightBypass threshold on diagonal
18:
mnew←max\(mi,max\(S~ij\)\)m\_\{\\text\{new\}\}\\leftarrow\\max\(m\_\{i\},\\max\(\\tilde\{S\}\_\{ij\}\)\)⊳\\trianglerightOnline softmax update
19:
α←exp\(mi−mnew\)\\alpha\\leftarrow\\exp\(m\_\{i\}\-m\_\{\\text\{new\}\}\)
20:
Pij←exp\(S~ij−mnew\)P\_\{ij\}\\leftarrow\\exp\(\\tilde\{S\}\_\{ij\}\-m\_\{\\text\{new\}\}\)
21:
lnew←li⋅α\+row\_sum\(Pij\)l\_\{\\text\{new\}\}\\leftarrow l\_\{i\}\\cdot\\alpha\+\\text\{row\\\_sum\}\(P\_\{ij\}\)
22:
acci←acci⋅α\+PijVjacc\_\{i\}\\leftarrow acc\_\{i\}\\cdot\\alpha\+P\_\{ij\}V\_\{j\}
23:
mi←mnewm\_\{i\}\\leftarrow m\_\{\\text\{new\}\},
li←lnewl\_\{i\}\\leftarrow l\_\{\\text\{new\}\}
24:endfor
25:
Oi←acci/liO\_\{i\}\\leftarrow acc\_\{i\}/l\_\{i\}⊳\\trianglerightNormalize output
26:
Li←mi\+ln\(li\)L\_\{i\}\\leftarrow m\_\{i\}\+\\ln\(l\_\{i\}\)⊳\\trianglerightStore log\-sum\-exp for backward pass
27:Store
Oi,Σsums,i,LiO\_\{i\},\\Sigma\_\{\\text\{sums\},i\},L\_\{i\}from SRAM to HBM
28:endfor
### E\.2Backward Pass and Custom Gradients
The backward pass is significantly more complex than standard attention due to the chain rule dependencies flowing through the thresholdτi\\tau\_\{i\}and the regularization signal∇σℒsparsity\\nabla\_\{\\sigma\}\\mathcal\{L\}\_\{\\text\{sparsity\}\}\.
The backward kernel loops over theKKandVVblocks in the outer loop, and iterates over theQQblocks in the inner loop\. For each block pair, the kernel recomputes the forward logitsSijS\_\{ij\}, the inclusion probabilitiesσij\\sigma\_\{ij\}, and the softmax probabilitiesPij=exp\(S~ij−Li\)P\_\{ij\}=\\exp\(\\tilde\{S\}\_\{ij\}\-L\_\{i\}\)\.
LetdOi∈ℝddO\_\{i\}\\in\\mathbb\{R\}^\{d\}be the upstream gradient of the attention output, anddΣid\\Sigma\_\{i\}be the upstream gradient from the sparsity regularization loss\. The standard derivatives are computed as follows \(for completeness we include the derivations in Section[E\.3](https://arxiv.org/html/2609.20888#A5.SS3)\):
dVj\\displaystyle dV\_\{j\}=∑iPijdOi\\displaystyle=\\sum\_\{i\}P\_\{ij\}dO\_\{i\}dPij\\displaystyle dP\_\{ij\}=dOi⊤⋅Vj\\displaystyle=dO\_\{i\}^\{\\top\}\\cdot V\_\{j\}dSijmasked\\displaystyle dS\_\{ij\}^\{\\text\{masked\}\}=Pij\(dPij−∑kPikdPik\)\\displaystyle=P\_\{ij\}\\left\(dP\_\{ij\}\-\\sum\_\{k\}P\_\{ik\}dP\_\{ik\}\\right\)
Because our soft inclusion mask relies onσij\\sigma\_\{ij\}, gradients must be routed back to the threshold predictor\. The local gradient with respect to the thresholdτi\\tau\_\{i\}incorporates both the task loss \(routed through the mask\) and the sparsity regularizer \(routed throughdΣid\\Sigma\_\{i\}\)\. Using the derivative of the sigmoid function,σij′=σij\(1−σij\)\\sigma^\{\\prime\}\_\{ij\}=\\sigma\_\{ij\}\(1\-\\sigma\_\{ij\}\), the gradient step for the threshold is the following \(see Section[E\.3](https://arxiv.org/html/2609.20888#A5.SS3)\):
dτi=∑j\(dSijmasked∂S~ij∂σij\+dΣi\)\(−β⋅σij′\)d\\tau\_\{i\}=\\sum\_\{j\}\\left\(dS\_\{ij\}^\{\\text\{masked\}\}\\frac\{\\partial\\tilde\{S\}\_\{ij\}\}\{\\partial\\sigma\_\{ij\}\}\+d\\Sigma\_\{i\}\\right\)\\big\(\-\\beta\\cdot\\sigma^\{\\prime\}\_\{ij\}\\big\)
Similarly, the gradient with respect to the raw pre\-softmax attention scoreSijS\_\{ij\}receives an additional term from the thresholding mechanism, yielding the finaldSijrawdS\_\{ij\}^\{\\text\{raw\}\}used to computedKdKanddQdQ\.
Because the backward pass’s inner loop iterates over queries while holding keys constant, gradients forQQandτ\\tauare accumulated atomically across multiple inner iterations \(tl\.atomic\_add\), ensuring thread\-safe gradient reductions across the sequence length without necessitating massive workspace buffers\.[Algorithm 3](https://arxiv.org/html/2609.20888#alg3)gives the full backward pass\.
Algorithm 3Hardware\-Aligned Backward Kernel1:Forward tensors
Q,K,V,τ,O,LQ,K,V,\\tau,O,L, upstream gradients
dO,dΣdO,d\\Sigma
2:Scale
ss, Temperature
β\\beta
3:Gradients
dQ,dK,dV∈ℝT×ddQ,dK,dV\\in\\mathbb\{R\}^\{T\\times d\},
dτ∈ℝTd\\tau\\in\\mathbb\{R\}^\{T\}
4:Initialize
dQ,dτ←0dQ,d\\tau\\leftarrow 0in HBM
5:foreach key block
jjfrom
11to
T/BNT/B\_\{N\}do
6:Load
Kj,VjK\_\{j\},V\_\{j\}from HBM to SRAM
7:Initialize
dKj←0dK\_\{j\}\\leftarrow 0,
dVj←0dV\_\{j\}\\leftarrow 0in SRAM
8:foreach query block
iifrom
jjto
T/BMT/B\_\{M\}do⊳\\trianglerightRespect causal bounds
9:Load
Qi,τi,Oi,Li,dOi,dΣiQ\_\{i\},\\tau\_\{i\},O\_\{i\},L\_\{i\},dO\_\{i\},d\\Sigma\_\{i\}from HBM to SRAM
10:Recompute
Sij←s⋅QiKj⊤S\_\{ij\}\\leftarrow s\\cdot Q\_\{i\}K\_\{j\}^\{\\top\}
11:Recompute
σij←sigmoid\(β⋅\(Sij−τi\)\)\\sigma\_\{ij\}\\leftarrow\\text\{sigmoid\}\(\\beta\\cdot\(S\_\{ij\}\-\\tau\_\{i\}\)\)
12:Recompute masked scores
S~ij\\tilde\{S\}\_\{ij\}⊳\\trianglerightUsing strict or soft mask
13:Apply causal/diagonal mask to
S~ij\\tilde\{S\}\_\{ij\}
14:
Pij←exp\(S~ij−Li\)P\_\{ij\}\\leftarrow\\exp\(\\tilde\{S\}\_\{ij\}\-L\_\{i\}\)⊳\\trianglerightRecompute attention probabilities
15:
dVj←dVj\+Pij⊤dOidV\_\{j\}\\leftarrow dV\_\{j\}\+P\_\{ij\}^\{\\top\}dO\_\{i\}⊳\\trianglerightAccumulate value gradients
16:
dPij←dOiVj⊤dP\_\{ij\}\\leftarrow dO\_\{i\}V\_\{j\}^\{\\top\}
17:
Di←row\_sum\(dOi⊙Oi\)D\_\{i\}\\leftarrow\\text\{row\\\_sum\}\(dO\_\{i\}\\odot O\_\{i\}\)⊳\\trianglerightSoftmax scaling factor
18:
dSijmasked←Pij⊙\(dPij−Di\)dS\_\{ij\}^\{\\text\{masked\}\}\\leftarrow P\_\{ij\}\\odot\(dP\_\{ij\}\-D\_\{i\}\)⊳\\trianglerightGradient through softmax
19:Compute threshold gradient
dτlocald\\tau\_\{\\text\{local\}\}using
dSijmasked,dΣidS\_\{ij\}^\{\\text\{masked\}\},d\\Sigma\_\{i\}, and
σij′\\sigma^\{\\prime\}\_\{ij\}
20:Compute raw pre\-softmax gradient
dSijrawdS\_\{ij\}^\{\\text\{raw\}\}
21:
dKj←dKj\+s\(dSijraw\)⊤QidK\_\{j\}\\leftarrow dK\_\{j\}\+s\(dS\_\{ij\}^\{\\text\{raw\}\}\)^\{\\top\}Q\_\{i\}⊳\\trianglerightAccumulate key gradients
22:atomic\_add\(
dQidQ\_\{i\},
dSijrawKjdS\_\{ij\}^\{\\text\{raw\}\}K\_\{j\}\)⊳\\trianglerightAccumulate to HBM safely
23:atomic\_add\(
dτid\\tau\_\{i\},
row\_sum\(dτlocal\)\\text\{row\\\_sum\}\(d\\tau\_\{\\text\{local\}\}\)\)
24:endfor
25:Store
dKj,dVjdK\_\{j\},dV\_\{j\}from SRAM to HBM
26:endfor
### E\.3Derivation of the Attention Gradients
To formulate the backward pass, we differentiate the scalar lossℒ\\mathcal\{L\}with respect to the intermediate variables in reverse\. We denote the upstream gradient of the loss with respect to any variableXXasdX=∂ℒ∂XdX=\\frac\{\\partial\\mathcal\{L\}\}\{\\partial X\}\. Recall the forward attention operations for a queryiiand keyjj:
Sij=s⟨Qi,Kj⟩,Pij=exp\(S~ij\)∑kexp\(S~ik\),Oi=∑kPikVkS\_\{ij\}=s\\langle Q\_\{i\},K\_\{j\}\\rangle,\\quad P\_\{ij\}=\\frac\{\\exp\(\\tilde\{S\}\_\{ij\}\)\}\{\\sum\_\{k\}\\exp\(\\tilde\{S\}\_\{ik\}\)\},\\quad O\_\{i\}=\\sum\_\{k\}P\_\{ik\}V\_\{k\}\(6\)wheressis the scaling factor andS~ij\\tilde\{S\}\_\{ij\}is the dynamically masked pre\-softmax logit\.
We first compute the gradients with respect to the value vectorsVjV\_\{j\}and the scalar attention probabilitiesPijP\_\{ij\}\. Applying the chain rule to the forward output sum yields:
dVj=∑iPijdOi,anddPij=dOi⋅VjdV\_\{j\}=\\sum\_\{i\}P\_\{ij\}dO\_\{i\},\\quad\\text\{and\}\\quad dP\_\{ij\}=dO\_\{i\}\\cdot V\_\{j\}\(7\)
Next, we route the gradient through the softmax normalization to find the derivative with respect to the masked logits,S~ij\\tilde\{S\}\_\{ij\}\. BecauseS~ij\\tilde\{S\}\_\{ij\}affects all probabilitiesPikP\_\{ik\}for queryii, we sum overkkusing the standard softmax Jacobian,∂Pik∂S~ij=Pij\(δjk−Pik\)\\frac\{\\partial P\_\{ik\}\}\{\\partial\\tilde\{S\}\_\{ij\}\}=P\_\{ij\}\(\\delta\_\{jk\}\-P\_\{ik\}\), whereδjk\\delta\_\{jk\}is the Kronecker delta:
dSijmasked=∑kdPik∂Pik∂S~ij=Pij\(dPij−∑kPikdPik\)dS\_\{ij\}^\{\\text\{masked\}\}=\\sum\_\{k\}dP\_\{ik\}\\frac\{\\partial P\_\{ik\}\}\{\\partial\\tilde\{S\}\_\{ij\}\}=P\_\{ij\}\\left\(dP\_\{ij\}\-\\sum\_\{k\}P\_\{ik\}dP\_\{ik\}\\right\)\(8\)
The thresholdτi\\tau\_\{i\}and the raw pre\-softmax logitSijS\_\{ij\}interact through the inclusion probabilityσij=σ\(β\(Sij−τi\)\)\\sigma\_\{ij\}=\\sigma\(\\beta\(S\_\{ij\}\-\\tau\_\{i\}\)\)\. This probability branches into two computational pathways: the task loss \(acting as a dynamic mask to produceS~ij\\tilde\{S\}\_\{ij\}\) and the sparsity regularization loss \(accumulating into the row\-wise sumRi=∑jσijR\_\{i\}=\\sum\_\{j\}\\sigma\_\{ij\}\)\.
Both gradient derivations rely on the shared upstream gradient flowing throughσij\\sigma\_\{ij\}\. UsingdSijmasked=∂ℒ∂S~ijdS\_\{ij\}^\{\\text\{masked\}\}=\\frac\{\\partial\\mathcal\{L\}\}\{\\partial\\tilde\{S\}\_\{ij\}\}anddΣi=∂ℒ∂Rid\\Sigma\_\{i\}=\\frac\{\\partial\\mathcal\{L\}\}\{\\partial R\_\{i\}\}, we apply the chain rule to find:
∂ℒ∂σij=dSijmasked∂S~ij∂σij\+dΣi\\frac\{\\partial\\mathcal\{L\}\}\{\\partial\\sigma\_\{ij\}\}=dS\_\{ij\}^\{\\text\{masked\}\}\\frac\{\\partial\\tilde\{S\}\_\{ij\}\}\{\\partial\\sigma\_\{ij\}\}\+d\\Sigma\_\{i\}
#### Threshold Gradient \(dτid\\tau\_\{i\}\):
The thresholdτi\\tau\_\{i\}only affects the loss viaσij\\sigma\_\{ij\}\. Because it influences all keysjjup to the causal limit, we sum the chain rule across the sequence\. Evaluating the inner derivative∂σij∂τi=−βσij′\\frac\{\\partial\\sigma\_\{ij\}\}\{\\partial\\tau\_\{i\}\}=\-\\beta\\sigma^\{\\prime\}\_\{ij\}\(whereσij′=σij\(1−σij\)\\sigma^\{\\prime\}\_\{ij\}=\\sigma\_\{ij\}\(1\-\\sigma\_\{ij\}\)\), we obtain:
dτi=∑j∂ℒ∂σij∂σij∂τi=∑j\(dSijmasked∂S~ij∂σij\+dΣi\)\(−β⋅σij′\)d\\tau\_\{i\}=\\sum\_\{j\}\\frac\{\\partial\\mathcal\{L\}\}\{\\partial\\sigma\_\{ij\}\}\\frac\{\\partial\\sigma\_\{ij\}\}\{\\partial\\tau\_\{i\}\}=\\sum\_\{j\}\\left\(dS\_\{ij\}^\{\\text\{masked\}\}\\frac\{\\partial\\tilde\{S\}\_\{ij\}\}\{\\partial\\sigma\_\{ij\}\}\+d\\Sigma\_\{i\}\\right\)\\big\(\-\\beta\\cdot\\sigma^\{\\prime\}\_\{ij\}\\big\)
#### Raw Score Gradient \(dSijrawdS\_\{ij\}^\{\\text\{raw\}\}\):
Unlike the threshold, the raw scoreSijS\_\{ij\}affects the loss through both the indirect sigmoid path \(σij\\sigma\_\{ij\}\) and the direct dynamic mask path \(S~ij\\tilde\{S\}\_\{ij\}\)\. Applying the multivariate chain rule:
dSijraw=∂ℒ∂S~ij∂S~ij∂Sij\+∂ℒ∂σij∂σij∂SijdS\_\{ij\}^\{\\text\{raw\}\}=\\frac\{\\partial\\mathcal\{L\}\}\{\\partial\\tilde\{S\}\_\{ij\}\}\\frac\{\\partial\\tilde\{S\}\_\{ij\}\}\{\\partial S\_\{ij\}\}\+\\frac\{\\partial\\mathcal\{L\}\}\{\\partial\\sigma\_\{ij\}\}\\frac\{\\partial\\sigma\_\{ij\}\}\{\\partial S\_\{ij\}\}Notice the mathematical symmetry in the sigmoid’s argument: the inner derivative with respect to the score is∂σij∂Sij=\+βσij′\\frac\{\\partial\\sigma\_\{ij\}\}\{\\partial S\_\{ij\}\}=\+\\beta\\sigma^\{\\prime\}\_\{ij\}\. Substituting this and the shared intermediate term yields the final local gradient:
dSijraw=dSijmasked∂S~ij∂Sij\+\(dSijmasked∂S~ij∂σij\+dΣi\)\(β⋅σij′\)dS\_\{ij\}^\{\\text\{raw\}\}=dS\_\{ij\}^\{\\text\{masked\}\}\\frac\{\\partial\\tilde\{S\}\_\{ij\}\}\{\\partial S\_\{ij\}\}\+\\left\(dS\_\{ij\}^\{\\text\{masked\}\}\\frac\{\\partial\\tilde\{S\}\_\{ij\}\}\{\\partial\\sigma\_\{ij\}\}\+d\\Sigma\_\{i\}\\right\)\\big\(\\beta\\cdot\\sigma^\{\\prime\}\_\{ij\}\\big\)
#### Masking Derivatives:
To implement these equations natively, the exact values of the local mask derivatives are determined by the chosen dynamic masking strategy:
- •Additive Masking\(S~ij=Sij\+C⋅σij−C\\tilde\{S\}\_\{ij\}=S\_\{ij\}\+C\\cdot\\sigma\_\{ij\}\-C\): The direct derivative is∂S~ij∂Sij=1\\frac\{\\partial\\tilde\{S\}\_\{ij\}\}\{\\partial S\_\{ij\}\}=1, and the sigmoid interaction is∂S~ij∂σij=C\\frac\{\\partial\\tilde\{S\}\_\{ij\}\}\{\\partial\\sigma\_\{ij\}\}=C\.
- •Multiplicative Masking\(S~ij=Sij⊙σij\\tilde\{S\}\_\{ij\}=S\_\{ij\}\\odot\\sigma\_\{ij\}\): The direct derivative is∂S~ij∂Sij=σij\\frac\{\\partial\\tilde\{S\}\_\{ij\}\}\{\\partial S\_\{ij\}\}=\\sigma\_\{ij\}, and the sigmoid interaction is∂S~ij∂σij=Sij\\frac\{\\partial\\tilde\{S\}\_\{ij\}\}\{\\partial\\sigma\_\{ij\}\}=S\_\{ij\}\.
#### Query and Key Gradients
As we saw,dSijmaskeddS\_\{ij\}^\{\\text\{masked\}\}is combined with the sparsity regularization gradient to form the total upstream gradient for the raw score, denoted asdSijrawdS\_\{ij\}^\{\\text\{raw\}\}\. We distribute this raw gradient back to the query and key vectors\. Differentiating the scaled dot\-productSij=sQiKjTS\_\{ij\}=sQ\_\{i\}K\_\{j\}^\{T\}yields symmetric accumulations:
dQi=∑js⋅dSijrawKj,anddKj=∑is⋅dSijrawQidQ\_\{i\}=\\sum\_\{j\}s\\cdot dS\_\{ij\}^\{\\text\{raw\}\}K\_\{j\},\\quad\\text\{and\}\\quad dK\_\{j\}=\\sum\_\{i\}s\\cdot dS\_\{ij\}^\{\\text\{raw\}\}Q\_\{i\}\(9\)
From a hardware implementation perspective, the scalarssis absorbed intodSijrawdS\_\{ij\}^\{\\text\{raw\}\}immediately prior to these matrix multiplications\. Because our backward kernel holds keys in the outer loop and iterates over queries in the inner loop,dKjdK\_\{j\}is accumulated safely in on\-chip SRAM, whereasdQidQ\_\{i\}requires atomic additions to prevent race conditions in global High Bandwidth Memory \(HBM\)\.
### E\.4Complexity Analysis
To formally evaluate the hardware efficiency of our Threshold Attention mechanism, we analyze its space, time \(FLOPs\), and memory access \(I/O\) complexities\. We follow the analytical framework of FlashAttention\([Dao et al\., 2022](https://arxiv.org/html/2609.20888#bib.bib9)\)\.
LetTTbe the sequence length andddbe the head dimension\. LetMMdenote the capacity of the fast on\-chip SRAM\. To maximize SRAM utilization without overflowing, our block sizes are constrained such thatBM,BN=Θ\(M/d\)B\_\{M\},B\_\{N\}=\\Theta\(M/d\)\. For this analysis, we assume a causal masking paradigm, meaning the inner loops traverse approximatelyT2/2T^\{2\}/2total element interactions\.
#### Forward Pass Complexity
In standard attention, materializing the denseT×TT\\times Tattention matrix requires𝒪\(T2\)\\mathcal\{O\}\(T^\{2\}\)space and𝒪\(T2\)\\mathcal\{O\}\(T^\{2\}\)High Bandwidth Memory \(HBM\) accesses\. Our hardware\-aligned forward pass avoids this\.
- •Space:We only store the inputsQ,K,V∈ℝT×dQ,K,V\\in\\mathbb\{R\}^\{T\\times d\}, the threshold parametersτ∈ℝT\\tau\\in\\mathbb\{R\}^\{T\}, the final outputO∈ℝT×dO\\in\\mathbb\{R\}^\{T\\times d\}, and the vectors required for the backward pass \(L,Σ∈ℝTL,\\Sigma\\in\\mathbb\{R\}^\{T\}\)\. The dynamic maskσij\\sigma\_\{ij\}is computed locally in SRAM and never explicitly materialized\. Thus, the total space complexity is𝒪\(Td\)\\mathcal\{O\}\(Td\), identical to standard FlashAttention\.
- •Time:The inner loop computes the dot product, the sigmoid inclusion probability, and the softmax accumulator updates\. While the sigmoid and masking operations introduce a constant factor overhead compared to raw FlashAttention, they are element\-wise𝒪\(1\)\\mathcal\{O\}\(1\)operations\. Across all block pairs, the dominant operation remains the matrix multiplications \(QiKjTQ\_\{i\}K\_\{j\}^\{T\}andPijVjP\_\{ij\}V\_\{j\}\), yielding a time complexity of𝒪\(T2d\)\\mathcal\{O\}\(T^\{2\}d\)\.
- •I/O \(HBM Accesses\):The outer loop iterates overT/BMT/B\_\{M\}query blocks\. For each query block, it loadsQiQ\_\{i\}andτi\\tau\_\{i\}from HBM \(Θ\(BMd\)\\Theta\(B\_\{M\}d\)elements\)\. The inner loop iterates overT/BNT/B\_\{N\}key/value blocks, loadingKjK\_\{j\}andVjV\_\{j\}\(Θ\(BNd\)\\Theta\(B\_\{N\}d\)elements\)\. The total number of HBM accesses is given by: HBM Accesses=∑i=1T/BM\[Θ\(BMd\)\+∑j=1iΘ\(BNd\)\]=𝒪\(T2dBM\)\\text\{HBM Accesses\}=\\sum\_\{i=1\}^\{T/B\_\{M\}\}\\left\[\\Theta\(B\_\{M\}d\)\+\\sum\_\{j=1\}^\{i\}\\Theta\(B\_\{N\}d\)\\right\]=\\mathcal\{O\}\\left\(\\frac\{T^\{2\}d\}\{B\_\{M\}\}\\right\)\(10\)SubstitutingBM=Θ\(M/d\)B\_\{M\}=\\Theta\(M/d\), the overall I/O complexity is𝒪\(T2d2M−1\)\\mathcal\{O\}\(T^\{2\}d^\{2\}M^\{\-1\}\)\.
#### Backward Pass Complexity
The backward pass reconstructs the forward pass intermediate states to avoid saving the massiveT×TT\\times Tmatrices, trading additional FLOPs for substantially reduced memory reads\.
- •Space:The backward pass requires storing the gradientsdQ,dK,dV∈ℝT×ddQ,dK,dV\\in\\mathbb\{R\}^\{T\\times d\}anddτ∈ℝTd\\tau\\in\\mathbb\{R\}^\{T\}, requiring𝒪\(Td\)\\mathcal\{O\}\(Td\)space\.
- •Time:RecomputingSijS\_\{ij\}andσij\\sigma\_\{ij\}requires the same𝒪\(T2d\)\\mathcal\{O\}\(T^\{2\}d\)FLOPs as the forward pass\. Computing the standard attention gradients \(dSij,dPij,dVj,dKj,dQidS\_\{ij\},dP\_\{ij\},dV\_\{j\},dK\_\{j\},dQ\_\{i\}\) and the threshold gradientdτid\\tau\_\{i\}involves purely linear matrix multiplications and element\-wise derivatives\. Thus, the total time complexity remains𝒪\(T2d\)\\mathcal\{O\}\(T^\{2\}d\)\.
- •I/O \(HBM Accesses\):The outer loop iterates overT/BNT/B\_\{N\}key blocks, holdingKjK\_\{j\}andVjV\_\{j\}in SRAM while accumulatingdKjdK\_\{j\}anddVjdV\_\{j\}\. The inner loop streams the query blocksQi,dOiQ\_\{i\},dO\_\{i\}and vectorsL,τ,D,dΣL,\\tau,D,d\\Sigmafrom HBM \(Θ\(BMd\)\\Theta\(B\_\{M\}d\)elements\)\. The gradientsdQidQ\_\{i\}anddτid\\tau\_\{i\}are accumulated to HBM using atomic additions\. The total HBM access cost is: HBM Accesses=∑j=1T/BN\[Θ\(BNd\)\+∑i=jT/BMΘ\(BMd\)\]=𝒪\(T2dBN\)\\text\{HBM Accesses\}=\\sum\_\{j=1\}^\{T/B\_\{N\}\}\\left\[\\Theta\(B\_\{N\}d\)\+\\sum\_\{i=j\}^\{T/B\_\{M\}\}\\Theta\(B\_\{M\}d\)\\right\]=\\mathcal\{O\}\\left\(\\frac\{T^\{2\}d\}\{B\_\{N\}\}\\right\)\(11\)SubstitutingBN=Θ\(M/d\)B\_\{N\}=\\Theta\(M/d\), the backward I/O complexity is𝒪\(T2d2M−1\)\\mathcal\{O\}\(T^\{2\}d^\{2\}M^\{\-1\}\)\.
## Appendix FInference\-Time Block\-Sparse Fused Kernel
Here we detail the algorithmic design and systems optimizations of our custom Triton\([Tillet et al\., 2019](https://arxiv.org/html/2609.20888#bib.bib4)\)fused kernel for block\-sparse attention decoding\.
### F\.1GQA\-Grouped Execution and Compact Metadata Layout
In Grouped\-Query Attention \(G=HQ/HKVG=H\_\{Q\}/H\_\{KV\}\), launching an independent thread block per query head replicates KV cache reads up toGGtimes\. Instead, our kernel launches a two\-dimensional grid over KV heads \(⌈Nblocks/C⌉×\(B⋅HKV\)\\lceil N\_\{\\text\{blocks\}\}/C\\rceil\\times\(B\\cdot H\_\{KV\}\)\), maintaining leading accumulator dimensions of sizeGG\. AllCCblock metadata records for a chunk are fetched in bulk coalesced tiles to evaluate theC×GC\\times Gscreening bounds simultaneously via Tensor Core matrix multiplications \(tl\.dot\)\. A KV block is loaded from HBM into SRAM once if*any*query head within the group selects it, with per\-head online\-softmax updates masked individually\. This reduces byte traffic fromHQ⋅DheadH\_\{Q\}\\cdot D\_\{\\text\{head\}\}toHKV⋅DunionH\_\{KV\}\\cdot D\_\{\\text\{union\}\}fractions of the cache\.
To minimize metadata I/O, each per\-block record stores only the 64\-dimensional centroid𝝁B\\boldsymbol\{\\mu\}\_\{B\}\(float16\), 64\-dimensional coordinate standard deviation𝝈B\\boldsymbol\{\\sigma\}\_\{B\}\(float16\), and scalar maximum normMBM\_\{B\}\(float32\), totaling258258bytes per block per KV head \(1\.6%1\.6\\%overhead atb=64b=64\)\. Caching𝝈B\\boldsymbol\{\\sigma\}\_\{B\}rather than variance𝝈B2\\boldsymbol\{\\sigma\}\_\{B\}^\{2\}prevents half\-precision underflow below6×10−56\\times 10^\{\-5\}in low\-variance blocks\.
### F\.2Mixed Precision and Numerical Stability
While Tensor Core matrix multiplications \(qKB⊤qK\_\{B\}^\{\\top\}andPVBPV\_\{B\}\) execute infloat16, squaring coordinates in half precision during proxy bound evaluation can induce overflow or cancellation\. Consequently, all coordinate\-wise square accumulations, dot\-product bounding terms \(⟨q,𝝁B⟩\\langle q,\\boldsymbol\{\\mu\}\_\{B\}\\rangle\), scaling factors, and online softmax accumulators \(mc,lcm\_\{c\},l\_\{c\}\) are strictly promoted tofloat32\.
### F\.3Chunked Decoding and Two\-Stage Reduction
To maximize Streaming Multiprocessor \(SM\) occupancy during long\-context decoding, the block sequence is partitioned into independent*chunks*ofCCcontiguous blocks\. The primary scan kernel evaluates block thresholds and updates local online softmax accumulators \(mmid\(c\)m\_\{\\text\{mid\}\}^\{\(c\)\},lmid\(c\)l\_\{\\text\{mid\}\}^\{\(c\)\},Omid\(c\)∈ℝdO\_\{\\text\{mid\}\}^\{\(c\)\}\\in\\mathbb\{R\}^\{d\}\) independently for each chunkcc\. WhenNchunks\>1N\_\{\\text\{chunks\}\}\>1, a secondary reduction kernel aggregates chunk statistics via associative online softmax reduction:
o=∑c=1NchunksOmid\(c\)exp\(mmid\(c\)−mglobal\)∑c=1Nchunkslmid\(c\)exp\(mmid\(c\)−mglobal\),wheremglobal=maxcmmid\(c\)\.o=\\frac\{\\sum\_\{c=1\}^\{N\_\{\\text\{chunks\}\}\}O\_\{\\text\{mid\}\}^\{\(c\)\}\\exp\\left\(m\_\{\\text\{mid\}\}^\{\(c\)\}\-m\_\{\\text\{global\}\}\\right\)\}\{\\sum\_\{c=1\}^\{N\_\{\\text\{chunks\}\}\}l\_\{\\text\{mid\}\}^\{\(c\)\}\\exp\\left\(m\_\{\\text\{mid\}\}^\{\(c\)\}\-m\_\{\\text\{global\}\}\\right\)\},\\quad\\text\{where \}m\_\{\\text\{global\}\}=\\max\_\{c\}\\,m\_\{\\text\{mid\}\}^\{\(c\)\}\.WhenNchunks=1N\_\{\\text\{chunks\}\}=1, a fast path normalizes and writeso=acc1/l1o=\\text\{acc\}\_\{1\}/l\_\{1\}directly to HBM without staging intermediate buffers\. Larger chunk sizesCCreduce intermediate buffer traffic and reduction trip counts at the cost of grid parallelism; as shown in[Table 9](https://arxiv.org/html/2609.20888#A6.T9),b=64,c=128b=64,c=128achieves optimal throughput at51\.2%51\.2\\%union density, whereas coarser blocks \(b=128,c=64b=128,c=64\) reach2\.50×2\.50\\timesspeedup in sparse regimes \(16\.0%16\.0\\%union\)\.
Table 9:Effect of block size and chunk sizeatB=64B=64,L=512L=512K \(32\.832\.8GB KV cache\), NVIDIA H100 SXM8080GB,float16\.ccdenotes blocks per chunk\. Coarser blocks reduce metadata overhead in sparse regimes \(16%16\\%\), whileb=64b=64achieves the best balance at51\.2%51\.2\\%union density\.
### F\.4Top\-1 Rescue, Tail Handling, and Kernel Validation
If an aggressive threshold prunes all candidate blocks in chunk00, leaving an empty softmax denominator \(lc=0l\_\{c\}=0\), the kernel executes a localized*Top\-1 Rescue Phase*: it tracks the maximum proxy bound index during scanning and unconditionally loadsKmax\_idx,Vmax\_idxK\_\{\\text\{max\\\_idx\}\},V\_\{\\text\{max\\\_idx\}\}into SRAM\. Furthermore, whenever sequence lengthTTis not an exact multiple of block sizeBB, the final chunk \(c=Nchunksc=N\_\{\\text\{chunks\}\}\) executes a predicated tail phase \(IS\_TAIL=True\) to process remaining tokens with out\-of\-bounds positions masked to−∞\-\\infty\.
We validate the grouped decode kernel across3131test configurations against an independent PyTorch reference implementation modeling greedy block selection and top\-1 rescue\. Integer selection counts \(per\-head density, attended token fraction, and GQA union blocks\) match with zero discrepancy across all cases, while attention outputs match within10−610^\{\-6\}infloat32and10−310^\{\-3\}infloat16\. The complete decode procedure is summarized in[Subsection F\.4](https://arxiv.org/html/2609.20888#A6.SS4)\.
Algorithm 4Hardware\-Aligned Block\-Sparse Decoding \(Inference\)
1:Query
q∈ℝdq\\in\\mathbb\{R\}^\{d\}, KV Cache
K,V∈ℝT×dK,V\\in\\mathbb\{R\}^\{T\\times d\}
2:Block Size
BB, Blocks per Chunk
CC, Total Full Blocks
Nfull←⌊T/B⌋N\_\{\\text\{full\}\}\\leftarrow\\lfloor T/B\\rfloor
3:Metadata: Centroids
μb∈ℝd\\mu\_\{b\}\\in\\mathbb\{R\}^\{d\}, Variances
σb2∈ℝd\\sigma\_\{b\}^\{2\}\\in\\mathbb\{R\}^\{d\}, Max Norms
Mb∈ℝM\_\{b\}\\in\\mathbb\{R\}for
b∈\[1,Nfull\]b\\in\[1,N\_\{\\text\{full\}\}\]
4:Dynamic Threshold
τ\\tau, Softmax Scale
ss, Operating Offset
aa, Z\-score
zz
5:Output
o∈ℝdo\\in\\mathbb\{R\}^\{d\}
6:Calculate
Nchunks←⌈Nfull/C⌉N\_\{\\text\{chunks\}\}\\leftarrow\\lceil N\_\{\\text\{full\}\}/C\\rceil
7:if
Nchunks\>1N\_\{\\text\{chunks\}\}\>1then
8:Allocate intermediate buffers
Mmid,Lmid∈ℝNchunksM\_\{\\text\{mid\}\},L\_\{\\text\{mid\}\}\\in\\mathbb\{R\}^\{N\_\{\\text\{chunks\}\}\},
Omid∈ℝNchunks×dO\_\{\\text\{mid\}\}\\in\\mathbb\{R\}^\{N\_\{\\text\{chunks\}\}\\times d\}in HBM
9:endif
10:
τeff←τ−a\\tau\_\{\\text\{eff\}\}\\leftarrow\\tau\-a⊳\\trianglerightEffective threshold with operating offset
11:foreach chunk
ccfrom
11to
NchunksN\_\{\\text\{chunks\}\}do⊳\\trianglerightProcessed in parallel across GPU SMs
12:
mc←−∞m\_\{c\}\\leftarrow\-\\infty,
lc←0l\_\{c\}\\leftarrow 0,
accc←𝟎∈ℝdacc\_\{c\}\\leftarrow\\mathbf\{0\}\\in\\mathbb\{R\}^\{d\},
tokens\_attended←0\\text\{tokens\\\_attended\}\\leftarrow 0
13:
max\_bound←−∞\\text\{max\\\_bound\}\\leftarrow\-\\infty,
max\_idx←−1\\text\{max\\\_idx\}\\leftarrow\-1
14:foreach full block
b∈\[\(c−1\)C\+1,min\(cC,Nfull\)\]b\\in\[\(c\-1\)C\+1,\\,\\min\(cC,N\_\{\\text\{full\}\}\)\]do
15:Load
μb,σb2,Mb\\mu\_\{b\},\\sigma\_\{b\}^\{2\},M\_\{b\}from HBM into SRAM
16:
boundgauss←s⋅\(⟨q,μb⟩\+z⋅∑iqi2\(σb2\)i\)\\text\{bound\}\_\{\\text\{gauss\}\}\\leftarrow s\\cdot\\left\(\\langle q,\\mu\_\{b\}\\rangle\+z\\cdot\\sqrt\{\\sum\_\{i\}q\_\{i\}^\{2\}\(\\sigma\_\{b\}^\{2\}\)\_\{i\}\}\\right\)
17:
boundspher←s⋅‖q‖⋅Mb\\text\{bound\}\_\{\\text\{spher\}\}\\leftarrow s\\cdot\\\|q\\\|\\cdot M\_\{b\}
18:
bound←min\(boundgauss,boundspher\)\\text\{bound\}\\leftarrow\\min\(\\text\{bound\}\_\{\\text\{gauss\}\},\\text\{bound\}\_\{\\text\{spher\}\}\)
19:if
bound≥τeff\\text\{bound\}\\geq\\tau\_\{\\text\{eff\}\}then
20:Load
Kb,VbK\_\{b\},V\_\{b\}from HBM into SRAM⊳\\trianglerightSignificant block
21:Update
mc,lc,acccm\_\{c\},l\_\{c\},acc\_\{c\}via online softmax using
q,Kb,Vbq,K\_\{b\},V\_\{b\}
22:
tokens\_attended←tokens\_attended\+B\\text\{tokens\\\_attended\}\\leftarrow\\text\{tokens\\\_attended\}\+B
23:endif
24:if
c==1c==1and
bound\>max\_bound\\text\{bound\}\>\\text\{max\\\_bound\}then⊳\\trianglerightTrack max only for Chunk 1 rescue
25:
max\_bound←bound\\text\{max\\\_bound\}\\leftarrow\\text\{bound\},
max\_idx←b\\text\{max\\\_idx\}\\leftarrow b
26:endif
27:endfor
28:if
c==1c==1and
tokens\_attended==0\\text\{tokens\\\_attended\}==0then⊳\\trianglerightTop\-1 Rescue Phase \(Chunk 1 only\)
29:Load
Kmax\_idx,Vmax\_idxK\_\{\\text\{max\\\_idx\}\},V\_\{\\text\{max\\\_idx\}\}from HBM into SRAM
30:Update
mc,lc,acccm\_\{c\},l\_\{c\},acc\_\{c\}via online softmax using
q,Kmax\_idx,Vmax\_idxq,K\_\{\\text\{max\\\_idx\}\},V\_\{\\text\{max\\\_idx\}\}
31:endif
32:if
c==Nchunksc==N\_\{\\text\{chunks\}\}and
T\>Nfull⋅BT\>N\_\{\\text\{full\}\}\\cdot Bthen⊳\\trianglerightTail\-Block Phase \(partial remaining tokens\)
33:Load remaining tail tokens
Ktail,VtailK\_\{\\text\{tail\}\},V\_\{\\text\{tail\}\}from HBM into SRAM
34:Update
mc,lc,acccm\_\{c\},l\_\{c\},acc\_\{c\}via online softmax with partial masking
35:endif
36:if
Nchunks==1N\_\{\\text\{chunks\}\}==1then
37:return
accc/lcacc\_\{c\}/l\_\{c\}⊳\\trianglerightSingle\-chunk fast path: return normalized output directly
38:else
39:Store unnormalized accumulators:
mc→Mmid\[c\]m\_\{c\}\\to M\_\{\\text\{mid\}\}\[c\],
lc→Lmid\[c\]l\_\{c\}\\to L\_\{\\text\{mid\}\}\[c\],
accc→Omid\[c\]acc\_\{c\}\\to O\_\{\\text\{mid\}\}\[c\]
40:endif
41:endfor
42:Global Reduction Kernel:⊳\\trianglerightExecuted whenNchunks\>1N\_\{\\text\{chunks\}\}\>1
43:
mglobal←−∞m\_\{\\text\{global\}\}\\leftarrow\-\\infty,
lglobal←0l\_\{\\text\{global\}\}\\leftarrow 0,
o←𝟎∈ℝdo\\leftarrow\\mathbf\{0\}\\in\\mathbb\{R\}^\{d\}
44:foreach chunk
ccfrom
11to
NchunksN\_\{\\text\{chunks\}\}do
45:
mnew←max\(mglobal,Mmid\[c\]\)m\_\{\\text\{new\}\}\\leftarrow\\max\(m\_\{\\text\{global\}\},M\_\{\\text\{mid\}\}\[c\]\)
46:
αglobal←exp\(mglobal−mnew\)\\alpha\_\{\\text\{global\}\}\\leftarrow\\exp\(m\_\{\\text\{global\}\}\-m\_\{\\text\{new\}\}\),
αchunk←exp\(Mmid\[c\]−mnew\)\\alpha\_\{\\text\{chunk\}\}\\leftarrow\\exp\(M\_\{\\text\{mid\}\}\[c\]\-m\_\{\\text\{new\}\}\)
47:
lglobal←lglobal⋅αglobal\+Lmid\[c\]⋅αchunkl\_\{\\text\{global\}\}\\leftarrow l\_\{\\text\{global\}\}\\cdot\\alpha\_\{\\text\{global\}\}\+L\_\{\\text\{mid\}\}\[c\]\\cdot\\alpha\_\{\\text\{chunk\}\}
48:
o←o⋅αglobal\+Omid\[c\]⋅αchunko\\leftarrow o\\cdot\\alpha\_\{\\text\{global\}\}\+O\_\{\\text\{mid\}\}\[c\]\\cdot\\alpha\_\{\\text\{chunk\}\}
49:
mglobal←mnewm\_\{\\text\{global\}\}\\leftarrow m\_\{\\text\{new\}\}
50:endfor
51:return
o/lglobalo/l\_\{\\text\{global\}\}⊳\\trianglerightFinal normalization across all chunks
## Appendix GTrain\-to\-Inference Representational Consistency
To formally characterize the relationship between training\-time multiplicative relaxation and inference\-time block\-sparse execution, we analyze their induced attention distributions over the shared causal support𝒮t=\{1,…,t\}\\mathcal\{S\}\_\{t\}=\\\{1,\\dots,t\\\}at decoding steptt\.
LetSs=qtks⊤dkS\_\{s\}=\\frac\{q\_\{t\}k\_\{s\}^\{\\top\}\}\{\\sqrt\{d\_\{k\}\}\}denote the raw pre\-softmax attention logit for past keys≤ts\\leq t, and letτt\\tau\_\{t\}be the predicted head threshold\. Let𝒦t⊂𝒮t\\mathcal\{K\}\_\{t\}\\subset\\mathcal\{S\}\_\{t\}denote the set of active keys retained by the kernel threshold test, and let𝒫t=𝒮t∖𝒦t\\mathcal\{P\}\_\{t\}=\\mathcal\{S\}\_\{t\}\\setminus\\mathcal\{K\}\_\{t\}be the set of pruned background keys\.
###### Definition 1\(Training and Inference Attention Distributions\)\.
The training\-time attention distributionPtrainP^\{\\mathrm\{train\}\}and inference\-time distributionPinferP^\{\\mathrm\{infer\}\}over the full support𝒮t\\mathcal\{S\}\_\{t\}are defined as:
Pstrain\\displaystyle P\_\{s\}^\{\\mathrm\{train\}\}=exp\(Ss⋅σs\)∑j=1texp\(Sj⋅σj\),∀s∈𝒮t,\\displaystyle=\\frac\{\\exp\\left\(S\_\{s\}\\cdot\\sigma\_\{s\}\\right\)\}\{\\sum\_\{j=1\}^\{t\}\\exp\\left\(S\_\{j\}\\cdot\\sigma\_\{j\}\\right\)\},\\quad\\forall s\\in\\mathcal\{S\}\_\{t\},\(12\)Psinfer\\displaystyle P\_\{s\}^\{\\mathrm\{infer\}\}=\{exp\(Ss\)∑j∈𝒦texp\(Sj\),ifs∈𝒦t,0,ifs∈𝒫t,\\displaystyle=\\begin\{cases\}\\dfrac\{\\exp\\left\(S\_\{s\}\\right\)\}\{\\sum\_\{j\\in\\mathcal\{K\}\_\{t\}\}\\exp\\left\(S\_\{j\}\\right\)\},&\\text\{if \}s\\in\\mathcal\{K\}\_\{t\},\\\\ 0,&\\text\{if \}s\\in\\mathcal\{P\}\_\{t\},\\end\{cases\}\(13\)whereσs=sigmoid\(β\(Ss−τt\)\)∈\(0,1\)\\sigma\_\{s\}=\\mathrm\{sigmoid\}\\left\(\\beta\(S\_\{s\}\-\\tau\_\{t\}\)\\right\)\\in\(0,1\)is the gating surrogate with sharpness parameterβ\>0\\beta\>0\.
### G\.1Relative Log\-Odds Invariance
A central question for any sparse attention surrogate is whether omitting pruned keys from the softmax denominator at inference—the transition from[Equation 12](https://arxiv.org/html/2609.20888#A7.E12)to[Equation 13](https://arxiv.org/html/2609.20888#A7.E13)—distorts the relative weighting among retained tokens\. Here we show that ETA’s multiplicative gating preserves relative log\-odds among salient tokens up to an exponentially vanishing residual\.
For any two retained tokensa,b∈𝒦ta,b\\in\\mathcal\{K\}\_\{t\}, the training attention ratio satisfies:
PatrainPbtrain=exp\(Saσa\)exp\(Sbσb\)=exp\(Saσa−Sbσb\)\.\\frac\{P\_\{a\}^\{\\mathrm\{train\}\}\}\{P\_\{b\}^\{\\mathrm\{train\}\}\}=\\frac\{\\exp\(S\_\{a\}\\sigma\_\{a\}\)\}\{\\exp\(S\_\{b\}\\sigma\_\{b\}\)\}=\\exp\\left\(S\_\{a\}\\sigma\_\{a\}\-S\_\{b\}\\sigma\_\{b\}\\right\)\.\(14\)BecauseSa,Sb≥τtS\_\{a\},S\_\{b\}\\geq\\tau\_\{t\}, the sigmoid gates saturate exponentially close to unity \(σs=1−ϵs\\sigma\_\{s\}=1\-\\epsilon\_\{s\}, whereϵs=𝒪\(e−β\(Ss−τt\)\)≪1\\epsilon\_\{s\}=\\mathcal\{O\}\(e^\{\-\\beta\(S\_\{s\}\-\\tau\_\{t\}\)\}\)\\ll 1\)\. Taking logarithms yields:
log\(PatrainPbtrain\)=\(Sa−Sb\)−\(Saϵa−Sbϵb\)=log\(PainferPbinfer\)\+𝒪\(e−β\(S−τt\)\)\.\\log\\left\(\\frac\{P\_\{a\}^\{\\mathrm\{train\}\}\}\{P\_\{b\}^\{\\mathrm\{train\}\}\}\\right\)=\(S\_\{a\}\-S\_\{b\}\)\-\(S\_\{a\}\\epsilon\_\{a\}\-S\_\{b\}\\epsilon\_\{b\}\)=\\log\\left\(\\frac\{P\_\{a\}^\{\\mathrm\{infer\}\}\}\{P\_\{b\}^\{\\mathrm\{infer\}\}\}\\right\)\+\\mathcal\{O\}\\\!\\left\(e^\{\-\\beta\(S\-\\tau\_\{t\}\)\}\\right\)\.\(15\)Thus, hard\-pruning sub\-threshold blocks at decode time rescales the softmax denominator uniformly without altering the relative attention hierarchy, ranking, or selective focus among retained salient keys\.
### G\.2Empirical Verification of Residual Stream Alignment
To empirically verify that dropping background keys during block\-sparse decoding preserves internal representations, we compare layer\-by\-layer state trajectories across parallel forward passes on held\-out C4 sequences \(L=1024L=1024\) using the 126M ETA checkpoint under block\-sparse decoding \(b=4b=4,z=2\.0z=2\.0,a=0\.4a=0\.4\)\.
Let𝐱train\(l\)\\mathbf\{x\}\_\{\\text\{train\}\}^\{\(l\)\}and𝐱infer\(l\)\\mathbf\{x\}\_\{\\text\{infer\}\}^\{\(l\)\}denote the residual stream hidden states at layerl∈\{0,…,11\}l\\in\\\{0,\\dots,11\\\}produced by training\-time multiplicative gating and discrete block\-sparse decoding, respectively\. At each decoding steptt, we evaluate directional cosine similarity and relative Euclidean deviation:
𝒮cos\(l\)=⟨𝐱train\(l\),𝐱infer\(l\)⟩‖𝐱train\(l\)‖‖𝐱infer\(l\)‖,ℰℓ2\(l\)=‖𝐱train\(l\)−𝐱infer\(l\)‖‖𝐱train\(l\)‖\.\\mathcal\{S\}\_\{\\cos\}\(l\)=\\frac\{\\langle\\mathbf\{x\}\_\{\\text\{train\}\}^\{\(l\)\},\\mathbf\{x\}\_\{\\text\{infer\}\}^\{\(l\)\}\\rangle\}\{\\\|\\mathbf\{x\}\_\{\\text\{train\}\}^\{\(l\)\}\\\|\\\|\\mathbf\{x\}\_\{\\text\{infer\}\}^\{\(l\)\}\\\|\},\\qquad\\mathcal\{E\}\_\{\\ell\_\{2\}\}\(l\)=\\frac\{\\\|\\mathbf\{x\}\_\{\\text\{train\}\}^\{\(l\)\}\-\\mathbf\{x\}\_\{\\text\{infer\}\}^\{\(l\)\}\\\|\}\{\\\|\\mathbf\{x\}\_\{\\text\{train\}\}^\{\(l\)\}\\\|\}\.
Figure 7:Internal representation and output distribution alignment between training\-time multiplicative relaxation and inference\-time block\-sparse execution\.\(a\) Layer\-by\-layer residual stream trajectory alignment across network depth \(L0–L11L0\\text\{\-\-\}L11\)\. \(b\) Final language modeling head calibration metrics\.As shown in[Figure 7](https://arxiv.org/html/2609.20888#A7.F7)\(a\), internal representations remain tightly aligned across network depth, maintaining a mean directional cosine similarity of𝒮cos=0\.9691\\mathcal\{S\}\_\{\\cos\}=0\.9691\(0\.99970\.9997at Layer 0\) alongside a stable22\.77%22\.77\\%relativeℓ2\\ell\_\{2\}shift\. At the final language modeling head \([Figure 7](https://arxiv.org/html/2609.20888#A7.F7)\(b\)\), next\-token logit vectors achieve0\.99590\.9959cosine similarity, a KL divergence of only0\.06310\.0631nats, and an80\.29%80\.29\\%exact top\-1 argmax match\.
## Appendix HMechanistic Analysis: Elimination of Attention Sinks and Layer Specialization
To investigate the mechanistic behavior of ETA across network depth and sequence positions, we conducted evaluation sweeps on held\-out FineWeb sequences up to lengthL=2048L=2048\. Across all2222layers and3232query heads \(22×32=70422\\times 32=704attention heads\), we recorded the active token density matrix and the softmax probability mass allocated to initial anchor positions \(t∈\[0,3\]t\\in\[0,3\]\)\.
#### Mathematical Mechanism of Attention Sink Elimination\.
In standard dense softmax attention—as well as sparse attention architectures trained with additive hard masks \(Sts→−∞S\_\{ts\}\\to\-\\inftyfors∉ℐts\\notin\\mathcal\{I\}\_\{t\}\)—attention probabilities are constrained to sum to unity over active tokens:
Pts=exp\(Sts\)∑j∈ℐtexp\(Stj\),∑s∈ℐtPts=1\.P\_\{ts\}=\\frac\{\\exp\(S\_\{ts\}\)\}\{\\sum\_\{j\\in\\mathcal\{I\}\_\{t\}\}\\exp\(S\_\{tj\}\)\},\\quad\\sum\_\{s\\in\\mathcal\{I\}\_\{t\}\}P\_\{ts\}=1\.When a query tokenqtq\_\{t\}has low semantic affinity for all available keys in the preceding context, the softmax normalization still forces100%100\\%of the probability mass to be distributed among the active set\. To avoid corrupting the residual stream with random context combinations during these “no\-op” steps, standard Transformers learn to project initial sequence tokens \(t∈\[0,3\]t\\in\[0,3\], which are causally visible to all subsequent tokens\) into a dedicated subspace with large positive key bias and near\-zero value impact\. As shown in[5\(a\)](https://arxiv.org/html/2609.20888#S5.F5.sf1)\(Section[5\.6](https://arxiv.org/html/2609.20888#S5.SS6)\), these*attention sinks*\([Xiao et al\., 2024](https://arxiv.org/html/2609.20888#bib.bib13)\)absorb over50%50\\%of total attention mass in standard dense models as sequence length increases\. Because standard models depend on token00as their sole probability sink, post\-hoc eviction methods \(e\.g\., StreamingLLM,H2O\\text\{H\}\_\{2\}\\text\{O\}\) suffer catastrophic perplexity degradation if initial anchor tokens are evicted, requiring explicit heuristic pinning of the first44tokens\.
Under ETA’s multiplicative gating during training \(S~ts=Sts⋅σ\(β\(Sts−τt\)\)\\tilde\{S\}\_\{ts\}=S\_\{ts\}\\cdot\\sigma\(\\beta\(S\_\{ts\}\-\\tau\_\{t\}\)\)\), sub\-threshold logits are contracted toward00rather than−∞\-\\infty\. Sinceexp\(0\)=1\\exp\(0\)=1, the training\-time softmax partition functionZtZ\_\{t\}decomposes into:
Zt=∑s∈ℐtexp\(S~ts\)\+∑s∉ℐtexp\(0\)=∑s∈ℐtexp\(S~ts\)\+\(t−\|ℐt\|\)\.Z\_\{t\}=\\sum\_\{s\\in\\mathcal\{I\}\_\{t\}\}\\exp\(\\tilde\{S\}\_\{ts\}\)\+\\sum\_\{s\\notin\\mathcal\{I\}\_\{t\}\}\\exp\(0\)=\\sum\_\{s\\in\\mathcal\{I\}\_\{t\}\}\\exp\(\\tilde\{S\}\_\{ts\}\)\+\(t\-\|\\mathcal\{I\}\_\{t\}\|\)\.The suppressed tail of size\(t−\|ℐt\|\)\(t\-\|\\mathcal\{I\}\_\{t\}\|\)acts as a natural, distributed probability reservoir with total weight\(t−\|ℐt\|\)⋅1\(t\-\|\\mathcal\{I\}\_\{t\}\|\)\\cdot 1\. Whenever a queryqtq\_\{t\}lacks strong semantic matches in the context, raisingτt\\tau\_\{t\}contracts all logits toward zero, causing the uniform background floor to absorb nearly all softmax mass equally across thetthistorical positions \(P~ts≈1/t\\tilde\{P\}\_\{ts\}\\approx 1/t\)\. Because this uniform background floor provides a built\-in “no\-op” reservoir throughout training, gradient descent experiences zero pressure to create localized sink projections on initial tokens\. Consequently, as demonstrated in[5\(a\)](https://arxiv.org/html/2609.20888#S5.F5.sf1),localized attention sinks disappear under ETA: average probability mass on tokenst∈\[0,3\]t\\in\[0,3\]drops from\>50%\>50\\%in dense attention to<2%<2\\%across all sequence lengths, eliminating the need for heuristic sink\-token pinning during block\-sparse inference\.
#### Autonomous Layer Specialization Across Depth\.
Examining the22×3222\\times 32layer\-head density profile in[5\(b\)](https://arxiv.org/html/2609.20888#S5.F5.sf2)\(Section[5\.6](https://arxiv.org/html/2609.20888#S5.SS6)\) reveals that ETA autonomously organizes its attention budget into three distinct functional stages without layer\-specific hyperparameter tuning:
1. 1\.Broad Surface Aggregation \(Layer 0\):The initial transformer layer retains≈96%\\approx 96\\%active token density across heads, functioning as a dense\-like feature extractor that mixes local and global surface tokens before higher\-level representations are formed\.
2. 2\.Aggressive Mid\-Network Compression \(Layers 3–14\):Intermediate layers compress context aggressively, reaching a global minimum at Layer 7 where mean active density drops below8%8\\%\. In these layers, heads specialize into targeted retrieval and syntactic routing heads that attend exclusively to high\-affinity semantic spans\.
3. 3\.Deep Predictive Synthesis \(Layers 15–21\):Deeper layers progressively restore attention density \(recovering to35%–48%35\\%\\text\{\-\-\}48\\%\) to aggregate distributed representations across the context window before final next\-token prediction\.
## Appendix INSA vs ETA: Experimental Details
Both models were pretrained from scratch on the FineWeb 10BT corpus \(5 parquet shards\) on a single NVIDIA H100 SXM 80GB GPU\. Training was executed for exactly 10,000 gradient steps with sequence lengthL=1024L=1024, batch sizeB=4B=4per device with 4 gradient accumulation steps \(effective global batch size=16=16, representing163\.8M163\.8\\text\{M\}tokens total\)\. Optimization was governed by AdamW \(β1=0\.9\\beta\_\{1\}=0\.9,β2=0\.95\\beta\_\{2\}=0\.95,ϵ=10−8\\epsilon=10^\{\-8\}, weight decay0\.10\.1\) with a cosine learning rate decay schedule \(peaklr=3×10−4\\text\{lr\}=3\\times 10^\{\-4\}, 500 warmup steps\)\. ETA incorporated a sparsity regularization penalty \(λ=0\.05\\lambda=0\.05\), while NSA trained purely with standard cross\-entropy\.
#### Hyperparameter Control\.
To isolate the fundamental efficiency and quality characteristics of the attention mechanisms, both models were trained with identical 126M\-parameter LLaMA\-style transformer backbones: 12 hidden layers, model hidden dimensiondmodel=768d\_\{\\text\{model\}\}=768, intermediate SwiGLU dimensiondffn=2048d\_\{\\text\{ffn\}\}=2048, 12 query heads \(HQ=12H\_\{Q\}=12\), 4 key/value heads \(HKV=4H\_\{KV\}=4, GQA ratio=3=3\), head dimensiondk=64d\_\{k\}=64, RMSNorm \(ϵ=10−6\\epsilon=10^\{\-6\}\), and a vocabulary size of 32,768 tokens\. Both models share identical Rotary Position Embedding \(RoPE\) parameters: base frequencyθ=500,000\.0\\theta=500,000\.0and LLaMA\-3 wavelength\-dependent frequency scaling \(factor=8\.0\\text\{factor\}=8\.0,high\_freq\_factor=4\.0\\text\{high\\\_freq\\\_factor\}=4\.0,low\_freq\_factor=1\.0\\text\{low\\\_freq\\\_factor\}=1\.0, andoriginal\_max\_positions=8192\\text\{original\\\_max\\\_positions\}=8192\)\.
Table 10:Backbone Architectural Hyperparameters\.All backbone dimensions and positional encodings are identical between the two models\. ETA adds12×\(768×12\+12\)=0\.1112\\times\(768\\times 12\+12\)=0\.11M threshold\-predictor parameters on top, under0\.1%0\.1\\%of the total\.
### I\.1Training Convergence and Wall\-Clock Dynamics
We first compare the training dynamics between the two models\. As shown in Figure[8](https://arxiv.org/html/2609.20888#A9.F8), ETA exhibits faster and more effective optimization than NSA across all 10,000 steps\. ETA reaches a final step loss of4\.370, whereas NSA stabilizes at4\.508\. Total training wall\-clock time was 4,796s for ETA versus 5,310s for NSA\.
000\.10\.10\.20\.20\.30\.30\.40\.40\.50\.50\.60\.60\.70\.70\.80\.80\.90\.911⋅104\\cdot 10^\{4\}5566Training StepsPretraining LossNSA 126M \(Final: 4\.508\)ETA 126M \(Final: 4\.370\)Figure 8:Pretraining Loss Convergence\.ETA demonstrates consistently steeper loss convergence throughout pretraining, finishingΔLoss=−0\.138\\Delta\\text\{Loss\}=\-0\.138below NSA\.
### I\.2Autoregressive Downstream Perplexity
We evaluated both models in an identical autoregressive split\-mode protocol at context lengthL=2048L=2048\(2×2\\timespretraining sequence length\): 1% context prefill and 99% autoregressive decoding with KV caching\. Evaluations were conducted across three benchmark corpora: FineWeb, C4, and the entire test partition of Wikitext\-v2\. For ETA, the probabilistic threshold index operated witha=0\.4a=0\.4andz=2\.0z=2\.0\.
Table 11:Perplexity \(PPL\) and Sparsity Comparison\.126126M models, evaluated under 1% prompt prefill \+ 99% autoregressive decode \(batch size44,L=2048L=2048\)\.As presented in[Table 11](https://arxiv.org/html/2609.20888#A9.T11), ETA outperforms NSA in downstream perplexity on FineWeb \(99\.8099\.80vs\.103\.55103\.55\) and WikiText\-2 \(158\.64158\.64vs\.161\.65161\.65\) while maintaining≈53%\\approx 53\\%sparsity during autoregressive generation, and matches NSA on C4 \(100\.73100\.73vs\.100\.18100\.18\)\. Across an identical 126M parameter backbone and training budget, ETA’s single unified thresholding mechanism learns more efficiently than NSA’s tri\-branch architecture without requiring multi\-scale heuristic branches\.
### I\.3Autoregressive Decoding Latency and Throughput
We benchmark autoregressive decoding latency and generation throughput across batch sizesB∈\{16,32\}B\\in\\\{16,32\\\}and sequence lengths up toL=32,768L=32\{,\}768\(32K\) under a 10% prefill / 90% decode partition\. As reported in[Table 12](https://arxiv.org/html/2609.20888#A9.T12), ETA significantly lowers per\-step decode latency across every measured configuration\. AtB=32,L=8KB=32,L=8\\text\{K\}, ETA reduces step latency from69\.0769\.07ms to25\.3525\.35ms \(2\.72×2\.72\\timesspeedup\), increasing generation throughput from463463to1,2621\{,\}262tok/s\. At long sequence lengths \(L=32KL=32\\text\{K\}\), ETA achieves a1\.63×1\.63\\timesspeedup atB=16B=16\(37\.3637\.36ms vs\.60\.9360\.93ms\)\. ETA’s fused single\-pass decode kernel eliminates the multi\-kernel launch overhead inherent to tri\-branch architectures, demonstrating practical systems\-level gains for long\-context generation\.
Table 12:Decoding Efficiency & Throughput Sweep\.Evaluated under 10% prompt prefill \+ 90% autoregressive decode across sequence lengths up to 32,768 tokens\.
## Appendix JBlock Size Mechanics, Index Screening, and Granularity Analysis
This appendix provides extended empirical evaluations of block granularity, GQA union memory transfers, and the dual screening index, supplementing[Subsection 5\.3](https://arxiv.org/html/2609.20888#S5.SS3)\. Together, these experiments isolate four distinct mechanisms governing hardware\-aligned block\-sparse decoding\.
### J\.1Isolating Block Over\-Inclusion from Exact Token Selection
Block\-sparse decoding groups contiguous keys into memory tiles of sizebb, co\-admitting sub\-threshold neighbor tokens whenever a block contains at least one salient key\. While our parallel trajectory analysis \([Subsection G\.2](https://arxiv.org/html/2609.20888#A7.SS2);[Figure 7](https://arxiv.org/html/2609.20888#A7.F7)\) establishes that hardening continuous soft training gates into discrete selection masks preserves residual representations \(0\.99590\.9959logit cosine similarity,0\.06310\.0631nats KL\),[Table 13](https://arxiv.org/html/2609.20888#A10.T13)isolates the specific impact of block coarseness by comparing block\-sparse hard selection \(b=4b=4\) against exact token\-level hard selection \(b=1b=1\) under identical checkpoints and thresholds\.
Table 13:Isolating the cost of block granularity\.Evaluated under identical checkpoints, thresholds, data, and protocols \(L=2048,a=0\.4L=2048,a=0\.4\)\.On the 1\.45B model, exact token\-level hard selection \(b=1b=1\) alters perplexity by merely0\.240\.24points on FineWeb \(18\.2318\.23vs\.17\.9917\.99\) and0\.190\.19points on C4 \(18\.1618\.16vs\.17\.9717\.97\) while operating at roughly half the head density \(18\.6%18\.6\\%vs\.37\.8%37\.8\\%\)\. This confirms that co\-admitting sub\-threshold neighbor tokens inside GPU blocks does not distort model predictions—a direct consequence of ETA’s uniform background floor—and that the higher density observed under block execution is not required for model quality, but rather an intentional systems trade\-off to enable coalesced HBM block transfers\.
### J\.2GQA Union Loading Across Heads and Groups
In Grouped\-Query Attention \(GQA\), each key\-value head is shared by a group𝒢g\\mathcal\{G\}\_\{g\}ofG=HQ/HKVG=H\_\{Q\}/H\_\{KV\}query heads\. Because each query headq∈𝒢gq\\in\\mathcal\{G\}\_\{g\}computes an independent thresholdτt,q\\tau\_\{t,q\}and selects an active block subset𝒮q⊆\{1,…,Nblocks\}\\mathcal\{S\}\_\{q\}\\subseteq\\\{1,\\dots,N\_\{\\text\{blocks\}\}\\\}, physical GPU hardware must transfer thegroup unionof blocks from HBM into SRAM:
𝒰g=⋃q∈𝒢g𝒮q\.\\mathcal\{U\}\_\{g\}=\\bigcup\_\{q\\in\\mathcal\{G\}\_\{g\}\}\\mathcal\{S\}\_\{q\}\.\(16\)While per\-head compute density \(DheadD\_\{\\text\{head\}\}\) governs Tensor Core FLOPs, the group union density \(DunionD\_\{\\text\{union\}\}\) governs HBM memory traffic and dominates decoding latency\. If query heads within a group selected uncorrelated, disjoint blocks, the union would expand additively up tomin\(1,G⋅Dhead\)\\min\(1,G\\cdot D\_\{\\text\{head\}\}\), erasing memory bandwidth savings\.
To measure this empirically, we tracked head\-level active masks𝒮q\\mathcal\{S\}\_\{q\}and group\-level union masks𝒰g\\mathcal\{U\}\_\{g\}across all 12 layers on C4 during full autoregressive decoding on the 126M model \(HQ=12,HKV=4,G=3H\_\{Q\}=12,H\_\{KV\}=4,G=3\)\.
Group 0Group 1Group 2Group 3Mean0020204040606036363232333335\.335\.334\.134\.154\.854\.847\.247\.249\.749\.751\.451\.450\.850\.8Active Block Density \(%\)Head Compute Density \(DheadD\_\{\\text\{head\}\}, FLOPs\)Actual GQA Union Density \(DunionD\_\{\\text\{union\}\}, HBM I/O\)Figure 9:GQA Union Loading vs\. Compute Sparsity across KV Groups\.Head compute density vs\. physical group union density across all four KV groups on C4 decoding\.As shown in[Figure 9](https://arxiv.org/html/2609.20888#A10.F9), the empirical group union expands by only1\.49×\\mathbf\{1\.49\\times\}\(50\.8%50\.8\\%union vs\.34\.1%34\.1\\%head density\), preserving a49\.23%\\mathbf\{49\.23\\%\}physical memory I/O reduction\. Query heads sharing a KV head naturally attend to overlapping semantic anchors and entity spans, preventing additive union blowup\.
### J\.3Screening Index Precision and Per\-Head Selectivity
The dual index of[Equation 5](https://arxiv.org/html/2609.20888#S4.E5)acts as an𝒪\(1\)\\mathcal\{O\}\(1\)probabilistic\-geometric filter\. To evaluate its retrieval accuracy at the individual head level,[Table 14](https://arxiv.org/html/2609.20888#A10.T14)tracks block\-level accept decisions against exact per\-token attention scores across2020batches of FineWeb on the 1\.45B model under fixed screening parameters \(z=2\.0,a=0\.4z=2\.0,a=0\.4\)\.
Table 14:The screening index as a retrieval system at fixedz=2\.0z=2\.0\.1\.451\.45B, FineWeb,L=2048L=2048,a=0\.4a=0\.4\. Rates are measured against true per\-token scores at the kernel’s effective threshold across all \(layer, head, block\) cells of2020batches\. Missed mass represents the fraction of softmax mass in rejected blocks\.Across all block sizes, the index maintains high token recall \(95\.3%–98\.3%95\.3\\%\\text\{\-\-\}98\.3\\%\)\. When evaluated at fixedzz, finer blocks \(b=4b=4\) provide tighter spatial selectivity and higher token recall, achieving lower perplexity\.
### J\.4The Granularity Trade\-Off: Per\-Head Selectivity vs\. Matched HBM Union Bandwidth
A critical systems insight arises when comparing block sizes at a fixedphysical HBM union transfer budget\(DunionD\_\{\\text\{union\}\}\) rather than fixed per\-head parameters\. While smaller blocks \(b=4b=4\) are superior at a fixed*per\-head*token budget \([Table 14](https://arxiv.org/html/2609.20888#A10.T14)\), physical hardware latency is governed byDunionD\_\{\\text\{union\}\}—the total volume of KV blocks moved across the HBM bus\.
In[Table 2](https://arxiv.org/html/2609.20888#S5.T2)\([Subsection 5\.3](https://arxiv.org/html/2609.20888#S5.SS3)\), we sweepb∈\{4,8,16,32,64\}b\\in\\\{4,8,16,32,64\\\}on C4 \(126M ETA model\) and tune the screening parameterzzso that every block size transfers an identical HBM union volume ofDunion≈51%D\_\{\\text\{union\}\}\\approx 51\\%\. When physical HBM transfer is held constant at≈51%\{\\approx\}51\\%, increasing block size fromb=4b=4tob=64b=64*improves*perplexity by8\.88\.8points \(93\.4893\.48vs\.102\.32102\.32\)\. The mechanism is explained directly by theHead densitycolumn in[Table 2](https://arxiv.org/html/2609.20888#S5.T2):
- •Atb=4b=4, small blocks suffer from higher inter\-head GQA divergence: different query heads in the same group select distinct 4\-token blocks, resulting in a union expansion ratio ofDunion/Dhead=51\.57%/34\.77%=1\.48×D\_\{\\text\{union\}\}/D\_\{\\text\{head\}\}=51\.57\\%/34\.77\\%=\\mathbf\{1\.48\\times\}\. Thus, at a51\.6%51\.6\\%HBM transfer budget, each individual query head only gets to attend to34\.77%34\.77\\%of the sequence\.
- •Atb=64b=64, coarser blocks naturally coalesce nearby token selections from different query heads sharing a KV head into the same 64\-token memory tile, compressing the union expansion ratio toDunion/Dhead=51\.94%/44\.26%=1\.17×D\_\{\\text\{union\}\}/D\_\{\\text\{head\}\}=51\.94\\%/44\.26\\%=\\mathbf\{1\.17\\times\}\. Consequently, for the*exact same51\.9%51\.9\\%physical HBM memory transfer*, each query head gets to attend to44\.26%44\.26\\%of the sequence—an extra\+9\.5%\+9\.5\\%of attended context per headat zero additional memory I/O cost\.
This\+9\.5%\+9\.5\\%increase in per\-head attended context far outweighs the slight reduction in spatial boundary precision, explaining why hardware\-aligned blocks \(b=64b=64\) simultaneously maximize Tensor Core throughput and achieve superior language modeling quality per byte transferred from HBM\.
## Appendix KDual Probabilistic\-Geometric Screening Index: Mathematical Analysis
This section details the theoretical properties and bounds governing the Dual Screening Index introduced in[Section 4](https://arxiv.org/html/2609.20888#S4)\.
### K\.1Cantelli Bound and Finite\-Population Maximums
For key blockB=\{k1,…,kb\}B=\\\{k\_\{1\},\\dots,k\_\{b\}\\\}with centroid𝝁B\\boldsymbol\{\\mu\}\_\{B\}and empirical covarianceΣB\\Sigma\_\{B\}, treatingk∼Unif\(B\)k\\sim\\text\{Unif\}\(B\)yields empirical mean⟨q,𝝁B⟩\\langle q,\\boldsymbol\{\\mu\}\_\{B\}\\rangleand empirical varianceq⊤ΣBqq^\{\\top\}\\Sigma\_\{B\}q\. Cantelli’s one\-sided inequality establishes:
Prk∼Unif\(B\)\[⟨q,k⟩≥⟨q,𝝁B⟩\+zq⊤ΣBq\]≤11\+z2\.\\Pr\_\{k\\sim\\text\{Unif\}\(B\)\}\\Big\[\\langle q,k\\rangle\\geq\\langle q,\\boldsymbol\{\\mu\}\_\{B\}\\rangle\+z\\sqrt\{q^\{\\top\}\\Sigma\_\{B\}\\,q\}\\Big\]\\leq\\frac\{1\}\{1\+z^\{2\}\}\.\(17\)Because the population is finite with cardinalitybb, the number of keys exceeding this threshold is at most⌊b/\(1\+z2\)⌋\\lfloor b/\(1\+z^\{2\}\)\\rfloor\. Wheneverz\>b−1z\>\\sqrt\{b\-1\}, this integer bound is identically zero\. Thus, for small blocks \(b=4,z≥2b=4,z\\geq 2\), Cantelli’s bound provides a certified upper bound on the maximum score in the block\.
### K\.2Diagonal Variance Surrogate and Per\-Head Pareto Frontier
To avoid materializingd×dd\\times dcovariance matricesΣB\\Sigma\_\{B\}, our kernel caches only the diagonal variance𝝈B2∈ℝd\\boldsymbol\{\\sigma\}\_\{B\}^\{2\}\\in\\mathbb\{R\}^\{d\}and evaluates:
σS\(q,B\)2=∑i=1dqi2𝝈B,i2\.\\sigma\_\{S\}\(q,B\)^\{2\}=\\sum\_\{i=1\}^\{d\}q\_\{i\}^\{2\}\\boldsymbol\{\\sigma\}\_\{B,i\}^\{2\}\.\(18\)This surrogate serves as an efficient quantile estimator\. By Cauchy\-Schwarz, an exact bound could be restored via∑i\|qi\|𝝈B,i\\sum\_\{i\}\|q\_\{i\}\|\\boldsymbol\{\\sigma\}\_\{B,i\}, but the diagonal surrogate is substantially tighter in practice and achieves empirical false\-negative rates under3\.4%3\.4\\%atb=4b=4\([Table 14](https://arxiv.org/html/2609.20888#A10.T14)\)\.相似文章
面向超长上下文的新型稀疏注意力方法
团队发布了 Latent Sparse Attention(LSA,潜在稀疏注意力)这一开放研究成果,实现了亚二次复杂度的注意力机制,在超长上下文中达到与全注意力相当的准确率,使稀疏注意力最高提速 22.7 倍,全注意力最高提速 72.4 倍。
EntmaxKV:面向Entmax注意力机制的支持感知解码
EntmaxKV提出了一种面向entmax注意力的支持感知稀疏解码框架,通过利用加载页面之前的稀疏性来减少KV缓存内存流量,在长上下文基准测试中实现了显著的加速,同时保持输出质量。
用于高效长上下文解码的联合子空间稀疏注意力
论文提出联合子空间稀疏注意力(JSSA),通过学习共享低维查询-键子空间并设计免gather的索引注意力核,在128K上下文下实现最高6.43倍解码吞吐提升,同时保持接近全KV的精度。
学习如何遗忘:针对长上下文稀疏注意力的微调
本文提出了一种新方法,用于对具有稀疏注意力的transformer语言模型进行微调,以实现高效的长上下文推理,通常优于使用精确注意力训练的模型,并介绍了高效的实现和一个新的开源库。
分层稀疏注意力机制的正确实现:迈向无限上下文建模
提出HiLS注意力机制,一种基于块的稀疏注意力方法,通过语言模型损失端到端学习块选择,性能可与全注意力媲美,同时支持超长上下文外推和更快的推理速度。