arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2604.03758cs.SEcs.AI
收藏

AutoReSpec:一种利用大语言模型生成规范的框架

AutoReSpec: A Framework for Generating Specification using Large Language Models

Texas State University(德克萨斯州立大学)

Ragib Shahariar Ayon, Shibbir Ahmed

AI总结:

本文提出AutoReSpec框架,通过动态选择LLM和提示配置,结合协作模型反馈,提升规范生成的准确性和效率,实验显示其在成功概率和完整性上优于现有方法。

摘要:

形式化规范生成近年来在软件工程中受到关注,旨在提高程序正确性而无需手动注释。大语言模型(LLMs)在此领域显示出潜力,但早期结果揭示了若干限制。生成的规范常因语法错误、逻辑不准确或推理不完整而无法验证,尤其是在包含循环或分支逻辑的程序中。SpecGen和FormalBench等技术通过提示和基准测试尝试解决这一问题,但通常依赖静态提示,不提供失败恢复或适应不同程序结构的机制。本文提出AutoReSpec,一种协作框架,结合开源和闭源LLM进行可验证的规范生成。AutoReSpec根据输入程序的结构动态选择LLM对和提示配置。若主要LLM无法生成有效输出,协作模型被调用,利用验证器反馈来优化和修正规范。这种双阶段设计实现了速度和鲁棒性的平衡。我们在包含72个真实世界和合成Java程序的新基准上评估了AutoReSpec。结果表明,其在72个案例中成功67个,优于SpecGen和FormalBench在成功概率和完整性方面。实验评估实现了58.2%的成功概率和69.2%的完整性分数,同时将评估时间平均缩短26.89%相比先前方法。这些结果表明,AutoReSpec提供了一种可扩展、高效且可靠的LLM基于形式化规范生成方法。

英文摘要:

Formal specification generation has recently drawn attention in software engineering as a way to improve program correctness without requiring manual annotations. Large Language Models (LLMs) have shown promise in this area, but early results reveal several limitations. Generated specifications often fail verification due to syntax errors, logical inaccuracies, or incomplete reasoning, especially in programs with loops or branching logic. Techniques like SpecGen and FormalBench attempt to address this through prompting and benchmarking, but they typically rely on static prompts and do not offer mechanisms for recovering from failure or adapting to different program structures. In this paper, we present AutoReSpec, a collaborative framework that combines open and closed-source LLMs for verifiable specification generation. AutoReSpec dynamically chooses an LLM pair and prompt configuration based on the structure of the input program. If the primary LLM fails to produce a valid output, a collaborative model is invoked, using validator feedback to refine and correct the specification. This two-stage design enables both speed and robustness. We evaluate AutoReSpec on a new benchmark of 72 real-world and synthetic Java programs. Our results show that it achieves 67 passes out of 72, outperforming SpecGen and FormalBench in both Success Probability and Completeness. Our experimental evaluation achieves a 58.2% success probability and a 69.2% completeness score, while cutting evaluation time by 26.89% on average compared to prior methods. Together, these results demonstrate that AutoReSpec offers a scalable, efficient, and reliable approach to LLM-based formal specification generation.

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

↑