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

大语言模型在编写Alloy公式中的有效性研究

On the Effectiveness of Large Language Models in Writing Alloy Formulas

University of Texas at Austin(德克萨斯大学奥斯汀分校)

Yang Hong, Shan Jiang, Yulei Fu, Sarfraz Khurshid

AI总结:

该研究通过对照实验探究大语言模型编写Alloy公式的三类应用场景,使用ChatGPT和DeepSeek在11个规约上验证了其在公式生成、等价改写及草图补全方面的良好效果,为规约编写提供了新助力。

摘要:

声明式规约在开发安全可靠的软件系统中发挥着至关重要的作用。然而,正确编写规约仍然极具挑战性。本文开展了一项对照实验,研究使用大语言模型(LLM)用知名语言Alloy编写声明式公式的效果。我们对LLM的使用分为三类:第一,利用LLM根据给定的自然语言(英文)描述编写完整的Alloy公式;第二,针对给定的Alloy公式,利用LLM生成等价的Alloy替代公式;第三,利用LLM补全Alloy公式草图,通过合成Alloy表达式与运算符填充草图中的空缺,使补全后的公式能准确表示(以自然语言给出的)预期属性。我们采用11个已被充分研究的主题规约开展实验评估,并使用两款主流LLM,即ChatGPT和DeepSeek。实验结果表明,LLM在根据以自然语言或Alloy给出的输入属性合成完整Alloy公式方面整体表现良好,且能够枚举多个不同的解。此外,LLM还能根据预期属性的自然语言描述,成功补全给定的Alloy公式草图(无需测试用例)。我们认为,LLM为我们编写规约的能力带来了十分令人振奋的进展,有助于让规约在软件开发中发挥核心作用,提升我们构建健壮软件的能力。

英文摘要:

Declarative specifications have a vital role to play in developing safe and dependable software systems. Writing specifications correctly, however, remains particularly challenging. This paper presents a controlled experiment on using large language models (LLMs) to write declarative formulas in the well-known language Alloy. Our use of LLMs is three-fold. One, we employ LLMs to write complete Alloy formulas from given natural language descriptions (in English). Two, we employ LLMs to create alternative but equivalent formulas in Alloy with respect to given Alloy formulas. Three, we employ LLMs to complete sketches of Alloy formulas and populate the holes in the sketches by synthesizing Alloy expressions and operators so that the completed formulas accurately represent the desired properties (that are given in natural language). We conduct the experimental evaluation using 11 well-studied subject specifications and employ two popular LLMs, namely ChatGPT and DeepSeek. The experimental results show that the LLMs generally perform well in synthesizing complete Alloy formulas from input properties given in natural language or in Alloy, and are able to enumerate multiple unique solutions. Moreover, the LLMs are also successful at completing given sketches of Alloy formulas with respect to natural language descriptions of desired properties (without requiring test cases). We believe LLMs offer a very exciting advance in our ability to write specifications, and can help make specifications take a pivotal role in software development and enhance our ability to build robust software.

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

↑