mlsanityData to 7 Oct 2026

Learning to Generate Unit Tests for Automated Debugging

arXiv 2502.01619 ↗First posted 3 Feb 2025cs.SE cs.AI cs.CLcited by 16

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

  1. 2023GPT-4 Technical Reportcited by 18,132
  2. 2024The Llama 3 Herd of Modelscited by 14,192
  3. 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,084
  4. 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
  5. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  6. 2022Self-Consistency Improves Chain of Thought Reasoning in Language Modelscited by 5,601
  7. 2024GPT-4o System Cardcited by 4,467
  8. 2023Reflexion: Language Agents with Verbal Reinforcement Learningcited by 4,064
  9. 2023Let's Verify Step by Stepcited by 3,598
  10. 2021Program Synthesis with Large Language Modelscited by 3,509
  11. 2023QLoRA: Efficient Finetuning of Quantized LLMscited by 3,355
  12. 2023Self-Refine: Iterative Refinement with Self-Feedbackcited by 3,317
28 more
  1. 2023SWE-bench: Can Language Models Resolve Real-World GitHub Issues?cited by 3,193
  2. 2023Code Llama: Open Foundation Models for Codecited by 2,105
  3. 2024Scaling LLM Test-Time Compute Optimally can be More Effective than Scaling Model Parameterscited by 1,928
  4. 2024LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Codecited by 1,906
  5. 2022Competition-Level Code Generation with AlphaCodecited by 1,427
  6. 2023Is Your Code Generated by ChatGPT Really Correct? Rigorous Evaluation of Large Language Models for Code Generationcited by 1,332
  7. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,154
  8. 2024Qwen2.5-Coder Technical Reportcited by 1,151
  9. 2023Large Language Models Cannot Self-Correct Reasoning Yetcited by 965
  10. 2023Teaching Large Language Models to Self-Debugcited by 963
  11. 2022STaR: Bootstrapping Reasoning With Reasoningcited by 895
  12. 2023StarCoder: may the source be with you!cited by 790
  13. 2024Generative Verifiers: Reward Modeling as Next-Token Predictioncited by 465
  14. 2022CodeT: Code Generation with Generated Testscited by 369
  15. 2024Skywork-Reward: Bag of Tricks for Reward Modeling in LLMscited by 322
  16. 2024CRUXEval: A Benchmark for Code Reasoning, Understanding and Executioncited by 294
  17. 2023An Empirical Evaluation of Using Large Language Models for Automated Unit Test Generationcited by 193
  18. 2023Is Self-Repair a Silver Bullet for Code Generation?cited by 191
  19. 2023OctoPack: Instruction Tuning Code Large Language Modelscited by 178
  20. 2024Generative Reward Modelscited by 148
  21. 2024On the Self-Verification Limitations of Large Language Models on Reasoning and Planning Taskscited by 137
  22. 2023Self-Edit: Fault-Aware Code Editor for Code Generationcited by 110
  23. 2024DebugBench: Evaluating Debugging Capability of Large Language Modelscited by 74
  24. 2024NExT: Teaching Large Language Models to Reason about Code Executioncited by 60
  25. 2024Self-Consistency Preference Optimizationcited by 50
  26. 2024MAgICoRe: Multi-Agent, Iterative, Coarse-to-Fine Refinement for Reasoningcited by 40
  27. 2023Coffee: Boost Your Code LLMs by Fixing Bugs with Feedbackcited by 15
  28. 2024Coffee-Gym: An Environment for Evaluating and Improving Natural Language Feedback on Erroneous Codecited by 9

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2025: 7; 2026: 9.

16 papers.

Sort:

By area:

Similar, not cited

Close in wording, no citation either way

  1. 2026Synthesizing File-Level Data for Unit Test Generation with Chain-of-Thoughts via Self-Debugging
  2. 2025Go-UT-Bench: A Fine-Tuning Dataset for LLM-Based Unit Test Generation in Go
  3. 2026LLM vs. Human Unit Tests: Fault Detection on Real Python Bugs
  4. 2025Unify and Triumph: Polyglot, Diverse, and Self-Consistent Generation of Unit Tests with LLMs
  5. 2025UTBoost: Rigorous Evaluation of Coding Agents on SWE-Bench
  6. 2025AugmenTest: Enhancing Tests with LLM-Driven Oracles
  7. 2026TAM-Eval: Evaluating LLMs for Automated Unit Test Maintenance
  8. 2025Dynamic Scaling of Unit Tests for Code Reward Modeling