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

TL;DR

This paper introduces Faster Flash Decoding (FFD), a novel approach that significantly speeds up long-context LLM decoding by cleverly combining hardware and algorithms. FFD uses low-bit quantization for efficient "content-aware scanning" and a new "top-δ" selection strategy to dynamically prune attention blocks, achieving substantial speedups without sacrificing accuracy.

What Problem Does This Paper Address?

Modern Large Language Models (LLMs) are increasingly capable of processing long contexts, but this comes at a steep price during the decoding phase. The standard attention mechanism's quadratic complexity and the linear growth of Key-Value (KV) caches create a severe memory bandwidth bottleneck. Existing methods to mitigate this, like metadata-based metrics or adaptive selection strategies, often introduce either significant memory overhead or computational inefficiencies. This paper aims to break through this "memory wall" by developing a more efficient and hardware-aware sparse attention mechanism for decoding.

Methods

FFD is a hardware-algorithm co-design that tackles the problem through two main innovations:

  • Content-Aware Scanning via Low-Bit Quantization: Instead of relying on external metadata, FFD uses a compressed representation of the KV cache. The key cache is split into 2-bit quantized thumbnails (for fast scanning) and 8-bit residuals. This allows for high-fidelity importance estimation without the memory overhead of traditional metadata.
  • Top-δ Selection Strategy: This novel strategy dynamically filters attention blocks based on their estimated contribution to the attention score sum. Unlike fixed "top-k" or computationally expensive "top-p" methods, top-δ adapts to the distribution of attention scores. It uses a relative threshold based on the local maximum attention score, enabling efficient, parallelizable execution.

FFD also integrates the "selector" and "computer" into a fully fused kernel, allowing the computation stage to directly reuse the scanning results from the selection stage, eliminating redundant operations.

Datasets

The paper evaluates FFD on the following benchmarks:

  • RULER: A benchmark for long-context understanding with 21 datasets across 6 categories.
  • LongBench: Another comprehensive benchmark for long-context understanding.

The authors also mention using "real text from the LongBench dataset" for specific experiments.

Key Insights and Ideas

  • "Compute-for-IO" Trade-off: The paper strongly advocates for spending cheap computational resources (FLOPs) on low-bit scanning to save expensive High-Bandwidth Memory (HBM) bandwidth, a crucial insight for efficient long-context inference.
  • Dynamic Sparsity is Key: The top-δ strategy's ability to adapt sparsity based on attention distribution is shown to be superior to fixed budget methods like top-k, especially for tasks requiring nuanced understanding of word frequencies or multi-peak attention patterns.
  • Hardware-Algorithm Co-design Pays Off: The fused kernel and CUDA graph optimizations, combined with the algorithmic improvements, create a synergistic effect that significantly boosts performance beyond what either could achieve alone.
  • 2-bit Quantization for Scanning is Sufficient: The study demonstrates that 2-bit quantization for the scanning phase, when paired with top-δ, preserves semantic fidelity and accuracy, making it a viable and efficient alternative to higher precision methods.

Key Results

  • Kernel-Level Speedup: FFD achieves up to 11.6x kernel-level speedup.
  • End-to-End Throughput Improvement: FFD provides up to 2.37x end-to-end throughput improvement on consumer GPUs (RTX 4090) and up to 1.96x speedup on datacenter GPUs (H100) at 16K context length.
  • Scalability: FFD scales to 256K context length.
  • Accuracy Preservation: FFD maintains model accuracy on RULER and LongBench benchmarks, even with high-ratio sparsity. For example, on RULER, FFD (δ=7) achieves an average score of 85.9 on Qwen2.5, outperforming other sparse methods.
  • Efficiency Comparison: FFD consistently outperforms baselines like FlashAttention-2 and Quest in terms of throughput.
  • Sparsity Analysis: FFD achieves average sparsity levels of 82% and 73% with δ=5 and δ=7 respectively, demonstrating significant computational savings.

Limitations and Future Work

  • Proxy Metrics for Failure Cases: The analysis of failure-prone conditions relies on proxy metrics (attention-level statistics) rather than direct end-to-end task failure attribution. Causal attribution remains an open area.
  • Architecture Specificity: FFD has been validated on Llama and Qwen architectures using Grouped-Query Attention (GQA). Its applicability to fundamentally different architectures (e.g., MLA-style) with different key/value factorization is not yet assessed.
  • Fine-grained Latency Breakdown: While the paper demonstrates overall speedups, a detailed fine-grained latency breakdown within the fused execution path is deferred to future work.
  • Further Validation: The characterization of per-head sparsity is based on controlled experiments and needs systematic validation across diverse task distributions.

Summary updated

BibTeX
@inproceedings{liu2026faster,
  author = {Zhigeng Liu and Zhiyuan Ning and Ruixiao Li and Xiaoran Liu and Yuerong Song and Min Zhang and Ziwei He and Xipeng Qiu},
  title = {{Faster Than Flash: Exploiting Attention Sparsity for Efficient Long-Context Decoding}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=r8YhlMRUR2},
}
Figure