RLPF Trains Code Agents for Faster, Correct Code Generation

Huihao Jing, Haozhe Cui, Wenbin Hu, Shaojin Chen, Haochen Shi, Changxuan Fan, Yuxuan Liu, Hanyu Yang, Sirui Zhang, Ziyi Chen, Haoran Li, Yangqiu Song· July 31, 2026 View original

Key takeaways

  • RLPF trains code generation agents to optimize for both correctness and runtime efficiency.
  • It uses a staged reward system, providing feedback on execution progress for failures and efficiency for correct code.
  • RLPF significantly improves the percentage of correct-and-runnable solutions and their efficiency.
  • This method enables AI to generate higher-quality, performant code beyond mere functional correctness.

Who benefits

Software DevelopmentAI/ML EngineeringDevOpsCybersecurityGaming

Summary

Researchers introduce RLPF (Reinforcement Learning from Performance Feedback), a method that trains code generation agents to prioritize both correctness and runtime efficiency. This approach uses a staged reward system that provides feedback on execution progress for failed programs and relative efficiency for correct ones.

Current methods for training AI code generation models often stop at ensuring functional correctness, overlooking the critical aspect of runtime efficiency, especially for systems code. Two programs might pass the same tests but differ significantly in speed. The challenge lies in providing meaningful feedback for efficiency, as runtime is only relevant for correct programs and offers little guidance when programs fail to compile or execute. To address this, a new technique called RLPF (Reinforcement Learning from Performance Feedback) has been developed. RLPF transforms execution outcomes into a staged reward system. For programs that fail, feedback is provided based on their execution progress, offering guidance even before correctness is achieved. For correct programs, the reward is based on their relative efficiency improvement compared to a baseline or expert reference. Fine-tuning Qwen3-32B with RLPF on PerfCodeBench dramatically increased correct-and-runnable solutions and improved relative efficiency. The trained model became competitive with stronger open-weight systems and showed some transferability of optimization behavior. This demonstrates that RLPF enables code agents to not only pass tests but also to actively optimize for performance.

Why it matters

For professionals developing or using AI for code generation, achieving both correctness and efficiency is paramount. RLPF offers a significant advancement, enabling AI models to produce higher-quality, performant code, which is critical for system development and optimization.

How to implement this in your domain

  1. 1Integrate RLPF's staged reward mechanism into reinforcement learning pipelines for training code generation models.
  2. 2Define clear metrics for execution progress and relative efficiency to provide granular feedback during training.
  3. 3Experiment with different baseline and expert references to guide the model towards optimal performance.
  4. 4Apply RLPF to fine-tune existing code LLMs to improve their ability to generate efficient and correct code for specific domains.

Original post by Huihao Jing, Haozhe Cui, Wenbin Hu, Shaojin Chen, Haochen Shi, Changxuan Fan, Yuxuan Liu, Hanyu Yang, Sirui Zhang, Ziyi Chen, Haoran Li, Yangqiu Song

"arXiv:2607.27271v1 Announce Type: new Abstract: Code models are increasingly trained with execution feedback, but most training signals still stop at correctness. This leaves an important gap for systems code: two programs can pass the same tests while differing greatly in runtim…"

View on X

Originally posted by Huihao Jing, Haozhe Cui, Wenbin Hu, Shaojin Chen, Haochen Shi, Changxuan Fan, Yuxuan Liu, Hanyu Yang, Sirui Zhang, Ziyi Chen, Haoran Li, Yangqiu Song on X · view source

Want to go deeper?

Turn these trends into skills with Learnijoy's hands-on AI & tech courses.

Explore courses