Predict, Reuse, and Repair: Accelerating Dynamic Sparse Attention for Long-Context LLM Decoding
Published 29 Jun 2026 in cs.LG | (2606.30389v1)
Abstract: Dynamic sparse attention (DSA) accelerates long-context LLM decoding by attending to only the top-K KV blocks relevant to each query, but it introduces a serialized selection-to-attention dependency that emerges as a new latency bottleneck. We present PRR, a speculate-reuse-repair runtime that exploits temporal locality in DSA selections to predict likely blocks, speculate the attention over them while selection is in flight, and incrementally repair missed blocks once the true selected set is known. PRR uses a lightweight EMA-based predictor, a profiling-guided speculation budget that keeps speculative work off the critical path, and a FlashAttention-based repair kernel that folds missed blocks into the partial attention state using online-softmax statistics. Across long-context benchmarks and representative DSA methods, PRR reduces per-token decoding latency by up to 40% while preserving downstream task accuracy. Github: https://github.com/Tianyu9748/Incremental_FlashAttention
The paper introduces PRR, a runtime that predicts future top-K blocks with an EMA model, reuses speculative attention, and repairs missed blocks incrementally while preserving bit-exact DSA outputs.
PRR reduces the serialized selection-to-attention bottleneck and delivers average speedups of 1.35× with Quest and 1.47× with InfLLM-v2, reaching 1.64× on LongBench.
The paper shows that incremental repair is essential—naive reuse achieves only 1.01× speedup—while calibrated prediction reaches 97.5–98.9% overlap and raises effective overlap to 98% without accuracy loss.
The selection-to-attention bottleneck in dynamic sparse attention
Dynamic sparse attention (DSA) methods such as Quest and InfLLM-v2 accelerate long-context LLM decoding by selecting, per query, only the top-K KV blocks relevant to that step. The paper identifies a structural cost of this approach: at each transformer layer, block selection (compressed attention over block summaries) must complete before sparse attention can begin, creating a strict serialized dependency on the decoding critical path. Profiling GLM-4-9B with Quest and InfLLM-v2 on H100 GPUs shows this path consuming roughly 60% of per-token latency at 16K context, rising to about 71% at 512K, with selection alone growing from ~4 ms to ~8 ms. The implication is that further arithmetic reduction in attention yields diminishing returns unless the selection-to-attention serialization itself is addressed.
The authors ground their solution in three empirical observations. First, top-K selections exhibit strong temporal locality: across LongBench, InfiniteBench, RULER, AIME, and MATH500, both DSA methods reselect more than 65% of blocks across consecutive decoding steps, averaging about 68%. Second, GPU resources remain substantially underutilized during DSA decoding — even at 512K context, SM, L2-bandwidth, and DRAM-bandwidth utilization all stay below 40%, a trend that persists up to batch size 16 — leaving headroom for speculative work to run concurrently without contending with the critical path. Third, naive reuse of the previous step's selection is insufficient as a predictor, because any missed block currently forces full recomputation.
PRR: speculative attention with incremental repair
PRR (predict, reuse, repair) is a runtime that exploits these observations while preserving exact DSA semantics. Its execution model splits prediction errors into two asymmetric categories: missed blocks (M=A∖P), which lie on the critical path after selection completes, and wasted blocks (P∖A), which consume bandwidth but do not extend latency. The design objective is therefore to minimize ∣M∣ subject to a speculation budget ∣P∣≤δ∣A∣, where δ bounds speculative resource consumption.
Three components realize this objective:
EMA-based predictor: a training-free exponential moving average forecaster maintains a smoothed level ℓit and trend vit per block, extrapolating importance scores via ISit=ℓit−1+γvit−1 before selection runs. Unlike prior-step reuse, it anticipates rather than lags the upcoming top-K0 set.
Online calibration: hyperparameters K1 are tuned per prompt via grid search (80 candidates) over the importance-score trajectory already produced during prefill, requiring no additional model execution. The non-overlapped critical-path cost is only 0.06 ms for 16K prefills, and per-step prediction costs 0.01 ms.
Critical-path-aware budget: an offline profiled lookup table indexed by context length selects the largest K2 whose speculative attention fits within the selection window, ensuring speculation never delays the FFN stage.
The correctness mechanism is the most technically substantive contribution. Existing engines (vLLM, SGLang) and kernels (FlashAttention-2, FlashInfer) provide no interface for incrementally merging blocks into a partially computed attention output, so mispredictions typically force recomputation over the entire selected set. PRR modifies the FlashAttention forward pass to emit the running log-sum-exp statistics (K3, K4) alongside the output — two scalars per head, negligible overhead — and implements a repair kernel that applies the online-softmax recurrence once per missed block, rescaling the accumulator and folding in the missed K5 tiles. Because every block in the true set K6 is ultimately included, the output is bit-exact with standard DSA; no accuracy loss is incurred, and post-selection work scales with K7 rather than K8.
Evaluation results
Across six LLMs (GLM-4-9B-1M, GLM-Z1-9B, DeepSeek-R1-8B, Llama3-8B-1M, Qwen3-14B, Qwen3-32B), two DSA methods, and five benchmarks, PRR achieves average speedups of 1.35× under Quest and 1.47× under InfLLM-v2 relative to serial DSA, peaking at 1.64× (GLM-4 with InfLLM-v2 on LongBench). Downstream task accuracy is preserved exactly, as expected given the repair guarantee.
The ablation isolates the contributions of each component and reveals a sharp contrast between naive and principled speculation:
S1's near-zero gain despite ~68% temporal overlap is a notable negative result: because a single missed block triggers full recomputation, partial overlap provides no benefit without repair capability. This directly motivates the kernel contribution. The customized sparse attention kernel also outperforms FlashInfer's BlockSparseAttention standalone, averaging 2.22× (peak 3.71× at 8K token budget) across block sizes 16–256, with gains growing as token budgets increase and fixed overheads amortize. The faster kernel enlarges the speculation budget headroom, lifting the effective overlap rate from 91% to 98% at no added critical-path cost. The EMA predictor itself achieves 97.5–98.9% overlap with true top-M=A∖P0 sets across all model–benchmark combinations, confirming that prefill-calibrated smoothing generalizes beyond the calibration workload.
Limitations and open questions
The paper concedes several boundaries on its claims. Evaluation covers only training-free DSA mechanisms (Quest, InfLLM-v2); NSA-style natively trainable sparsity is excluded, so applicability to learned gating components remains untested. Kernel optimization targets NVIDIA Hopper under half precision, leaving Blackwell and fp8 unexplored. All reported results use batch size 1; the authors note that coordinating selection and speculation stages across batched requests — where idle-resource headroom may shrink — is left open. Finally, the budget lookup table is profiled at five discrete context lengths with polynomial interpolation for intermediate values, so budget optimality at unprofiled lengths depends on the accuracy of that regression. An additional implicit assumption is that temporal locality of importance scores holds for the workloads studied; adversarial or highly volatile attention patterns could degrade the predictor toward the S1 regime, though the repair path still guarantees correctness in that case.
Conclusion
PRR reframes dynamic sparse attention acceleration around its newly exposed bottleneck — the serialized selection-to-attention dependency — and resolves it through correctness-preserving speculation: an EMA predictor calibrated during prefill, a profiling-guided speculation budget, and an online-softmax repair kernel that bounds post-selection work by the number of mispredicted blocks. The combination yields consistent 1.3–1.6× decoding speedups with zero accuracy degradation across diverse models and long-context benchmarks, and demonstrates that incremental attention repair is the enabling primitive that converts modest temporal locality into substantial end-to-end gains.