TL;DR
HiSparse is an exact, indexer-agnostic hierarchical KV cache management system that breaks the GPU memory capacity wall in long-context LLM serving. By keeping the full KV history in host memory (CPU RAM) and maintaining a small, fixed-size cache in GPU memory, HiSparse boosts peak decoding throughput by up to 4.7× without altering model outputs.
What Problem Does This Paper Address?
While long-context LLMs (handling tens of thousands to millions of tokens) are becoming standard, serving them is incredibly expensive. Top-$k$ sparse attention mechanisms—like those in DeepSeek-V3.2 or Quest—make decoding computationally cheap because each step only attends to a few thousand selected tokens rather than the entire history.
However, existing serving systems still suffer from a capacity wall. To keep every token position selectable by the model's sparse indexer, systems keep the entire KV cache resident in expensive GPU High Bandwidth Memory (HBM). As a result, a single 1M-token request can demand over 100 GB of HBM, exhausting memory and capping throughput long before the GPU runs out of compute power.
Methods
HiSparse decouples logical KV availability from physical GPU residency by introducing a two-level hierarchical KV cache:
- Host KV Pool: The authoritative, full KV cache history is stored in pinned host memory (CPU DRAM).
- GPU Cache: A small, fixed-size buffer ($B$) is reserved in GPU HBM per request and layer to hold the most recently selected KV records.
To keep this hierarchy from slowing down the critical path of token generation, the authors introduced several key innovations:
- Indexer-Agnostic Interface: HiSparse intercepts the model at the logical position interface. It doesn't care how the sparse tokens are selected, making it compatible with multiple sparse attention families (e.g., DSA, NSA, Quest) without retraining.
- Fused Miss-Resolution Kernel (RESOLVE): Hit detection, Least Recently Used (LRU) eviction, page table updates, and host-to-device fetches are fused into a single CUDA kernel captured inside SGLang's steady-state decode CUDA graph. It leverages GPU-assisted vectorized non-coherent loads to pull missing entries directly from host memory at near-link bandwidth.
- Layer-wise Prefetching: For models that share indexer selections across consecutive layers, HiSparse uses a "plan-then-IO" scheme to prefetch missing KV records several layers before they are needed, effectively hiding host-device transfer latency behind layer computation.
Datasets
The system was evaluated using:
- LongBenchV2: Selection traces from this benchmark were replayed to analyze cache hit rates and replacement policies.
- Synthetic Long-Context Workloads: Evaluated via SGLang’s standard
bench_servingharness across input lengths up to 200K tokens.
Key Insights and Ideas
- Temporal Locality in Sparsity: The core "aha moment" is that sparse attention selections behave exactly like traditional memory accesses with strong temporal locality. Consecutive decoding steps reselect largely overlapping token positions.
- LRU is Highly Effective: Because of this locality, managing the GPU cache with a simple LRU policy (at twice the top-$k$ size) achieves an 87% hit rate, closely tracking the theoretical offline-optimal Bélády policy.
- Compute is Free, IO is the Bottleneck: A "no-IO oracle" experiment revealed that the metadata management and hash table lookups of the
RESOLVEkernel add virtually zero measurable per-token compute overhead. The only true cost of bounding HBM residency is the host-device IO link.
Key Results
HiSparse has been fully integrated into upstream SGLang. When evaluated on H200, B200, and GH200 platforms, it demonstrated substantial improvements over standard full-HBM baselines:
- Throughput Multiplier: Peak generation throughput improved by up to 4.7× on Qwen3-30B with Quest at 200K context, and 3.1× on GLM-5.1 with DSA at 32K context.
- TTFT Reduction: Under high concurrency, HiSparse prevents decode memory from crowding out prefill tasks, drastically reducing Time-to-First-Token (TTFT).
- Latency Preservation: In overlapping throughput ranges, HiSparse preserves a comparable Time Per Output Token (TPOT) to the baseline, while layer-wise prefetching successfully hides roughly half of the remaining miss overhead.
Limitations and Future Work
- Non-Capacity-Bound Overhead: When serving short contexts or low-concurrency workloads where HBM is not saturated, HiSparse introduces a minor TPOT overhead (7–8 ms per token synchronously, reduced to ~3 ms with prefetching) due to host-device IO. The authors note it should simply be disabled in these regimes.
- Hardware Architecture Dependencies: HiSparse assumes host DRAM is significantly larger than GPU HBM. On unified architectures like NVIDIA Grace Hopper (GB200/GB300) where CPU LPDDR capacity is comparable to GPU HBM, the capacity dividend shrinks. Extending the hierarchy to NVMe or network-attached storage is a noted direction for future work.
- Static Cache Sizing: Currently, the GPU cache size ($B$) is a static configuration parameter. Implementing dynamic or admission-time cache resizing remains an open area for exploration.
Summary updated