跳到正文
返回论文列表
cs.LG提交于 已译

基于验证器的智能体强化学习用于可证明正确的代码

Verifier-Grounded Agentic RL for Provably Correct Code

George Ma · Yuhao Zhang · Bing He · Zeren Shui · Ferhat Erata · Murali Krishna Ramanathan · et al.

中文摘要

代码强化学习通常以通过测试为奖励,但模型可能在测试未覆盖的输入上出错。程序验证器(program verifier)能判断程序是否满足所有输入的形式化规范。将验证器转化为奖励面临两个难题:验证器仅报告接受或拒绝,导致全失败时无梯度;策略可能通过假设证明目标来欺骗验证器。本文构建智能体环境与奖励机制,通过读取验证器诊断信息而非最终判决,根据满足的证明义务加权比例评分,并引入参考证明的隐藏探针。完整性审计优先于验证器,拒绝修改规范或假设证明目标的候选。模型作为智能体与实时验证器多轮交互,并配合冻结的证明专家。在 Qwen3 1.7B 至 14B 及 35B Qwen3.6 MoE 模型上,DafnyBench 代码生成验证率从 66.1% 升至 93.5%,SWE-Proof 从 56.3% 升至 100%。该奖励优于其他训练信号。在需提交仓库补丁的任务中,解决率从 59.6% 升至 72.5%。在三个未参与训练的验证套件上,检查点均表现提升,包括语言与验证器未在训练中出现的情况。

关键要点

  1. 01针对验证器奖励稀疏及策略欺骗问题,提出基于诊断信息的加权评分机制。
  2. 02引入完整性审计,优先拒绝修改规范或假设证明目标的候选代码。
  3. 03在 Qwen3 系列模型上,DafnyBench 验证率从 66.1% 提升至 93.5%。
  4. 04在 SWE-Proof 基准上,代码生成验证率达到 100%,优于二元奖励。
  5. 05在需提交补丁的任务中,解决率从 59.6% 提升至 72.5%,且具备跨语言泛化能力。

解读

尚无解读。

原始英文摘要

arXiv:2610.19298v1 Announce Type: new Abstract: Reinforcement learning for code usually rewards passing tests, which a model can do while remaining wrong on the inputs the tests do not cover. A program verifier instead decides whether a program satisfies a formal specification for all inputs. Language models are almost always paired with verifiers at inference time only, and turning a verifier into a reward raises two difficulties. It reports only acceptance or rejection, which gives no gradient when every attempt fails, and a policy can cheat it, most simply by telling it to assume what the proof was supposed to establish. We build an agentic environment and reward that address both. The reward reads the verifier's diagnostics rather than its verdict, scoring a candidate by the weighted fraction of proof obligations it discharges, extended with hidden probes from a reference proof's annotations. An integrity audit outranks the verifier, rejecting any candidate that alters the specification or assumes what it was meant to prove. The model works as an agent against a live verifier over many turns, with a separately trained proof specialist as a frozen collaborator. Across Qwen3 models from 1.7B to 14B and a 35B Qwen3.6 mixture-of-experts model, held-out verification on code generation rises from 66.1% to 93.5% on DafnyBench and from 56.3% to 100% on SWE-Proof. This reward leads every other training signal we compare, including a binary pass-or-fail reward trained under otherwise identical settings, with the widest margin on code generation. When the agent must also deliver the repository patch, graded by each project's withheld tests, the fraction of held-out issues it resolves rises from 59.6% to 72.5%. Evaluated unchanged on three verification suites withheld from training, the checkpoints improve on all of them, including one whose language and verifier are absent from training.

同方向论文 · cs.LG

查看全部 →

反向发现 · 这篇论文相关的工具与提示词

去交叉发现 →

关联提示词 · 6

编程tech.qimao.com·外部收录·

按规范检查 Go 代码改动,分析问题与服务影响并生成 Code Review 报告

``` # Code Review 规范 你是 golang 编程的专家,现在对代码进行 Code Review,请按照以下步骤进行: (若遇到 git 命令分页的情况,请加上`| cat`) ## 步骤一:代码规范检查 - [ ] 是否遵循最佳实践 @.cursor/rules/rule-code-spec.mdc - [ ] 是否存在重复代码 - [ ] 是否有充分的注释和文档 - [ ] 是否易于理解和维护 ## 步骤二:功能问题分析 - [ ] 分析本次代码改动的影响…

编程zhuanlan.zhihu.com·外部收录·

用于指导 Claude Code 按阶段规划、测试驱动实现、重构并提交代码。

### 1. 规划与分阶段 将复杂的工作分解为 3-5 个阶段。在 `IMPLEMENTATION_PLAN.md` 中记录: ```text ## 阶段 N: [Name] **目标**: [具体可交付成果] **成功标准**: [可测试的结果] **测试**: [具体的测试用例] **状态**: [未开始|进行中|已完成] ``` * 随着进展更新状态 * 所有阶段完成后删除文件 ### 2. 实现流程 1. **理解** - 研究代码库中的现有模式 2. **测试**…

编程github.com/PlexPt/awesome-chatgpt-prompts-zh·外部收录·

充当全栈软件开发人员

我想让你充当软件开发人员。我将提供一些关于 Web 应用程序要求的具体信息,您的工作是提出用于使用 Golang 和 Angular 开发安全应用程序的架构和代码。我的第一个要求是'我想要一个允许用户根据他们的角色注册和保存他们的车辆信息的系统,并且会有管理员,用户和公司角色。我希望系统使用 JWT 来确保安全。

编程github.com/PlexPt/awesome-chatgpt-prompts-zh·外部收录·

充当前端智能思路助手

我想让你充当前端开发专家。我将提供一些关于Js、Node等前端代码问题的具体信息,而你的工作就是想出为我解决问题的策略。这可能包括建议代码、代码逻辑思路策略。我的第一个请求是“我需要能够动态监听某个元素节点距离当前电脑设备屏幕的左上角的X和Y轴,通过拖拽移动位置浏览器窗口和改变大小浏览器窗口。”

编程github.com/PlexPt/awesome-chatgpt-prompts-zh·外部收录·

充当 Linux 终端

我想让你充当 Linux 终端。我将输入命令,您将回复终端应显示的内容。我希望您只在一个唯一的代码块内回复终端输出,而不是其他任何内容。不要写解释。除非我指示您这样做,否则不要键入命令。当我需要用英语告诉你一些事情时,我会把文字放在中括号内[就像这样]。我的第一个命令是 pwd