Uncovering Uncontrolled Repetition through Residual Stream Dynamics

📄 arXiv: 2609.38802v1 📥 PDF

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

分类: cs.CL, cs.AI

发布日期: 2026-09-30


💡 一句话要点

提出Tokenwise Residual Comparison以解决大语言模型中的无控制重复问题

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 无控制重复 大语言模型 视觉语言模型 残差流动态 异常识别 生成模型 资源消耗攻击

📋 核心要点

  1. 现有方法对无控制重复的生成过程理解不足,尤其是在早期层的表现和影响。
  2. 提出的Tokenwise Residual Comparison(TRC)方法通过分析残差流动态,识别与重复相关的异常并进行抑制。
  3. 实验结果显示,TRC在减少无控制重复方面表现优异,平均降低循环率57%,并可推广至其他大型模型。

📝 摘要(中文)

无控制重复会延长大语言模型的自回归生成过程,并可能导致资源消耗攻击。以往对重复生成的分析主要集中在中间和后期层的特征激活,但对其在这些层之前如何出现和发展仍缺乏理解。本文主要研究大型视觉语言模型中的这一问题,提出了一种名为Tokenwise Residual Comparison(TRC)的方法,能够识别和定位与重复相关的异常。TRC通过比较生成过程中残差流的注意力和多层感知机写入,识别与重复相关的模式,并在识别的层中选择性抑制残差流的坐标。实验表明,TRC有效减轻了无控制重复,平均降低循环率57%。

🔬 方法详解

问题定义:本文旨在解决大语言模型生成过程中的无控制重复问题,现有方法主要关注后期层的特征激活,未能有效识别早期层的重复活动及其传播机制。

核心思路:提出Tokenwise Residual Comparison(TRC)方法,通过分析生成过程中残差流的动态变化,识别与重复相关的异常并进行抑制,从而减少无控制重复的发生。

技术框架:TRC方法包括几个主要模块:首先,通过分析生成的每个token的残差流,比较注意力和多层感知机的写入;其次,识别出与重复相关的模式;最后,在识别的层中选择性地抑制残差流的坐标。

关键创新:TRC的创新在于将残差流动态与重复生成活动关联起来,提供了一种新的视角来理解和干预无控制重复的生成过程,这与以往仅关注后期层的研究方法有本质区别。

关键设计:在TRC中,关键参数包括残差流的分析窗口和选择性抑制的阈值,损失函数设计为能够有效捕捉重复模式的特征,网络结构则结合了注意力机制和多层感知机的输出。

🖼️ 关键图片

fig_0
fig_1

📊 实验亮点

实验结果显示,TRC方法在减轻无控制重复方面表现显著,平均降低循环率57%。此外,该方法在大型语言模型和推理模型中也表现出良好的通用性,能够捕捉到类似的重复动态并实现有效的减轻。

🎯 应用场景

该研究的潜在应用领域包括自然语言处理、计算机视觉和多模态学习等。通过有效减轻无控制重复,TRC方法可以提高生成模型的效率和安全性,降低资源消耗攻击的风险,具有重要的实际价值和未来影响。

📄 摘要(原文)

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.