Overview
Large Language Models (LLMs) frequently suffer from the "Repeat Curse," a phenomenon where they generate repetitive tokens or paragraphs indefinitely. This research investigates the internal mechanisms driving this behavior using Sparse Autoencoders (SAEs) to identify specific "Repetition Features"—monosemantic units in the model's hidden layers. By surgically deactivating these features, researchers can mitigate repetition without compromising the model's general intelligence.
The Problem: Defining the Repeat Curse
The "Repeat Curse" manifests in two primary forms: token-level repetition and paragraph-level repetition. Traditional solutions, such as repetition penalties during decoding, often act as blunt instruments that can degrade output coherence or punish necessary word usage. This study shifts the focus toward mechanistic interpretability to understand why the model's internal activations trigger these loops in the first place.
Methodology: The "Duplicatus Charm" (DUC) Pipeline
The authors propose the Duplicatus Charm (DUC) pipeline, a structured approach to induce, identify, and silence repetition features within LLMs.
The pipeline consists of four key stages:
- Repeat Pattern Construction: Creating datasets designed to trigger repetitive behaviors (e.g., modifying Orca-Chat samples).
- Evaluation and Metric Selection: Identifying sensitive indicators of repetition. The study concluded that 1-gram repeat scores and Information Entropy were the most effective metrics.
- Repetition Feature Identification: Using SAEs to decompose messy, polysemantic neuron activations into thousands of monosemantic features. Layer localization revealed these features are primarily located in intermediate and final layers.
- Feature Steering: Validating features by artificially boosting their activation (to induce the curse) or zeroing them out (to break it).
Key Insights: Repetition as a Feature
A central finding is that repetition is not a random error but is driven by specific directions in the model's activation space. These "repetition features" are often semantically grounded, clustering around categories like Names, Time, or Mathematics. For instance, over-activating a feature associated with "proper names" can cause the model to list names endlessly. Deactivating these features doesn't just stop the looping; it often improves output diversity by allowing the model to move past the repetitive trigger.
Results and Mitigation Performance
The DUC method achieved a 88.9% state-of-the-art probability in reducing repetition across various models. Crucially, this intervention resulted in a zero performance hit to general model intelligence. Unlike traditional penalties, deactivating internal features did not significantly increase perplexity. In some cases, such as with Gemma-2-2B on academic tasks, the model's performance actually improved after the "curse" was lifted.
Limitations and Future Work
While effective, the method currently relies on the availability of high-quality pre-trained SAEs, which are currently most accessible for models under 10B parameters. Additionally, setting the threshold for identifying a "repetition feature" involves some subjectivity. Future work will focus on automatically detecting and neutralizing these features during the training process to prevent the Repeat Curse from developing.
Summary updated