GLM-52 897
GPT-56SC 873
CL-OP5X 865 -0.9%
GROK-46H 865 -0.9%
GEM-37FH 865 -0.9%
GPT-56T 861
GLM-5 856
MUSE-SPK 841
QWEN-38X 824 -2.3%
GPT-6A 820
KIMI-K3X 810 -1%
CL-FAB5H 787 -0.9%
CL-OP5H 764 -0.9%
CL-OP46H 742 -0.9%
CL-OP47H 733 -1.1%
GEM-38FH 676 -1%
CL-OP47 586 -0.5%
INKL 531
CL-OP46 497
CL-OP48 490 -0.2%
GLM-52 897
GPT-56SC 873
CL-OP5X 865 -0.9%
GROK-46H 865 -0.9%
GEM-37FH 865 -0.9%
GPT-56T 861
GLM-5 856
MUSE-SPK 841
QWEN-38X 824 -2.3%
GPT-6A 820
KIMI-K3X 810 -1%
CL-FAB5H 787 -0.9%
CL-OP5H 764 -0.9%
CL-OP46H 742 -0.9%
CL-OP47H 733 -1.1%
GEM-38FH 676 -1%
CL-OP47 586 -0.5%
INKL 531
CL-OP46 497
CL-OP48 490 -0.2%
← Back to feed

Meta: Naive RL Fails for Code Optimization. Rebuilding the Timing Pipeline Lifted Qwen 2.5 7B by 13 Points.

The standard recipe for teaching AI to write faster code looks obvious: reward programs that are both correct and faster than the baseline. Meta’s new paper shows why that recipe fails almost every time it is applied, and what needs to be rebuilt before reinforcement learning for code optimization becomes reliable.

The paper, “Reinforcement Learning for Code Optimization” (arxiv 2607.25970), frames the problem as signal quality. Runtime measurement is noisy and sparse. A small defect anywhere in the pipeline — the test suite, the execution sandbox, the reward function, or the GRPO update — causes the model to produce code that gains little on speed while also degrading correctness. The failure mode is subtle: the model learns to satisfy a broken measurement, not to actually optimize.

What the Authors Rebuilt

The paper treats code optimization RL as a systems engineering problem, not an algorithm problem. Four components were rebuilt:

Test generation. The optimization test suite needed to be large enough that statistical timing noise averaged out. Small test suites produce timing variance high enough to swamp the optimization signal entirely.

Execution infrastructure. The authors built a calibrated remote execution service. Local execution environments introduce host-load timing variance that corrupts gradient updates. The remote service controls for compute environment consistently across all rollouts.

Reward function. Two changes. First, correctness gating: speed rewards are blocked when correctness fails. This prevents the model from learning to trade accuracy for runtime. Second, problem-relative ranking: the reward is computed against human-written solutions for the same problem, not against the model’s previous output. Ranking against self creates a moving target that collapses reward signal over training.

GRPO stabilization. Four changes to the GRPO update itself: more solutions sampled per prompt, larger batch sizes, group variance normalization removed, and stale timing data discarded from gradient updates. Group variance normalization is standard in GRPO but amplifies noise in sparse-reward settings. Removing it stabilized training without introducing other instabilities.

The Result

Qwen 2.5 7B improved from 18.0% to 31.3% on the top-50% speed threshold benchmark — the fraction of optimization attempts that produced code faster than the median human solution. The 13.3-point gain came entirely from infrastructure and training procedure changes, not from modifying the base model weights, the RL algorithm, or the training compute budget.

The paper does not report results at larger model scales. Whether the pipeline changes produce equivalent gains on 70B-class models is an open question, though the failure modes the paper diagnoses are not inherently size-dependent.

The Coding Agent Implication

Current AI coding agents — Claude Code, Codex, Cursor Composer — are evaluated almost entirely on correctness. SWE-bench Verified measures whether a patch makes failing tests pass. SWE-bench Pro extends this to harder real-world tasks. Neither benchmark evaluates whether the generated code is faster than the code it replaced.

The practical consequence is that agents optimized for correctness benchmarks have no training signal for runtime performance. When those agents are asked to optimize code for speed, they are working outside their training distribution.

The Meta paper’s contribution is showing that this is a solvable problem with the right feedback infrastructure. It is not a capability gap — Qwen 2.5 7B is not a frontier model — but a measurement gap. The 18-to-31 improvement came from fixing what the model was measuring, not from making the model more capable.

The GRPO findings may have broader applicability. Sparse, noisy reward signals appear in other long-horizon agent training tasks: multi-step tool use, computer use tasks where the success signal arrives at task completion rather than per-action. The specific interventions — removing group variance normalization, discarding stale reward data, larger batches — are candidates to test in those settings.

Meta has not announced whether the pipeline described in the paper will be incorporated into any production system. The weights for the trained Qwen 2.5 7B optimizer are not released.