Reinforcement Learning for Code Optimization
Summary
This paper addresses challenges in using reinforcement learning for code optimization by proposing three stages: improved testing with DMC-Optim, converting execution time into reward via correctness-speed composition and an offline simulator, and adapting GRPO for noisy timing rewards. The method achieves substantial improvements on code optimization benchmarks.
View Cached Full Text
Cached at: 07/29/26, 07:54 PM
Paper page - Reinforcement Learning for Code Optimization
Source: https://huggingface.co/papers/2607.25970
Abstract
RLforcodecorrectnessisnowestablished:havethemodelgenerateaprogram,runitagainsthiddentestcases,andrewardsolutionsthatpass.Extendingthistocodeoptimizationseemsstraightforward:justaddexecutiontimetothereward.Butinpractice,oncetimingdrivesthereward,smallproblemsinmeasurementnoise,rewardsparsity,orGRPOinstabilityoverwhelmthesignalandmakeRLfail:generatedsolutionsarebarelyfaster,andmoreofthemcanfail.Wemakeexecutiontimelearnablethroughthreestages:(1)howcodeistested,bybuildingDMC-Optimwithlargeoptimizationtestsandacalibratedsandbox;(2)howspeedisturnedintoreward,bycomposingcorrectnessandspeedintheRLenvironmentandusinganofflinesimulatortopredictthemostpromisingconfigurations;and(3)howthemodellearnsfromthatreward,byadaptingGRPOandevaluationtothesparser,noisiertimed-executionsetting.OnDMC-Optim,thestrongestoptimization-awareconfigurationsimprovestricttop-50%[email protected]%to31.3%onQwen2.57Bandfrom30.7%to50.4%onCWM32B.Thesegainsfurtherincreaseatstricterpercentilessuchastop-30%,with125%relativeimprovementforCWM32B,whilepreservingpure-correctnessscores.Whenthetimingsandboxisdegraded,robustoptimizationRLreaches100%to200%improvementoverstandardRLVR,dependingontheevaluationcriterion.OnLCB,CWM32Bwinsupto83%ofmedian-samplespeedcomparisonsagainststandardRLVR.Relativetothefastestcorrecthumansubmissionsperproblem,itreachesabouthalfthehumanrateofcomplexity-classimprovements(14%vs.28%).
View arXiv pageView PDFAdd to collection
Models citing this paper0
No model linking this paper
Cite arxiv.org/abs/2607.25970 in a model README.md to link it from this page.
Datasets citing this paper0
No dataset linking this paper
Cite arxiv.org/abs/2607.25970 in a dataset README.md to link it from this page.
Spaces citing this paper0
No Space linking this paper
Cite arxiv.org/abs/2607.25970 in a Space README.md to link it from this page.
Collections including this paper0
No Collection including this paper
Add this paper to acollectionto link it from this page.
Similar Articles
@rohanpaul_ai: New Meta Paper. Code optimization looks like an easy extension of reinforcement learning: reward correct programs, then…
A Meta paper analyzes why standard RL recipes fail for code optimization and rebuilds the entire feedback pipeline with calibrated timing, problem-relative ranking, and GRPO changes, improving Qwen 2.5 7B speed threshold from 18.0% to 31.3%.
RLPF: Reinforcement Learning from Performance Feedback for Code Generation
RLPF is a reinforcement learning method that trains code models to optimize runtime in addition to correctness, using staged rewards based on execution progress and relative efficiency. Fine-tuning Qwen3-32B with RLPF on PerfCodeBench raises correct-and-runnable solutions from 11.1% to 54.6% and improves relative efficiency from 8.1% to 38.6%.
Performance, Efficiency and Collapse -- Advantages and Challenges in Offline Post-training of Code LLMs
This paper investigates offline reinforcement learning for post-training code-generating LLMs, showing that it can improve zero-shot code generation performance using existing datasets without online sampling.
StarOR: Synergizing Tree Search and Test-Time Reinforcement Learning for Optimization Modeling
StarOR proposes a framework that synergizes Monte Carlo Tree Search with test-time reinforcement learning for automated optimization modeling, achieving state-of-the-art performance across multiple benchmarks.
Learning from Failures: Correction-Oriented Policy Optimization with Verifiable Rewards
Proposes Correction-Oriented Policy Optimization (CIPO), an extension to RLVR that converts failed trajectories into correction-oriented supervision, improving reasoning and correction performance in LLMs across math and code benchmarks.