⚠️ 以下所有内容总结都来自于 大语言模型的能力,如有错误,仅供参考,谨慎使用
🔴 请注意:千万不要用于严肃的学术场景,只能用于论文阅读前的初筛!
💗 如果您觉得我们的项目对您有帮助 ChatPaperFree ,还请您给我们一些鼓励!⭐️ HuggingFace免费体验
2025-11-19 更新
Whose Narrative is it Anyway? A KV Cache Manipulation Attack
Authors:Mukkesh Ganesh, Kaushik Iyer, Arun Baalaaji Sankar Ananthan
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.
键值(KV)缓存是自动回归大型语言模型(LLM)中进行高效推理的重要组成部分,但其作为模型内部状态表示的角色使其成为潜在的安全性攻击目标。本文介绍了“历史替换”这种新型块级攻击,它通过操纵KV缓存来引导模型生成,而无需更改面向用户的提示。这种攻击涉及用来自不同主题的预计算缓存覆盖活动生成的连续缓存段。我们通过实验在Qwen 3系列模型的324个配置中评估了此方法,分析了缓存覆盖的时间、幅度和层深度的影响。我们的研究发现,只有完整的层覆盖才能成功改变对话的主题,导致三种不同的行为:立即且持久的话题转换、部分恢复或延迟的覆盖。此外,我们观察到高级结构计划被编码在生成过程的早期,而局部话语结构则由模型的最后几层维持。这项工作表明,KV缓存是安全分析的重要载体,因为它不仅包含上下文,还包含主题轨迹和结构规划,使其成为操纵模型行为的有力接口。
论文及项目相关链接
PDF 7 pages, 10 figures
Summary
本文探讨了键值(KV)缓存对于大型自回归语言模型(LLM)的推理效率的重要性,同时揭示了其作为模型内部状态表示可能面临的安全风险。针对此问题,文章提出了一种名为“历史交换”的新型块级攻击方法,该方法通过操纵KV缓存来引导模型生成而不改变用户面对的提示。实验评估表明,只有全层覆盖才能成功劫持对话主题,导致三种不同的行为:立即且持久的主题切换、部分恢复或延迟劫持。文章强调KV缓存不仅是上下文编码的重要载体,还包含了话题轨迹和结构规划,因此是操纵模型行为的有力接口。
Key Takeaways
- 键值(KV)缓存对于大型自回归语言模型的推理效率至关重要。
- KV缓存作为模型内部状态的表示,存在潜在的安全风险。
- 提出了一种名为“历史交换”的新型块级攻击方法,通过操纵KV缓存引导模型生成。
- 只有全层覆盖的缓存重写才能成功改变话题。
- 话题劫持会导致三种不同的行为:立即且持久的主题切换、部分恢复或延迟劫持。
- 高层次的结构性计划被编码在生成的早期阶段,而局部话语结构则由模型的最后几层维持。