[KongchangAI]
· 2 min read· 1,268 words

Cross-Version KV Cache Reuse: A DeepSeek-V4-Flash Case Study

Cross-Version KV Cache Reuse: A DeepSeek-V4-Flash Case Study

DeepSeek-V4-Flash case reveals cross-version KV Cache reuse can accelerate but carries fidelity risks.

This case study examines direct KV Cache reuse across four DeepSeek-V4-Flash model updates. Reusing source caches retained useful task information and delivered a median 2.10-5.08x speedup in time to first token, but retrieval accuracy fluctuated significantly and reused caches did not faithfully reproduce updated model behavior. The study proposes functional cache divergence to quantify behavioral deviation via next-token distributions, finding natural text continuation preserves fidelity better while single-token retrieval degrades with longer prefixes. Answer margin analysis shows matching first tokens don't guarantee consistent answers or stopping behavior. The study establishes a dual-criteria evaluation framework of task utility and fidelity.

Introduction: The Promise and Challenges of Cross-Version KV Cache Reuse

In large language model inference, KV Cache is a key technique for avoiding redundant computation over shared context. But when model weights are updated, can the old KV Cache still be reused directly? A case study on DeepSeekAd-V4-Flash offers a detailed answer. The study examines direct cache reuse across four model updates, focusing on the migration from DeepSeek-V4-Flash to Flash-0731. The core finding is: caches can retain useful task information, yet they may not faithfully reproduce the behavior of the updated model. This defines the capability boundaries of cross-version cache reuse.

KV Cache reuse research diagram

KV Cache (key-value cache) is a memory mechanism used by Transformer decoders during autoregressive generation: for each generated token, the model computes and caches key (Key) and value (Value) vectors for all previous tokens, so subsequent steps only need to compute the key-values of the new token, avoiding repeated attention computation over the shared prefix. In long-context scenarios, KV Cache can occupy a major portion of GPU memory and directly determines inference throughput and latency. Cross-version reuse means: after model weights are updated, still attempting to feed the KV Cache generated by the old version directly into the new version model, skipping the prefill stage. This requires the new model to "understand" the key-value representations produced by the old model, while weight updates may change the representation space, so whether reuse is effective becomes a key question.

Core Finding: The Separation of Task Utility and Behavioral Fidelity

The research team tested the effect of directly reusing the source model's KV Cache on three long-prefix question-answering benchmarks. Results show that retrieval accuracy fluctuates significantly across updates, ranging from near-native performance to substantial loss. Given a ready source cache, reuse delivered a median 2.10 to 5.08 times speedup in time to first token. This speedup indicates that reuse can indeed save considerable computational overhead.

However, the speedup is not without cost. A separation emerged between the task information retained by the cache and the model's actual behavior: even when the cache helps the model make correct retrieval decisions, its internal state has already deviated from the updated native model. This separation gives rise to two independent criteria for evaluating cross-version cache reuse: task utility (whether the task can be completed) and fidelity (whether it is faithful to native inference).

Time to First Token (TTFT) is a core metric for measuring inference service responsiveness, referring to the latency from when a request is issued to when the model generates the first output token. For long-prefix inputs, TTFT is mainly determined by the prefill stage: the model must perform a forward pass over the entire prefix and build the KV Cache. Directly reusing an existing KV Cache can skip prefill, thus significantly reducing TTFT. The 2.10 to 5.08 times speedup reported in the article was measured precisely under the premise that the source cache was ready and no recomputation was needed. Note that this speedup only reflects savings in computational overhead and does not directly indicate the impact of reused cache on generation quality, which must be evaluated separately through task utility and fidelity.

Methodological Innovation: Measuring Functional Cache Divergence

To characterize the behavioral differences between reused and native caches, the study proposes Functional Cache Divergence, which quantifies the degree of deviation by comparing the next-token distributions under reused and native caches. This metric goes beyond traditional accuracy evaluation and directly touches on changes in the model's internal state.

The analysis reveals a significant impact of task type on compatibility: in natural text continuation tasks, directly reusing KV Cache preserves native model behavior relatively well; in single-token retrieval tasks, compatibility decreases as prefix length increases. This shows that the effectiveness of cache reuse is highly dependent on task nature and cannot be generalized.

The next-token distribution is the probability distribution output by an autoregressive language model at each step, covering the likelihood of each token in the vocabulary becoming the next token. The model's behavior is essentially determined by this sequence of distributions: capabilities such as retrieval, continuation, and stopping are all reflected in the shape and peaks of the distribution. Functional cache divergence quantifies deviation by comparing the next-token distributions at the same position under reused versus native cache conditions, using common metrics such as KL divergence, total variation distance, or top-k overlap rate. Compared with only checking whether the final answer is correct, distribution-level comparison can capture subtle shifts in internal state; even if the two models sample the same token at a given position, their probability mass distributions may differ significantly, providing a finer-grained perspective for understanding fidelity loss.

Answer Margin Analysis: How Correct Decisions Survive

The study further uses answer margin analysis to explain how correct retrieval decisions survive after substantial changes in internal state. Even when the reused cache and native cache produce the same first generated token, this does not guarantee consistency in answer content or stopping behavior. This means that apparent token consistency may mask deeper distributional shifts.

This finding has direct implications for practical applications: checking only whether the first token matches is insufficient to judge the reliability of cache reuse. In scenarios requiring precise answers or strict stopping conditions, more comprehensive behavioral validation is necessary.

The answer margin refers to the log-probability difference between the correct candidate and the strongest competing candidate when the model generates an answer token, reflecting the model's confidence in the current decision. The larger the margin, the more confident the model; the smaller the margin, the flatter the distribution, and the more susceptible sampling results are to small perturbations. In cross-version cache reuse, even if the reused cache and native cache yield the same first generated token, the answer margin may differ: the reused cache's margin may be smaller, causing the distribution of subsequent tokens or stopping behavior to shift. Therefore, answer margin analysis can explain why behavioral differences remain behind apparently consistent outputs, and suggests that in practical deployment, margin changes should be monitored rather than only comparing the first token.

Practical Implications and Future Directions

This case study establishes a dual-criteria framework for evaluating cross-version KV Cache reuse. For engineering practice, this means that while enjoying the 2.10–5.08 times speedup, fidelity risk must be assessed according to task type. Long-prefix question-answering tasks may face greater compatibility challenges, whereas natural text continuation is relatively robust.

Future work can explore how to balance utility and fidelity through lightweight calibration or selective reuse. The DeepSeek-V4-Flash case shows that cross-version KV Cache reuse is not simply "usable or unusable," but a continuous spectrum requiring fine-grained trade-offs.

One-line Summary

The DeepSeek-V4-Flash case reveals that cross-version KV Cache reuse can accelerate inference but carries fidelity risks.

Paragraph Summary

This case study examines the effect of directly reusing KV Cache across four model updates for DeepSeek-V4-Flash. The study finds that reusing the source model's cache can retain useful task information, delivering a median 2.10 to 5.08 times speedup in time to first token, but retrieval accuracy fluctuates significantly, and the reused cache may not faithfully reproduce the updated model's behavior. The study proposes a functional cache divergence metric that quantifies behavioral deviation by comparing next-token distributions, and reveals the impact of task type: natural text continuation has higher fidelity, while single-token retrieval tasks show decreasing compatibility as prefix length increases. Answer margin analysis further shows that consistency in the first generated token does not guarantee consistency in answer content or stopping behavior, requiring more comprehensive behavioral validation. The study thus establishes a dual-criteria evaluation framework of task utility and fidelity.

#KV Cache reuse#DeepSeek-V4-Flash#cross-version cache#LLM inference#time to first token#functional cache divergence#answer margin
Share:

Related articles