cs.CLSep 30, 2026

Uncovering Uncontrolled Repetition through Residual Stream Dynamics

Authors: Yuanhe Zhang, Xinyao Zhou, Haoran Gao, Yuyao Zhang, Zhenhong Zhou, Fanyu Meng, Li Sun, Sen Su

Organizations: Beijing University of Posts and Telecommunications · JIUTIAN Research · Nanyang Technological University · Chongqing University of Posts and Telecommunications

Abstract

Uncontrolled repetition can prolong autoregressive generation in large language models (LLMs) and enable resource consumption attacks. Prior analyses of repetitive generation have identified strongly activated features in intermediate and late layers. However, how uncontrolled repetition activity emerges and develops before becoming prominent in these layers remains insufficiently understood. In this paper, we investigate this question primarily in large vision-language models (LVLMs), which support a richer set of uncontrolled repetitions through both visual and textual inputs. We propose Tokenwise Residual Comparison (TRC), a method that identifies and localizes anomalies associated with repetition from residual dynamics during generation. TRC compares attention and multilayer perceptron writes to the residual stream across generated tokens to identify patterns associated with repetition. It then selectively suppresses coordinates in the residual stream at the identified layer. Experiments show that TRC effectively mitigates uncontrolled repetition, reducing loop rates by 57% on average. Our analysis further shows that repetition semantics emerge in shallow layers and propagate through the residual stream, disrupting normal representations. TRC also generalizes to large language models (LLMs) and large reasoning models (LRMs), where it consistently captures analogous repetition dynamics and achieves effective mitigation. Our work broadens the study of repetitive generation from its prominent internal representations to earlier opportunities for intervention, providing insights for mitigating resource consumption attacks.

Figures & tables

Appendix figures & tables10 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. When Reasoning Goes Astray: Attention Dynamics of Uncontrolled Reasoning

    Sep 30, 2026Yuanhe Zhang, Ziwei Wang, Jie Ren +6Large Reasoning ModelsReasoning Errors

  2. RecurGuard: Runtime Monitoring for Reasoning-Token Consumption Attacks

    Jun 6, 2026Abid Aziz, Hafsa Binte KibriaLLM Reasoning StrategiesRecursive Models