arXiv:2611.04671cs.DCNov 2026

Manuscript Offprint

arXiv:2611.04671

LeanSparse: Memory-Efficient Serving for Native Sparse-Attention LLMs

Zaifeng Pan, Chris Wu, Xinwei Qiang, Zhengding Hu, Zhongkai Yu, Yufei Ding

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

ABSTRACT

Sparse attention limits the history read by each query, but serving long contexts still requires substantial GPU memory. Existing KV offloading systems retain the full history of indexer keys on GPU, limiting decode concurrency. Prefill's temporary memory demand can further delay admission even when enough memory remains for the same request's subsequent decode. We present LeanSparse, a serving system that reduces both decode's persistent memory use and prefill's temporary memory demand. Our design exploits two observations: prefill consumes historical data one layer at a time, and decode can identify promising candidates before comparing their original indexer scores. During prefill, LeanSparse streams layer histories through two reusable GPU buffers, overlapping next-layer loading with ongoing model computation. During decode, coarse-to-fine indexing searches compact representations and retrieves original indexer keys only for candidate refinement. Separate indexer key and KV caches reuse data across generation steps. We implement LeanSparse in SGLang and evaluate it on DeepSeek-V4-Flash. At 950K context length, LeanSparse supports 2.95× as many concurrent requests and achieves 2.14× decode throughput over HiSparse. On multi-turn Open-SWE traces, it reduces median time to first token from 21.6 to 0.6 s and median session completion time by 17.7% relative to ECHO.

1 INTRODUCTION

Native sparse-attention LLMs incorporate sparse selection into training to reduce the cost of processing long contexts (Yuan et al., 2025; Lu et al., 2025; DeepSeek-AI et al., 2025; 2026; GLM-5-Team et al., 2026). This benefits multi-turn conversations and agent workflows, whose histories accumulate messages, documents, and tool outputs. However, sparse access does not eliminate the need to retain history: tokens skipped by one query may be selected later. The key-value (KV) cache still grows with context length, so concurrent requests can exhaust GPU high-bandwidth memory (HBM) even when each query reads only a small fraction of the stored KV (Liu et al., 2026a; Xie et al., 2026).

To address this memory pressure, ECHO (Liu et al., 2026a) and HiSparse (Xie et al., 2026) offload historical KV to host memory and retain a hot KV buffer on GPU. This design exploits the overlap between tokens selected by successive decode steps. Once a token's KV has been fetched, later steps can reuse it from the buffer instead of transferring it again. Prefetching further reduces exposed transfer latency by loading likely selections in advance. These optimizations substantially reduce the GPU memory occupied by attention KV while allowing decoding to continue over a long history.

With a learned indexer, however, these systems still retain the full history of indexer keys on GPU. The indexer scores these indexer keys to select tokens before attention. They are separate from the KV that attention consumes. Keeping all indexer keys resident allows the indexer to search the history at every decode step, but leaves a memory cost that grows linearly with context length. Figure 1 illustrates this cost for DeepSeek-V4-Flash (DeepSeek-AI et al., 2026). At 512K context tokens, its FP8 indexer keys require 7.2× the space of a 4K-entry hot KV buffer per indexed layer. Thus, reducing the attention-KV cache can leave the indexer as the larger allocation, limiting further concurrency growth.

Besides indexer residency, existing offloading optimizations mainly target decode, where repeated accesses across generation steps make a hot buffer effective. Prefill has a different access pattern. It processes many input queries together, and the tokens they select can span a much larger part of the history than those selected in a single decode step. A newly admitted or resumed request also cannot rely on an already warm GPU buffer. Consequently, prefill cannot benefit from the hot buffer optimization used for decode. HiSparse (Xie et al., 2026) thus keeps the full KV history in HBM throughout prefill.

When prefill and decode share a GPU, the remaining HBM may be enough for an arriving request's decode state but insufficient for its temporary prefill demand. As Figure 2(a) shows, the request must then wait for active decode requests

*Equal contribution ¹University of California, San Diego, CA, USA. Correspondence to: Zaifeng Pan zapan@ucsd.edu.

Preprint.

Figure

Figure 1. Indexer key storage grows with context length. Per-request memory of one CSA layer in HiSparse: FP8 indexer keys versus the fixed hot KV buffer.

to release memory before prefill can start, increasing time to first token (TTFT). In contrast, reserving HBM for prefill avoids this wait but reduces decode concurrency even when no prefill is running, as shown in Figure 2(b).

Existing systems (Liu et al., 2026a; Xie et al., 2026) thus suggest prefill-decode (PD) disaggregation (Zhong et al., 2024), placing the two phases on separate GPU pools. However, instance-level disaggregation duplicates model weights and restricts resource sharing between phases (Wu et al., 2026; Wang et al., 2025). When HBM is already scarce enough to require KV offloading, these extra weight copies further reduce the space available for request state under a fixed GPU budget. Sharing a model instance is therefore a more suitable choice in this setting, as both phases reuse the same weights and memory pool. Efficient memory sharing thus requires reducing both decode's persistent indexer allocation and prefill's temporary memory demand.

To address these limitations, we present LeanSparse, a memory-efficient serving system for long-context sparse attention. LeanSparse keeps the full history of indexer keys and KV in host memory. It reduces prefill's temporary memory demand through layer-wise prefill streaming and decode's persistent indexer residency through coarse-to-fine indexing.

Layer-wise prefill streaming. A prefill chunk can extend an already computed prefix, reused from a cached request or produced by earlier chunks of the same request. The prefix's indexer keys and KV have already been computed for each layer, but the new queries consume them one layer at a time. LeanSparse streams this prefix state from host memory through two reusable GPU buffers. One serves the current layer while the other loads the next layer's prefix state, without waiting for that layer's new queries. Reusing the buffers reduces prefill's temporary memory demand and leaves more HBM for concurrent decode requests.

Coarse-to-fine indexing. Consecutive decode steps often select overlapping historical positions, yet the indexer still reads every original indexer key to find them. We use a com-

Figure

(a) Temporary prefill memory delays admission

Figure

(b) Reserved prefill space reduces throughput

Figure 2. Prefill admission competes with decode for GPU memory. A prefill request either waits for decode to release memory or uses a reservation that sits idle when no prefill runs.

pact approximation to screen the history before retrieving original indexer keys. This first pass retains more candidates than attention needs: positions that are difficult to rank approximately can all survive and be compared using their original scores. Only these candidates require original indexer keys on GPU, and cached indexer keys can serve repeated candidates across steps. Our implementation uses product quantization (PQ) (Jégou et al., 2011) for this coarse pass.

We implement LeanSparse in SGLang (Zheng et al., 2024) and evaluate it on DeepSeek-V4-Flash (DeepSeek-AI et al., 2026). Across context lengths from 200K to 950K tokens, LeanSparse supports up to 2.95× as many concurrent requests and achieves up to 2.14× the decode throughput of HiSparse (Xie et al., 2026). On multi-turn OpenSWE replay, LeanSparse reduces median TTFT by 97.2% and median session completion time by 17.7% relative to ECHO (Liu et al., 2026a).

Our contributions are:

  • We identify two memory bottlenecks that limit long-context sparse-attention serving beyond attention-KV offloading: persistent indexer residency and temporary prefill demand.

  • We propose LeanSparse, a serving system that reduces GPU memory requirements across prefill and decode. It reuses GPU buffers across layers during prefill and retrieves original indexer keys only for candidate refinement during decode.

  • We implement LeanSparse in SGLang and demonstrate higher long-context serving concurrency and throughput, together with lower TTFT and session completion latency on multi-turn workloads.

Figure

Figure 3. DeepSeek-V4-Flash attention architecture and the computation within a CSA layer.

References (29)