What Context Leaves Behind: How Earlier Examples Affect Retrieval from Reused KV Caches
Reusing the key–value (KV) cache of a document lets a language model encode the document once and use it for many requests. We ask what happens when the task changes. The cached keys and values of a block are computed while the block attends to the text before it, so they may keep the influence of that text. In a controlled retrieval task, we encode identical records after demonstrations of one extraction rule or of another, then answer the same query with the same, correct demonstrations. Records encoded under a different rule lower accuracy by 5.9–15.4 percentage points in all four 4–9B models on 32 Wikipedia tables, and by 12.5–27.0 points in three of the models on synthetic records; most of the extra errors return the field that the earlier rule selects. Replacing only the cached keys reproduces 57–62% of the loss from replacing both keys and values in two models. With plain-text prompts, such a stale cache is never significantly worse than encoding the records on their own, and is often better. Under official chat templates the picture changes, and in Llama the stale cache is 14.5 points worse than encoding the records on their own. Whether a cached block can be reused therefore depends on the task context it was built in, not only on its text.
Authors
- Ngoc Kim Bui (ORCID: https://orcid.org/0000-0002-8526-0471)
Institutions
- VNU University of Science (VN)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-12-01
- DOI
- https://doi.org/10.5281/zenodo.24707263
- Primary Topic
- Topic Modeling
- Type
- preprint