Source-linked AI summary
KVLink: Accelerating Large Language Models via Efficient KV Cache Reuse
Jingbo Yang, Bairu Hou, Wei Wei, Yujia Bao, Shiyu Chang
TL;DR
When queries share retrieved documents, LLMs still re-encode the concatenated context, creating redundant computation. KVLink precomputes document KV caches for reuse, adjusts their positions and reconnects cross-document attention; it consistently outperforms baselines and cuts time-to-first-token latency by up to 96%.
Problem
When queries share documents, conventional LLMs re-encode the concatenated context instead of reusing segment representations, incurring redundant computation.
Source: §1 · p. 2Method
KVLink precomputes each document’s KV states independently and concatenates them at inference, re-encoding positions and using link tokens to reconnect cross-document attention.
Source: §1 · p. 2, §2.1 · p. 3, §2.2 · p. 3Results
Across datasets, KVLink consistently outperforms baselines, with up to 5% higher accuracy than BLOCKATTENTION on most QA tasks, while reducing time-to-first-token latency by up to 96% versus conventional full encoding.
Source: §1 · p. 2, §3.2 · p. 7Takeaways & Limitations
KVLink can avoid redundant computation for overlapping contexts across queries by reusing precomputed KV caches.
Source: §5 · p. 10Storing precomputed KV caches and loading them onto the GPU can impose substantial overhead, challenging their integration into real-world RAG deployments.
Source: §2.4 · p. 4
Abstract
from arXiv · showhide
We describe KVLink, an approach for efficient key-value (KV) cache reuse in large language models (LLMs). In many LLM applications, different inputs can share overlapping context, such as the same retrieved document appearing in multiple queries. However, the LLMs still need to encode the entire context for each query, leading to redundant computation. In this paper, we investigate a new strategy to eliminate such inefficiency, where the KV cache of each document is precomputed independently. During inference, the KV caches of retrieved documents are concatenated, allowing the model to reuse cached representations instead of recomputing them. To mitigate the performance degradation when using KV caches computed independently for each document, KVLink introduces two key techniques: adjusting positional embeddings of the KV cache at inference to match the global position after concatenation, and using trainable special tokens to restore self-attention across independently encoded documents. Experiments across 7 datasets demonstrate that KVLink improves question answering accuracy by an average of 4% over state-of-the-art methods. Furthermore, by leveraging precomputed KV caches, our approach reduces time-to-first-token by up to 96% compared to standard LLM inference, making it a scalable and efficient solution for context reuse. Additionally, KVLink can be combined with KV cache compression to further save cache loading and storage overhead while outperforming the baselines.
1 Introduction
KVLink addresses redundant encoding when queries reuse overlapping context by precomputing each segment’s KV cache independently and reusing caches at inference. Positional re-encoding and trainable link tokens mitigate performance loss from independent encoding, while experiments report gains over baselines and reduced latency.
1 Introduction
- Conventional LLM inference encodes the entire concatenated context for every query, redundantly re-encoding unchanged documents shared across queries.This raises prefilling costs for long contexts and prevents separately encoded segment representations from being reused.Source: §1 · p. 2
- KVLink precomputes each document’s KV states independently, then reuses and concatenates them at inference to avoid re-encoding shared context.It adjusts cached positional embeddings to match global positions and inserts trainable cross-segment tokens whose KV representations are computed at inference; the tokens attend to preceding tokens to restore self-attention across documents.Source: §1 · p. 2
- KVLink beats the best baseline by 6.6% on Natural Question and 7.3% on HotpotQA [11], while reducing time-to-first-token latency by up to 96% versus full encoding.Against the conventional full-encoding model, KVLink sacrifices only minimal performance; evaluations cover Llama-3.2-1B, Llama-3.2-3B, and Llama-3.1-8B.Source: §1 · p. 2
- KVLink combined with KV cache compression methods LLMLINGUA [12] and ANLLMS [13] consistently outperforms baseline approaches.The paper examines compression because storing precomputed KV caches can incur substantial storage overhead.Source: §1 · p. 2
2 Methodology
KVLink avoids repeatedly encoding recurring documents by precomputing document-level KV caches and concatenating them at inference. It corrects positional shifts, reconnects cross-document attention with trainable link tokens, and can be combined with cache compression.
2.1 Problem Formulation
- KVLink precomputes context-free KV caches for documents and concatenates retrieved caches for reuse, avoiding redundant encoding but losing cross-document dependencies that can degrade QA accuracy.Prior work reported up to a 35% relative accuracy decrease on question-answering tasks when each retrieved document was cached separately [7].Source: §2.1 · p. 3
2.2 KV Cache Positional Re-encoding
- KVLink stores KV states without RoPE rotations, then applies each token’s global-position rotation after concatenation to correct the mismatch between local and full-sequence positions.RoPE is still applied during segment encoding for local self-attention, but its positional transformations are excluded before saving the caches.Source: §2.2 · p. 3
2.3 Cross-Document Reconnection with Link Tokens
- Trainable link tokens reconnect documents: each attends to its document and preceding documents, while document tokens retain local causal attention; training jointly optimizes the model and tokens.At inference, KVLink concatenates precomputed caches and runs a forward pass only on the appended link tokens using the customized attention map.Source: §2.3 · p. 4
2.4 Compressed KV Cache Linking
- To reduce cache storage and loading overhead, KVLink combines with LLMLINGUA token dropping or chunk-based ANLLMS, whose anchor tokens attend within their chunk and to preceding anchors.The default chunk size is 100; training predicts tokens beyond the input chunks using only anchor tokens, then fine-tunes on QA datasets with KVLink.Source: §2.4 · pp. 4–5
3 Experiments
KVLINK improves performance with separately encoded KV caches, substantially reduces time-to-first-token, and maintains general capabilities. Link tokens also mitigate accuracy losses under cache compression, while results remain competitive across different training data mixtures.
3.1 Experiment Setup
- Experiments evaluate separately cached retrieval QA and summarization, TTFT, general capabilities, and QA with compressed caches.The QA suite includes NaturalQuestions, 2WikiMQA, TriviaQA, HotpotQA, and MuSiQue; summarization uses MultiNews and Samsum. Evaluation also covers reasoning and instruction-following benchmarks and compression rates of 50% and 75%.Source: §3.1 · pp. 5–6
3.2 Main Results
- KVLINK outperforms baselines on evaluation datasets, with up to 5% higher accuracy than BLOCKATTENTION on most QA tasks.The exceptions are 2WikiMQA and TriviaQA, whose training sets were included in the training mixture; on other evaluation datasets, KVLINK outperforms the baselines. It also approaches fine-tuned Llama performance under standard, fully concatenated-context decoding. Performance improves consistently as the number of link tokens increases.Source: Table 1 · p. 6, §3.2 · p. 7
3.3 Inference Efficiency Evaluation
- 85%–96% lower TTFT than standard decoding is achieved by KVLINK1 and KVLINK5, with a 96% reduction at 5,000 tokens.Measurements include loading precomputed caches from CPU to GPU, positional re-encoding, and encoding link tokens; the methods have lower TTFT across context sizes, and the gap widens as context length increases.Source: Figure 3 · p. 7, §3.3 · pp. 7–8
3.4 General Capability Preservation
- KVLINK maintains performance comparable to fine-tuned Llama across general-capability tasks, with drops from original models typically below 3% on affected benchmarks.The reported minor drops include ARC-Challenge and Winogrande; results across both model sizes are described as highly comparable to fine-tuned Llama.Source: §3.4 · p. 8
3.5 KVLINK with Cache Compression
- Adding link tokens consistently mitigates compression-related accuracy drops, while modified ANLLMS retains more information and outperforms LLMLINGUA across QA benchmarks.The comparison evaluates KVLINK with five link tokens against BLOCKATTENTION at 50% and 75% compression rates.Source: §3.5 · pp. 8–9, Table 3 · p. 9
3.6 Ablation Study
- KVLINK remains competitive across different training data mixtures, while task combinations and domain coverage can slightly affect downstream performance.The paper identifies balanced data selection as important and leaves comprehensive exploration of optimal data configurations for future work.Source: §3.6 · p. 9
4 Related Work
Related work addresses LLM inference efficiency through computational savings and KV-cache reuse, alongside complementary efforts on cache memory and retrieval-augmented generation.
Efficient inference for LLMs
- KVLink aims to reduce inference-time computation like pruning [35] [36] [37] [38], quantization [40] [41] [42] [43], and optimized decoding, and can combine cache reuse with eviction and KV-cache quantization for memory efficiency.The cited cache-memory approaches reduce footprint through eviction [56] [57] [58] or quantization [59] [42] [41] [60] [61] [62].Source: §4 · p. 9
KV cache reuse
- KV-cache reuse across queries often focuses on prefixes [51] [52]; PROMPTCACHE[9] supports discontinuous positions but ignores cross-chunk attention and requires Prompt Markup Language.The paper says these limitations reduce performance and flexibility across tasks.Source: §4 · p. 9
- CACHEBLEND selectively recomputes tokens with the largest value-state variance, but recomputing 10%–20% of tokens plus all first-layer tokens carries non-trivial cost.The passage also reports performance degradation.Source: §4 · p. 9
- BLOCKATTENTION[7] re-encodes caches without positional embeddings but lacks strategies to connect reused contexts; TurboRAG [54] adds two boundary tokens yet also reconnects caches ineffectively.The passage characterizes BLOCKATTENTION's performance as below ideal and says TurboRAG falls short similarly.Source: §4 · p. 9
Retrieve-augmented generation
5 Conclusion
KVLink improves LLM efficiency by reusing precomputed KV caches for retrieved documents or context segments, avoiding redundant computation across queries with overlapping context.
5 Conclusion
- Precomputed KV caches for retrieved documents or context segments let the method avoid redundant computation across queries with overlapping contexts.The paper identifies refining the data mixture, optimizing fine-tuning, and exploring real-world deployment as future work; limitations and societal impact are discussed in the Appendix.Source: §5 · p. 10
NeurIPS Paper Checklist
The checklist affirms that the abstract and introduction accurately reflect KVLINK’s contribution and scope, citing experimental results in Section 3 as verification.
- The checklist answers “Yes,” stating that KVLINK addresses performance degradation in cache reuse to accelerate LLM inference and that Section 3’s experiments verify the abstract and introduction’s claims.Source: NeurIPS Paper Checklist · p. 16
2. Limitations
The authors report that limitations are discussed in Appendix A.9, but the supplied passages do not describe their substance. The paper includes no theoretical results and reports no error bars because training is stable and evaluation uses greedy decoding.
Limitations
- The paper reports that its limitations are discussed in Appendix A.9, but the supplied passages do not specify what those limitations are.The passage confirms the discussion exists without describing its content.Source: §2 · p. 16
- The paper has no theoretical results, so theoretical assumptions and proofs are not applicable.The paper’s checklist answer states that it does not include theoretical results.Source: §2 · p. 17
- The paper says reproduction details are in Section 3.1 and Appendix A.2, and that code, datasets, and KVLINK models will be released.Training and test details are also reported in those sections.Source: §2 · pp. 17–18
- Error bars are not reported because training is empirically stable and evaluation uses greedy decoding.The supplied passage gives these as the reasons for omitting error bars.Source: §2 · p. 18
A Appendix · A.1 Data Mixture
The A.1 training mixture combines retrieval-augmented QA, multi-turn conversation, and summarization examples with data intended to preserve the model’s existing QA, instruction-following, and language-modeling capabilities.
A.1 Data Mixture
- TriviaQA and 2WikiMQA questions are paired with ten separately encoded Wikipedia passages retrieved using Contriever, with GPT-4-generated reference answers as supervision.The passages are retrieved for each question.Source: §A.1 · p. 23
- Earlier turns in instruction-following conversations are randomly converted into independently encoded KV caches, and the model learns to answer subsequent turns using those contexts.This setup is intended to teach integration of segmented contexts while maintaining instruction-following capability.Source: §A.1 · p. 23
- For XSum summarization, each document is split into consecutive segments encoded as separate KV caches, and the model is trained to generate the ground-truth summary.The task trains the model to aggregate information across independently encoded document chunks.Source: §A.1 · p. 23
- Standard TriviaQA and 2WikiMQA examples use whole, concatenated retrieved contexts to train generation of ground-truth answers and preserve existing QA capabilities.Source: §A.1 · p. 23
- Tulu 3 examples are included to preserve instruction-following ability, while a small amount of Fineweb pretraining data is included to preserve language-modeling capability.Source: §A.1 · p. 23
- Conversation training loss is computed only on the assistant’s final response; summarization uses 100-token segments, and all examples are truncated to 4096 tokens.Table 4 provides an overview of the training data.Source: §A.1 · p. 23
A.2 Implementation Details
KVLink is fine-tuned on mixed-source data to integrate disjoint context segments while preserving the LLM’s original capabilities. Training uses task-specific prompts and boundary/link tokens, while evaluation measures QA accuracy and general capability.
- Fine-tuning uses a mixed dataset from different sources to integrate disjoint context segments while preserving the LLM’s original capabilities.Source: §A.2 · p. 23
- Training uses randomly selected, GPT-4-generated system prompts tailored to SFT, QA, and summarization, and shuffles retrieved documents in QA data.Source: §A.2 · p. 23, Figure 5 · p. 24
- Reused contexts are marked with KV-START and KV-END, and each document’s link tokens depend on its index, following linkn-1 through linkn-K.For the n-th reused document, the tokens are linkn-1, linkn-2, ..., linkn-K when K link tokens are used.Source: §A.2 · pp. 23, 25
- QA accuracy counts a prediction as correct when any prediction substring exactly matches any gold answer, following [7] [21] [73] [74].Source: §A.2 · p. 25
- General capability preservation is evaluated with LM Evaluation Harness, using 8-shot GSM8K and 5-shot MMLU.Source: §A.2 · p. 25
A.3 More Implementation Details of Baselines
KVLink’s baselines differ in how they handle reused-document caches: BLOCKATTENTION concatenates them without special tokens, while PROMPTCACHE’s evaluation uses gold positions.
A.3 More Implementation Details of Baselines
- BLOCKATTENTION separately encodes reused documents or segments and concatenates their caches without special tokens; data without reuse is processed as in KVLink.For PROMPTCACHE, the original implementation does not adjust position encodings, but evaluation gives reused contexts gold position information to maximize performance.Source: §A.3 · p. 25
A.4 Ablation Studies on Data Mixure
Ablations under KVLINK5 indicate that cross-chunk reasoning tasks and diverse cache-reuse training data are important for robust reuse and generalization, while the optimal training mix remains unresolved.
A.4 Ablation Studies on Data Mixure
- Under KVLINK5, ablations indicate that cross-chunk reasoning tasks are essential for robust cache reuse and multiple cache-reuse data types improve generalization.The study compares No Summarization, No Multi-turn Conversation, and QA Only; the best training-data recipe for general cache reuse remains an open question.Source: §A.4 · p. 25
A.5 Impact of Answer Document Position … A.12 LLM Usage
These appendix sections examine answer-position sensitivity, compression training and storage trade-offs, compare KVLink with TurboRAG, and document limitations and research-use disclosures.
A.5 Impact of Answer Document Position
- Accuracy drops significantly when the correct answer document appears farther back in the context, supporting shuffled retrieved documents during QA training.The authors attribute the risk to relevance-ranked training data placing answer-containing documents near the front, which can teach the model to look there rather than reason across the context.Source: §A.5 · p. 25, Figure 6 · p. 26
A.6 Training of Modified ANLLM Compression
- Modified ANLLM compression is trained in continuous pre-training and QA-tuning stages.During pre-training, the former half is divided into 100-token segments; compression tokens attend to preceding compression tokens and original tokens in their segment, while latter-half tokens attend only to compression tokens. QA tuning adapts compression tokens for document compression and QA, with each document’s compression tokens unable to attend to one another.Source: §A.6 · pp. 25–27, Figure 7 · p. 26
A.7 Storage Demand of KV Cache Reuse
- KVLink can reduce storage use by combining with existing KV-cache compression methods, which the authors say can incur minimal performance loss when well designed.They also note that continued improvements in compression could further reduce storage demand.Source: §A.7 · p. 27
- For a 5,000-token input, KVLink cuts latency by 96% on an A100 80GB GPU.Under fixed GPU hours, it handles 25 times more requests than standard decoding; per million requests, it uses 9 GPU hours (16 USD) versus 246 GPU hours (440 USD).Source: §A.7 · p. 27
- Storage costs can be managed by caching high-hit-rate documents and placing infrequently accessed KV caches in cheaper storage such as SSDs.LRU or LFU can help select documents to cache, while frequently accessed caches can remain in faster CPU RAM.Source: §A.7 · p. 27
A.8 Comparison with TurboRAG
- Unlike TurboRAG’s offline, document-local boundary tokens, KVLink recomputes link-token caches at test time and trains them to reconnect separately encoded contexts.The authors report comparing the methods using replicated TurboRAG trained with the same data and setup, but the supplied passages do not state the Table 6 results.Source: §A.8 · p. 27, Table 6 · p. 27
A.9 Limitations
- KVLink still loses some performance after cache compression, and variable cache sizes complicate storage in vector databases.The authors identify larger-scale training and efficient organization of precomputed caches as possible ways to address these limitations.Source: §A.9 · p. 28
A.10 Societal Impact; A.11 License; A.12 LLM Usage
- The authors report using GPT-4 for proofreading, using datasets and software for their intended purposes, and finding no personal identifying or offensive content in their materials.They state that the training and evaluation data contain no private or sensitive information and that KV-cache reuse introduces no additional risks or bias; dataset licenses are listed across the materials.Source: §A.10 · p. 28, §A.11 · p. 28, §A.12 · p. 28
Related papers
This paper cites
- GPT-4 Technical Report2023
- RoFormer: Enhanced Transformer with Rotary Position Embedding2021
- Think you have Solved Question Answering? Try ARC, the AI2 Reasoning Challenge2018
- HotpotQA: A Dataset for Diverse, Explainable Multi-hop Question Answering2018
- Efficient Streaming Language Models with Attention Sinks2023
- Retrieval-Augmented Generation for Large Language Models: A Survey2023
Cited by
- FuseRAG: Fusing Structure and Evidence into Inference for Cost-Efficient Graph-based RAG2026
- Efficient KV Cache Migration for Geo-Distributed LLM Inference in Collaborative Edge Computing2026
- CacheSmith: Accurate RAG Serving under Latency SLOs with Adaptive KV Reuse2026
- Hybrid Reasoning Agents2026
- KV-Repurpose: A Testbed for Evaluating Non-Prefix KV-Cache Reuse2026
- Where Should a Document Live: Context, Representations, or Parameters?2026