Don't Repeat Yourself: Stopping Verbatim Loops at Sampling Time
The paper introduces "Don't Repeat Yourself" (DRY), a sampling-time logit adjustment that effectively reduces verbatim looping in large language models by penalizing tokens that extend exact suffix matches from earlier context, thereby improving lexical diversity and fluency without degrading performance or requiring model retraining.
Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Large language models are the engines behind the text-generating tools that have reshaped how we write, code, and converse with machines. These systems work by predicting the next word in a sentence, one piece at a time, building a response based on everything that came before it. For the most part, they are remarkably fluent, capable of weaving together complex ideas and mimicking human style. However, they suffer from a specific, frustrating flaw known as "verbatim looping." When a model gets stuck, it begins to repeat a phrase or a sentence over and over again, sometimes for hundreds of words, as if it has forgotten it just said it. This happens because the model's own output reinforces the pattern, creating a feedback loop that is difficult to break. While developers have long tried to fix this by simply telling the model not to use words it has already seen, these blunt tools often ruin the quality of the text, breaking up necessary formatting or making the writing sound robotic.
A new study introduces a smarter way to handle this problem, a method called "Don't Repeat Yourself," or DRY. Instead of punishing a model for using a word it has used before, this new approach looks at the structure of the sentence itself. It waits to see if the model is about to complete a pattern that has already appeared in the text. If the model is merely repeating a word that is part of a normal structure, like a speaker label in a dialogue or a bullet point in a list, the method leaves it alone. But if the model starts to extend a sequence of words that matches a previous section exactly, the method gently nudges the model to choose a different path. This distinction is crucial because it allows the model to keep its natural rhythm and formatting while stopping the runaway repetition that causes it to get stuck.
The researchers tested this idea across a wide range of computer models, from small ones that can run on a personal laptop to massive systems with billions of parameters. They ran thousands of generations using different types of prompts, including creative writing, long conversations, and structured formatting tasks. The results were clear: the new method reduced the rate of these exact repetition loops by nearly half compared to doing nothing at all. More importantly, it did so without damaging the quality of the writing. In fact, the text generated with this method was more diverse and varied than text produced with the old, blunt penalties. When the researchers compared the new method to the standard tools currently used in the industry, the old tools either failed to stop the loops or, when they did, they made the text sound unnatural and broke the formatting.
To ensure that the improvement came from the specific logic of the new method and not just from adding random noise to the system, the team ran a special control test. They applied a similar amount of interference to the model but without the specific rule about matching patterns. This control group did not stop the loops, proving that the success of the new method comes from its ability to recognize and interrupt the specific structure of the repetition. The study also looked at whether this fix would hurt the model's ability to solve hard problems or follow complex instructions. On tests measuring reasoning and knowledge, the new method performed just as well as the uncontrolled model, while the older methods caused a noticeable drop in performance. This suggests that the new approach is safe to use in real-world applications without sacrificing the model's intelligence.
The impact of this work extends beyond the laboratory. The method has already been adopted by several popular open-source software frameworks that power local AI applications, meaning users can start benefiting from it immediately. By focusing on the sequence of words rather than just the individual words themselves, the researchers have found a way to keep these powerful tools from getting stuck in a loop, ensuring they remain useful, fluent, and reliable for the long conversations and complex tasks they are designed to handle.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.