paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Learning to Refine Specifications for Code Generation

学习精化规约以用于代码生成
FSE Proceedings of the 34th ACM International Conference on the Foundations of Software Engineering2026匹配度 2/10 · 该论文的目标是训练智能体精化自然语言规约以提升 LLM 代码生成正确率,本质上属于“以提升 LLM/Agent 能力本身为目标”的工作,与用户关注的两条主线(PL→AI 的静态分析/浮点/贝叶斯程序分析,以及 AI→PL 用 LLM 改进静态分析与形式化验证)没有直接交集;且实验建立在 GPT-4o-mini 这类较弱模型上,提升幅度也有限。引用 0 inbox
Jay Patel
crossref: 2026-09-12dblp: 2026-09-12

AI 速览

一句话:提出 RLAIF 框架,训练 Student 智能体迭代精化自然语言规约,从而提升 LLM 代码生成的正确率。

LLM 代码生成在复杂算法逻辑与边界情形上仍易出错,而迭代式自我精化常陷入重复失败循环,因为模型难以独立跳出自身的逻辑盲区。本文提出一种基于 AI 反馈的强化学习(RLAIF)框架,核心洞见是规约本身可以借助 LLM 自身输出的反馈被迭代精化,形成自改进回路;这与以往把规约视为静态输入的做法不同。方法上不更新基座模型参数:专有 LLM 通过 API 充当 Worker,另有 Tutor 与合成测试生成器提供监督与奖励信号,三者均由同一模型实例化,学习能力完全集中在较小的可训练 Student 智能体上,由它学习如何修改自然语言规约以引导生成。作者在 LiveCodeBench 与 HumanEvalPlus 上以 200 道题、Qwen 2.5-14B-Instruct 作 Student、GPT-4o-mini 扮演其余角色进行评估,pass@1 相对提升分别为 3.2%(64.0% vs. 62.0%)与 1.1%(96.0% vs. 95.0%)。

问题
现有 LLM 代码生成系统在复杂算法逻辑与边界用例上表现不佳,而迭代自我精化会因模型自身逻辑盲区陷入重复失败循环;同时规约通常被当作静态输入,未被充分利用。
方法
构建 RLAIF 框架:固定专有 LLM 作为 Worker、Tutor 与合成测试生成器,仅训练较小的 Student 智能体,使其根据失败反馈迭代修改自然语言规约,并以测试生成器识别的失败驱动奖励信号来引导精化。
评估
在 LiveCodeBench 与 HumanEvalPlus 上以 200 道题进行评测,Student 使用 Qwen 2.5-14B-Instruct,其余角色使用 GPT-4o-mini,报告 pass@1 相对提升(LiveCodeBench 3.2%,HumanEvalPlus 1.1%)。
原文摘要(Abstract)

The use of Large Language Models (LLMs) for code generation has advanced rapidly, yet current systems often struggle with complex algorithmic logic and edge cases. Standard methods for improving code generation, such as iterative self-refinement, often cause repetitive failure cycles, as models cannot independently escape their own logical blind spots. To address this gap, we propose a novel Reinforcement Learning from AI Feedback (RLAIF) framework. Our key insight is that specifications can be iteratively refined by leveraging feedback from the LLM's own outputs, creating a self-improving loop. This approach contrasts with prior methods that treat specifications as static inputs. Rather than updating the parameters of the base model, a proprietary LLM (the Worker) is accessed via API, while a smaller, trainable Student agent learns to guide generation by modifying natural language specifications. A Tutor agent supervises these refinements, ensuring they are precise and actionable, and provides a reward signal driven by failures identified by a synthetic test generator. Crucially, the Worker, Tutor, and Test Generator roles are all instantiated using the same proprietary model, isolating the learning capacity entirely within the Student agent. We evaluate our approach on N = 200 problems using a Qwen 2.5-14B-Instruct Student and a GPT-4o-mini model fulfilling the Worker, Tutor, and Test Generator roles on the LiveCodeBench and HumanEvalPlus benchmarks. Our method achieves relative pass@1 improvements of 3.2% on LiveCodeBench (64.0% vs. 62.0%) and 1.1% on HumanEvalPlus (96.0% vs. 95.0%).

链接与引用

DOI 原文 · PDF(开放获取) · DBLP

BibTeX
@inproceedings{Patel26,
  title = {Learning to Refine Specifications for Code Generation},
  author = {Jay Patel},
  booktitle = {FSE},
  year = {2026},
  doi = {10.1145/3803437.3804436}
}