arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2606.26490cs.SEcs.AIcs.LOcs.PL
收藏

LLM 生成的 VeriFast 规范实证研究

An Empirical Study of LLM-Generated Specifications for VeriFast

Purdue University(普渡大学);University of Michigan(密歇根大学);Meta;Ann Arbor, Michigan, USA(美国密歇根州安阿伯);Menlo Park, California, USA(美国加州Menlo Park);West Lafayette, Indiana, USA(美国印第安纳州西拉法叶)

Wen Fan, Minh Tran, Sanya Dod, Xin Hu, Marilyn Rego, Danning Xie, Jenna DiVincenzo, Lin Tan

AI总结:

本研究评估了大型语言模型为分离逻辑验证器 VeriFast 生成规范的能力,发现虽然功能保持良好(>91%),但验证成功率仅31.4%,主要错误源于领域知识不足。

摘要:

静态验证工具可以保证工业级软件的质量,但需要大量人工编写规范。对于基于分离逻辑的静态验证器(SL验证器)尤其如此,它们在验证堆操作程序方面表现出色,但需要许多复杂的辅助规范来推理堆结构。最近的工作应用大型语言模型(LLMs)生成代码、测试和证明,包括验证器的规范,但主要针对非SL验证器。为弥补这一空白,本文全面评估了LLMs在提示生成规范以使用SL验证器VeriFast验证303个C函数时的表现。我们分两个阶段探索了八种提示方法、十种LLM和三种输入类型。使用定量和定性分析来评估LLM生成的代码和规范的功能行为、可验证性和错误。结果表明,LLMs在源代码和规范中保持了功能行为(均超过91%),但验证成功率适中(31.4%)。在我们的设置中,使用Gemini 2.5 Pro并提供形式化合同可提高成功率。此外,大多数错误(94%)来自LLMs在VeriFast等SL验证器的领域特定知识上的失误。这些发现为优化SL验证器的LLM生成规范提供了指导。

英文摘要:

Static verification tools can assure industrial scale software, but require significant human labor to write specifications. This is particularly true of static verifiers based on separation logic (SL verifiers), which excel at verifying heapmanipulating programs, but require many complex auxiliary specifications to reason about heap structure. Recent work applies large language models (LLMs) to generate code, tests, and proofs, including specifications for verifiers, but mostly targeting non-SL verifiers. To address this gap, this paper thoroughly evaluates how well LLMs perform when prompted to generate specifications for verifying 303 C functions with the SL verifier VeriFast. We explored eight prompting approaches, ten LLMs, and three input types in two stages. Quantitative and qualitative analyses are used to assess the LLM-generated code and specifications for functional behavior, verifiability and errors. The results show that LLMs preserve functional behavior in source code and specifications (both over 91%), but achieve modest verification success (31.4%). Using Gemini 2.5 Pro and providing formal contracts lead to higher success rates in our setting. Moreover, most errors (94%) come from LLMs' mistakes in the domainspecific knowledge of SL verifiers such as VeriFast. These findings provide guidance for optimizing LLM-generated specifications for SL verifiers.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑