Inference systems · Research feature

InferScale: GPU-Native KV Injection for Personalized LLM Serving

The researchers present InferScale, a memory system that colocates a GPU-native semantic index with a KV store to retrieve and inject precomputed fact states directly into the attention cache.

Adapted from research by Peter Li and Prashant Pandey.

arXiv preprint revision · 2026-12-02 · Attribution & reuse
In this article
Editorial illustration of processor die.

Authors’ overview

Personalized large language model (LLM) applications retrieve facts from conversation history to answer new requests. During prefill, the model converts these facts into key-value (KV) states, often repeating work from earlier requests. Prefix caching reuses states when prompts share an identical initial token sequence, but changing fact subsets and ordering limits its effectiveness. We present InferScale, a memory system that colocates a GPU-native semantic index with a KV store to retrieve and inject precomputed fact states directly into the attention cache. Context-Window Encoding mitigates the accuracy loss of encoding facts separately by including preceding conversation context while retaining only each fact’s states. Chunked RoPE adjusts the stored keys for their serving positions. InferScale integrates through vLLM’s KV-connector interface without engine modifications, model fine-tuning, or serving-time cache recomputation. On LoCoMo, InferScale achieves 1.7-2.2x speedups over Mem0 in query-to-first-token latency at a retrieval budget of 50 facts across three 7-8B models. On Llama-3.1-8B, replacing Mem0’s CPU-based Qdrant backend with GPU-native retrieval reduces latency from 117 to 83 ms. Adding KV injection reduces it further to 55 ms. As retrieval grows from 5 to 400 facts, InferScale’s engine time-to-first-token rises from 16 to 25 ms. At 400 facts, this is a 13.3x speedup over Mem0’s 327 ms. At 50 facts, Context-Window Encoding achieves 60.3% accuracy versus Mem0’s 63.3%. These results show that integrating semantic retrieval with reusable inference state reduces the serving cost of persistent memory while retaining useful source context.

Introduction

Personalized large language model (LLM) applications retain information from past interactions as persistent memory and draw on it to answer new requests. Retrieving only relevant memories keeps the input prompt shorter and reduces the work needed to process it, helping inference remain fast as the stored memory grows over time. Systems such as Mem0, Zep, and Letta organize information from past interactions and retrieve relevant entries to include in each prompt. Mem0, for example, represents memories as facts: short statements extracted from conversation history. We call the process of producing these statements memory extraction. For example, a user’s dietary preference may be relevant to both restaurant recommendations and meal planning. The same facts can be retrieved for multiple requests, creating an opportunity to reuse the computation needed to process them.

Challenge. Reusing individual facts across requests poses two concrete challenges. First, when does a fact’s KV state remain valid in a new prompt? A fact’s KV states depend on both its token positions11 1 The models evaluated in this paper use rotary position embeddings (RoPE), which encode token positions by rotating query and key vectors. and the preceding text. A new request may change both the fact’s position and its surrounding context. Adjusting positional encoding therefore addresses only part of the problem; it does not recover the interactions lost when facts are encoded separately. Second, how can the system store and retrieve these states efficiently? Precomputed KV states occupy much more space than the original text. Their storage and transfer can become bottlenecks, offsetting the computation saved by avoiding repeated prefill.

Prior approaches. Existing works provide two complementary foundations for serving precomputed KV states. First, KV reuse methods study how cached text segments, or chunks, can be combined in a new prompt. Block-Attention uses model fine-tuning, CacheBlend selectively recomputes tokens at serving time, and LazyAttention defers positional encoding to support reuse across positions. Second, KV caching and storage systems, such as LMCache, manage where these states reside and how they are delivered to the serving engine. Together, these approaches provide mechanisms for reusing and managing KV state.

Building a persistent-memory system from these mechanisms leaves two questions open. First, how can individual facts retain enough context to be useful across requests without requiring model fine-tuning or online cache recomputation? Second, how should semantic retrieval (finding facts relevant to a query’s meaning), KV storage, and delivery be organized so that finding and accessing reusable states does not offset the computation saved? These questions concern the representation and serving of persistent memory, beyond the mechanics of reusing cached chunks.

Insights. Our first insight is that a fact can be encoded with its source context while remaining an individually reusable unit. We encode each fact together with a window of preceding conversation turns, where each turn is one participant’s message, but retain only the fact’s own KV states. These states capture information from the surrounding conversation without requiring that context to be retrieved and processed on every request. We call this Context-Window Encoding. We handle changes in position separately through Chunked RoPE, which stores keys before positional rotation and applies the positions assigned by each request. Together, these techniques preserve useful source context while allowing facts to be assembled into new prompts. These techniques do not reproduce every interaction computed when the retrieved facts are processed together in a single prompt (joint prefill). However, they mitigate the accuracy loss of encoding facts separately without online cache recomputation.

LLM inference and KV caching

LLM inference separates processing the input prompt from generating the response. During prefill, the model processes the prompt and computes the representations needed to predict the first response token. During decode, it generates the remaining response one token at a time, using the prompt and previously generated tokens as context. Processing a longer prompt generally requires more prefill work, increasing the delay before the response begins. We distinguish engine time-to-first-token (TTFT), measured within the serving engine, from query-to-first-token latency (QTFT), which also includes retrieval and request preparation before engine execution.

KV caching lets the model reuse earlier tokens’ attention states as generation proceeds. At each transformer layer, attention uses key and value vectors that represent the preceding tokens. We build on vLLM, an inference engine that stores these vectors in a key–value (KV) cache. vLLM manages the active attention cache in fixed-size blocks through paged attention. These blocks can receive precomputed KV states. Prefill populates the cache for the prompt, and decode reads and extends it as new tokens are generated. This avoids recomputing earlier tokens’ KV states at each decode step. Reusing these states within a request, however, does not by itself avoid processing the same input again in a later request.

Position dependence of KV states

A fact’s KV states depend on the context in which it is encoded. With causal self-attention, each token attends only to itself and preceding tokens. The resulting representation incorporates information from the preceding text, influencing the keys and values computed at subsequent layers. Encoding a fact in isolation can therefore omit information from the conversation that helps interpret it. At serving time, jointly encoding retrieved facts introduces another source of context since each fact can attend to preceding facts. Because retrieval changes this preceding context across requests, the same fact text can produce different KV states.

Token position introduces a separate dependency through rotary position embeddings (RoPE), which are used by the models we evaluate. RoPE rotates query and key vectors according to their token positions, allowing attention scores to reflect relative distances between tokens. When a retrieved fact moves to a different position in the prompt, its cached keys must reflect the new positions. Because this rotation is applied after the key projection, it can be adjusted separately. However, changing the rotation does not recover the contextual interactions omitted when the fact was encoded. Positional adjustment alone therefore does not make separately encoded facts equivalent to joint prefill.

Retrieval and delivery of reusable KV states

Semantic retrieval and KV reuse require different representations of the same memory. A vector index stores embeddings that let it identify content relevant to a query. The serving engine uses token-level KV states, with separate keys and values at each transformer layer. Reusing memory therefore requires both finding relevant entries and accessing their corresponding KV states. The retrieval index therefore must deliver high performance, as the time spent retrieving and preparing these states contributes to QTFT and can offset the computation saved by avoiding repeated prefill.

GPU-native vector search places semantic retrieval onto the GPU device that already hosts the model and its active KV cache. Jasper supports this through a graph-based approximate nearest-neighbor index, storing embeddings and searching their proximity graph on the GPU. Jasper supports insertions and deletions without rebuilding the entire index, allowing the indexed memory to evolve over time. Furthermore, when device capacity permits, colocating the retrieval index and reusable KV store with the serving engine allows selected states to remain on the GPU, avoiding the cost of transferring them from CPU memory.

Memory representation

Each fact forms one memory chunk, with two complementary representations: a semantic embedding and per-layer KV states. The embedding allows the retrieval index to select facts relevant to a query. The KV states allow the serving model to attend to those facts without computing their representations again. A shared fact_id links the two representations, so retrieval returns identifiers that can be used to locate the corresponding states.

The stored KV states represent the fact as encoded with its source conversation context. InferScale uses the same LLM for encoding and serving, retaining only the states associated with the fact’s tokens. It stores keys before their rotary position encoding is applied, together with the corresponding values, so that the keys can be rotated for their assigned positions during serving. These states still depend on the context used during encoding. Therefore, storing pre-RoPE keys does not make them context-independent.

Each fact also retains its token sequence to connect the stored states to the serving engine’s cache management. When facts are selected for a request, their token sequences identify the prompt portion whose KV states will be supplied through the connector. This representation separates fact selection from cache injection: the retrieval index determines which facts to use, while the KV store supplies their precomputed states.

Offline encoding and online serving

The offline phase prepares each fact for retrieval and reuse before requests arrive. Starting from facts extracted by Mem0, InferScale embeds their text and inserts the embeddings into Jasper’s semantic retrieval index. In a separate encoding step, Context-Window Encoding processes each fact together with a window of preceding conversation turns. The resulting fact states are stored under the same identifiers as the indexed embeddings, making them available for subsequent requests.

The online phase selects the facts needed for a query and assembles their states for inference. InferScale searches Jasper using the query embedding and gathers the KV states associated with the returned fact identifiers. It then assigns positions to the selected facts and applies the corresponding rotary encoding to their stored keys. The states can reside on the GPU or in host memory. Host-resident states, however, must be transferred to the GPU before use.

The vLLM KV connector makes the assembled states available to the model without repeating the facts’ prefill. It places the states into the request’s paged attention cache and informs the engine which prompt tokens already have KV states available. The model then prefills the query while attending to the injected memory, after which decoding proceeds through the existing serving path. This integration uses vLLM’s connector interface without modifying the engine or fine-tuning the model.

Positional composition with Chunked RoPE

Chunked RoPE builds on positional reassignment techniques used in prior KV-reuse systems. Block-Attention re-encodes block positions and fine-tunes the model for independent block encoding, whereas InferScale combines positional reassignment with Context-Window Encoding without fine-tuning. LazyAttention applies positional adjustments inside custom attention kernels to avoid materializing position-adjusted copies. InferScale instead rotates selected keys before inserting them into vLLM’s request cache, retaining the existing attention kernels at the cost of composing and copying the selected states.

Applying these rotations does not reconstruct the states that joint prefill would produce. The stored keys and values were computed from hidden states—the model’s internal token representations—formed using each fact’s source context. Composition rotates the keys but does not recompute these representations. Chunked RoPE therefore supplies the positional transformation for the chosen serving positions, while leaving the context mismatch between offline encoding and joint prefill unresolved. The next subsection makes this distinction explicit when stating the conditions for exact reuse.

GPU-native retrieval and KV storage

The GPU-resident configuration keeps the retrieval index and persistent fact states alongside the serving model. Jasper’s index, the fact–ID map, and the precomputed KV store reside on the GPU, so the selected states can be gathered and composed without transferring them from host memory. The persistent store holds pre-RoPE keys and values. The request’s attention cache receives the selected states with their serving-time positions applied. Keeping both copies consumes device memory but allows the stored representation to be reused across requests.

Host-resident storage increases memory capacity while retaining GPU-native retrieval. In this configuration, the Jasper index and fact–ID map remain on the GPU, while the precomputed KV store resides in pinned host DRAM, which is kept resident for GPU transfers. Each request transfers only the selected facts’ states over PCIe before composition and injection. Those states still occupy the GPU attention cache during inference, but unselected facts need not reside on the device. This placement reduces persistent device-memory use at the cost of transfer and staging work on the request path.

Experimental Setup

Workload. We evaluate on LoCoMo, a widely used benchmark for long-term conversational memory employed by prior personalized LLM systems. Its questions require recalling and using information from long, multi-session conversations, matching the persistent-memory workload we target. Its ten conversations provide 1,540 questions: 282 multi-hop, 321 temporal, 96 open-domain, and 841 single-hop (excluding adversarial and unanswerable questions). Following Mem0’s preprocessing pipeline, we extract up to five salient facts from each dialogue turn and store each fact as a separate memory chunk. We embed facts and questions using the same 1,536-dimensional text-embedding-3-small model.

Models and platform. We evaluate three instruction-tuned models with different attention and positional-encoding configurations: Llama-3.1-8B-Instruct, Mistral-7B-Instruct-v0.3, and Qwen2.5-7B-Instruct. We also evaluate Qwen3-14B to examine a larger model. The retrieval-budget scaling experiments compare all three serving configurations across all four models. All models are used without fine-tuning. Experiments run on a single NVIDIA RTX PRO 6000 Blackwell Server Edition GPU with 96 GB of GDDR7 memory, connected through PCIe 5.0 x16. InferScale integrates with vLLM v0.19.1 through its KV-connector interface, using bfloat16 KV states and 16-token cache pages. Prefix caching is enabled so that prompt-injection baselines can reuse matching prefixes.

All three use the same extracted fact corpus, embeddings, and retrieval budget. Mem0 runs Qdrant in exact-search mode and Jasper uses inner-product search with 64 graph neighbors and beam width 64. The two backends can return different facts, so the Qdrant–Jasper comparison changes retrieval as well as its execution cost. Comparing Jasper + PI with InferScale holds the retrieval backend fixed. We additionally compare with CacheBlend on LMCache, with its configuration discussed alongside the comparison.

Latency. Query-to-first-token (QTFT) measures the request path from retrieval to the first generated token. It includes vector search, prompt assembly or KV composition, and engine execution. We also report the engine’s time-to-first-token (TTFT), which excludes retrieval and KV composition to isolate the engine-side benefit of injection. Unless stated otherwise, both metrics are medians over the 1,540 questions. We provide P95 and P99 measurements over the same queries in Appendix I.

QTFT starts from a precomputed query embedding and measures retrieval through the first generated token. Generating the embedding for a new query would add latency to all configurations. Fact extraction, embedding generation, KV precomputation, index construction, and engine startup also occur before serving and are excluded from request latency. We report KV precomputation time separately when examining the cost of Context-Window Encoding.

KV reuse. Existing methods reduce repeated prefill by reusing cached representations of prompt modules or document chunks. Prompt Cache uses explicitly defined reusable modules, while TurboRAG and KVLink adapt models to independently encoded document caches. CacheBlend and Cache-Craft selectively recompute cached states, and EPIC addresses the attention effects of composing independently cached documents. InferScale builds on positional reassignment while encoding each extracted fact with its source conversation context. Our CacheBlend comparison evaluates a representative alternative that repairs cached representations during serving, using the same retrieval backend and a matched host-storage configuration.

KV storage and delivery. Storage systems improve how cached inference state is retained and delivered. RAGCache manages cached representations for retrieved documents, CacheGen compresses and streams KV, and Mooncake and MemServe coordinate state across disaggregated resources. These mechanisms address storage, transfer, and scheduling decisions that can complement InferScale. Our evaluation focuses on contextual fact encoding and the retrieval-to-injection path on one GPU, including host-resident KV, rather than distributed cache management.

Contextualized fine-grained reuse. CoinRAG subsequently explored contextualized KV reuse for information nuggets extracted as spans within document chunks. It retrieves chunks and then nuggets, slices their contextualized KV, and supports optional fine-tuning and CacheBlend integration. InferScale instead encodes extracted conversational facts behind a source-context window and links their stored states directly to a semantic index. Comparing these complete pipelines would change extraction and retrieval as well as KV construction. Our Context-Window Encoding ablation isolates the effect of source context within the fact-based pipeline.

Conclusion

InferScale makes individual memory facts reusable units of inference computation. Context-Window Encoding preserves useful source context within each fact’s KV states, while Chunked RoPE handles their placement in a new prompt. Linking these states to a GPU-native semantic index allows the system to retrieve and inject them directly into the serving engine, avoiding repeated prefill of the retrieved facts. This design requires neither model fine-tuning nor serving-time cache recomputation and integrates through vLLM’s existing KV-connector interface.