mlsanityData to 14 Oct 2026

Reinforcement Learning from Automatic Feedback for High-Quality Unit Test Generation

arXiv 2310.02368 ↗First posted 3 Oct 2023cs.SE cs.LGcited by 21

On the map: LLM alignment / RLHF / preference optimisation → Process reward models for reasoning

Abstract (arXiv)

Software testing is a crucial aspect of software development, and the creation of high-quality tests that adhere to best practices is essential for effective maintenance. Recently, Large Language Models (LLMs) have gained popularity for code generation, including the automated creation of test cases. However, these LLMs are often trained on vast amounts of publicly available code, which may include test cases that do not adhere to best practices and may even contain test smells (anti-patterns). To address this issue, we propose a novel technique called Reinforcement Learning from Static Quality Metrics (RLSQM). To begin, we analyze the anti-patterns generated by the LLM and show that LLMs can generate undesirable test smells. Thus, we train specific reward models for each static quality metric, then utilize Proximal Policy Optimization (PPO) to train models for optimizing a single quality metric at a time. Furthermore, we amalgamate these rewards into a unified reward model aimed at capturing different best practices and quality aspects of tests. By comparing RL-trained models with those trained using supervised learning, we provide insights into how reliably utilize RL to improve test generation quality and into the effects of various training strategies. Our experimental results demonstrate that the RL-optimized model consistently generated high-quality test cases compared to the base LLM, improving the model by up to 21%, and successfully generates nearly 100% syntactically correct code. RLSQM also outperformed GPT-4 on four out of seven metrics. This represents a significant step towards enhancing the overall efficiency and reliability of software testing through Reinforcement Learning and static quality metrics. Our data are available at https://figshare.com/s/ded476c8d4c221222849.

Key facts. Cited by 21 papers in the map (data through 14 Oct 2026). Placed in Process reward models for reasoning, one of 10 directions in LLM alignment / RLHF / preference optimisation. Builds on 35 of its 68 references that are in the map. First posted on arXiv 3 Oct 2023.

Builds on

35 of 68 references.

References · 35

  1. 2020Language Models are Few-Shot Learnerscited by 32,419
  2. 2023GPT-4 Technical Reportcited by 18,396
  3. 2022Training language models to follow instructions with human feedbackcited by 15,971
  4. 2017Proximal Policy Optimization Algorithmscited by 15,215
  5. 2021LoRA: Low-Rank Adaptation of Large Language Modelscited by 14,380
  6. 2023LLaMA: Open and Efficient Foundation Language Modelscited by 14,132
  7. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 13,028
  8. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  9. 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,326
  10. 2017Deep reinforcement learning from human preferencescited by 3,912
  11. 2022Training a Helpful and Harmless Assistant with Reinforcement Learning from Human Feedbackcited by 3,720
  12. 2023Tree of Thoughts: Deliberate Problem Solving with Large Language Modelscited by 3,211
23 more
  1. 2022Constitutional AI: Harmlessness from AI Feedbackcited by 3,050
  2. 2019The Curious Case of Neural Text Degenerationcited by 2,916
  3. 2020Learning to summarize from human feedbackcited by 2,588
  4. 2016Asynchronous Methods for Deep Reinforcement Learningcited by 2,258
  5. 2021Pre-train, Prompt, and Predict: A Systematic Survey of Prompting Methods in Natural Language Processingcited by 2,234
  6. 2019Fine-Tuning Language Models from Human Preferencescited by 2,150
  7. 2023Code Llama: Open Foundation Models for Codecited by 2,139
  8. 2022Few-Shot Parameter-Efficient Fine-Tuning is Better and Cheaper than In-Context Learningcited by 896
  9. 2015Scheduled Sampling for Sequence Prediction with Recurrent Neural Networkscited by 803
  10. 2023Open Problems and Fundamental Limitations of Reinforcement Learning from Human Feedbackcited by 759
  11. 2015Sequence Level Training with Recurrent Neural Networkscited by 576
  12. 2021Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributionscited by 431
  13. 2022Is Reinforcement Learning (Not) for Natural Language Processing: Benchmarks, Baselines, and Building Blocks for Natural Language Policy Optimizationcited by 246
  14. 2023An Empirical Evaluation of Using Large Language Models for Automated Unit Test Generationcited by 194
  15. 2020Unit Test Case Generation with Transformers and Focal Contextcited by 118
  16. 2023No More Manual Tests? Evaluating and Improving ChatGPT for Unit Test Generationcited by 82
  17. 2021TOGA: A Neural Method for Test Oracle Generationcited by 57
  18. 2023Effective Test Generation Using Pre-trained Large Language Models and Mutation Testingcited by 51
  19. 2022Code Generation Tools (Almost) for Free? A Study of Few-Shot, Pre-Trained Language Models on Codecited by 39
  20. 2023A3Test: Assertion-Augmented Automated Test Case Generationcited by 33
  21. 2023Can Large Language Models Write Good Property-Based Tests?cited by 31
  22. 2021Learning to Complete Code with Sketchescited by 23
  23. 2023Transformer-based Vulnerability Detection in Code at EditTime: Zero-shot, Few-shot, or Fine-tuning?cited by 13

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2023: 1; 2024: 6; 2025: 8; 2026: 6.

21 papers.

Sort:

By area:

  1. 2024LiveCodeBench: Holistic and Contamination Free Evaluation of Large Language Models for Codecited by 2,004
  2. 2025ACECODER: Acing Coder RL via Automated Test-Case Synthesiscited by 93
  3. 2023Unifying the Perspectives of NLP and Software Engineering: A Survey on Language Models for Codecited by 62
  4. 2024How Far Are We From AGI: Are LLMs All We Need?cited by 31
  5. 2025CodeCrash: Exposing LLM Fragility to Misleading Natural Language in Code Reasoningcited by 14
  6. 2024Leveraging Large Language Models for Enhancing the Understandability of Generated Unit Testscited by 11
  7. 2025Hallucination to Consensus: Multi-Agent LLMs for End-to-End JUnit Test Generationcited by 9
  8. 2025Tests as Prompt: A Test-Driven-Development Benchmark for LLM Code Generationcited by 5
  9. 2024Toward Automated Validation of Language Model Synthesized Test Cases using Semantic Entropycited by 4
  10. 2025Nexus: Execution-Grounded Multi-Agent Test Oracle Synthesiscited by 4
  11. 2024Parameter-Efficient Fine-Tuning of Large Language Models for Unit Test Generation: An Empirical Studycited by 3
  12. 2024Distilling Desired Comments for Enhanced Code Review with Large Language Modelscited by 2
9 more
  1. 2026Beyond Code Generation: Reliability, Verification, and Cost Economics in the Agentic Software Development Lifecyclecited by 1
  2. 2025VERIRL: Boosting the LLM-based Verilog Code Generation via Reinforcement Learningcited by 0
  3. 2025The Software Engineering Simulations Lab: Agentic AI for RE Quality Simulationscited by 0
  4. 2025DUET: Agentic Design Understanding via Experimentation and Testingcited by 0
  5. 2026PPO guided Agentic Pipeline for Adaptive Prompt Selection and Test Case Generationcited by 0
  6. 2026FeedbackLLM: Metadata driven Multi-Agentic Language Agnostic Test Case Generator with Evolving prompt and Coverage Feedbackcited by 0
  7. 2026Beyond Execution: Static-Analysis Rewards and Hint-Conditioned Diffusion RL for Code Generationcited by 0
  8. 2026ClaHF: A Human Feedback-inspired Reinforcement Learning Framework for Improving Classification Taskscited by 0
  9. 2026Reinforcement Learning for Software Vulnerability Analysis: A Systematic Review with Emphasis on C/C++ Source Code and Static Analysiscited by 0

Similar, not cited

Close in wording, no citation either way

  1. 2024Reinforcement Learning from Automatic Feedback for High-Quality Unit Test Generation
  2. 2025Learning to Generate Unit Test via Adversarial Reinforcement Learning
  3. 2026Two-Stage Reinforcement Learning for Sound and Adversarial Test Generation in Code LLMs
  4. 2024Process Supervision-Guided Policy Optimization for Code Generation
  5. 2025Training Language Models to Generate Quality Code with Program Analysis Feedback
  6. 2025HarnessLLM: Automatic Testing Harness Generation via Reinforcement Learning
  7. 2025CodeContests+: High-Quality Test Case Generation for Competitive Programming
  8. 2025Klear-CodeTest: Scalable Test Case Generation for Code Reinforcement Learning