2607.25970v1 Jul 28, 2026 cs.LG

코드 최적화를 위한 강화 학습

Reinforcement Learning for Code Optimization

Gabriel Synnaeve
Gabriel Synnaeve
Citations: 63,503
h-index: 58
Kunhao Zheng
Kunhao Zheng
Citations: 131
h-index: 5
Pierre Chambon
Pierre Chambon
Citations: 63
h-index: 2
Juliette Decugis
Juliette Decugis
Citations: 135
h-index: 3
Benoît Sagot
Benoît Sagot
Citations: 176
h-index: 3

코드의 정확성을 향상시키기 위한 강화 학습(RL)은 이미 확립된 방법입니다. 이 방법은 모델이 프로그램을 생성하고, 숨겨진 테스트 케이스를 통해 실행하며, 성공적인 솔루션에 대해 보상을 제공합니다. 이를 코드 최적화로 확장하는 것은 간단해 보입니다. 단순히 실행 시간을 보상에 추가하면 됩니다. 그러나 실제로는 실행 시간이 보상을 주도하게 되면 측정 오류, 희소한 보상, GRPO 불안정성과 같은 작은 문제들이 신호를 압도하여 RL이 실패하게 됩니다. 생성된 솔루션은 거의 더 빠르지 않고, 더 많은 솔루션이 실패합니다. 우리는 세 단계를 통해 실행 시간을 학습 가능하도록 만들었습니다: (1) 대규모 최적화 테스트와 교정된 샌드박스를 사용하여 코드가 어떻게 테스트되는지 학습합니다; (2) RL 환경에서 정확성과 속도를 결합하고 오프라인 시뮬레이터를 사용하여 가장 유망한 구성을 예측함으로써, 속도를 보상으로 변환하는 방법을 학습합니다; 그리고 (3) GRPO와 평가 방식을 더 희소하고 노이즈가 많은 실행 시간 기반 설정에 맞게 조정하여 모델이 해당 보상을 통해 학습하도록 합니다. DMC-Optim에서 최적화에 대한 인식이 가장 뛰어난 구성은 Qwen 2.5 7B 모델에서 strict top-50% pass@1 성능을 18.0%에서 31.3%로 향상시키고, CWM 32B 모델에서는 30.7%에서 50.4%로 향상시켰습니다. 이러한 개선 효과는 top-30%와 같은 더 엄격한 퍼센타일에서도 더욱 증가하며, 특히 CWM 32B 모델의 경우 125%의 상대적인 성능 향상을 보였으며, 이는 정확성 점수를 유지하면서 달성되었습니다. 실행 시간 샌드박스가 저하된 경우에도 강력한 최적화 RL은 표준 RLVR보다 100%에서 200%까지 성능이 향상됩니다(평가 기준에 따라 다름). LCB 데이터셋에서는 CWM 32B 모델이 표준 RLVR과의 속도 비교에서 최대 83%의 우위를 점했습니다. 문제별로 가장 빠른 올바른 인간 제출 결과와 비교했을 때, 복잡성 클래스 개선률은 약 절반 수준(14% vs. 28%)입니다.

Original 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%).

0 Citations
0 Influential
29 Altmetric
145.0 Score
Original PDF

No Analysis Report Yet

This paper hasn't been analyzed by Gemini yet.

Log in to request an AI analysis.

댓글

댓글을 작성하려면 로그인하세요.

아직 댓글이 없습니다. 첫 번째 댓글을 남겨보세요!