SparseServe: Unlocking Parallelism for Dynamic Sparse Attention in Long-Context LLM Serving

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

Abstract

Serving long-context Large Language Models (LLMs) is computationally expensive because attention computation grows linearly with context length. Dynamic sparse attention algorithms (DSAs) mitigate this by attending only to the key-value (KV) cache of critical tokens. However, with DSAs, the main performance bottleneck shifts from HBM bandwidth to HBM capacity: KV caches for unselected tokens must remain in HBM for low-latency decoding, constraining parallel batch size and stalling further throughput gains. Offloading these underutilized KV caches to DRAM could free HBM capacity, allowing larger parallel batch sizes. Yet, achieving such hierarchical HBM-DRAM storage raises new challenges, including fragmented KV cache access, HBM cache contention, and high HBM demands of hybrid batching. This paper proposes SparseServe, an LLM serving system that unlocks the parallel potential of DSAs through efficient hierarchical HBM-DRAM management. SparseServe introduces three key innovations: fragmentation-aware KV cache transfer, working-set-aware batch size control, and layer-segmented prefill. Extensive experimental results demonstrate that SparseServe achieves up to 9.26x lower mean time-to-first-token (TTFT) latency and up to 3.14x higher token generation throughput compared to state-of-the-art LLM serving systems.

Introduction

As LLMs move toward million-token context windows, the memory footprint of the KV cache—storing keys and values for previous tokens—explodes. Traditionally, serving these models is limited by High Bandwidth Memory (HBM) bandwidth. While Dynamic Sparse Attention (DSA) reduces computation by focusing on critical tokens, it introduces a capacity bottleneck. Systems typically keep the entire KV cache in HBM to ensure low-latency decoding, as the set of important tokens is dynamic. This prevents effective batching, as HBM fills rapidly. SparseServe addresses this by offloading underutilized KV caches to system DRAM, overcoming the challenges of fragmented data access and PCIe bandwidth limitations.

System Design and Innovations

SparseServe introduces three core innovations to make hierarchical HBM-DRAM memory management viable for sparse attention serving.

The SparseServe system architecture, featuring a Request Scheduler with batch size control, a Model Executor for layer-segmented prefill, and a KV Cache Manager for hierarchical storage.

Fragmentation-Aware KV Cache Transfer

To handle the overhead of moving fragmented 32-token blocks between DRAM and HBM, SparseServe implements two specialized mechanisms:

  • FlashH2D (Host-to-Device): Instead of thousands of small memory calls, SparseServe launches a single GPU kernel to pull all required blocks in parallel, effectively saturating the PCIe bus.
  • FlashD2H (Device-to-Host): To prevent GPU stalls, the system writes contiguous blocks to a DRAM buffer. CPU threads then asynchronously handle the "scattering" of this data into fragmented blocks in DRAM.
Bandwidth comparison showing that FlashH2D and FlashD2H significantly outperform standard memcpy across various block sizes, enabling efficient hierarchical memory management.

Working-Set-Aware Batch Size Control

Attention sparsity in LLMs is not random; consecutive query tokens often attend to overlapping sets of KV blocks (often >95%). SparseServe exploits this temporal locality by tracking a "working set" of recently used blocks. This allows the scheduler to accurately estimate real-time HBM requirements, enabling larger batch sizes without causing HBM cache thrashing.

Layer-Segmented Prefill

Standard chunked prefill requires keeping the KV cache of all previous chunks in HBM. SparseServe processes the initial prompt layer-by-layer, evicting each layer's cache to DRAM immediately after processing. This bounds the memory footprint of massive prompts to just a single layer's worth of HBM.

Experimental Evaluation

SparseServe was evaluated using the LongBench benchmark on LWM-7B (1M context) and Llama3-8B (262K context) models. The evaluation covered tasks including question answering, summarization, and code generation.

Key Results

  • Latency Reduction: SparseServe reduced the Mean Time-To-First-Token (TTFT) by up to 9.26× compared to vLLM.
  • Throughput Gains: The system achieved up to 3.14× higher token generation throughput by enabling significantly larger batch sizes.
  • Efficiency: SparseServe outperformed naive offloading baselines (e.g., vLLM-SO), proving the necessity of its fragmentation-aware transfer methods.
  • Model Accuracy: Despite the use of dynamic sparsity, the system maintained 99% of the accuracy of full-attention models across all tested tasks.

Conclusion and Future Work

SparseServe demonstrates that for long-context LLM serving, the primary constraint has shifted from computation to HBM capacity. By leveraging CPU-GPU synergy and intelligent scheduling, SparseServe unlocks the throughput potential of dynamic sparse attention. Future research directions include optimizing metadata management for multi-million token contexts and integrating model parameter offloading to support even larger models on single-GPU setups.

Summary updated

BibTeX
@misc{zhou2025sparseserve,
  author = {Qihui Zhou and Peiqi Yin and Pengfei Zuo and James Cheng},
  title = {{SparseServe: Unlocking Parallelism for Dynamic Sparse Attention in Long-Context LLM Serving}},
  year = {2025},
  eprint = {2509.24626},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.24626},
}
Figure