Introduction
In modern Large Language Model (LLM) applications such as Retrieval-Augmented Generation (RAG) or multi-agent systems, models frequently process the same documents or context segments across multiple queries. Standard LLM architectures are inherently context-sensitive, encoding the entire input sequence as a single unit. Consequently, if a document appears in ten different queries, the model must re-calculate its Key-Value (KV) cache ten times, leading to significant "prefilling" costs and high latency.
Naively precomputing and storing KV caches for individual documents fails because LLMs rely on relative positions and global attention. Independently encoded documents suffer from positional mismatches and a lack of cross-document attention, which can lead to accuracy drops of up to 35%. KVLink addresses these challenges by enabling efficient KV cache reuse without sacrificing model performance.
Methodology
KVLink introduces two primary technical innovations to bridge the gap between independent encoding and global context awareness:
1. KV Cache Positional Re-encoding
Modern LLMs utilize Rotary Positional Embedding (RoPE), which encodes a token's position directly into its mathematical representation. When a document is encoded in isolation, its tokens are assigned initial positions (e.g., 0, 1, 2...). However, when concatenated into a larger context, their actual global positions change. KVLink decouples these embeddings during storage and applies the correct "global" rotation only at inference time, ensuring mathematical consistency across the sequence.
2. Trainable Link Tokens
To restore cross-document attention, KVLink inserts a small set of trainable "link tokens" (typically 1 to 5) between document segments. During inference, these link tokens are allowed to attend to all preceding segments, acting as a compressed bridge that facilitates information flow across concatenated contexts. This reconnection strategy allows the model to maintain the efficiency of independent encoding while recovering the performance of joint encoding.
Evaluation and Results
The authors evaluated KVLink across a diverse set of benchmarks, including Question Answering (NaturalQuestions, TriviaQA, HotpotQA), Summarization (MultiNews, Samsum), and general capabilities (MMLU, GSM8K).
Performance Gains
KVLink achieves a dramatic reduction in latency. For contexts of 5,000 tokens, it demonstrates a 96% reduction in time-to-first-token (TTFT). As context length increases, these efficiency gains become even more pronounced, allowing the system to handle significantly more requests under the same computational budget.
Accuracy and Robustness
Beyond speed, KVLink maintains high accuracy. On average, it improves QA accuracy by 4% over existing state-of-the-art methods like BlockAttention and PromptCache. In specific tasks like Natural Questions, it outperformed the best baseline by 6.6%. Furthermore, the model preserved its general reasoning and instruction-following capabilities, showing less than a 3% drop on standard benchmarks like MMLU compared to original Llama models.
Discussion and Future Work
KVLink demonstrates that full joint encoding is not strictly necessary for high-quality LLM outputs. By using link tokens as a lightweight interface, the framework achieves massive efficiency gains with minimal overhead.
However, challenges remain. KV caches are significantly larger than raw text, posing storage and systems engineering hurdles even with compression. While KVLink is compatible with cache compression techniques, extreme compression still leads to noticeable accuracy dips. Future research will focus on large-scale training specifically for the "compression and linking" phase to further close the performance gap and exploring more complex data mixtures to enhance reasoning across disjointed segments.
Summary updated