arXiv:2611.09474cs.DCNov 2026

Manuscript Offprint

arXiv:2611.09474

Nebula: Distributed Position-Independent Caching for LLM Serving

Yifei Liu, Junbin Pan, Junhao Hu, Yang Liu, Junyi Chen, Juntong Wu, Chen Chen, Haiyuan Zhao, Xiaoxu Chen, Weihang Chen

Abstract

Modern LLM workflows, such as retrieval-augmented generation (RAG) and LLM agents, build long prompts from multiple independent text segments, making prefill a major source of computation. Reusing KV caches is therefore important for reducing serving costs and latency: distributed caching systems spread KV cache across a cluster to increase aggregate capacity, while position-independent caching (PIC) enables reuse of recurring segments under different prefixes. However, existing systems distribute KV caches but still rely on prefix caching (PC), while existing PIC methods enable position-independent reuse without cluster-wide resource management.

We present NEBULA, the first distributed LLM serving framework to treat PIC segments as first-class citizens, enabling remote PIC reuse and parallel prefill. To track PIC's fine-grained, asynchronous state changes, NEBULA combines optimistic accounting with event-driven updates to provide a timely and truthful cluster view for cache management and prefill scheduling. To accommodate diverse reuse patterns across workloads, NEBULA leverages cluster-wide ghost-hit feedback to automatically tune the allocation of shared cache capacity between PC and PIC. Finally, NEBULA incorporates queueing, computation, and KV transfer costs into a unified prefill completion time model to guide elastic parallelism adjustment and locality-aware compute placement. Across four models and four real-world RAG and agentic workloads, NEBULA reduces median TTFT by an average of 61.4% compared with the strongest existing baseline and recovers an average of 76.1% of the tokens missed by prefix caching.

1 Introduction

Large language model (LLM) serving is expanding beyond single-turn chat to support retrieval-augmented generation

RAG / Agent request

Figure

(a) Prefix-aware routing + worker-local PIC

Figure 1: Distributed PIC for a single request. Both plans start with the same cache placement and worker loads, with PIC segments A and B cached on different workers. (a) Worker-local PIC reuses A but leaves remote B and an idle worker unused. (b) NEBULA reuses B across workers and computes C and D on separate workers while preserving prefix reuse. W1 combines the KV cache and processes query segment q.

(RAG) and long-horizon agents. RAG inserts retrieved documents into prompt templates [2,4,12,28], while long-horizon agents extend their context with tool outputs, memory and skill files [7,21,32]. Prefilling these growing contexts requires substantial GPU computation and increases time-to-first-token (TTFT). Reusing KV caches to avoid repeated prefill computation is therefore important for lowering serving costs and improving responsiveness.

Distributed inference systems extend KV caching across the cluster. Mooncake [22], LMCache [11], and MemServe [5] support cross-node indexing, storage, and transfer, allowing requests to reuse KV generated on other nodes and benefit from aggregate cache capacity. Yet their distributed reuse still relies on strict prefix caching (PC): only content

∗^{*}Both authors contributed equally to this work.

†^{\dagger}Yifei Liu is the corresponding author (liuyifei5@xiaohongshu.com).

that matches continuously from the beginning of a request can be reused. PC therefore cannot reuse a previously seen document or tool result independently when its preceding context changes.

In parallel, position-independent caching (PIC) [6, 9, 13, 14, 26, 27, 31] expands the scope of reuse. Methods such as CacheBlend [31] and EPIC [6] cache semantically independent segments and combine their KV under a different prefix with correction or recomputation as needed. This matches the recombination of retrieved documents in RAG and the reuse of shared content in different agent contexts. Across six real-world RAG and agent workloads, our reuse breakdown shows that PIC can recover approximately 72.1% of the tokens missed by PC on average ( §3.1§3.1).

However, simply combining existing PIC algorithms with distributed inference systems does not realize the full capabilities of distributed PIC. Routers still match caches by prefix and cannot locate cached PIC segments across nodes; schedulers still treat each request as monolithic and cannot parallelize prefill of its cold segments across workers. Figure 1 illustrates the resulting missed opportunities for remote cache reuse and parallel prefill.

We present NEBULA, the first distributed LLM serving framework to treat PIC segments as first-class citizens. NEBULA enables remote PIC reuse and parallel prefill of uncached segments across workers while preserving PC semantics. Through a unified backend interface, NEBULA supports multiple PIC algorithms and decouples algorithm-specific KV processing from cluster-wide resource management. Building on this framework, we further introduce three designs, each addressing a distinct challenge posed by distributed PIC.

C1: Keeping the cluster view timely and truthful through optimistic, event-driven view synchronization. Distributed PIC can break a single request into hundreds of scheduling units whose states change asynchronously across workers, while routing decisions and actual execution are separated in time. Inferring cache state solely from scheduling decisions may report invalid cache hits, while relying solely on execution feedback may lead to redundant computation. NEBULA combines these complementary sources: the router immediately records expected cache locations and compute load upon dispatch, and workers confirm or correct these records through cache residency, eviction, and task completion events. This allows NEBULA to maintain an accurate and timely cluster view, providing a common basis for cache management and prefill scheduling ( §5§5).

C2: Balancing PC and PIC allocation through shared, self-tuning cache management. Workloads differ in their PC and PIC reuse patterns: RAG documents recur under different prefixes, while successive agent interactions extend the same prefix. Uncontrolled competition between PC and PIC for shared cache space can cause cache pollution, while fixed quotas can strand cache capacity. NEBULA dynamically adjusts the target PC/PIC capacity ratio using cluster-wide ghost-hit feedback, which captures reuse demand after eviction. Capacity allocation thus adapts to the actual reuse patterns observed across the cluster ( §6§6).

C3: Balancing compute and transfer through elastic, locality-aware prefill scheduling. A distributed PIC request must both fetch cached KV and compute uncached segments. Placing computation on cache-affine nodes may cause load imbalance, while placing it on idle nodes may increase network traffic. Optimizing cache locality or load balance alone does not necessarily minimize the prefill completion time of a PIC request. NEBULA incorporates queueing, computation, and KV transfer costs into a unified prefill completion time estimate and uses a greedy search to select the best candidate execution plan. The prefill plans therefore dynamically adjust parallelism and compute placement as load and cache distribution change, accounting for both available compute resources and data locality ( §7§7).

We implement NEBULA on SGLang [33] and Dynamo [18], with support for PIC methods including CacheBlend [31], A 3^{3} [34], EPIC [6] and HYPIC [10]. We evaluate NEBULA with four diverse models on four real-world RAG and agentic workloads. NEBULA reduces median TTFT by an average of 61.4% compared with the strongest existing baseline and recovers an average of 76.1% of the tokens missed by prefix caching. NEBULA's source code will be released at https://github.com/redai-studio/Nebula.

References (30)