← Latest papers
🤖 AI

MURPHY: Feedback-Aware GRPO with Retrospective Credit Assignment for Multi-Turn Code Generation

The paper introduces MURPHY, a multi-turn extension of Group Relative Policy Optimization (GRPO) that utilizes feedback-conditioned rollout trees and retrospective credit assignment to significantly improve self-correcting code generation by propagating rewards from successful refinements back to earlier informative attempts.

Original authors: Chanakya Ekbote, Vijay Lingam, Sujay Sanghavi, Jun Huan, Behrooz Omidvar-Tehrani, Anoop Deoras, Stefano Soatto

Published 2026-05-12
📖 4 min read☕ Coffee break read

Original authors: Chanakya Ekbote, Vijay Lingam, Sujay Sanghavi, Jun Huan, Behrooz Omidvar-Tehrani, Anoop Deoras, Stefano Soatto

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are teaching a robot to solve a complex puzzle, like writing a computer program.

The Old Way (The "One-Shot" Mistake)
Traditionally, you'd ask the robot to solve the puzzle. If it gets it wrong, you might just say, "Try again," and let it guess a completely new solution from scratch. Or, in more advanced setups, the robot would see its mistake and try to fix it during the test, but the robot itself wouldn't actually learn how to fix mistakes better in the future. It was like a student taking a test, getting a red "X" on a question, and then immediately forgetting the lesson before the next test.

The Problem with Current "Learning" Methods
Newer methods let the robot try, fail, see the error message, and try again. This works, but the "teacher" (the training algorithm) is a bit clumsy. It treats the whole attempt as a single unit.

  • Scenario: The robot tries a solution, fails, and the error message tells it exactly why it failed (e.g., "You forgot to handle negative numbers"). The robot then uses that clue to fix the code and succeeds.
  • The Clumsy Teacher: The old training method says, "Great job on the final success!" but it gives zero credit to the first failed attempt. It doesn't realize that the first failure was actually useful because it provided the specific clue needed to solve the problem. It treats the failure as a total waste of time.

Enter MURPHY: The "Smart Detective" Teacher
The paper introduces MURPHY, a new way to train these robots. Think of MURPHY as a detective who looks at the whole story, not just the ending.

  1. Building a "Tree of Attempts": Instead of just one try, MURPHY lets the robot branch out.

    • Branch A: The robot tries a solution. It fails.
    • The Twist: MURPHY takes that failure, the error message, and the original question, and asks the robot to try again specifically to fix that error.
    • Branch B: The robot uses the error clue to fix the code and succeeds.
  2. Rewinding the Tape (Retrospective Credit): This is the magic part. Once the robot succeeds on Branch B, MURPHY goes backwards in time. It says, "Wait a minute! Branch B only succeeded because Branch A gave us that specific error clue. So, Branch A deserves credit too!"

    • It's like a detective realizing that the suspect's initial mistake (leaving a fingerprint) was actually the key evidence that led to the arrest. The fingerprint wasn't a "bad" move; it was a necessary step to the solution.
  3. Two Ways to Give Credit:

    • MARS (The Optimist): If any of the robot's follow-up attempts succeed, MARS gives full credit to the earlier failure that started the chain. It's like saying, "If you eventually find the treasure, the map you drew when you were lost was valuable."
    • MERS (The Realist): This method gives credit based on the average success of all follow-up attempts. It's a bit more cautious, spreading the credit out.
  4. Cutting the Dead Branches (Pruning): Sometimes, the robot tries so many variations that the "tree" gets too big and slow to process. MURPHY has a smart "gardener" tool. It looks at the branches and cuts off the ones that are all doing the same thing (not learning anything new). It keeps the branches that show the most variety and potential for learning, saving time and computer power.

The Results
The authors tested this on three different coding challenges using two different robot "brains" (models).

  • The Outcome: MURPHY made the robots significantly better at fixing their own code.
  • The Sweet Spot: The improvement was biggest on the hard problems. On easy problems, the robots were already good. But on hard problems where the robot had to fail, learn from the error, and try again, MURPHY helped them succeed about 6% more often than previous methods.

In a Nutshell
MURPHY teaches AI that failure is data. It stops treating a failed attempt as a "bad" outcome and starts treating it as a "necessary step" if that failure provided the information needed to eventually succeed. It rewires the AI to value the process of self-correction, not just the final answer.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →