Large language models are increasingly used to generate code from natural language, but ensuring correctness remains challenging. Formal verification offers a principled way to obtain such guarantees by proving that a program satisfies a formal specification. However, specifications are frequently missing in real-world codebases, and writing high-quality specifications remains expensive and expertise-intensive. We present VeriSpecGen, a traceable refinement framework that synthesizes intent-aligned specifications in Lean through requirement-level attribution and localized repair. VeriSpecGen decomposes natural language into atomic requirements and generates requirement-targeted tests with explicit traceability maps to validate generated specifications. When validation fails, traceability maps attribute failures to specific requirements, enabling targeted clause-level repairs. VeriSpecGen achieve 86.6% on VERINA SpecGen task using Claude Opus 4.5, improving over baselines by up to 31.8 points across different model families and scales. Beyond inference-time gains, we generate 343K training examples from VeriSpecGen refinement trajectories and demonstrate that training on these trajectories substantially improves specification synthesis by 62-106% relative and transfers gains to general reasoning abilities.


翻译:大型语言模型越来越多地被用于从自然语言生成代码,但确保正确性仍然具有挑战性。形式化验证通过证明程序满足形式化规约,提供了一种获得此类保证的原则性方法。然而,现实世界代码库中的规约常常缺失,且编写高质量规约成本高昂且需要专业知识。我们提出了 VeriSpecGen,一个可追溯的精化框架,通过需求级归因与局部修复,在 Lean 中合成与意图对齐的规约。VeriSpecGen 将自然语言分解为原子需求,并生成具有显式可追溯性映射的需求导向测试,以验证生成的规约。当验证失败时,可追溯性映射将失败归因于特定需求,从而实现针对性的子句级修复。VeriSpecGen 在使用 Claude Opus 4.5 的 VERINA SpecGen 任务上达到了 86.6% 的准确率,在各模型系列和规模上比基线提升了多达 31.8 个百分点。除了推理阶段性能提升之外,我们还从 VeriSpecGen 的精化轨迹中生成了 34.3 万个训练样本,并证明在这些轨迹上训练可将规约合成能力相对提升 62-106%,并将改进迁移至通用推理能力。

0
下载
关闭预览

相关内容

ICML2026 | 重新思考顺序知识编辑中的正则化
专知会员服务
9+阅读 · 5月27日
融合知识图谱的大语言模型研究综述
专知会员服务
38+阅读 · 2025年4月18日
定制化大型语言模型的图检索增强生成综述
专知会员服务
38+阅读 · 2025年1月28日
大语言模型对齐研究综述
专知会员服务
56+阅读 · 2024年8月1日
大型语言模型对齐技术综述:RLHF、RLAIF、PPO、DPO 等
专知会员服务
55+阅读 · 2024年7月24日
【ICML2022】可达性约束强化学习
专知会员服务
23+阅读 · 2022年5月18日
专知会员服务
34+阅读 · 2021年5月8日
基于模型的强化学习综述
专知
42+阅读 · 2022年7月13日
智能合约的形式化验证方法研究综述
专知
16+阅读 · 2021年5月8日
知识图谱嵌入的Translate模型汇总(TransE,TransH,TransR,TransD)
深度学习自然语言处理
31+阅读 · 2020年6月12日
深入理解BERT Transformer ,不仅仅是注意力机制
大数据文摘
22+阅读 · 2019年3月19日
综述 | 知识图谱向量化表示
开放知识图谱
33+阅读 · 2017年10月26日
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
10+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
VIP会员
最新内容
学习数据的几何:形状空间分析数学综述
专知会员服务
7+阅读 · 6月17日
定向能反无人机系统最新发展动态
专知会员服务
8+阅读 · 6月17日
从燃煤战舰到算法战争:水面指挥的永恒要求
专知会员服务
6+阅读 · 6月17日
相关基金
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
10+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员