TL;DR
When humans write code, a compiler error or a failing unit test isn't a dead end—it's a clue. Standard reinforcement learning recipes for LLMs treat every failed first draft as uniformly bad, missing out on how models actually debug in the wild. MURPHY extends the popular GRPO training algorithm into multi-turn territory, rewarding earlier "good failures" when they trigger informative feedback that leads to a working fix later on.
What Problem Does This Paper Address?
Post-training LLMs with Group Relative Policy Optimization (GRPO)—an efficient reinforcement learning method that skips training a separate critic model by comparing groups of responses against each other—has become the gold standard for reasoning tasks. However, GRPO is inherently single-turn: prompt goes in, code comes out, unit tests score it, done.
Real-world coding agents work in loops: write code, run tests, read stack traces, and refine. While inference-time frameworks (like Reflexion) let models self-correct at test time, they don't update the model's weights to actually get better at using feedback. Prior attempts to train models on execution feedback required heavy extra machinery like separate PPO critics, learned verifiers, or synthetic test generators. And if you naively stretch GRPO across multiple turns by broadcasting a final pass/fail score to every step in a trajectory, credit assignment gets blurry—the model can't tell whether an intermediate failure exposed a crucial edge case or just wasted a turn.
Methods
MURPHY keeps GRPO’s lightweight, critic-free architecture intact while introducing three structural upgrades:
- Feedback-Conditioned Rollout Trees: Given a coding prompt, the model samples a group of candidate programs and executes them. Passing solutions terminate immediately. Failing solutions are bundled with their error messages or failing test outputs to form new prompts, branching out into child groups of refinements in the next turn.
- Retrospective Credit Assignment: Once the tree is built, rewards flow backward from the leaves to the root before running standard local GRPO updates at each node. A failed first attempt earns positive credit if its error message helped a child node solve the problem. The authors test two backup rules: MARS (Max Reward), which optimistically passes up the best score achieved by any descendant, and MERS (Mean Reward), which passes up a discounted average of child scores.
- Post-Rollout Pruning: Because trees grow exponentially with each turn, computing gradients over every branch gets expensive. After generating the tree, MURPHY prunes uninformative branches before propagating rewards. INTRAP keeps high-variance individual trajectories within each group, while INTERP keeps entire refinement groups that show high internal reward diversity (mixing passes and fails).
Datasets
No new benchmarks are introduced; the authors rely on established datasets chosen to minimize data contamination:
- Training: Models are fine-tuned on a 1,000-sample subset randomly drawn from KodCode, selected specifically for its minimal overlap with standard coding evaluations.
- Evaluation: Models are tested on HumanEval, MBPP, and the contamination-resistant LiveCodeBench-v6 (stratified into Easy, Medium, and Hard subsets).
Key Insights and Ideas
- Not all bugs are created equal: Treating a broken script that surfaces a crisp
IndexErrorthe same as gibberish leaves learning signal on the table. Retrospective credit assignment teaches the model how to fail productively and pivot from execution traces. - Optimism wins in code: MARS consistently beats MERS—by over 10 percentage points on HumanEval with OLMo-2-7B. In code generation, rewards are sparse; averaging across children dilutes the signal of a rare breakthrough fix, whereas taking the max lets that single working refinement light up the path that led to it.
- Prune whole groups, not just individual samples: When cutting down compute, INTERP preserves multi-turn self-correction much better than INTRAP. Why? Because GRPO learns from contrast within a group. If every child in a refinement group fails (or every child passes), variance is near zero and there's nothing to learn. Keeping mixed-outcome groups concentrates gradient updates where the preference signal is sharpest.
Key Results
Evaluated across two model families (OLMo-2-7B-Instruct and Qwen3-1.7B/4B), MURPHY consistently outperforms multi-turn GRPO baselines and specialized execution-feedback methods ($\mu$Code and ReVeal):
- HumanEval & MBPP: At 3 self-correction turns (Iter-3), MURPHY boosts
pass@1by up to +6.20 percentage points (pp) on HumanEval and +6.07 pp on MBPP over the strongest baselines, with the largest leaps appearing on the weaker OLMo-2-7B base model. - LiveCodeBench-v6: Using Qwen3-4B, MURPHY shines brightest where single-shot generation struggles, beating baselines by +4.38 pp on Medium and +4.20 pp on Hard problems at 5 turns—while requiring roughly half the training time of ReVeal (~11 hours vs. ~23 hours on 8$\times$H100s).
- Compute Efficiency: Applying INTERP cuts retained trajectories nearly in half (from 72 to 40 per prompt), slashing gradient optimization time by 74.1% and overall step time by 21.4%, while staying within 0.4–0.8 pp of unpruned MURPHY's accuracy.
Limitations and Future Work
Multi-turn tree expansion inevitably costs more time and memory than standard single-turn GRPO. While INTERP slashes the backward-pass optimization cost, it happens after rollouts finish, meaning code generation and execution bottlenecks remain untouched. Future engineering could exploit shared prompt prefixes between parent and child nodes via vLLM prefix caching and KV-cache reuse. Additionally, unit tests provide unusually crisp, deterministic feedback; extending MURPHY to noisier, open-ended agentic environments, longer refinement horizons, and adaptive turn budgets remains open territory.
Summary updated