Skip to main content
QUICK REVIEW

[Paper Review] RLEF: Grounding Code LLMs in Execution Feedback with Reinforcement Learning

Jonas Gehring, Kangfeng Zheng|arXiv (Cornell University)|Oct 2, 2024
Adversarial Robustness in Machine LearningComputer Science5 citations
TL;DR

RLEF trains code-generation LLMs with reinforcement learning to leverage execution feedback across multiple turns, achieving state-of-the-art solve rates on CodeContests with fewer samples and distributing benefits to HumanEval+ and MBPP+.

ABSTRACT

Large language models (LLMs) deployed as agents solve user-specified tasks over multiple steps while keeping the required manual engagement to a minimum. Crucially, such LLMs need to ground their generations in any feedback obtained to reliably achieve the desired outcomes. We propose an end-to-end reinforcement learning method for teaching models to leverage execution feedback in the realm of code synthesis, where state-of-the-art LLMs struggle to improve code iteratively compared to independent sampling. We benchmark on competitive programming tasks, where we achieve new state-of-the art results with both small (8B parameters) and large (70B) models while reducing the amount of samples required by an order of magnitude. Our analysis of inference-time behavior demonstrates that our method produces LLMs that effectively leverage automatic feedback over multiple steps.

Motivation & Objective

  • Motivate grounding code-generation LLMs in environment feedback to improve iterative repair and final correctness.
  • Propose an end-to-end RL framework (RLEF) that uses execution feedback from code execution as rewards.
  • Show that RLEF improves solve rates on competitive programming benchmarks with smaller models and fewer samples.
  • Demonstrate generalization of RLEF improvements to other code-generation benchmarks (HumanEval+, MBPP+) and higher turn budgets.

Proposed method

  • Model iterative code synthesis as a multi-turn dialogue where each turn generates code and receives execution feedback.
  • Use two test sets (public for feedback during training and private for final evaluation) to avoid leakage and ensure robust evaluation.
  • Frame the problem as a partially observable MDP and optimize with Proximal Policy Optimization (PPO) with a KL-penalty to regularize toward the initial policy.
  • Treat the policy as token-level actions with a turn-level value function, enabling feedback-informed updates.
  • Incorporate a binary final reward plus penalties for invalid code and a KL term to balance exploration and fidelity.
Figure 1: Solve rates of Llama 3.1 Models after RLEF training on CodeContests, compared to previously reported results across sampling budgets (log scale).
Figure 1: Solve rates of Llama 3.1 Models after RLEF training on CodeContests, compared to previously reported results across sampling budgets (log scale).

Experimental results

Research questions

  • RQ1Can reinforcement learning with execution feedback improve iterative code synthesis beyond independent sampling?
  • RQ2Does RLEF enable LLMs to effectively leverage in-context execution feedback over multiple turns?
  • RQ3Do improvements from RLEF generalize to other code-generation benchmarks beyond CodeContests?
  • RQ4How does RLEF affect sample efficiency and turn-budget utilization across small and large models?

Key findings

  • RLEF-trained models achieve new state-of-the-art results on CodeContests for both 8B and 70B LLMs, with substantially reduced sample requirements.
  • On the test set, the 70B model after RLEF reaches 37.5 and 40.1 solves (1@3) and (1ex+RLEF 1@3) respectively, surpassing prior methods.
  • RLEF improvements transfer to HumanEval+ and MBPP+ benchmarks and persist under increased sample budgets.
  • Inference-time feedback enables multi-turn self-repair and diverse though targeted edits, reducing reliance on independent sampling.
  • Using true feedback yields larger gains than random feedback, indicating the method’s reliance on meaningful execution signals.
Figure 2: Left: Overview of reinforcement learning with execution feedback (RLEF). The LLM is repeatedly prompted to implement code according to a problem description. Each attempt is evaluated on a public test set; upon failure, feedback is inserted into the conversation. If public tests are passin
Figure 2: Left: Overview of reinforcement learning with execution feedback (RLEF). The LLM is repeatedly prompted to implement code according to a problem description. Each attempt is evaluated on a public test set; upon failure, feedback is inserted into the conversation. If public tests are passin

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.