Refine After Generation: Toward Correct and Concise Patches in LLM-based Program Repair
On the map: LLM agents and tool use → Software engineering coding agents
Abstract (arXiv)
Large language models (LLMs) have advanced automatic program repair (APR) to the point where agentic systems routinely resolve real-world, repository-level issues. Yet the generated patch has received little scrutiny beyond whether it passes tests. In this paper, we identify patch verbosity as a major yet overlooked concern in LLM-based APR. Characterizing 28 state-of-the-art approaches on SWE-bench Verified, we find that even successful patches are consistently larger and more complex than developer patches, with the median approach producing 121.78% more total changes, 80.91% more net changes, and 43.99% higher cyclomatic complexity. We further show that this verbosity is rooted in capability-oriented design choices such as iterative refinement and broad context, and can hardly be reduced by surface-level controls such as output format or minimality prompts. Motivated by these findings, we formulate post-generation patch refinement and propose RECAP, a lightweight, plug-and-play adapter that attaches to existing repair frameworks after generation. RECAP's refiner is trained via supervised fine-tuning and direct preference optimization with distilled reasoning traces, on a dataset of patch pairs we construct from multiple sources. Across four host systems, prompting, commit-untangling, and minimality-aware baselines reduce patch size only by sacrificing 49 to 217 resolved instances. In contrast, RECAP achieves a substantially better size-correctness tradeoff, cutting average total changes from +242.14% to +4.24% and net changes from +348.24% to -39.75% relative to developer patches while preserving or improving resolution by up to 42 instances. Our results indicate that minimality cannot be simply reduced to syntactic compression, and that decoupling minimization from generation offers a practical path to more reviewable repairs.
Key facts. Cited by 2 papers in the map (data through 14 Oct 2026). Placed in Software engineering coding agents, one of 16 directions in LLM agents and tool use. First posted on arXiv 13 Aug 2026.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2026: 2.
2 papers.
Similar, not cited
Close in wording, no citation either way
- 2025REFINE: Enhancing Program Repair Agents through Context-Aware Patch Refinement
- 2025Unlocking LLM Repair Capabilities Through Cross-Language Translation and Multi-Agent Refinement
- 2026If It's Not Buggy, Don't Fix It: On the Dynamics of Iterative Bug-fixing with LLMs
- 2025Enhancing Automated Program Repair via Faulty Token Localization and Quality-Aware Patch Refinement ↗
- 2025The Art of Repair: Optimizing Iterative Program Repair with Instruction-Tuned Models
- 2025A Survey of LLM-based Automated Program Repair: Taxonomies, Design Paradigms, and Applications
- 2024An Empirical Evaluation of Pre-trained Large Language Models for Repairing Declarative Formal Specifications
- 2026Multi-Perspective Agentic Program Repair via Code Property Graphs and Temporal Execution Graphs