Abstract
Large Language Models (LLMs) frequently encounter "degeneration" during open-ended generation tasks, manifesting as repetitive loops or a gradual loss of thematic focus known as "topic drift." This paper introduces Look-back Decoding, a training-free, distribution-aware algorithm designed to mitigate these issues. By utilizing Kullback–Leibler (KL) divergence to monitor the relationship between a model's current probability distribution and its historical context, Look-back Decoding ensures that generated text remains diverse enough to avoid repetition while staying semantically anchored to the initial prompt.
1. Introduction
While Large Language Models have demonstrated remarkable capabilities in short-form tasks, their performance often degrades during long-form, open-ended generation. This degradation typically follows two patterns: undesired repetition, where the model enters an infinite loop of phrases, and topic drift, where the model loses the context of the original prompt.
Existing remedies often involve "unlikelihood training," which requires expensive retraining, or "contrastive search," which relies on internal hidden state similarities that may not be accessible in API-based models. Look-back Decoding addresses these challenges at the decoding stage by analyzing output probability distributions, making it a versatile, "plug-and-play" solution for any pre-trained model.
2. Methodology
The fundamental premise of Look-back Decoding is that the probability distribution of the next token serves as a diagnostic signal for the model's state. The algorithm monitors the "distance" between the current step’s distribution and previous steps using KL divergence.
2.1 Alleviating Repetitions
To detect potential loops, the algorithm calculates the KL divergence between the current step and all preceding steps in the generation history. If the minimum distance ($KL^t_{min}$) falls below a predefined threshold $\alpha$, it indicates a high risk of repetition. In such instances, the algorithm shifts from top-1 selection to sampling from the top-$k$ candidates, effectively breaking the deterministic cycle that leads to loops.
2.2 Improving Coherence via Distribution-Guided Sampling
To prevent topic drift, Look-back compares the current distribution to the distributions generated during the processing of the prefix (the initial prompt). The authors propose that for high-quality text, the next-token distribution should remain "relatively close" to the prefix distributions.
When a failure in coherence is detected, the model employs Distribution-Guided Sampling. This involves applying a softmax over the negative KL distances to the prefix, steering the model toward tokens that maintain a distribution statistically similar to the original context. This ensures the thematic integrity of the generation over long sequences.
3. Experimental Setup
The researchers evaluated the effectiveness of Look-back Decoding using two primary benchmarks for open-ended generation:
- WikiText-103: Focused on document continuation.
- WritingPrompts: Focused on creative story generation based on high-level Reddit prompts.
The algorithm was tested using GPT2-XL and OPT-6.7B as the backbone architectures to demonstrate its model-agnostic nature.
4. Key Results and Insights
Look-back Decoding significantly outperformed established baselines, including Nucleus Sampling, Typical Decoding, and SimCTG.
- MAUVE Scores: Look-back achieved superior MAUVE scores, which measure the statistical proximity of machine-generated text to human-written text. On WikiText-103 with GPT2-XL, Look-back reached a score of 0.81, compared to 0.72 for SimCTG.
- Semantic Coherence: Using SimCSE embedding similarities, the authors confirmed that Look-back maintains higher semantic alignment with the prompt than competing methods.
- Human Evaluation: In blind head-to-head tests, human evaluators preferred Look-back over SimCTG more than 70% of the time, citing improvements in both fluency and thematic consistency.
5. Discussion and Limitations
While effective, Look-back Decoding presents certain trade-offs. The algorithm's aggressive approach to eliminating repetition can sometimes penalize natural linguistic repetitions, such as common grammatical structures. Additionally, the focus on prefix coherence can lead to higher bi-gram repetition as the model frequently re-references specific terms from the prompt.
Furthermore, the authors note that automatic metrics like MAUVE are sensitive to the underlying embedding models, reinforcing the necessity of human evaluation in this field. Future research may explore alternative distance measures beyond KL divergence and the application of look-back mechanisms to mitigate hallucinations in constrained generation tasks.
6. Conclusion
Look-back Decoding offers a robust, training-free alternative to existing decoding strategies. By treating probability distributions as a guide for both diversity and coherence, it provides a practical solution to the long-standing problem of model degeneration in open-ended text generation.
Summary updated