Introduction
Large language models (LLMs) like GPT-2 and BART have achieved impressive results across various text generation tasks. However, when using standard maximization-based decoding algorithms like greedy search, these models often fall into bizarre, infinite loops—repeating the exact same sentence over and over.
This phenomenon is highly counter-intuitive. Human language almost never features consecutive sentence-level repetitions (e.g., they account for only 0.02% of the Wikitext-103 dataset), yet state-of-the-art models do it constantly. Existing solutions generally fall into two camps: decoding-based methods (like hard n-gram blocking or stochastic sampling) and training-based methods (like unlikelihood training). Unfortunately, hard blocking can degrade text quality, and stochastic sampling merely masks the underlying issue by avoiding the most likely tokens.
In this paper, the authors quantitatively investigate why models favor these loops and propose a novel training method to fix the root cause without sacrificing overall language capabilities.
The Repetition Problem
To understand the repetition mechanism, the authors analyzed the relationship between the probability of repetitive tokens and their previous repetitions in context.
They discovered a massive discrepancy between human text and model-generated text, particularly at the sentence level. The core issue stems from a Self-Reinforcement Effect. The probability of a model repeating a sentence increases almost monotonically with the number of times it has already been repeated in the context. Once a model repeats a sentence, it gets trapped in a positive feedback loop, eventually hitting a high-probability ceiling from which it cannot escape.
Even with just one sentence-level repetition in the context, the probability of generating that sentence again increases over 90% of the time. The model becomes overly confident in its historical context, learning a "cheap shortcut" to copy the previous pattern rather than generating novel information. Furthermore, sentences with higher initial probabilities—exactly the types selected by greedy decoding—exhibit a much stronger self-reinforcement effect, reaching the inescapable probability ceiling much faster.
DITTO: Breaking the Loop
To fix these discovered issues, the authors introduce DITTO (PseuDo-RepetITion PenalizaTiOn), a simple but highly effective fine-tuning strategy:
- Pseudo-Repetitive Data Construction: The method takes a normal sentence from the training corpus and artificially repeats it multiple times to reach the model's maximum input length.
- Sentence-level Repetition Penalization: A custom loss function is applied to this pseudo-data. Instead of a hard penalty on all repeated tokens, DITTO forces the model to exponentially decay the probability of a token as the number of sentence-level repetitions increases.
- Mixed Fine-tuning: The model is fine-tuned using a 50/50 mix of standard Maximum Likelihood Estimation (MLE) loss on normal data and the DITTO penalty loss on the pseudo-repetitive data. This teaches the model to distinguish between natural, useful repetitions (like names or entities) and useless, infinite sentence loops.
Key Results
The authors evaluated DITTO across open-ended text generation (Wikitext-103) and directed generation/summarization (CNN/DailyMail), yielding impressive results:
- Massive Reduction in Repetition: On Wikitext-103 using greedy decoding, the baseline MLE model had a sentence-level repetition rate of 14.50%. DITTO slashed this to 2.85%, bringing it much closer to the human baseline.
- Higher Quality Text: DITTO doesn't just stop loops; it improves overall text quality. On Wikitext-103, DITTO achieved a MAUVE score of 0.77, obliterating the baseline MLE (0.34) and competing unlikelihood training methods (0.48 - 0.57).
- No Perplexity Trade-off: Unlike previous penalty methods that degrade the model's core language modeling ability, DITTO actually improved perplexity slightly (24.33 vs. the baseline's 25.68).
- Summarization Improvements: On the CNN/DailyMail dataset using BART-large, DITTO consistently outperformed baselines, achieving a ROUGE-1 score of 44.41 (vs. baseline 44.11).
- Human Preference: In pairwise blind evaluations, human annotators preferred DITTO's generated text over the standard MLE baseline 84% of the time under greedy search, and 65% of the time under nucleus sampling.
Limitations and Future Work
While the authors successfully identify the self-reinforcement effect and provide a mathematical way to penalize it, they acknowledge they haven't solved the deepest "why." The paper does not investigate the root cause of this phenomenon from the perspective of the Transformer's neural architecture, the attention mechanism, or the embedding space. Future work should look into the intrinsic characteristics of the network to understand exactly why the model's representations default to this copying shortcut in the first place.
Summary updated