基于一致数据与检查器生成的LLM字符串需求可满足性检查
LLM-based Satisfiability Checking of String Requirements by Consistent Data and Checker Generation
AI总结:
本文提出一种混合方法,利用LLM生成一致字符串及SMT/Python检查器,验证自然语言字符串需求的可满足性,实验显示检查器显著提升生成成功率与F1分数。
摘要:
字符串上的需求通常用自然语言(NL)表示,由于软件系统对字符串数据操作的严重依赖,这类需求与软件系统尤为相关。虽然单个需求通常可以手动分析,但验证一组自然语言需求上的属性(例如可满足性)尤其具有挑战性。形式化方法(例如SMT求解器)可能高效地验证此类属性,但已知存在理论局限性。此外,将自然语言需求转换为形式化约束通常需要大量人工工作。近年来,大语言模型(LLMs)已成为形式化推理任务的替代方法,但它们在验证字符串需求方面的有效性研究较少。在本文中,我们提出了一种混合方法,通过使用LLMs(1)推导可满足性结果(如果可能,还推导出一致的字符串),以及(2)生成声明式(即SMT)和命令式(即Python)检查器,用于验证(1)的正确性,从而验证自然语言字符串需求的可满足性。在我们的实验中,我们评估了四个LLM的性能。结果表明,LLMs能有效地将自然语言翻译成检查器,甚至对基于Python的检查器达到了完美的测试准确率。这些检查器极大地帮助LLMs生成一致的字符串并准确识别不可满足的需求,与没有生成检查器的基线相比,在某些情况下生成成功率和F1分数提高了一倍以上。
英文摘要:
Requirements over strings, commonly represented using natural language (NL), are particularly relevant for software systems due to their heavy reliance on string data manipulation. While individual requirements can usually be analyzed manually, verifying properties (e.g., satisfiability) over sets of NL requirements is particularly challenging. Formal approaches (e.g., SMT solvers) may efficiently verify such properties, but are known to have theoretical limitations. Additionally, the translation of NL requirements into formal constraints typically requires significant manual effort. Recently, large language models (LLMs) have emerged as an alternative approach for formal reasoning tasks, but their effectiveness in verifying requirements over strings is less studied. In this paper, we introduce a hybrid approach that verifies the satisfiability of NL requirements over strings by using LLMs (1) to derive a satisfiability outcome (and a consistent string, if possible), and (2) to generate declarative (i.e., SMT) and imperative (i.e., Python) checkers, used to validate the correctness of (1). In our experiments, we assess the performance of four LLMs. Results show that LLMs effectively translate natural language into checkers, even achieving perfect testing accuracy for Python-based checkers. These checkers substantially help LLMs in generating a consistent string and accurately identifying unsatisfiable requirements, leading to more than doubled generation success rate and F1-score in certain cases compared to baselines without generated checkers.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。