Editor’s introduction
UlaCache introduces a unified logical address space that allows the inference engine to manage key-value (KV) cache data independently of its physical location, spanning GPU memory and optional CPU storage. The system supports both data-parallel and tensor-parallel attention by maintaining stable logical references to KV entries, enabling efficient allocation and sparse access. Local GPU buffers retain selected KV entries during decoding, reducing the need for data transfers. When CPU memory is used, Parallel Bucketed LRU (PB-LRU) manages the shared GPU pool by updating recency metadata and selecting eviction candidates in parallel. The system transfers KV data and updates address mappings accordingly. Performance gains are observed under speculative decoding with matched memory budgets, showing speedups of up to 2.51 times in tensor-parallel settings on B300 hardware compared to a state-of-the-art baseline.
Introduction
Efficient serving of long-context large language models (LLMs) requires enough memory to keep many requests active. Batching amortizes model execution across requests and raises decoding throughput, but every active request needs a key-value (KV) cache to retain its history. The memory occupied by model weights is independent of batch size, whereas KV storage grows with the number and length of active contexts. As context length and concurrency grow, this cache can exhaust GPU memory and prevent larger decode batches. Increasing the amount of useful history that fits in a fixed memory budget is therefore central to throughput scaling.
Sparse attention reduces the KV data read by each decoding step, selecting a subset of historical tokens or blocks for attention. Models including DeepSeek-V4.1-Flash, the GLM-5 family, Qwen3.8-Flash-Next, Hy4 Preview, and Step 5 Preview adopt this approach to reduce long-context attention cost. In index-based sparse attention, the selected set can change across steps, so unselected history must remain available for future queries. Reading less KV data per step therefore leaves a storage problem: the retained history still grows with context length and the number of active requests, limiting the number of requests that can decode concurrently under a fixed memory budget.
CPU memory can extend KV storage, but its effect on decode concurrency depends on how it is used. In the prefix-reuse paths of HiCache and LMCache, cached KV is loaded into the inference engine’s GPU slots to avoid prefill computation. This improves serving efficiency, while the active decode batch remains bounded by the GPU KV allocation. HiSparse instead keeps complete histories of active requests in CPU memory and fetches selected KV into GPU caches. This supports decoding beyond GPU memory capacity, but GPU slots hold copies of CPU-resident KV and do not add capacity for distinct history.
Sparse Attention and KV History
LLM inference consists of prefill and decoding. Prefill computes KV states for the input sequence. Each decoding step adds new states and uses the history to generate subsequent tokens. The cache avoids recomputing the earlier states, but must remain available while the request is active. Longer histories and larger batches therefore increase the storage requirement even though model weights are shared across requests.
Attention Parallelism and KV Placement
Attention parallelism determines which GPUs compute a request and store its history. Under TP, ranks split attention heads; KV heads are partitioned where possible and replicated when too few are available. Multi-head Latent Attention (MLA) compresses KV into a representation shared across heads. Partitioning query-head computation therefore does not partition this shared representation: conventional head-partitioned TP keeps a copy on each participating rank. The GPUs perform different attention computation while retaining the same token history.
Under DP, each rank processes separate requests and stores their histories locally. This avoids storing the same history on every rank, but makes the capacity available to a request depend on its assigned rank. Free slots on another rank are not directly usable by that request without an additional placement and access mechanism. The DP and TP labels here describe attention parallelism; other model components can use separate partitioning strategies.
CPU Storage for KV Cache
CPU memory can retain KV for reuse across requests or back the history of active requests. Hierarchical prefix caches such as HiCache and LMCache keep KV in CPU memory and external storage. A prefix hit restores cached KV into the inference engine’s GPU allocation, avoiding repeated prefill computation and improving request-serving efficiency. Transfers can be pipelined with layer execution to reduce exposed loading latency. The backing cache stores reusable contexts, while the inference engine manages the GPU slots required for execution.
Sparse KV offloading uses CPU memory during the lifetime of an active request. It keeps history outside GPU memory and brings selected entries to GPUs for attention. A selected entry missing from the GPU requires a host-to-device transfer before it can be consumed. A GPU cache retains entries across steps so that repeated selections can hit locally, reducing these transfers. The amount of history retained and the amount resident on GPUs can consequently differ.
KV Storage and Decode Concurrency
Each active request must retain its KV history throughout decoding, so storage capacity limits how many requests can decode concurrently. CPU memory provides additional KV storage, but whether it supports larger decode batches depends on how that history is used during execution. Prefix reuse and storage for active request histories are two common uses of CPU memory, with different implications for decode concurrency.
One approach uses CPU memory to cache reusable KV and avoid repeated computation across requests. In the prefix-reuse paths of HiCache and LMCache, a cache hit loads existing KV into the inference engine’s GPU slots, avoiding the corresponding prefill computation. Increasing CPU capacity retains more reusable contexts, but these contexts still occupy GPU history slots during execution. Adding CPU prefix storage therefore does not reduce the GPU storage required for the active histories. Once GPU KV slots limit the decode batch, additional CPU prefix storage improves reuse but does not directly admit more concurrently decoding requests.
Increasing decode concurrency therefore calls for CPU memory to store active request histories and for less duplication between GPU and CPU memory and across GPUs. While retaining the cached copies needed to reduce access overhead, more of the available space should store distinct KV history, allowing the expanded storage to accommodate larger decode batches.
Fixed Per-Request Cache Quotas
GPU caches reduce repeated CPU-to-GPU transfers by retaining selected KV across decoding steps. Limiting each request to a fixed cache quota bounds its GPU memory footprint and leaves room for other requests. As the number of active requests falls, however, the remaining requests keep the same quotas and cannot use the capacity left idle by absent requests.
This restriction can cause KV misses even when the complete active history fits in the available GPU KV capacity. If an individual history exceeds its request’s quota, some entries remain outside that request’s GPU cache. Whenever sparse attention selects one of these entries, it must be fetched from CPU memory. The transfer occurs despite there being enough GPU space to retain the data.
System Overview
Unified logical address space. UlaCache combines GPU KV pools and optional CPU pools into a logical address space. The address mapping associates each logical KV address with its current GPU or CPU physical slot. When KV cache moves, UlaCache updates this mapping without changing the logical addresses used by the inference engine. The address space covers a rank’s own pools in DP mode or aggregates the pools of a GPU group in TP mode. GPU KV pools retain history; in TP mode, each computing rank also maintains a local GPU buffer of selected copies. Buffer hits reuse local data without changing the history’s mapped storage location.
KV allocation and access. The inference engine allocates logical KV slots for a request, and UlaCache assigns their physical storage. Prefill writes the computed KV cache to these slots, and decoding extends the allocation as new tokens are generated. After sparse selection, UlaCache reuses local GPU buffer hits where available and resolves the remaining logical addresses through the address mapping. Selected CPU data is first moved into its storage GPU pool. The selected KV cache is then read directly from the GPU pool or fetched into a local GPU buffer for attention.
GPU–CPU scheduling with PB-LRU. When CPU storage is enabled, UlaCache uses Parallel Bucketed LRU (PB-LRU) to schedule transfers over a GPU KV pool shared by requests. PB-LRU groups GPU slots into recency buckets, updates accessed slots in parallel, and uses hierarchical bitmaps to select replacement slots. Its transfer plan promotes selected CPU data and moves replaced GPU data to CPU memory; UlaCache updates the address mapping after the exchange completes.
Unified KV Storage and Access
UlaCache uses stable logical KV addresses for sparse attention in both DP and TP modes. In DP mode, each rank manages its own GPU pool and optional CPU pool. In TP mode, the ranks’ GPU pools and optional CPU pools form a distributed address space. In both modes, UlaCache resolves selected logical addresses to the current physical locations of KV.
KV Allocation and Access
Allocation and writes. The inference engine allocates logical KV slots and records them in its request-to-token mapping. UlaCache binds these slots to physical storage within the request’s rank in DP mode or across the storage ranks in TP mode. Prefill writes the computed KV cache to the assigned locations; decoding allocates additional logical slots for newly generated tokens. Both phases use the same address mapping, and existing tokens retain their logical addresses as their KV cache moves between GPU and CPU memory.
Sparse access. Sparse selection returns logical KV addresses. In DP mode, the rank resolves these addresses to physical slots, promotes any selected CPU data into its GPU pool, and supplies attention directly from that pool. In TP mode, the computing rank reuses local GPU buffer hits and resolves the remaining addresses to their storage ranks and physical locations. Selected CPU data is first promoted into the corresponding storage GPU pool, then missing KV cache is fetched from local or peer GPU pools into the computing rank’s buffer. Attention waits until the selected data is available. Section 5 describes GPU–CPU data exchange and the corresponding address mapping updates.
Local GPU Buffer
Each computing rank in TP mode maintains a local GPU buffer that caches copies of KV cache selected from the distributed pools and supplies them to the attention backend. Its capacity is independent of the retained history length. Cached copies remain available across decoding steps, reducing repeated transfers when sparse selections overlap. Replacing a buffer copy leaves the retained KV cache in the storage pools available for future selections. DP mode accesses its GPU pool directly without allocating this buffer.
Lookup and transfer. After sparse selection, UlaCache checks which logical KV addresses are present in the buffer. A tag associated with each buffer slot identifies its cached KV cache data. Hits are retained for the current attention computation; missing addresses are deduplicated across queries and assigned buffer slots. The resulting transfer plan specifies the missing data and its destination slots. GPU kernels fetch this data from local or peer GPU pools, using CUDA IPC for peer access. The buffer uses the layout required by the attention backend.
Plan reuse and prefetching. For layers that share sparse selection results, UlaCache performs address lookup, miss deduplication, and buffer allocation once and reuses the resulting access plan across the layer group. Each layer still fetches its own KV cache data. A separate CUDA stream prefetches the required data to overlap transfers with computation. Stream dependencies and CUDA events order source writes, prefetching, and attention reads, and prevent buffer slots from being reused before attention completes.
Distributed Indexer
In TP mode, Index keys follow the same logical token allocation and GPU partition as the KV cache. Each GPU scores only its local keys, and an all-gather combines the scores for the model’s TopK selection. This partitioning reduces Index key replication and redundant scoring across TP ranks. Selected positions identify logical KV addresses and enter the KV access path described above. The score all-gather introduces communication and synchronization overhead, particularly at low concurrency. In DP mode, each rank stores and scores the Index keys of its local requests without this cross-rank score exchange.
CPU Memory Expansion and PB-LRU
For each sparse access, PB-LRU identifies KV cache that must be fetched from CPU memory and assigns GPU slots to it. Recently accessed KV cache remains in a GPU pool shared by requests, while replaced KV cache moves to CPU memory. The scheduler determines which KV entries to move and their destination slots. UlaCache moves the data, then updates the address mappings.
Parallel Bucketed LRU
Parallel access processing. GPU threads resolve the supplied logical KV addresses in parallel using the address mapping. GPU-resident KV cache remains in place, and its slots move to the current recency bucket. CPU-resident addresses are deduplicated into a list of KV cache to fetch. Repeated references to the same GPU slot produce one effective recency update; repeated references to the same CPU address require one transfer.
Each bucket is represented by a bitmap with one bit per GPU physical slot. A set bit indicates membership in that bucket. A bucket identifier stored for each slot lets an access clear its previous membership and set its bit in the current bucket. Access updates touch the referenced slots rather than scanning the GPU pool. Bucket rotation additionally processes the expiring bucket’s members, which can include the entire pool in the worst case. CPU slots do not belong to these bitmaps.
KV Exchange and Mapping Updates
For each CPU-to-GPU transfer, the plan records the logical KV address, source CPU slot, destination GPU slot, and the logical address of any KV cache being replaced. Planning changes bucket membership without modifying KV data or the address mapping.
GPU kernels exchange the data after prior readers of the affected slots complete. When the destination GPU slot is occupied, its KV cache moves into the source CPU slot as the incoming data moves to the GPU. Reusing this CPU slot avoids allocating additional CPU space for the replaced data. For an empty GPU destination, only a CPU-to-GPU copy is required; the source CPU slot is released after the mapping update.
After all data transfers complete, UlaCache updates the address mapping to reflect the new GPU and CPU locations, then signals completion. Attention and local GPU buffer fetches wait for this signal before using the new GPU locations. The logical KV addresses remain unchanged throughout the exchange.
Experimental Setup
Workload. We use Multi-LexSum requests with input lengths of 64K–128K tokens. H200 uses 256 requests (98,125 input tokens on average); B300 extends the frozen request order to reach each configuration’s admitted concurrency, up to 578 requests. Each request generates 2,048 tokens using greedy decoding.
Metrics. We complete prefill for all requests in a batch before starting decoding. We report output token throughput (tokens/s) and time per output token (TPOT, ms). Throughput comparisons use each method’s observed peak over all measured batch sizes, independently of its admission limit. We skip batch sizes for which the system cannot accommodate all requests concurrently.
Throughput Scaling
Effect of speculative decoding. Speculative decoding raises output throughput at shared batch sizes because each target verification can accept multiple output tokens. It also changes memory allocation for the draft model and verification state, so throughput and maximum admitted concurrency need not increase together. The curves include these allocations and use naturally accepted outputs. Peak throughput thus reflects both decoding efficiency and the concurrency supported by each complete configuration.
KV Allocation and Capacity
In DP mode, UlaCache stores request histories across both GPU and CPU memory. HiSparse keeps full histories in CPU memory and uses GPU buffers to cache copies, so these buffers do not increase its history capacity. In TP mode, UlaCache also stores different portions of each history on different ranks. The additional capacity allows more requests to decode concurrently, as shown by the admission bars.
Hierarchical sparse-attention serving
HiSparse stores complete KV histories of active requests in CPU memory and fetches selected KV into fixed per-request GPU caches, fusing hit detection, LRU replacement, and transfers. ECHO overlaps KV transfers with indexer computation. Spin provides partitions, elastic per-request buffers, GPU bucketed LRU, and hierarchical metadata. PB-LRU also groups slots by recency, using GPU-slot bitmaps and hierarchical summaries for parallel victim selection from a pool shared across requests. UlaCache integrates this replacement with KV migration and mapping updates in rank-local and distributed storage.
FlexGen aggregates GPU, CPU, and disk resources. InfiniGen predicts KV for prefetching; RetrievalAttention combines GPU caching with CPU vector retrieval. OasisKV approximates dense attention through draft-guided block selection and pipelined prefetching. Its complete history resides in CPU or remote memory; GPU buffers hold copies and add no independent history capacity. UlaCache uses the model’s existing sparse selections to drive KV access and migration.


