Learning to Generate Unit Tests for Automated Debugging
Not on the map. Why?
Abstract (arXiv)
Unit tests (UTs) play an instrumental role in assessing code correctness as well as providing feedback to large language models (LLMs), motivating automated test generation. However, we uncover a trade-off between generating unit test inputs that reveal errors when given a faulty code and correctly predicting the unit test output without access to the gold solution. To address this trade-off, we propose UTGen, which teaches LLMs to generate unit test inputs that reveal errors along with their correct expected outputs based on task descriptions. Since model-generated tests can provide noisy signals (e.g., from incorrectly predicted outputs), we propose UTDebug that (i) scales UTGen via test-time compute to improve UT output prediction, and (ii) validates and backtracks edits based on multiple generated UTs to avoid overfitting, and helps LLMs debug effectively. We show that UTGen outperforms other LLM-based baselines by 7.59% based on a metric measuring the presence of both error-revealing UT inputs and correct UT outputs. When used with UTDebug, we find that feedback from UTGen's unit tests improves pass@1 accuracy of Qwen2.5 32B on HumanEvalFix and our own harder debugging split of MBPP+ by over 3.17% and 12.35% (respectively) over other LLM-based UT generation baselines. Moreover, we observe that feedback from Qwen2.5 32B-based UTGen model can enhance debugging with frontier LLMs like GPT-4o by 13.8%. Lastly, we demonstrate that UTGen is a better judge for code correctness, outperforming a state-of-the-art trained 8B reward model by 4.43% on HumanEval+ with best-of-10 sampling using Qwen2.5 7B.
Key facts. Cited by 16 papers in the map (data through 7 Oct 2026). Builds on 40 of its 61 references that are in the map. First posted on arXiv 3 Feb 2025.
Builds on
40 of 61 references.
References · 40
- 2023GPT-4 Technical Reportcited by 18,132
- 2024The Llama 3 Herd of Modelscited by 14,192
- 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,084
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2022Self-Consistency Improves Chain of Thought Reasoning in Language Modelscited by 5,601
- 2024GPT-4o System Cardcited by 4,467
- 2023Reflexion: Language Agents with Verbal Reinforcement Learningcited by 4,064
- 2023Let's Verify Step by Stepcited by 3,598
- 2021Program Synthesis with Large Language Modelscited by 3,509
- 2023QLoRA: Efficient Finetuning of Quantized LLMscited by 3,355
- 2023Self-Refine: Iterative Refinement with Self-Feedbackcited by 3,317
28 more
- 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,193
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
- 2024Scaling LLM Test-Time Compute Optimally can be More Effective than Scaling Model Parameterscited by 1,928
- 2024LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Codecited by 1,906
- 2022Competition-Level Code Generation with AlphaCodecited by 1,427
- 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,332
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,154
- 2024Qwen2.5-Coder Technical Reportcited by 1,151
- 2023Large Language Models Cannot Self-Correct Reasoning Yetcited by 965
- 2023Teaching Large Language Models to Self-Debugcited by 963
- 2022STaR: Bootstrapping Reasoning With Reasoningcited by 895
- 2023StarCoder: may the source be with you!cited by 790
- 2024Generative Verifiers: Reward Modeling as Next-Token Predictioncited by 465
- 2022CodeT: Code Generation with Generated Testscited by 369
- 2024Skywork-Reward: Bag of Tricks for Reward Modeling in LLMscited by 322
- 2024CRUXEval: A Benchmark for Code Reasoning, Understanding and Executioncited by 294
- 2023An Empirical Evaluation of Using Large Language Models for Automated Unit Test Generationcited by 193
- 2023Is Self-Repair a Silver Bullet for Code Generation?cited by 191
- 2023OctoPack: Instruction Tuning Code Large Language Modelscited by 178
- 2024Generative Reward Modelscited by 148
- 2024On the Self-Verification Limitations of Large Language Models on Reasoning and Planning Taskscited by 137
- 2023Self-Edit: Fault-Aware Code Editor for Code Generationcited by 110
- 2024DebugBench: Evaluating Debugging Capability of Large Language Modelscited by 74
- 2024NExT: Teaching Large Language Models to Reason about Code Executioncited by 60
- 2024Self-Consistency Preference Optimizationcited by 50
- 2024MAgICoRe: Multi-Agent, Iterative, Coarse-to-Fine Refinement for Reasoningcited by 40
- 2023Coffee: Boost Your Code LLMs by Fixing Bugs with Feedbackcited by 15
- 2024Coffee-Gym: An Environment for Evaluating and Improving Natural Language Feedback on Erroneous Codecited by 9
Built on by
Citing papers per year: 2025: 7; 2026: 9.
16 papers.
Sort:
By area:
- 2025Co-Evolving LLM Coder and Unit Tester via Reinforcement Learningcited by 51
- 2025debug-gym: A Text-Based Environment for Interactive Debuggingcited by 19
- 2025Co-PatcheR: Collaborative Software Patching with Component(s)-specific Small Reasoning Modelscited by 12
- 2025Learning to Generate Unit Test via Adversarial Reinforcement Learningcited by 11
- 2025Code Reasoning for Software Engineering Tasks: A Survey and A Call to Actioncited by 4
- 2026RM -RF: Reward Model for Run-Free Unit Test Evaluationcited by 2
- 2026PaT: Planning-after-Trial for Efficient Test-Time Code Generationcited by 2
- 2026Oracle Gap and Signal Fidelity: A Fixed-Pool Diagnostic for Test-Time Collaborationcited by 2
- 2025OptiHive: Ensemble Selection for LLM-Based Optimization via Statistical Modelingcited by 1
- 2026LAUDE: LLM-Assisted Unit Test Generation and Debugging of Hardware DEsignscited by 1
- 2026Self-Improving Code Generation via Semantic Entropy and Behavioral Consensuscited by 1
- 2025Chain of Unit-Physics: A Primitive-Centric Approach to Scientific Code Synthesiscited by 0
4 more
- 2026SAFEdit: Does Multi-Agent Decomposition Resolve the Reliability Challenges of Instructed Code Editing?cited by 0
- 2026D3-Gym: Constructing Real-World Verifiable Environments for Data-Driven Discoverycited by 0
- 2026Themis: Training Robust Multilingual Code Reward Models for Flexible Multi-Criteria Scoringcited by 0
- 2026GPU Forecasters: Language Models as Selective Surrogates for Kernel Runtime Optimizationcited by 0
- 2026Oracle Gap and Signal Fidelity: A Fixed-Pool Diagnostic for Test-Time Collaboration20 Jul 2026
- 2026GPU Forecasters: Language Models as Selective Surrogates for Kernel Runtime Optimization29 May 2026
- 2026PaT: Planning-after-Trial for Efficient Test-Time Code Generation8 May 2026
- 2026Themis: Training Robust Multilingual Code Reward Models for Flexible Multi-Criteria Scoring1 May 2026
- 2026D3-Gym: Constructing Real-World Verifiable Environments for Data-Driven Discovery30 Apr 2026
- 2026SAFEdit: Does Multi-Agent Decomposition Resolve the Reliability Challenges of Instructed Code Editing?28 Apr 2026
- 2026Self-Improving Code Generation via Semantic Entropy and Behavioral Consensus31 Mar 2026
- 2026RM -RF: Reward Model for Run-Free Unit Test Evaluation19 Jan 2026
- 2026LAUDE: LLM-Assisted Unit Test Generation and Debugging of Hardware DEsigns6 Jan 2026
- 2025Chain of Unit-Physics: A Primitive-Centric Approach to Scientific Code Synthesis30 Nov 2025
- 2025Learning to Generate Unit Test via Adversarial Reinforcement Learning28 Aug 2025
- 2025OptiHive: Ensemble Selection for LLM-Based Optimization via Statistical Modeling4 Aug 2025
4 more
- 2025Code Reasoning for Software Engineering Tasks: A Survey and A Call to Action16 Jun 2025
- 2025Co-Evolving LLM Coder and Unit Tester via Reinforcement Learning3 Jun 2025
- 2025Co-PatcheR: Collaborative Software Patching with Component(s)-specific Small Reasoning Models25 May 2025
- 2025debug-gym: A Text-Based Environment for Interactive Debugging27 Mar 2025
- 2025Co-PatcheR: Collaborative Software Patching with Component(s)-specific Small Reasoning Modelscited by 12
- 2025Code Reasoning for Software Engineering Tasks: A Survey and A Call to Actioncited by 4
- 2026PaT: Planning-after-Trial for Efficient Test-Time Code Generationcited by 2
- 2026Oracle Gap and Signal Fidelity: A Fixed-Pool Diagnostic for Test-Time Collaborationcited by 2
- 2026Themis: Training Robust Multilingual Code Reward Models for Flexible Multi-Criteria Scoringcited by 0
- 2026Oracle Gap and Signal Fidelity: A Fixed-Pool Diagnostic for Test-Time Collaboration20 Jul 2026
- 2026PaT: Planning-after-Trial for Efficient Test-Time Code Generation8 May 2026
- 2026Themis: Training Robust Multilingual Code Reward Models for Flexible Multi-Criteria Scoring1 May 2026
- 2025Code Reasoning for Software Engineering Tasks: A Survey and A Call to Action16 Jun 2025
- 2025Co-PatcheR: Collaborative Software Patching with Component(s)-specific Small Reasoning Models25 May 2025
- 2025debug-gym: A Text-Based Environment for Interactive Debuggingcited by 19
- 2025Chain of Unit-Physics: A Primitive-Centric Approach to Scientific Code Synthesiscited by 0
- 2026SAFEdit: Does Multi-Agent Decomposition Resolve the Reliability Challenges of Instructed Code Editing?cited by 0
- 2026GPU Forecasters: Language Models as Selective Surrogates for Kernel Runtime Optimizationcited by 0
- 2026GPU Forecasters: Language Models as Selective Surrogates for Kernel Runtime Optimization29 May 2026
- 2026SAFEdit: Does Multi-Agent Decomposition Resolve the Reliability Challenges of Instructed Code Editing?28 Apr 2026
- 2025Chain of Unit-Physics: A Primitive-Centric Approach to Scientific Code Synthesis30 Nov 2025
- 2025debug-gym: A Text-Based Environment for Interactive Debugging27 Mar 2025
- 2025Co-Evolving LLM Coder and Unit Tester via Reinforcement Learningcited by 51
- 2025Learning to Generate Unit Test via Adversarial Reinforcement Learningcited by 11
- 2026RM -RF: Reward Model for Run-Free Unit Test Evaluationcited by 2
- 2025OptiHive: Ensemble Selection for LLM-Based Optimization via Statistical Modelingcited by 1
- 2026LAUDE: LLM-Assisted Unit Test Generation and Debugging of Hardware DEsignscited by 1
- 2026D3-Gym: Constructing Real-World Verifiable Environments for Data-Driven Discoverycited by 0
- 2026D3-Gym: Constructing Real-World Verifiable Environments for Data-Driven Discovery30 Apr 2026
- 2026RM -RF: Reward Model for Run-Free Unit Test Evaluation19 Jan 2026
- 2026LAUDE: LLM-Assisted Unit Test Generation and Debugging of Hardware DEsigns6 Jan 2026
- 2025Learning to Generate Unit Test via Adversarial Reinforcement Learning28 Aug 2025
- 2025OptiHive: Ensemble Selection for LLM-Based Optimization via Statistical Modeling4 Aug 2025
- 2025Co-Evolving LLM Coder and Unit Tester via Reinforcement Learning3 Jun 2025
Similar, not cited
Close in wording, no citation either way
- 2026Synthesizing File-Level Data for Unit Test Generation with Chain-of-Thoughts via Self-Debugging
- 2025Go-UT-Bench: A Fine-Tuning Dataset for LLM-Based Unit Test Generation in Go
- 2026LLM vs. Human Unit Tests: Fault Detection on Real Python Bugs
- 2025Unify and Triumph: Polyglot, Diverse, and Self-Consistent Generation of Unit Tests with LLMs
- 2025UTBoost: Rigorous Evaluation of Coding Agents on SWE-Bench
- 2025AugmenTest: Enhancing Tests with LLM-Driven Oracles
- 2026TAM-Eval: Evaluating LLMs for Automated Unit Test Maintenance
- 2025Dynamic Scaling of Unit Tests for Code Reward Modeling