# Reinforcement Learning for Code Optimization

- **ID:** 779
- **Kind:** paper
- **URL:** https://arxiv.org/abs/2607.25970
- **Authors:** Pierre Chambon, Kunhao Zheng, Juliette Decugis, Benoit Sagot, Gabriel Synnaeve
- **Venue:** arXiv
- **Published:** 2026
- **Source:** arxiv
- **Language:** en
- **Access:** public
- **Tags:** rl, code-optimization, grpo, dmc-optim, execution-time-reward
- **Topics:** reinforcement learning, code optimization
- **Added:** 2026-09-29
- **Verified:** 2026-09-29
- **Research status:** done
- **Page:** https://papers.projxon.ai/entries/779

## Summary

Makes execution time learnable for RL on code optimization via three stages: (1) DMC-Optim benchmark with large optimization tests and a calibrated timing sandbox; (2) composing correctness and speed into the reward using an offline simulator to pick configurations; (3) adapting GRPO and evaluation to the sparser, noisier timed-execution setting. Strongest configurations improve strict top-50% pass@1 from 18.0% to 31.3% on Qwen 2.5 7B and 30.7% to 50.4% on CWM 32B, with further gains at stricter percentiles (125% relative improvement for CWM 32B at top-30%) while preserving pure-correctness scores.

## From the source (fetched 2026-10-03)

- **Published:** Jul 28, 2026 (arXiv)
- **arXiv categories:** cs.LG, cs.AI (arXiv)
- **Author comment:** 125 pages (arXiv)
- **Citations:** 0 (Semantic Scholar)
- **References:** 0 (Semantic Scholar)

## Abstract

RL for code correctness is now established: have the model generate a program, run it against hidden test cases, and reward solutions that pass. Extending this to code optimization seems straightforward: just add execution time to the reward. But in practice, once timing drives the reward, small problems in measurement noise, reward sparsity, or GRPO instability overwhelm the signal and make RL fail: generated solutions are barely faster, and more of them can fail. We make execution time learnable through three stages: (1) how code is tested, by building DMC-Optim with large optimization tests and a calibrated sandbox; (2) how speed is turned into reward, by composing correctness and speed in the RL environment and using an offline simulator to predict the most promising configurations; and (3) how the model learns from that reward, by adapting GRPO and evaluation to the sparser, noisier timed-execution setting. On DMC-Optim, the strongest optimization-aware configurations improve strict top-50% pass@1 from 18.0% to 31.3% on Qwen 2.5 7B and from 30.7% to 50.4% on CWM 32B. These gains further increase at stricter percentiles such as top-30%, with 125% relative improvement for CWM 32B, while preserving pure-correctness scores. When the timing sandbox is degraded, robust optimization RL reaches 100% to 200% improvement over standard RLVR, depending on the evaluation criterion. On LCB, CWM 32B wins up to 83% of median-sample speed comparisons against standard RLVR. Relative to the fastest correct human submissions per problem, it reaches about half the human rate of complexity-class improvements (14% vs. 28%).

## Research notes

- Discovery: shared by Pierre Chambon (@PierreChambon6, FAIR/Meta AI & INRIA) in an X thread on 2026-09-29 presenting 3 papers on code optimization: https://x.com/PierreChambon6/status/2104966972043657560
- Method: DMC-Optim benchmark + calibrated sandbox; correctness-speed reward composition via offline simulator; GRPO adapted to sparse noisy timed rewards.
- Submitted 2026-07-28.

## Related entries

- Discussed in: [RL for language models after GRPO: fixes, costs, rewards, agents (overview)](https://papers.projxon.ai/entries/1207) (note, #1207)

## Similar entries

- [Marathoner: Ultra-Long-Horizon Autonomous Intelligence](https://papers.projxon.ai/entries/837) (paper, #837)
- [RLEF: Grounding Code LLMs in Execution Feedback with Reinforcement Learning](https://papers.projxon.ai/entries/923) (paper, #923)
- [Extrapolative Weight Averaging Reveals Correctness-Efficiency Frontiers in Code RL](https://papers.projxon.ai/entries/778) (paper, #778)
- [RLTL;DR: Self-improvement by Internalizing Self-generated Feedback](https://papers.projxon.ai/entries/812) (paper, #812)
- [AutoCompact: Learning When to Compact Context in Long-Horizon Coding Agents](https://papers.projxon.ai/entries/1211) (paper, #1211)
- [GEPA: Reflective Prompt Evolution Can Outperform Reinforcement Learning](https://papers.projxon.ai/entries/648) (paper, #648)
