Whose Narrative is it Anyway? A KV Cache Manipulation Attack
On the map: Efficient LLM inference and serving → KV cache optimization
Abstract (arXiv)
The Key Value(KV) cache is an important component for efficient inference in autoregressive Large Language Models (LLMs), but its role as a representation of the model's internal state makes it a potential target for integrity attacks. This paper introduces "History Swapping," a novel block-level attack that manipulates the KV cache to steer model generation without altering the user-facing prompt. The attack involves overwriting a contiguous segment of the active generation's cache with a precomputed cache from a different topic. We empirically evaluate this method across 324 configurations on the Qwen 3 family of models, analyzing the impact of timing, magnitude, and layer depth of the cache overwrite. Our findings reveal that only full-layer overwrites can successfully hijack the conversation's topic, leading to three distinct behaviors: immediate and persistent topic shift, partial recovery, or a delayed hijack. Furthermore, we observe that high-level structural plans are encoded early in the generation process and local discourse structure is maintained by the final layers of the model. This work demonstrates that the KV cache is a significant vector for security analysis, as it encodes not just context but also topic trajectory and structural planning, making it a powerful interface for manipulating model behavior.
Key facts. Cited by 3 papers in the map (data through 7 Oct 2026). Placed in KV cache optimization, one of 12 directions in Efficient LLM inference and serving. Builds on 6 of its 14 references that are in the map. First posted on arXiv 16 Nov 2025.
Builds on
6 of 14 references.
Closest ancestors · 3
Same direction, newest first
- 2025LMCache: An Efficient KV Cache Layer for Enterprise-Scale LLM Inference8 Oct
- 2025Selective KV-Cache Sharing to Mitigate Timing Side-Channels in LLM Inference11 Aug
- 2024GEAR: An Efficient KV Cache Compression Recipe for Near-Lossless Generative Inference of LLM8 Mar
Other references · 3
Built on by
Citing papers per year: 2026: 3.
3 papers.
Similar, not cited
Close in wording, no citation either way
- 2026Positions Are Not Facts: The Mismatch Between KV Caches and Memory
- 2026Recency/Frequency Adaptive KV Caching for Large Language Model Serving
- 2025Taming the Fragility of KV Cache Eviction in LLM Inference
- 2025Shadow in the Cache: Unveiling and Mitigating Privacy Risks of KV-cache in LLM Inference
- 2026Coverage-Driven KV Cache Eviction for Efficient and Improved Inference of LLM
- 2025Krul: Efficient State Restoration for Multi-turn Conversations with Dynamic Cross-layer KV Sharing
- 2026Reformulating KV Cache Eviction Problem for Long-Context LLM Inference
- 2025Judge Q: Trainable Queries for Optimized Information Retention in KV Cache Eviction