Progressive Sparse Attention: Algorithm and System Co-design for Efficient Attention in LLM Serving

Qihui Zhou, Peiqi Yin, Pengfei Zuo, James ChengarXiv 2025 · OpenReview

Abstract

Processing long contexts has become a critical capability for modern large language models (LLMs). However, serving long-context LLMs comes with significant inference costs due to the high memory overhead of the key-value (KV) cache. Existing work leverages dynamic sparse attention algorithms (DSAes) to mitigate the KV cache overhead, but these algorithms rely on top-$k$ KV cache selection, which results in a trade-off between accuracy and efficiency. To overcome this trade-off, this paper presents PSA, a Progressive Sparse Attention mechanism that integrates algorithmic innovations with system co-design to achieve both high inference accuracy and improved efficiency in LLM serving. The PSA algorithm adaptively adjusts the KV cache budget of different tokens and layers according to their real attention weight distributions, rather than relying on a fixed budget $k$. Extensive experimental results demonstrate that PSA reduces KV cache usage for attention computation by up to 2.4$\times$ and 8.8$\times$, and increases end-to-end serving throughput by up to 1.4$\times$ and 2.0$\times$, compared to state-of-the-art DSAes and systems without sparse attention, respectively.

Introduction

As LLMs move toward "infinite" context windows (e.g., 128K to 1M tokens), the KV cache—which stores previous token representations to avoid recomputation—becomes a massive bottleneck. For instance, a Llama-3.1 8B model with a 128K context can require a 62 GB KV cache, significantly exceeding the 16 GB required for model weights. Existing Dynamic Sparse Attention (DSA) algorithms attempt to mitigate this by loading only the most "important" KV blocks via top-$k$ selection. However, these methods suffer from a "one-size-fits-all" dilemma: different tokens and layers exhibit varying levels of attention skewness, making a fixed $k$ either inefficient or inaccurate.

The PSA Algorithm: Threshold-based Progressive Selection

PSA replaces rigid top-$k$ selection with an adaptive, threshold-based approach. Instead of picking a fixed number of blocks, PSA uses a cumulative weight threshold (e.g., 95%) to ensure each token uses exactly the amount of KV cache it needs.

The algorithm operates through Progressive Computation: it ranks KV blocks by estimated importance and computes attention in "micro-batches." After each micro-batch, it estimates the total accumulated attention weight. If this weight exceeds the target threshold, the process stops immediately (Early Exit). This ensures that tokens with concentrated attention distributions exit early, saving compute and memory bandwidth.

Figure 6: The PSA algorithm progressively computes attention in iterations, checking against a confidence threshold for early exit.

System Co-design and Optimizations

To translate algorithmic flexibility into hardware efficiency, PSA introduces several system-level optimizations that address the overheads of dynamic computation:

  1. Pipelined Iteration: PSA overlaps the loading of KV blocks from CPU host memory to GPU with the actual attention computation on the GPU using separate CUDA streams. This hides the latency of moving data from host RAM to the GPU.
  2. Unified GPU Memory Management: Traditional systems allocate equal KV cache space to every layer. PSA merges these into a single pool, allowing layers with "diffuse" attention to borrow space from layers with "concentrated" attention, optimizing overall memory utilization and cache hit ratios.
  3. Verifying GPU Kernel: A specialized kernel monitors accumulated weights directly on the GPU, notifying the CPU asynchronously to stop the process, which minimizes synchronization overhead.
Figure 5: The PSA system architecture showing the interaction between the LLM Model Executor and the KV Cache Manager.

Experimental Evaluation

The researchers evaluated PSA using the LongBench benchmark across tasks like single-doc QA and summarization, using models such as LWM-Text-7B and Llama-3.1-8B.

  • Memory Efficiency: PSA reduced the KV cache required for attention by 2.1$\times$ to 2.4$\times$ compared to state-of-the-art sparse baselines while maintaining 98% accuracy.
  • Throughput Gains: PSA achieved up to 1.4$\times$ higher throughput than existing sparse systems and up to 2.0$\times$ higher than systems using full attention.
  • SLO Compliance: Under strict latency requirements (Service Level Objectives), PSA sustained significantly higher Queries Per Second (QPS) by fitting larger batches into GPU memory.

Conclusion

PSA demonstrates that a co-design of adaptive algorithms and specialized system support can effectively break the accuracy-efficiency trade-off in long-context LLM serving. By shifting from "quantity" (fixed $k$) to "quality" (threshold-based confidence), PSA achieves significant throughput gains and memory savings. Future work may explore more compressed metadata formats and semantic-aware eviction policies to further enhance performance.

Summary updated

Abstract

Processing long contexts has become a critical capability for modern large language models (LLMs). However, serving long-context LLMs comes with significant inference costs due to the high memory overhead of the key-value (KV) cache. Existing work leverages dynamic sparse attention algorithms (DSAes) to mitigate the KV cache overhead, but these algorithms rely on top-$k$ KV cache selection, which results in a trade-off between accuracy and efficiency. A larger $k$ improves accuracy but decreases efficiency, while a smaller $k$ boosts efficiency but compromises accuracy. To overcome this trade-off, this paper presents PSA, a $\underline{P}$rogressive $\underline{S}$parse $\underline{A}$ttention mechanism that integrates algorithmic innovations with system co-design to achieve both high inference accuracy and improved efficiency in LLM serving. The PSA algorithm adaptively adjusts the KV cache budget of different tokens and layers according to their real attention weight distributions, rather than relying on a fixed budget $k$. This enables high accuracy while minimizing KV cache usage. To further enhance execution efficiency, we introduce a pipelined iteration scheme that reduces CPU-GPU interleaving and synchronization overhead during PSA computation. Additionally, we implement unified GPU memory management that optimizes PSA's memory utilization by accounting for uneven memory requirements across different model layers. Extensive experimental results demonstrate that PSA reduces KV cache usage for attention computation by up to 2.4$\times$ and 8.8$\times$, and increases end-to-end serving throughput by up to 1.4$\times$ and 2.0$\times$, compared to state-of-the-art DSAes and systems without sparse attention, respectively.
BibTeX
@misc{zhou2025progressive,
  author = {Qihui Zhou and Peiqi Yin and Pengfei Zuo and James Cheng},
  title = {{Progressive Sparse Attention: Algorithm and System Co-design for Efficient Attention in LLM Serving}},
  year = {2025},
  eprint = {2503.00392},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2503.00392},
}
Figure