\(\text{C}^2\text{KV}\): Compressed and Composable KV Cache Reuse
for Efficient LLM Inference
July 20, 2026
Long-context inference is central to modern large language model (LLM) applications such as retrieval-augmented generation. To mitigate the growing inference cost, recent work has explored non-prefix key-value (KV) cache reuse to reduce redundant prefill computation. However, existing reuse methods primarily focus on computation savings and overlook a critical bottleneck in long-context LLM serving: the cost of storing and accessing large KV caches. While KV compression appears to be a natural complement, naively combining compression with non-prefix KV reuse often leads to severe accuracy degradation. In this work, we propose \(\text{C}^2\text{KV}\), a unified framework for non-prefix KV reuse that jointly optimizes KV cache compression and concatenation. \(\text{C}^2\text{KV}\) learns a composable and compressed KV cache manifold that is explicitly designed to be position-agnostic. Our approach introduces a lightweight sidecar Extractor with learnable compression tokens and a structured attention flow, enabling modular KV representations that can be flexibly reused and concatenated without modifying the frozen base model. We further employ a compression-concatenation co-training strategy to align extraction-time representations with their downstream reuse behavior. Extensive experiments across multiple long-context benchmarks and model families demonstrate that \(\text{C}^2\text{KV}\) significantly reduces KV cache storage and transfer costs, achieving up to 17\(\times\) inference speedup under long contexts, while preserving generation quality.
<ccs2012> <concept> <concept_id>10010147.10010178.10010179</concept_id> <concept_desc>Computing methodologies Natural language processing</concept_desc> <concept_significance>500</concept_significance> </concept> </ccs2012>
Large language models (LLMs) have been widely adopted across a broad range of applications, including question answering [1]–[3], personal assistants [4], [5] and knowledge-intensive reasoning systems [6]. In practical deployments, these applications are increasingly powered by in-context learning (ICL) paradigms such as retrieval-augmented generation (RAG) [7]–[10], agent systems with long-term memory [11], and few-shot learning [12]. A common characteristic of these workloads is the continuous growth of input context length [13]–[15], as each request injects multiple long documents into the model input.
As context lengths increase, LLM inference becomes prohibitively expensive. Given an input sequence of length \(L\), inference incurs a compute-intensive prefill stage with \(O(n^2)\) complexity to construct key-value (KV) caches, followed by autoregressive decoding where each generation step attends to all cached tokens, resulting in \(O(L)\) memory storage and bandwidth costs. Consequently, long-context inference simultaneously stresses GPU compute, memory capacity, and memory bandwidth, motivating the need for effective KV cache reuse mechanisms in LLM serving systems.
KV cache reuse has therefore attracted significant attention. Existing approaches can be broadly categorized into three classes. 1) Prefix-based reuse exploits identical prefixes across requests and enables exact KV reuse under standard causal attention; however, its applicability is severely limited in ICL workloads where repeated documents rarely appear at the same position. 2) To go beyond prefix matching, training-free non-prefix methods attempt to concatenate independently computed KV caches with limited recomputation to mitigate context mismatch, reducing prefill computation while preserving the original model. 3) In contrast, training-based approaches modify the attention structure or introduce auxiliary tokens during pretraining to enable more flexible reuse or compression, at the cost of altering the base model or introducing information bottlenecks.
While existing KV cache reuse techniques are effective at reducing recomputation, they largely overlook a growing bottleneck in long-context LLM inference: the cost of storing and accessing KV caches. In practical deployments, KV caches are often stored outside high-bandwidth accelerator memory and transferred on demand, making KV cache size and memory bandwidth critical factors as context length increases. As a result, previous works overlook a critical challenge in real-world LLM serving systems: the dominant bottleneck has shifted to KV cache storage and memory bandwidth.
This naturally motivates incorporating KV compression [16]–[20] into non-prefix KV reuse. However, this exposes two fundamental challenges. First, most existing compression schemes produce KV representations that are tightly coupled to their original context and thus non-composable, leading to significant accuracy degradation when reused or concatenated across different contexts. Second, there exists an architectural mismatch: long-context serving requires sequence-level compression, whereas many token-eviction methods rely on layer- or head-dependent selection, preventing consistent alignment once contexts are recomposed. As a result, even under the most reuse-compatible setting, naive compression remains fundamentally incompatible with non-prefix KV reuse, motivating a composability-aware design.
To resolve this tension, we propose \(\text{C}^2\text{KV}\), a unified framework for non-prefix KV reuse that jointly optimizes the KV extraction and inference-time concatenation, as shown in Figure 1. Unlike prior methods that directly compress or cache the original KV states, which are inherently context-dependent, \(\text{C}^2\text{KV}\) constructs a Composable and Compressed KV cache manifold. This manifold is specifically designed to be position-agnostic, allowing KV segments of various documents to be flexibly “plugged and played” at arbitrary positions within a long-context prompt.
The core of \(\text{C}^2\text{KV}\) is its \(\text{C}^2\)Extractor, a lightweight sidecar module that operates independently of the frozen base LLM. Unlike traditional fine-tuning, this “attached” module performs extraction without perturbing the model’s original parametric knowledge. To achieve efficient reuse, the \(\text{C}^2\)Extractor injects learnable \(\text{C}^2\)Tokens as compressed memory slots, whose interactions are governed by a novel Structured Attention Flow. This mechanism serves a dual purpose: first, it acts as a high-fidelity semantic aggregator that maximizes information retention via localized grouping; second, it ensures the resulting KV representations are modular and position-independent. This structured flow inherently facilitates seamless downstream concatenation while eliminating semantic cross-talk.
To further fortify the robustness of these compressed representations, we employ a Compression-Concatenation Co-training strategy. By supervising the model on generation tasks conditioned on concatenated KV segments, we implicitly steer the \(\text{C}^2\)Extractor to produce “merge-ready” states that maintain semantic coherence even when reordered. Consequently, \(\text{C}^2\)KV enables aggressive compression with minimal fidelity loss, significantly alleviating the storage and bandwidth bottlenecks of long-context inference.
Our main contributions are summarized as follows:
We show that the key challenge of KV cache reuse lies in storage and memory transfer overheads, whereas existing approaches only reduce recomputation and ignore the storage overhead.
We propose a unified training formulation that jointly optimizes KV extraction and inference-time KV concatenation, explicitly aligning the extracted representations with their reuse behavior under non-prefix inference.
We introduce a new attention information flow through a carefully designed attention mask to preserve generation accuracy when concatenating compressed KV caches.
Extensive experiments show that our method significantly reduces KV cache storage and transfer cost, achieving up to 17\(\times\) inference speedups over existing approaches, without degrading the inference quality.
The Transformer-based Large Language Model (LLM) generates tokens auto-regressively. To avoid redundant computations, Key-Value (KV) caching stores the intermediate attention states. Formally, for a sequence \(\{x_1, \dots, x_t\}\), the KV cache at layer \(l\) is:
\[\mathbf{K}_l = [k_1, \dots, k_t], \quad \mathbf{V}_l = [v_1, \dots, v_t].\]
During the generation of \(x_{t+1}\), the model only computes the KV pair for the new token and concatenates it with the existing cache. While accelerating standard inference, the sequential dependency of self-attention poses a challenge for reusing KV blocks in different contexts.
Existing LLM serving systems primarily utilize Prefix Caching (e.g., vLLM [21], RadixAttention [22]), which allows the reuse of KV states if the leading sequence of a new request exactly matches a previously cached one. This is achieved by simple position-aligned mapping. However, in complex scenarios such as multi-document RAG [23] or modular tool-use [24], reusable content (e.g., \(\text{Doc}_\text{A}, \text{Doc}_\text{B}\)) may appear in arbitrary orders or be interleaved with dynamic instructions. To address this, we move beyond prefix matching and consider a Non-Prefix Caching paradigm.
We define a generalized two-stage framework for non-prefix reuse. Given a request with a static context \(\mathbf{x}^{\text{s}}\), several independent cached documents \(\{\mathbf{x}^{\text{d}}_1, \dots, \mathbf{x}^{\text{d}}_K\}\), and a query \(\mathbf{x}^{\text{q}}\), the process is formalized as:
Encoding: An encoder \(\mathcal{M}\) (typically the base LLM itself or a specialized module) extracts KV representations from documents: \[\mathbf{KV}^{\text{reuse}}_k = \mathcal{M}(\mathbf{x}^{\text{d}}_k).\]
Blending: A blender \(\mathcal{B}\) adapts and integrates these pre-computed states into the new request context: \[\mathbf{KV}^{\text{total}} = \mathcal{B}(\mathbf{x}^{\text{s}}, \mathbf{KV}^{\text{reuse}}_1, \dots, \mathbf{KV}^{\text{reuse}}_K).\]
Inference: The LLM computes the final output: \[y = \mathcal{F}([\mathbf{KV}^{\text{total}}, \mathbf{x}^{\text{q}}]).\]
Based on the implementation of \(\mathcal{M}\) and \(\mathcal{B}\), current methods fall into two categories:
Training-Free Methods: These methods (e.g., CacheBlend [25], KVShare [26]) use the vanilla LLM as the encoder and employ selective recomputation as the blender to reconcile mismatched KV states.
Training-Based Methods: These methods (e.g., Block-Attention [27], KVLink [28]) modify the model’s architecture or fine-tune its weights so that it natively learns to process disjoint or reordered KV blocks.
Despite their potential, both categories of methods face critical bottlenecks that prevent efficient and lossless serving.
In training-free methods, the blender \(\mathcal{B}\) identifies a subset of tokens \(M(\mathbf{x})\) to recompute. However, since the remaining unrecomputed KV states were generated in a different context, there exists an inherent KV deviation (\(\Delta \mathbf{KV}\)): \[\Delta \mathbf{KV} = \bigl\lVert \mathbf{KV}^{\text{full}} - \mathbf{KV}^{\text{blend}} \bigr\rVert\;/\;\bigl\lVert \mathbf{KV}^{\text{full}}\bigr\rVert \ge \delta > 0.\] As shown in Figure 2, this deviation monotonically increases as the recomputation ratio decreases, creating a rigid trade-off between serving latency and model accuracy.
Training-based methods attempt to eliminate this gap by altering the self-attention mechanism, which suffers from:
Capability Loss: Altering attention patterns often leads to “catastrophic forgetting”. Our empirical study shows a Llama3.1-8B model fine-tuned with Block-Attention suffers a performance drop of up to \(10.4\%\) on LongBench.
Inflexibility: The high cost of per-model fine-tuning makes it difficult to adapt these methods to the rapid iteration of open-source base models.
Crucially, prior methods primarily focus on reducing blending computation, while overlooking the fact that modern long-context serving is increasingly memory-bound. As context length \(L\) grows, the KV cache size scales linearly, making the transfer of uncompressed KV states between memory hierarchies (e.g., from DRAM to HBM) the dominant latency factor. As illustrated in Figure 3, existing reuse methods reduce prefill cost by loading cached KVs from memory, but still do not address this storage pressure; moreover, naively applying KV compression to reused blocks leads to severe fidelity loss, as standard compressed representations are not designed to be composable or position-agnostic.
We propose a non-prefix KV cache reuse framework \(\text{C}^2\text{KV}\) that enables long documents to be compressed, stored, and directly reused at arbitrary positions. \(\text{C}^2\text{KV}\) augments a frozen base LLM with a lightweight trainable module, together forming the \(\text{C}^2\)Extractor, which produces compact and composable KV representations.
The pipeline consists of two stages. First, given a set of documents, the \(\text{C}^2\)Extractor encodes each document independently into a compressed, position-agnostic KV cache, referred to as \(\text{C}^2\)KV. The \(\text{C}^2\)Extractor employs Structured Information Flow to preserve the base model’s semantics while enabling compression. Second, at inference time, the requested \(\text{C}^2\)KV caches are retrieved, assigned positional embeddings according to their designated position, and directly concatenated to condition generation.
To ensure the validity of the extracted KV caches after concatenation, the \(\text{C}^2\)Extractor is trained using Compression-Concatenation Co-Training, jointly optimizing compression and generation under a single supervised objective. This design decouples document encoding from query-time generation, enabling efficient non-prefix reuse with reduced KV cache size and minimal impact on generation quality. An overview of the pipeline is illustrated in Figure 4.
The \(\text{C}^2\)Extractor is a lightweight module attached to a frozen base language model. It takes a document as input and produces a compressed, composable key-value representation, whose length is reduced by a \(k\!:\!1\) ratio. Given a document token sequence, the \(\text{C}^2\)Extractor outputs per-layer key-value pairs, referred to as \(\text{C}^2\)KVs, which are stored and later retrieved for downstream generation.
Compression is achieved by introducing a sequence of auxiliary tokens, referred to as \(\text{C}^2\)Tokens, into the document token stream. Given a compression ratio k, the number of \(\text{C}^2\)Tokens is determined as m = \(\lceil n / k \rceil\). The \(\text{C}^2\)Tokens are logically interleaved with the document tokens such that one \(\text{C}^2\)Token is associated with each consecutive block of \(k\) document tokens. All \(\text{C}^2\)Tokens share the same learnable embedding vector and do not correspond to any lexical content.
The core design of the \(\text{C}^2\)Extractor is a set of new, per-layer QKV projection heads that operate exclusively on the \(\text{C}^2\)Tokens. For each Transformer layer \(\ell\), the base model’s original QKV projections are kept frozen and are applied only to the original document tokens. In contrast, \(\text{C}^2\)Tokens are projected using separate trainable matrices: \[Q^{(\ell)}_{\text{C}^2} = W^{(\ell)}_{{\text{C}^2},Q} h^{(\ell)}_{\text{C}^2}, \quad K^{(\ell)}_{\text{C}^2} = W^{(\ell)}_{{\text{C}^2},K} h^{(\ell)}_{\text{C}^2}, \quad V^{(\ell)}_{\text{C}^2} = W^{(\ell)}_{{\text{C}^2},V} h^{(\ell)}_{\text{C}^2},\] where the projection dimensions exactly match those of the base model, ensuring compatibility with downstream attention operations.
The projected \(\text{C}^2\)QKV tensors are concatenated with the frozen QKV tensors of the original document tokens and passed into the standard attention operator. Only the parameters of the \(\text{C}^2\)Token embeddings and their associated QKV projection heads are trainable; all base model parameters remain frozen. This design adds around \(10\%\) of additional parameters to the base model for Qwen3-4B and Llama3.1-8B.
We also consider a variant of the Extractor that incorporates residual semantic aggregation, denoted as \(\text{C}^2\)KV-Residual. In this variant, at the first Transformer layer, we compute the mean of the hidden states of the k document tokens associated with a given \(\text{C}^2\)Token and add it to the \(\text{C}^2\)Token’s hidden state: \[h^{(\ell)}_{\text{C}^2} \leftarrow h^{(\ell)}_{\text{C}^2} + \frac{1}{k} \sum_{i \in \mathcal{B}} h^{(\ell)}_i,\] where \(\mathcal{B}\) denotes the corresponding document token block. The scaling factor is fixed to \(1.0\). This residual pathway provides an explicit aggregation of local document semantics and improves robustness under compression.
After extraction, only the KV pairs associated with the \(\text{C}^2\)Tokens are retained as \(\text{C}^2\)Extractor KVs. During inference, the retrieved KVs are applied new positional embeddings according to their placement in the final input sequence, where positional offsets are accumulated across concatenated segments and each compressed KV segment is treated as occupying the same effective span as its original uncompressed tokens. The compressed KV segments are then directly concatenated and used to condition downstream generation, without reintroducing the original tokens.
The goal of Structured Information Flow (SIF) is to enable semantic extraction and compression without altering the behavior of the frozen base model. To this end, we impose a block-structured attention pattern that strictly separates the information pathways of Original Tokens and \(\text{C}^2\)Tokens during extraction.
Given a document token sequence \(x_{1:n}\), we partition it into contiguous blocks of size \(k\). For each block \(\mathcal{B}(j)=\{(j-1)k+1,\ldots,\min(jk,n)\}\), we introduce exactly one \(\text{C}^2\)Token \(c_j\). Conceptually, \(c_j\) is placed after all tokens in its corresponding block, so that standard causal attention suffices to enforce block-local visibility. For implementation convenience, all \(\text{C}^2\)Tokens are physically grouped after the document tokens, and logical block boundaries are enforced solely through the attention mask. Each \(\text{C}^2\)Token is assigned the same position index as the last token in its block. This positional assignment is used only during extraction; the resulting key-value pairs are stored before positional embeddings are applied.
At every layer, we apply an attention mask that enforces the following constraints.
Original-token invariance. Original Tokens are allowed to attend only to other Original Tokens under the standard causal mask. Attention from Original Tokens to any \(\text{C}^2\)Token is strictly disallowed: \[M_{o,c}=-\infty \quad \forall\, o\in\mathcal{O},\; c\in\mathcal{C}.\] As a result, the hidden states and KV caches of Original Tokens are identical to those produced by the frozen base model.
Block-local semantic extraction. Each \(\text{C}^2\)Token \(c_j\) may attend only to the Original Tokens in its own block \(\mathcal{B}(j)\) and the sink block \(\mathcal{B}(0)\): \[M_{c_j,o}=0 \;\; \forall\, o\in\mathcal{B}(j)\cup\mathcal{B}(0),\; M_{c_j,o}=-\infty \;\; \forall\, o\notin\mathcal{B}(j)\cup\mathcal{B}(0).\] Since \(c_j\) is conceptually positioned at the end of the block, causal masking guarantees that it can attend to all tokens within \(\mathcal{B}(j)\) while preventing access to tokens beyond the block boundary. This enforces a \(k\!:\!1\) structure and prevents global information leakage during extraction.
Causal accumulation across blocks. To allow compressed representations to accumulate document-level context, \(\text{C}^2\)Tokens may attend to preceding \(\text{C}^2\)Tokens causally. This enables later blocks to incorporate information from earlier compressed segments, while preserving autoregressive consistency.
Figure 6 contrasts our Structured Attention Flow with anchor token-based compression methods, which also interleave auxiliary tokens into the input sequence. While both approaches introduce extra tokens, they serve fundamentally different purposes. Anchor tokens are designed as semantic bottlenecks for context compression and rely on bidirectional attention between original tokens and anchor tokens. As a result, original token representations are modified through anchor tokens, and the resulting KV cache is inherently entangled with the full input context.
In contrast, \(\text{C}^2\)Tokens are introduced as latent KV carriers rather than semantic bottlenecks. Information flows only from original tokens to \(\text{C}^2\)Tokens in a block-local and causal manner. This asymmetry is critical: it allows the extracted \(\text{C}^2\)KVs to be context-independent, composable, and directly reusable across requests. Consequently, although anchor token-based methods are effective for compressing context within a single input, they are fundamentally incompatible with non-prefix KV cache reuse. Our design replaces semantic compression with structural KV extraction, enabling reuse by construction rather than approximation.
The objective of compression-concatenation training is to ensure that document-level compression and KV cache concatenation are , so that independently extracted KV caches remain valid and useful after being composed in arbitrary multi-document contexts.
The entire model is trained using a single supervised fine-tuning objective on the generated answer. Let \(\mathbf{K}_{\text{cat}}, \mathbf{V}_{\text{cat}}\) denote the concatenated document KV cache, and let \(q_{1:m}\) and \(y_{1:T}\) denote the query and answer tokens. The training loss is the standard autoregressive language modeling loss: \[\mathcal{L}_{\text{SFT}} = - \sum_{t=1}^{T} \log p\bigl(y_t \mid y_{<t}, q_{1:m}, \mathbf{K}_{\text{cat}}, \mathbf{V}_{\text{cat}}\bigr).\] No auxiliary reconstruction loss, alignment loss, or document-level supervision is introduced. Gradients are propagated exclusively to the parameters of the \(\text{C}^2\)Extractor, including the \(\text{C}^2\)Token embeddings and their dedicated QKV projection heads; all base model parameters remain frozen.
Although documents are extracted independently, supervision is applied only after concatenation. Each document’s \(\text{C}^2\)KV cache is optimized based on its contribution to answering the query in the presence of other documents. Since document order and the number of documents vary across training samples, the Extractor is forced to project document semantics into a KV cache manifold that remains valid under different compositions. Importantly, compression and concatenation are not optimized in isolation. A document KV cache that compresses too aggressively but fails after concatenation will incur higher generation loss, as will a KV cache that only functions in a fixed global context. Through end-to-end supervision, the Extractor learns a representation that balances both requirements and maps document tokens into a compression concatenation enabled KV manifold.
We train the \(\text{C}^2\)Extractor using multi-document supervised fine-tuning (SFT) question-answering data, while keeping all Base Model parameters frozen. The training corpus is constructed from the training splits of three publicly available QA datasets: HotpotQA [29], 2WikiMultiHopQA [30], and LongMagpie [31]. Together, these datasets cover a wide range of multi-document reasoning scenarios, making them suitable for learning document-level KV extraction under non-prefix reuse settings.
Each instance is formatted using the target model’s official chat template, including a system prompt, documents, user question, and reference answer. To improve formatting robustness and reduce verbosity, both system prompts and QA instructions are randomly sampled from a small prompt pool. During extraction, document tokens do not attend to system tokens; system KVs are concatenated only at generation time.
For evaluation, we use the LongBench [32] benchmarks. For the single-document subsets in LongBench, we partition each document into natural paragraphs and treat them as multiple documents, enabling evaluation of non-prefix KV reuse.
We adopt task-appropriate evaluation metrics following prior works. For question-answering tasks, we report the F1 score, which measures token-level overlap between the predicted answers and the ground-truth references. For summarization tasks, we report ROUGE-L, which evaluates sequence-level similarity based on the longest common subsequence between the generated and reference summaries.
We conduct experiments using three widely adopted instruction-tuned large language models: Qwen3-4B-Instruct-2507 [33], Llama-3.1-8B-Instruct [34], and Qwen2.5-7B-Instruct [35]. These models cover different architectures and parameter scales, allowing us to evaluate the robustness of our method across model families.
We compare \(\text{C}^2\text{KV}\) against 5 baselines:
Full KV Recompute (FR): The model performs a full prefill for every request without any KV reuse, serving as an accuracy and computation upper bound;
Full KV Reuse (Reuse): KV caches of reusable documents are directly reused without correction or retraining, representing an aggressive but error-prone lower bound;
EPIC [36]: A selective recompute reuse method that choose tokens by a static pattern;
CacheBlend [25]: A selective recompute reuse method that recomputes tokens by value differences to mitigate errors.
Block-Attention [27]: A training-based baseline by continue-training with no cross-attention between documents.
In this experiment, we focus on Time-to-First-Token (TTFT) under a document-reuse serving scenario, where a document corpus is available and document KV caches can be pre-extracted offline. TTFT is defined as the time elapsed from receiving a user request to the moment when the language model has its past KV cache fully prepared on GPU and is ready to start decoding the first output token.
Under this definition, different methods incur TTFT from different sources:
Full Recompute (FR) must prefill the entire document context online and thus its TTFT corresponds to the full-context prefill latency.
Non-prefix reuse methods load precomputed document KVs from host memory and additionally perform blending or structural transformations before decoding.
\(\text{C}^2\text{KV}\) loads compressed document KVs from host memory and directly reassigns positions without any blending, reducing TTFT to a load-only operation.
Although different reuse methods may employ different KV compression ratios, this difference reflects their inherent design goals. In particular, \(\text{C}^2\text{KV}\) jointly performs KV compression (4\(\times\)) and reuse.
Figure 7 shows the trade-off between time-to-first-token (TTFT) and task accuracy across seven LongBench tasks and three instruction-tuned LLMs. Each point corresponds to the average TTFT and task score of a method on the full test set, where lower TTFT and higher accuracy are preferable. This analysis reveals how different KV reuse strategies balance startup latency against generation quality:
While FR consistently achieves the highest accuracy by prefilling the entire context online, it suffers from prohibitive TTFT. This establishes a performance ceiling for accuracy but highlights the critical need for efficient KV reuse in long-context workloads.
Prior non-prefix reuse approaches reduce TTFT (shifting leftward in the plot) but introduce substantial accuracy instability. Methods like EPIC and CacheBlend, which rely on KV blending, require complex preparation and exhibit sensitivity to architectural changes, leading to degraded performance in multi-document reasoning.
\(\text{C}^2\text{KV}\) achieves minimal TTFT and competitive accuracy simultaneously, occupying the optimal upper-left region of the trade-off plot. Its learnable, composable KV representation transforms preparation into a load-only operation, eliminating errors from blending. While the \(\text{C}^2\text{KV}\)-Residual variant improves stability on specific tasks, the vanilla \(\text{C}^2\text{KV}\) delivers the best overall efficiency-performance balance.
Finally, we note that this experiment isolates TTFT, which dominates user-perceived latency for long-context requests. Together with the decode-time results presented in the next section, these findings show that \(\text{C}^2\text{KV}\) improves both request startup latency and steady-state generation efficiency.
We evaluate decode-stage efficiency using average time per token (TBT), isolating memory bandwidth costs by excluding prefill. All methods use identical decoding settings with KV reuse applied before decoding, and results are shown in Figure 8. Our findings are summarized as follows.
As context length grows from 16k to 128k tokens, per-token decode latency increases for all methods due to longer attention contexts. Full-length KV caches exhibit near-linear scaling, indicating severe memory bandwidth pressure. In contrast, \(\text{C}^2\text{KV}\) compresses the KV footprint and largely flattens the decode-time curve, showing only a mild increase even at 128k tokens across all models. Shrinking the effective KV cache size directly translates into lower time-between-tokens (TBT) under long-context decoding.
Beyond eliminating redundant prefill computation, \(\text{C}^2\text{KV}\) delivers sustained performance benefits during decoding, where KV access dominates user-perceived latency. These results highlight that non-prefix KV reuse, when combined with effective KV compression, yields system-level gains throughout the entire inference pipeline.
| LLama3.1-8B | MuSiQue | WikiMQA | SAMSum | MultiNews |
|---|---|---|---|---|
| Full | 0.3198 | 0.4018 | 0.3652 | 0.2685 |
| Naïve reuse | 0.1970 | 0.2681 | 0.3172 | 0.2674 |
| EPIC | 0.2498 | 0.2821 | 0.4217 | 0.2630 |
| CacheBlend | 0.2720 | 0.1334 | 0.3379 | 0.2126 |
| -4x | 0.3587 | 0.4477 | 0.3904 | 0.2532 |
| -8x | 0.3225 | 0.4462 | 0.2572 | 0.2351 |
| -16x | 0.2746 | 0.3973 | 0.3556 | 0.2234 |
| -Dyn-4xTest | 0.3457 | 0.4680 | 0.3779 | 0.2503 |
| -Dyn-8xTest | 0.3285 | 0.4555 | 0.3694 | 0.2428 |
| -Dyn-10xTest | 0.3198 | 0.4310 | 0.3570 | 0.2357 |
| -Dyn-16xTest | 0.2831 | 0.4298 | 0.3525 | 0.2343 |
We further evaluate how \(\text{C}^2\text{KV}\) scales under different KV compression ratios on Llama3.1-8B. Table 1 compares \(\text{C}^2\text{KV}\) with existing non-prefix reuse methods under both fixed and dynamic compression settings.
As the compression ratio increases from \(4\times\) to \(16\times\), \(\text{C}^2\text{KV}\) exhibits graceful degradation and remains substantially more robust than existing reuse methods. Even under aggressive compression, \(\text{C}^2\text{KV}\) preserves competitive performance across both QA and summarization tasks, demonstrating that the extracted KV representations remain stable and composable under large sequence reduction ratios.
We further train a single model by randomly sampling compression ratios from \(\{4\times, 8\times, 16\times\}\) at each training step. The resulting model generalizes effectively across different inference-time compression budgets, including the unseen \(10\times\) setting. Compared with fixed-ratio training, dynamic-ratio training consistently improves robustness and achieves stronger overall performance across varying compression levels.
Overall, these results demonstrate that \(\text{C}^2\text{KV}\) provides a unified framework for composable KV reuse and scalable KV compression, while maintaining strong accuracy across a wide range of compression budgets.
We further evaluate \(\text{C}^2\text{KV}\) on the RULER benchmark under 4\(\times\) KV compression. To support long-context evaluation, each input context is split into segments of approximately 4k tokens before extraction and KV reuse. Figure 9 reports the average retrieval score across different context lengths and answer depths.
\(\text{C}^2\text{KV}\) maintains stable retrieval performance as the context length increases from 4k to 64k tokens, demonstrating effective long-range information preservation under compressed KV reuse.
Despite operating with 4\(\times\) compressed KV caches, \(\text{C}^2\text{KV}\) achieves only limited degradation compared with the original models, showing that composable KV compression can preserve strong long-context reasoning capability.
| Qwen3-14B | MuSiQue | WikiMQA | SAMSum | MultiNews |
|---|---|---|---|---|
| Full | 0.4384 | 0.5514 | 0.4060 | 0.2472 |
| Naïve reuse | 0.1046 | 0.3184 | 0.2055 | 0.2421 |
| EPIC | 0.2645 | 0.3826 | 0.4093 | 0.2472 |
| CacheBlend | 0.4187 | 0.3955 | 0.3782 | 0.2413 |
| -4x | 0.4311 | 0.5625 | 0.4105 | 0.2478 |
| -8x | 0.4043 | 0.5654 | 0.3835 | 0.2448 |
| -16x | 0.3342 | 0.5679 | 0.3871 | 0.2403 |
To evaluate whether \(\text{C}^2\text{KV}\) scales to larger model sizes, we further conduct experiments on Qwen3-14B and report the results in Table 2. We compare \(\text{C}^2\text{KV}\) against existing non-prefix reuse baselines under multiple compression ratios.
The results show that \(\text{C}^2\text{KV}\) consistently maintains strong performance across all tasks while enabling substantial KV compression. In particular, \(C^2\)KV-4x-Res achieves accuracy close to or exceeding the full-context baseline on MuSiQue, SAMSum, and MultiNews, while significantly outperforming existing reuse methods on multi-document QA tasks such as WikiMQA. Moreover, the performance degradation of \(\text{C}^2\text{KV}\) remains gradual as the compression ratio increases from \(4\times\) to \(16\times\), demonstrating favorable scaling behavior under aggressive compression settings.
These results indicate that the composable KV representations learned by \(\text{C}^2\text{KV}\) generalize effectively to larger LLMs and remain stable under high compression ratios.
| Dataset | FR | +SnapKV | Naive | +SnapKV | BlockAttn | +SnapKV | Epic | +SnapKV | CacheBlend | +SnapKV |
|---|---|---|---|---|---|---|---|---|---|---|
| HotpotQA | 0.5343 | 0.5045 | 0.3973 | 0.0547 | 0.4271 | 0.0743 | 0.4363 | 0.0897 | 0.2970 | 0.0532 |
| MuSiQue | 0.3198 | 0.1615 | 0.1821 | 0.1366 | 0.2572 | 0.0657 | 0.2498 | 0.1799 | 0.2720 | 0.1311 |
| MultiNews | 0.2685 | 0.2421 | 0.2682 | 0.2179 | 0.2763 | 0.2202 | 0.2651 | 0.2300 | 0.2126 | 0.2177 |
| SAMSum | 0.3652 | 0.3582 | 0.3151 | 0.1215 | 0.3599 | 0.1266 | 0.4217 | 0.1867 | 0.3379 | 0.1650 |
| 2WikiMQA | 0.4018 | 0.3438 | 0.2602 | 0.0936 | 0.3886 | 0.1396 | 0.2821 | 0.1681 | 0.1334 | 0.0765 |
To validate the claim that naively combining KV reuse with generic compression degrades accuracy, we conduct a motivating experiment. Table 3 reports LongBench accuracy when a generic KV compression method, SnapKV (\(4\times\) compression on all layers), is applied prior to KV reuse strategies. Across all reuse methods, directly stacking SnapKV with KV reuse results in severe accuracy loss. This pattern is consistent across tasks and models, showing that generic KV compression, while reducing cache size, is incompatible with non-prefix KV reuse without composability-aware adaptation.
These results motivate our design: compressing KV caches naively further distorts already non-composable KV representations, compounding errors during reuse. KV compression and reuse must therefore be jointly designed within a unified framework that produces KV representations both compressible and composable.
| Ablation Methods | Qasper | SAMSum | GovReport |
|---|---|---|---|
| Base Model | 0.4417 | 0.3652 | 0.3274 |
| Anchor Tokens | 0.2750 | 0.3201 | 0.1280 |
| -Res. (4x) w/o T. | 0.1572 | 0.3042 | 0.1318 |
| -Residual (4x) | 0.3185 | 0.3330 | 0.2802 |
| (4x) Fixed-Pos. | 0.2827 | 0.3303 | 0.2801 |
| (4x) Info-Leakage | 0.2577 | 0.3406 | 0.2543 |
| (4x) Global-Info | 0.3722 | 0.3810 | 0.2888 |
| (4x) | 0.3755 | 0.3904 | 0.2967 |
We conduct ablation studies to validate the key designs of \(\text{C}^2\text{KV}\). Table 4 shows that replacing Structured Information Flow with bidirectional Anchor Tokens causes large accuracy degradation, indicating that unrestricted information mixing breaks KV composability. Directly using the untrained Extractor also fails severely, showing that composable KV representations must be learned.
\(\text{C}^2\text{KV}\)(4x) Fixed-Pos. disables reuse-time positional re-rotation and consistently reduces accuracy, validating the necessity of position re-alignment after KV concatenation.
Relaxing block-local constraints through Info-Leakage or Global-Info attention harms performance across all tasks. These results show that stable KV reuse requires strict structural isolation and localized information aggregation.
Overall, the results support the core principles of \(\text{C}^2\text{KV}\): structured extraction, learned composable representations, and reuse-time positional alignment.
Efficient KV cache reuse is critical for reducing Time-to-First-Token (TTFT) and computational redundancy. Prefix-based methods, such as PromptCache [37], PagedAttention [21] and Radix-Attention [22], cache KV states of common prefixes in a tree structure to avoid recomputation across multiple requests. To handle non-prefix scenarios, training-free approaches like CacheBlend [25] and Cache-Craft [38] enable arbitrary text chunk reuse via selective recomputation and KV state alignment, though they may suffer from slight accuracy degradation. Training-based methods, including TurboRAG [39] and Block-Attention [27], modify model architectures or employ fine-tuning to support modular cache stitching (e.g., independent attention blocks). While these offer better generation quality, they require significant training overhead and risk compromising the base model’s general capabilities.
To mitigate LLM memory bottlenecks, KV cache compression reduces per-token storage. Quantization methods like CommVQ [40] or MiniKV [41] achieve ultra-low bit-precision (e.g., 2-bit) while preserving accuracy. Eviction strategies, such as SnapKV [42] and RocketKV [43], identify and retain crucial tokens via attention-driven scores or reconstruction importance. Furthermore, Merging and Low-rank approaches like MiniCache [44] or ReCalKV [45] consolidate redundant KV states across layers or attention heads. These techniques maximize memory efficiency and, when paired with reuse, significantly scale long-context processing.
In this work, we identify KV cache storage and memory bandwidth as the key bottlenecks in non-prefix KV reuse for long-context LLM inference. We show that existing reuse and compression methods are fundamentally limited by the non-composability of standard KV representations. To address this, we propose \(\text{C}^2\text{KV}\), a unified framework that learns a composable and compressed KV cache manifold through a lightweight extractor and structured attention, while keeping the base model frozen. Extensive experiments demonstrate that \(\text{C}^2\text{KV}\) enables efficient KV reuse and compression without degrading generation quality, substantially reducing inference overhead under long contexts.
This work was sponsored in part by China NSF grant No. 62441236, 62472278, 62432007, 62332014, 62332013, and 62372296, and Shanghai QiYuan Innovation Foundation. This work was partially supported by Alibaba Group through the Alibaba Innovation Research Program and in part by SJTU Kunpeng & Ascend Center of Excellence. The opinions, findings, conclusions, and recommendations in this paper are those of the authors and do not necessarily reflect the views of the funding agencies or the government.
In this appendix, we report the following sections as supplementary materials for the main paper.
Appendix 8 shows the dataset setup for training and evaluation.
Appendix 9 shows the detailed TTFT measurement protocol.
Appendix 10 gives full results for accuracy evalution.
Appendix 11 lists the limitations and future work.
We train the \(\text{C}^2\)Extractor using supervised fine-tuning on multi-document instruction-following data sampled from HotpotQA, 2WikiMQA, and LongMagpie. We sample 40k instances from each dataset, resulting in 120k total training samples, and train for one epoch only. For LongMagpie, long passages are segmented into multiple documents using sentence- or paragraph-aware splitting.
The base LLM remains frozen throughout training. Only the C\(^2\) token embeddings and per-layer QKV projection heads are trainable. We use AdamW with cosine learning rate scheduling under the following settings: Learning rate: 5e-5, Warmup ratio: 0.06, Weight decay: 0.1, Global batch size: 32, Gradient accumulation: 4 and Precision: BF16.
We evaluate \(\text{C}^2\text{KV}\) on LongBench datasets covering multi-document QA and long-form summarization, including HotpotQA, 2WikiMQA, MuSiQue, MultiNews, SAMSum, QMSum, and GovReport.
For QA tasks, we report F1 following official evaluation protocols. For summarization tasks, we report ROUGE-L. All methods use greedy decoding, with maximum generation lengths of 32 tokens for QA and 512 tokens for summarization.
This section formalizes the protocol used to measure Time-to-First-Token (TTFT) in our system-level evaluations.
TTFT is defined as the elapsed wall-clock time from when a user request arrives to when the language model has its past key–value cache fully prepared on GPU and is ready to start decoding the first output token.
We explicitly exclude the prefill cost of system prompts and query tokens from TTFT for all methods, as their lengths are short and negligible relative to long-context document processing. Offline document KV extraction time is also excluded. All timing measurements are synchronized using torch.cuda.synchronize() to ensure accurate GPU timing.
Under this definition, TTFT is measured as follows:
Full Recompute (FR): TTFT equals the wall-clock time of performing a full prefill over the entire document context to construct the KV cache, since non-prefix document reuse is not supported.
Load+Blend Methods: TTFT is the sum of loading precomputed document KVs from host memory to GPU and executing GPU-side KV blending or structural transformation kernels. These components are profiled separately and summed.
\(\text{C}^2\text{KV}\): TTFT includes loading compressed document KVs from host memory to GPU and lightweight positional reassignment and RoPE re-rotation. No blending or recomputation is required.
| Multi-Document Information Retrieval | Few-shot Learning | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| 2-8 (l)9-10 | QA | Summary | QA | Summary | |||||
| 2-6 (lr)7-8 (l)9-10 | HotpotQA | 2WikiMQA | MuSiQue | QMSum | Qasper | MultiNews | GovReport | GSM8K | SAMSum |
| FR (1\(\times\)) | 0.5392 | 0.4095 | 0.1991 | 0.2419 | 0.3074 | 0.2386 | 0.2826 | 0.8953 | 0.3846 |
| FR-SnapKV (4\(\times\)) | 0.3715 | 0.2930 | 0.0821 | 0.2022 | 0.2055 | 0.2087 | 0.2602 | 0.9007 | 0.3697 |
| Naive (1\(\times\)) | 0.2486 | 0.2035 | 0.0339 | 0.1820 | 0.2521 | 0.2388 | 0.2666 | 0.7448 | 0.3296 |
| Epic (1\(\times\)) | 0.3266 | 0.2412 | 0.0492 | 0.2151 | 0.2697 | 0.2364 | 0.2565 | 0.8999 | 0.3795 |
| CacheBlend (1\(\times\)) | 0.3487 | 0.2522 | 0.2049 | 0.1573 | 0.1730 | 0.2398 | 0.1680 | 0.8999 | 0.3772 |
| \(C^2\)KV-Res. (4\(\times\)) | 0.3482 | 0.4419 | 0.2194 | 0.2175 | 0.2662 | 0.2506 | 0.2830 | 0.8837 | 0.3883 |
| \(C^2\)KV (4\(\times\)) | 0.3801 | 0.3920 | 0.2300 | 0.1824 | 0.3344 | 0.2529 | 0.2744 | 0.8730 | 0.3836 |
| FR (1\(\times\)) | 0.5343 | 0.4018 | 0.3198 | 0.2452 | 0.4417 | 0.2685 | 0.3274 | 0.6914 | 0.3652 |
| FR-SnapKV (4\(\times\)) | 0.5045 | 0.3438 | 0.1615 | 0.2201 | 0.2836 | 0.2421 | 0.2811 | 0.6990 | 0.3582 |
| Naive (1\(\times\)) | 0.3973 | 0.2602 | 0.1821 | 0.2075 | 0.3804 | 0.2682 | 0.2573 | 0.4263 | 0.3151 |
| Epic (1\(\times\)) | 0.4363 | 0.2821 | 0.2498 | 0.2231 | 0.4109 | 0.2630 | 0.2782 | 0.7319 | 0.4217 |
| CacheBlend (1\(\times\)) | 0.2970 | 0.1334 | 0.2720 | 0.1967 | 0.2107 | 0.2126 | 0.1860 | 0.6895 | 0.3379 |
| Block-Attn (1\(\times\)) | 0.4271 | 0.3886 | 0.2572 | 0.2161 | 0.3433 | 0.2763 | 0.2595 | 0.6371 | 0.3599 |
| \(C^2\)KV-Res. (4\(\times\)) | 0.4173 | 0.4526 | 0.3395 | 0.2310 | 0.3185 | 0.2448 | 0.2802 | 0.7189 | 0.3330 |
| \(C^2\)KV (4\(\times\)) | 0.4828 | 0.4477 | 0.3587 | 0.1885 | 0.3755 | 0.2532 | 0.2967 | 0.6175 | 0.3904 |
| FR (1\(\times\)) | 0.5848 | 0.4332 | 0.3448 | 0.2266 | 0.4358 | 0.2475 | 0.3073 | 0.7991 | 0.4048 |
| FR-SnapKV (4\(\times\)) | 0.4871 | 0.3060 | 0.1829 | 0.1988 | 0.2755 | 0.2166 | 0.2858 | 0.8701 | 0.4027 |
| Naive (1\(\times\)) | 0.3901 | 0.2700 | 0.1321 | 0.1820 | 0.3232 | 0.2314 | 0.2716 | 0.5737 | 0.3621 |
| Epic (1\(\times\)) | 0.4360 | 0.2610 | 0.2211 | 0.1992 | 0.3663 | 0.2361 | 0.2727 | 0.7212 | 0.4113 |
| CacheBlend (1\(\times\)) | 0.1903 | 0.3244 | 0.2224 | 0.1530 | 0.2001 | 0.2463 | 0.1642 | 0.8365 | 0.3063 |
| \(C^2\)KV-Res. (4\(\times\)) | 0.4606 | 0.4655 | 0.3655 | 0.2152 | 0.3019 | 0.2486 | 0.2812 | 0.7502 | 0.3805 |
| \(C^2\)KV (4\(\times\)) | 0.4795 | 0.4718 | 0.2856 | 0.1879 | 0.3491 | 0.2453 | 0.2987 | 0.7141 | 0.3754 |
We evaluate non-prefix KV cache reuse across multiple models and tasks under a unified setup. KV reuse is applied only to document tokens, while query and generation tokens are always computed online. Block-Attention results are reported only for Llama-3.1-8B-Instruct due to checkpoint availability.
As shown in Table 5, \(\text{C}^2\text{KV}\) maintains strong accuracy under \(4\times\) KV compression, consistently approaching Full KV Recompute (FR) across models and tasks. This demonstrates that non-prefix KV reuse can remain accurate when using composable KV representations.
In contrast, directly concatenating standard KV caches causes severe degradation on multi-document QA tasks, revealing the non-composability of vanilla self-attention KV representations. Training-free reuse methods such as EPIC and CacheBlend partially improve over naive reuse but exhibit unstable performance across models and datasets.
Under the same compression ratio, \(\text{C}^2\text{KV}\) achieves the best or near-best accuracy among reuse-based approaches on most tasks. Compared with generic KV compression methods such as SnapKV, \(\text{C}^2\text{KV}\) attains comparable or better accuracy while additionally supporting composable KV reuse.
While \(\text{C}^2\text{KV}\) effectively enables compressed and composable non-prefix KV reuse, it has several limitations that suggest directions for future work. First, \(\text{C}^2\text{KV}\) focuses on document-level reuse and assumes that reusable content can be identified and extracted offline. Extending the extractor to support online or incremental KV extraction is an important direction. Second, our current design applies a uniform compression ratio across documents and layers. Future work could explore adaptive or content-aware compression strategies that preserve the composability property while allocating compression budgets more flexibly.