LoopGuard: Breaking Self-Reinforcing Attention Loops via Dynamic KV Cache Intervention

Dongjie Xu, Hao Wu, Weijie Shi, Yue Cui, Yuanjun Liu, Jiawei Li, Haolun MA, An Liu, Jia Zhu, Jiajie Xu


Abstract
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.
Anthology ID:
2026.findings-emnlp.1223
Volume:
Findings of the Association for Computational Linguistics: EMNLP 2026
Month:
October
Year:
2026
Address:
Budapest, Hungary
Editors:
Hung-Yi Lee, Sunipa Dev, Jessy Li, Desmond Elliott
Venue:
Findings
SIG:
SIGDAT
Publisher:
Association for Computational Linguistics
Note:
Pages:
25883–25898
Language:
URL:
https://aclanthology.org/2026.findings-emnlp.1223/
DOI:
Bibkey:
Cite (ACL):
Dongjie Xu, Hao Wu, Weijie Shi, Yue Cui, Yuanjun Liu, Jiawei Li, Haolun MA, An Liu, Jia Zhu, and Jiajie Xu. 2026. LoopGuard: Breaking Self-Reinforcing Attention Loops via Dynamic KV Cache Intervention. In Findings of the Association for Computational Linguistics: EMNLP 2026, pages 25883–25898, Budapest, Hungary. Association for Computational Linguistics.
Cite (Informal):
LoopGuard: Breaking Self-Reinforcing Attention Loops via Dynamic KV Cache Intervention (Xu et al., Findings 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.findings-emnlp.1223.pdf