Retrieval-augmented generation repeatedly feeds familiar documents to a model. It is tempting to compute each document’s internal representation once and reuse it wherever the document appears. Text behaves like a reusable file; attention states do not necessarily behave the same way. Their meaning can depend on everything that preceded the document during the original computation.
SAFE-KV makes that dependency the centre of the optimisation problem. The question is not simply whether a cached block can be inserted and decoded quickly. It is whether doing so preserves the behaviour of the exact prompt under full prefill—and whether restoring that behaviour leaves any meaningful saving.
A document carries its old causal context
SAFE-KV's October 10 study repairs the causal suffix after non-prefix reuse and compares answers with exact full prefill. It reports strong preservation after repair, but its single-request hardware study finds faithful repair expensive enough to favour full prefill for every evaluated workload. Read the research paper.
In a causal transformer, later states depend on earlier tokens. A cached document can therefore incorporate a system instruction, its position and preceding retrieved material. Move that state into a different arrangement and the representation may still reflect a history the current prompt never contained.
SAFE-KV repairs a composed cache by re-encoding the causal suffix from a selected starting document. The need to repair a suffix, rather than just one suspicious block, follows from the dependency structure. States after the repaired region must incorporate its new history too. Local-looking edits can therefore require a much larger amount of recomputation.
The prompt order is part of the cache key
Two requests may retrieve the same documents in a different order. At the text level, the overlap is large. At the causal-state level, the second document now has a different prefix, and every later state may inherit that difference. The relevant cache identity is therefore richer than a document hash.
This is why a document-only repair or a fixed repair window can recover much less behaviour than suffix forwarding in the paper. The states after that window can still carry the old history. A valid implementation needs an account of which dependencies have changed, not just a rule that recomputes a convenient number of tokens. The practical implication is to make the cache contract explicit: exact equivalence to full prefill and an approximate reuse method are different products. Each may be useful, but their evaluations and user expectations should not be mixed.
Preservation is a stricter reference
On Qwen2.5-7B-Instruct, the authors report that prefix-conditioned composition preserves only 47.2% of full-prefill answers on HotpotQA-500 and 37.8% on 2Wiki-500. Their risk-guided repair restores much higher agreement, including 100.0% and 98.4% respectively under actual suffix forwarding.
Answer preservation is not identical to truth: the full-prefill reference can itself answer incorrectly. But it is the appropriate question for an optimisation presented as maintaining the original computation’s behaviour. Without that comparison, a fast cache strategy could quietly be a different inference method with a different accuracy profile.
Sometimes the benchmark should reject the feature
The striking operating result is that faithful repair re-encodes so much context that the tested single-request L40S setting chooses full prefill for every workload. That is not a contradiction of the repair’s effectiveness. It separates a correctness result from a profitable serving policy.
Other batching strategies, cache hit patterns and hardware may change the economics. They still inherit the causal-state requirement. For deployment teams, SAFE-KV supplies a useful discipline: calculate the cost of the necessary repair before advertising reuse savings. A smaller number of nominally new tokens does not guarantee a smaller amount of valid computation.
Questions, news tips or corrections? Contact [email protected].


