LoopGuard: 通过动态KV缓存干预打破自增强注意力循环
LoopGuard: Breaking Self-Reinforcing Attention Loops via Dynamic KV Cache Intervention
AI总结:
本文通过系统实验发现长上下文生成中解码会陷入持续重复循环,提出LoopGuard通过动态KV缓存干预检测并打断循环,有效减少循环发生率并恢复输出多样性。
摘要:
通过系统实验发现长上下文生成中解码会陷入持续重复循环,该现象由塌陷的注意力模式驱动,其中部分注意力头锁定在历史的狭窄后缀,并通过推理时的KV缓存重用进一步稳定。关键在于许多现有KV缓存策略依赖注意力重要性,这种塌陷会产生对重复token的 spuriously 高评分,导致缓存管理无意中放大重复。为研究此现象,我们引入LoopBench,一个具有显式循环诱导条件和循环导向度量的基准,量化重复严重性和生成不稳定性。基于这些见解,我们提出LoopGuard,一种轻量级、可插拔的KV缓存守护程序,通过在线检测循环起始并剪枝重复尾部跨度,在固定缓存预算下打断反馈循环。在LoopBench上的实验表明,LoopGuard将循环发生率降低超过90个百分点,同时恢复输出多样性和减少token浪费。
英文摘要:
Through systematic experiments on long-context generation, we observe a damaging failure mode in which decoding can collapse into persistent repetition loops. We find that this degeneration is driven by collapsed attention patterns, where a subset of heads locks onto a narrow suffix of the history, and is further stabilized by inference-time KV cache reuse. Crucially, since many existing KV cache policies rely on attention-based importance, this collapse can produce spuriously high scores for repetitive tokens, causing cache management to inadvertently amplify repetition. To study this phenomenon in a controlled and reproducible manner, we introduce LoopBench, a benchmark with explicit loop-inducing conditions and loop-oriented metrics that quantify repetition severity and generation instability beyond downstream task scores. Building on these insights, we propose LoopGuard, a lightweight, plug-in KV cache guard that detects loop onset online and disrupts the feedback cycle by pruning repetitive tail spans under a fixed cache budget. Experiments on LoopBench show that LoopGuard reduces loop incidence by over 90 percentage points, while restoring output diversity and reducing token waste.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。