跳到正文
arXiv (AI + Vision + Imaging)· Prashank Kadam·· 7 天前AI 评分30

Option-GRPO:用分层强化学习让代码大模型为未见过的SDK生成简洁代码

Option-GRPO: Hierarchical RL Against AI Slop in Code Generation for Unseen SDKs

AI 导读

Option-GRPO是一种分层强化学习框架,仅凭SDK源码即可让代码大模型适配训练截止后发布的SDK,无需人工示例或测试用例,并同时优化功能正确性与代码简洁度。

正文 · 原文

arXiv:2611.23633v1 Announce Type: cross Abstract: Large language models increasingly produce AI slop in generated code: verbose, redundant, non-idiomatic implementations that pass functional checks but bloat codebases. The problem compounds on SDKs released after the model's training cutoff, where the model has neither idiomatic priors nor compositional understanding. We present Option-GRPO, a hierarchical reinforcement learning framework that adapts a code LLM to an unseen SDK from its source code alone, without human-written usage examples or test cases, and that explicitly optimizes for both functional correctness and code elegance. Our key insight is that SDK source code contains compositional structure that defines a hierarchy of reusable code patterns (code options) which simultaneously serve as the building blocks of a curriculum and the action space for efficient policy optimization. We show that code options induce a valid semi-Markov decision process, give conditional bounds under which shorter option description length implies more concise and, in expectation, more API-efficient programs, and analyze under stated assumptions how the option hierarchy improves credit assignment by a factor of $\sqrt{T/K}$. Using Group Relative Policy Optimization (GRPO) with execution-based rewards at each curriculum level, Option-GRPO discovers SDK idioms, composes them into patterns, and assembles patterns into complete programs. Experiments on 12 unseen SDKs with a 32B-parameter base model demonstrate 61.4% pass@1, outperforming flat GRPO by 8.7 points, ExploraCoder by 11.2 points, and ReCode by 6.3 points. Option-GRPO produces solutions that use 34.7% fewer API calls and are 27% shorter than flat-GRPO outputs while maintaining higher correctness, directly attacking the slop problem.

来源:arXiv (AI + Vision + Imaging) · arxiv.org