Multi-Turn Code Generation Through Single-Step Rewards

Abstract

We address the problem of code generation from multi-turn execution feedback. Existing methods either generate code without feedback or use complex, hierarchical reinforcement learning to optimize multi-turn rewards. We propose a simple yet scalable approach, $\mu$Code, that solves multi-turn code generation using only single-step rewards. Our key insight is that code generation is a one-step recoverable MDP, where the correct code can be recovered from any intermediate code state in a single turn. $\mu$Code iteratively trains both a generator to provide code solutions conditioned on multi-turn execution feedback and a verifier to score the newly generated code. Experimental evaluations show that our approach achieves significant improvements over state-of-the-art baselines such as STaR. We provide analysis of the design choices of the reward models and policy, and show the efficacy of $\mu$Code at utilizing the execution feedback.

Cite

Text

Jain et al. "Multi-Turn Code Generation Through Single-Step Rewards." ICLR 2025 Workshops: LLM_Reason_and_Plan, 2025.

Markdown

[Jain et al. "Multi-Turn Code Generation Through Single-Step Rewards." ICLR 2025 Workshops: LLM_Reason_and_Plan, 2025.](https://mlanthology.org/iclrw/2025/jain2025iclrw-multiturn/)

BibTeX

@inproceedings{jain2025iclrw-multiturn,
  title     = {{Multi-Turn Code Generation Through Single-Step Rewards}},
  author    = {Jain, Arnav Kumar and Gonzalez-Pumariega, Gonzalo and Chen, Wayne and Rush, Alexander M and Zhao, Wenting and Choudhury, Sanjiban},
  booktitle = {ICLR 2025 Workshops: LLM_Reason_and_Plan},
  year      = {2025},
  url       = {https://mlanthology.org/iclrw/2025/jain2025iclrw-multiturn/}
}