Manuscript Offprint

arXiv:2609.00097

Faster Than Flash: Exploiting Attention Sparsity for Efficient Long-Context Decoding

Zhigeng Liu, Zhiyuan Ning, Ruixiao Li, Xiaoran Liu, Yuerong Song, Min Zhang, Ziwei He, Xipeng Qiu

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

The development of long-context Large Language Models (LLMs) is constrained by the memory bandwidth bottleneck and quadratic complexity of the attention mechanism during decoding. To overcome the inherent trade-offs between the memory overhead of metadata-based metrics and the computational inefficiency of adaptive selection strategies, we present Faster Flash Decoding (FFD), a novel hardware-algorithm co-design framework designed to break the memory wall in long-context decoding. FFD integrates the selector and computer into a fully fused kernel, replacing external metadata indices with content-aware scanning via low-bit quantization. Furthermore, we introduce the top-δ\delta strategy, which dynamically filters blocks to achieve distribution-adaptive sparsity without global synchronization. Offering a training-free and plug-and-play solution, FFD also enables the reuse of scanning results for computation, achieving up to 11.6×11.6\times kernel-level speedup and scaling to 256K context length, with 2.37×2.37\times end-to-end throughput improvement. Empirical validation on RULER and LongBench confirms that FFD maintains model accuracy while delivering high-ratio sparsity, with code available at https://github.com/qluoluo/faster-flash-decoding.

Correspondence: 253108120105@si.edu.cn, zhangmin2021@hit.edu.cn, ziwei.he@si.edu.cn, xpqiu@fudan.edu.cn

1 Introduction

The capability to process long contexts has become a defining characteristic of modern Large Language Models (LLMs) [1–4]. However, long-context capability comes at a prohibitive cost during the decoding phase. As the sequence length grows, the standard attention mechanism exhibits quadratic computational complexity and linear memory growth for Key-Value (KV) caches [5], creating a severe memory wall bottleneck in the decoding stage [6, 7]. Unlike the prefill phase where computation dominates and queries are processed in parallel, the autoregressive decode phase is memory-bandwidth-bound: each token generation requires reloading the entire KV cache from HBM, making IO the primary bottleneck rather than FLOPs. Consequently, sparse attention mechanisms, particularly training-free, plug-and-play approaches, have emerged as a critical research direction to reduce computational overhead without retraining the model [8–12].

Despite the diversity of sparse attention techniques, most approaches adhere to a decoupled Selector-

Figure

Figure 1 Comparison of selection strategies. (a) Top-kk (fixed budget) is fast but fails to adapt to distribution shape. (b) Top-pp offers dynamic cardinality but introduces non-trivial overhead due to global synchronization and sorting, which breaks the streaming pipeline. (c) Top-δ\delta (ours) uses a relative threshold δ\delta from the local max, achieving the adaptivity of top-pp with the hardware efficiency of top-kk.

Computer paradigm. In this standard workflow, the selector first filters indices based on metrics, and the computer subsequently retrieves data for calculation. This separation prevents the Computer from reusing the Selector's intermediate computations, leading to efficiency bottlenecks. Furthermore, the two core components within this paradigm—the importance metric and the selection strategy—face their own dilemmas. On one hand, to determine which tokens to retain, existing methods typically rely on extra metadata, such as partial dimensions, cluster centroids, or geometric bounds [8, 9, 13]. These approaches result in a metric dilemma: they either incur additional memory overhead to store these metadata structures or suffer from information distortion. On the other hand, selecting the optimal subset of tokens remains challenging. As shown in Fig 1, top-kk selection is computationally efficient but fails to adapt to the varying entropy of attention distributions[14, 15]. Comparatively, top-pp selection offers theoretical superiority by adapting to the distribution, but needs a global softmax operation to compute cumulative probabilities, thus limiting its efficiency [10].

In this paper, we propose FFD, Faster Flash Decoding, a novel sparse attention framework that addresses these challenges through a hardware-algorithm co-design. By integrating the selector and computer, FFD enables the computation stage to directly reuse the scanning results from the selection stage. We shift from metadata-based indexing to content-aware scanning. Instead of storing extra metadata, we split the K cache

Figure

Figure 2 Overview of our FFD implementation. Inputs include the 16-bit query as well as the value cache and the key cache split into a 2-bit quantized thumbnail and an 8-bit residual. The attention output is acquired after K quantization, pseudo-max estimation, top-δ\delta selection, as well as filtering based on the top-δ\delta strategy, and fine-grained refinement.

into low-bit quantization and half-precision residual, taking the former as a compressed representation of the KV cache. Then, we introduce a top-δ\delta strategy rooted in numerical precision analysis. Rather than enforcing a fixed budget (kk) or computing global probabilities (pp), top-δ\delta dynamically filters blocks based on their estimated contribution to the attention score sum and can be approximately parallelized thanks to the properties of attention in LLMs [16]. We implement FFD as a fully fused kernel that eliminates reduction bubbles, achieving 11.6×11.6\times kernel-level speedup. Our contributions are summarized as follows:

  • Content-Aware Scanning via Low-Bit Quantization. We resolve the "metric dilemma" by replacing metadata-based indexing with content-aware scanning. By partitioning the K-cache into low-bit quantized representations and 8-bit residuals, we eliminate the memory overhead of extra metadata while maintaining high information fidelity.

  • The Top-δ\delta Selection Strategy. We introduce top-δ\delta, a novel selection mechanism, unlike top-kk (fixed budget) or top-pp (high overhead), top-δ\delta dynamically filters attention blocks based on their contribution to the attention sum, offering distribution-adaptive sparsity with the efficiency of parallel execution.

  • Faster Flash Decoding (FFD). We present FFD, a hardware-algorithm co-design framework tailored for the bandwidth-critical decode phase. We implement a fused selector-computer kernel where the calculation phase reuses the selector's quantized scan, optimizing memory access patterns. Our implementation achieves up to 11.6×11.6\times kernel-level speedup and scales to 256K context, with up to 2.37×2.37\times end-to-end throughput increase while remaining a plug-and-play, training-free solution.

  • Extensive Empirical validation. We demonstrate that FFD maintains the performance of LLMs across various short and long-context benchmarks, including RULER [17] and LongBench [18], proving that high-ratio sparsity can be achieved without retraining or sacrificing accuracy.

Conflict of Interest Disclosure We declare no financial conflicts of interest related to this work.

References (25)