Repair-R1: Better Test Before Repair
Not on the map. Why?
Abstract (arXiv)
APR (Automated Program Repair) aims to automatically locate program defects, generate patches and validate the repairs. Existing techniques for APR are often combined with LLMs (Large Language Models), which leverages the code-related knowledge of LLMs to improve repair effectiveness. Current LLM-based APR methods typically utilize test cases only during the inference stage, adopting an iterative approach that performs repair first and validates it through test execution afterward. This conventional paradigm neglects two important aspects: the potential contribution of test cases in the training phase, and the possibility of leveraging testing prior to repair. To address this, we propose Repair-R1, which introduces test cases into the model's training phase and shifts test generation to precede repair. The model is required to first generate discriminative test cases that can distinguish defective behaviors, and then perform repair based on these tests. This enables the model to better locate defects and understand the underlying causes of defects, thereby improving repair effectiveness. We implement Repair-R1 with three different backbone models, using RL (reinforcement learning) to co-optimize test generation and bug repair. Experimental results on four widely adopted benchmarks demonstrate the superiority of Repair-R1. Specially, compared to vanilla models, Repair-R1 improves repair success rate by 2.68% to 48.29%, test generation success rate by 16.38% to 53.28%, and test coverage by 0.78% to 53.96%. We publish the code and weights at https://github.com/Tomsawyerhu/APR-RL and https://huggingface.co/tomhu/Qwen3-4B-RL-5000-step.
Key facts. Cited by 6 papers in the map (data through 14 Oct 2026). Builds on 16 of its 24 references that are in the map. First posted on arXiv 30 Jul 2025.
Builds on
16 of 24 references.
References · 16
- 2017Proximal Policy Optimization Algorithmscited by 15,215
- 2024DeepSeekMath: Pushing the Limits of Mathematical Reasoning in Open Language Modelscited by 9,379
- 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Modelcited by 8,065
- 2025DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learningcited by 6,330
- 2024SimPO: Simple Preference Optimization with a Reference-Free Rewardcited by 963
- 2024RepairAgent: An Autonomous, LLM-Based Agent for Program Repaircited by 232
- 2019IPO: Interior-point Policy Optimization under Constraintscited by 132
- 2024StepCoder: Improve Code Generation with Reinforcement Learning from Compiler Feedbackcited by 77
- 2024Value-Incentivized Preference Optimization: A Unified Approach to Online and Offline RLHFcited by 73
- 2019TBar: Revisiting Template-based Automated Program Repaircited by 65
- 2021Neural Program Repair with Execution-based Backpropagationcited by 50
- 2022SelfAPR: Self-supervised Program Repair with Test Execution Diagnosticscited by 33
4 more
- 2017ARJA: Automated Repair of Java Programs via Multi-Objective Genetic Programmingcited by 26
- 2023GAMMA: Revisiting Template-based Automated Program Repair via Mask Predictioncited by 23
- 2024CREF: An LLM-based Conversational Software Repair Framework for Programming Tutorscited by 15
- 2017Ultra-Large Repair Search Space with Automatically Mined Templates: the Cardumen Mode of Astorcited by 9
Built on by
Citing papers per year: 2025: 2; 2026: 4.
6 papers.
- 2025A Survey of Reinforcement Learning for Large Reasoning Modelscited by 180
- 2025From Code Foundation Models to Agents and Applications: A Comprehensive Survey and Practical Guide to Code Intelligencecited by 15
- 2026SGAgent: Suggestion-Guided LLM-Based Multi-Agent Framework for Repository-Level Software Repaircited by 9
- 2026ExecCritic: Learn to Test, Test to Improve for Coding Agentscited by 3
- 2026MultiFixer: A Coordinator-Proposer Based Multi-Agent Framework For Fixing Multi-Hunk Bugscited by 0
- 2026Test-Driven Approaches to Software Engineering with Large Language Models: A Survey of Phases, Tasks, and Agent Skillscited by 0
- 2026Test-Driven Approaches to Software Engineering with Large Language Models: A Survey of Phases, Tasks, and Agent Skills10 Sep 2026
- 2026ExecCritic: Learn to Test, Test to Improve for Coding Agents8 Sep 2026
- 2026MultiFixer: A Coordinator-Proposer Based Multi-Agent Framework For Fixing Multi-Hunk Bugs29 Jul 2026
- 2026SGAgent: Suggestion-Guided LLM-Based Multi-Agent Framework for Repository-Level Software Repair27 Feb 2026
- 2025From Code Foundation Models to Agents and Applications: A Comprehensive Survey and Practical Guide to Code Intelligence23 Nov 2025
- 2025A Survey of Reinforcement Learning for Large Reasoning Models10 Sep 2025
Similar, not cited
Close in wording, no citation either way
- 2025The Art of Repair: Optimizing Iterative Program Repair with Instruction-Tuned Models
- 2026Rethinking Automated Program Repair: The Impact of Bug Complexity, Fault Localization, and LLM Cost-efficiency
- 2024RePair: Automated Program Repair with Process-based Feedback
- 2024Aligning the Objective of LLM-based Program Repair
- 2025Accelerating Automatic Program Repair with Dual Retrieval-Augmented Fine-Tuning and Patch Generation on Large Language Models
- 2024ThinkRepair: Self-Directed Automated Program Repair
- 2025Self-Bootstrapping Automated Program Repair: Using LLMs to Generate and Evaluate Synthetic Training Data for Bug Repair
- 2025T3: Multi-level Tree-based Automatic Program Repair with Large Language Models