paperbot · PL 论文追踪

全部论文 待读 收藏

P0 Fun2spec: Code Contract Synthesis At Scale

Fun2spec:大规模代码契约合成
FSE Proceedings of the 34th ACM International Conference on the Foundations of Software Engineering2026匹配度 9/10 · 该论文利用 LLM 为大规模 C++ 代码合成带量词的一阶逻辑契约,直接对应“AI→PL:用 LLM/Agent 改进静态分析/形式化验证”的核心方向,且包含工业级落地、形式化规范与自动验证流程。引用 1 inbox
Shubham Ugare, Tarun Suresh, Sasa Misailovic, Julien Vanegue
crossref: 2026-09-12dblp: 2026-09-12

AI 速览

一句话:首个工业级工具,引导 LLM 合成带量词的一阶逻辑 C++ 规范,准确率达 85%。

本文提出 Fun2spec,首个工业级、面向大规模 C++ 代码的代码契约合成工具。其核心思路是引导大语言模型(LLM)生成一阶逻辑(含量词)形式的 C++ 规范,并通过自动化验证流程配合错误驱动的 oracle 反馈来迭代修正,从而保证规范的语义正确性。在标准基准上,Fun2spec 达到 85% 的准确率,且能在 60% 的情况下生成最强代码契约,相比先前方法在有效性上提升 20–25%。作者还将该工具应用于包含数百万行代码的工业级 C++ 代码库,并通过全面的人工验证确认了所生成规范的质量与实用价值。该工作表明,LLM 驱动的规范合成可有效支撑真实世界大规模底层 C++ 程序的自动化软件分析。

问题
大规模底层 C++ 代码库缺乏形式化契约,而手工编写带量词的一阶逻辑规范在工业规模上不可行。
方法
引导 LLM 合成 C++ 代码的一阶逻辑契约,并采用自动化验证流程与错误驱动的 oracle 反馈来迭代提升规范的正确性与强度。
评估
在标准基准上与先前方法对比有效性,测量准确率与最强契约生成率,并在数百万行级工业 C++ 代码库上进行全面人工验证。
原文摘要(Abstract)

We present Fun2spec, the first industrial-strength tool guiding LLMs to synthesize C++ specifications in first-order logic with quantifiers. Fun2spec's very high accuracy (85%) employs an automated validation procedure with error-driven oracle feedback, and can even generate the strongest code contract 60% of the time. Our approach significantly outperforms previous methods, achieving 20–25% higher validity on standard benchmarks. We applied Fun2spec to very large scale industrial C++ codebases containing many millions of lines of code and performed comprehensive manual validation to confirm the quality and utility of the specification. Fun2spec stands as the first effective code contract synthesis tool for real-world large-scale low-level C++ programs, advancing the state-of-the-art in automated software analysis using LLMs.

链接与引用

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

BibTeX
@inproceedings{UgareSMV26,
  title = {Fun2spec: Code Contract Synthesis At Scale},
  author = {Shubham Ugare and Tarun Suresh and Sasa Misailovic and Julien Vanegue},
  booktitle = {FSE},
  year = {2026},
  doi = {10.1145/3803437.3805262}
}