mlsanityData to 7 Oct 2026

Solving LLM Repetition Problem in Production: A Comprehensive Study of Multiple Solutions

arXiv 2512.04419 ↗First posted 4 Dec 2025cs.AIcited by 1

Not on the map. Why?

Abstract (arXiv)

The repetition problem, where Large Language Models (LLMs) continuously generate repetitive content without proper termination, poses a critical challenge in production deployments, causing severe performance degradation and system stalling. This paper presents a comprehensive investigation and multiple practical solutions for the repetition problem encountered in real-world batch code interpretation tasks. We identify three distinct repetition patterns: (1) business rule generation repetition, (2) method call relationship analysis repetition, and (3) PlantUML diagram syntax generation repetition. Through rigorous theoretical analysis based on Markov models, we establish that the root cause lies in greedy decoding's inability to escape repetitive loops, exacerbated by self-reinforcement effects. Our comprehensive experimental evaluation demonstrates three viable solutions: (1) Beam Search decoding with early_stopping=True serves as a universal post-hoc mechanism that effectively resolves all three repetition patterns; (2) presence_penalty hyperparameter provides an effective solution specifically for BadCase 1; and (3) Direct Preference Optimization (DPO) fine-tuning offers a universal model-level solution for all three BadCases. The primary value of this work lies in combining first-hand production experience with extensive experimental validation. Our main contributions include systematic theoretical analysis of repetition mechanisms, comprehensive evaluation of multiple solutions with task-specific applicability mapping, identification of early_stopping as the critical parameter for Beam Search effectiveness, and practical production-ready solutions validated in real deployment environments.

Key facts. Cited by 1 paper in the map (data through 7 Oct 2026). Builds on 20 of its 39 references that are in the map. First posted on arXiv 4 Dec 2025.

Builds on

20 of 39 references.

References · 20

  1. 2017Attention Is All You Needcited by 59,932
  2. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
  3. 2020Language Models are Few-Shot Learnerscited by 32,199
  4. 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
  5. 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 5,767
  6. 2019The Curious Case of Neural Text Degenerationcited by 2,881
  7. 2018Hierarchical Neural Story Generationcited by 1,182
  8. 2019Neural Text Generation with Unlikelihood Trainingcited by 489
  9. 2016Diverse Beam Search: Decoding Diverse Solutions from Neural Sequence Modelscited by 299
  10. 2017OpenNMT: Open-source Toolkit for Neural Machine Translationcited by 251
  11. 2017Lexically Constrained Decoding for Sequence Generation Using Grid Beam Searchcited by 234
  12. 2017Beam Search Strategies for Neural Machine Translationcited by 232
8 more
  1. 2022A Contrastive Framework for Neural Text Generationcited by 224
  2. 2016A Persona-Based Neural Conversation Modelcited by 221
  3. 2018Fast Lexically Constrained Decoding with Dynamic Beam Allocation for Neural Machine Translationcited by 181
  4. 2018Analyzing Uncertainty in Neural Machine Translationcited by 126
  5. 2018Correcting Length Bias in Neural Machine Translationcited by 119
  6. 2022Learning to Break the Loop: Analyzing and Mitigating Repetitions for Neural Text Generationcited by 90
  7. 2022On Decoding Strategies for Neural Text Generatorscited by 89
  8. 2019Improving Neural Conversational Models with Entropy-Based Data Filteringcited by 30

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2026: 1.

1 paper.

Similar, not cited

Close in wording, no citation either way

  1. 2025Rethinking Repetition Problems of LLMs in Code Generation
  2. 2024What Makes Large Language Models Reason in (Multi-Turn) Code Generation?
  3. 2025On Evaluating Performance of LLM Inference Serving Systems
  4. 2024Code Repair with LLMs gives an Exploration-Exploitation Tradeoff
  5. 2025Decoupling Task-Solving and Output Formatting in LLM Generation
  6. 2024Understanding Defects in Generated Codes by Language Models
  7. 2024Enhancing LLM Agents for Code Generation with Possibility and Pass-rate Prioritized Experience Replay
  8. 2025Let's Revise Step-by-Step: A Unified Local Search Framework for Code Generation with LLMs