NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Process-Supervised Reinforcement Learning for Code Generation

Y. Ye, Ting Zhang, Wenbin Jiang, Hua Huang · DOI

Abstract

Existing reinforcement learning strategies based on outcome supervision have proven effective in enhancing the performance of large language models(LLMs) for code generation. While reinforcement learning based on process supervision has shown great promise in handling multi-step reasoning tasks, its effectiveness in code generation remains largely underexplored and underjustified. The primary obstacle stems from the resource-intensive nature of constructing high-quality process-supervised data, which demands substantial human expertise and computational resources. In response to this challenge, we propose a "statement mutation/refactoring-compile and execution verification" strategy: mutating and refactoring code line-by-line through a teacher model, and utilizing compiler execution results to automatically label each line, resulting in line-by-line process-supervised data, which is pivotal for training a process-supervised reward model. The trained reward model is then integrated into the PRLCoder framework, followed by experimental validation on several benchmarks. Experimental results demonstrate that process-supervised reinforcement learning significantly surpasses methods relying solely on outcome supervision. Notably, in tackling complex code generation tasks, process-supervised reinforcement learning shows a clear advantage, ensuring both the integrity of the code generation process and the correctness of the generation results.

Introduction

Training Large Language Models (LLMs) for code generation typically relies on Outcome-Supervised Reward Models (ORM). In this paradigm, a model receives a reward based solely on whether the final output passes unit tests. This leads to a sparse reward problem: if a multi-line program fails due to a single error, the entire sequence is penalized, providing no information on which parts of the code were actually correct.

While Process-Supervised Reward Models (PRM)—which grade every intermediate step—have revolutionized mathematical reasoning tasks, they are difficult to implement for code due to the high cost of manual line-by-line labeling. This paper introduces PRLCoder, a framework that automates the creation of process-level data using a teacher model and compiler-based verification.

The PRLCoder Framework

PRLCoder addresses the sparse reward challenge through a three-phase pipeline designed to provide fine-grained feedback during the reinforcement learning process.

Overview of the PRLCoder pipeline, illustrating the transition from SFT to automated reward model training and final PPO optimization.
  1. Supervised Fine-Tuning (SFT): The base model is first trained on standard code datasets to establish a foundational policy.
  2. Automated PRM Training: This is the core innovation. To bypass human labeling, the framework uses a "statement mutation/refactoring-verification" strategy to generate positive and negative labels for individual lines of code.
  3. Reinforcement Learning (PPO): The model is optimized using Proximal Policy Optimization, where the reward signal is derived from the line-by-line scores of the trained PRM, leading to more stable and precise updates.

Automated Process Supervision

The "secret sauce" of PRLCoder is its ability to generate high-quality process data automatically. By leveraging a teacher model (such as DeepSeek-Coder) and a compiler, the system creates "hard negatives" and "verified positives" at the line level.

The detailed workflow for automated process-supervised data generation, showing how code is mutated, refactored, and verified by a compiler.

As shown in the workflow, the teacher model takes a correct program and either mutates a line (changing logic) or refactors it (changing syntax while keeping logic). The resulting code is run through a compiler against unit tests. If the code passes, the line is labeled Positive; if it fails (and was intended as a mutation), it is labeled Negative. This ensures the reward model learns to distinguish between subtle logical errors and valid syntactic variations.

Key Results and Insights

Experimental validation on benchmarks like MBPP+ and HumanEval highlights the advantages of this approach:

  • Superior Performance: On MBPP+, PRLCoder achieved a pass@1 rate of 18.7%, a 10.5% improvement over the base model and a 5.1% improvement over outcome-supervised RL.
  • Complexity Scaling: The advantage of process supervision is most significant in complex tasks. In "Hard" categories (defined by code length), PRLCoder outperformed the base model by a wider margin than in simpler tasks, proving that fine-grained feedback is essential for long-form reasoning.
  • Training Stability: By providing feedback at every step, the reinforcement learning process becomes more stable, with smoother convergence compared to the "all-or-nothing" feedback of ORMs.

Conclusion

PRLCoder demonstrates that the compiler can serve as an ultimate, automated judge for process-level supervision in code generation. By automating the labeling of intermediate steps, the framework overcomes the primary bottleneck of PRMs, resulting in models that are more accurate and robust in handling complex programming logic.

Summary updated

BibTeX
@misc{ye2025process,
  author = {Y. Ye and Ting Zhang and Wenbin Jiang and Hua Huang},
  title = {{Process-Supervised Reinforcement Learning for Code Generation}},
  year = {2025},
  eprint = {2502.01715},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.01715},
  howpublished = {arXiv},
}
Figure