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

LLM 能写出正确的 TLA+ 规范吗?自然语言到 TLA+ 生成的评估

Can LLMs Write Correct TLA+ Specifications? Evaluating Natural-Language-to-TLA+ Generation

Department of Computer Science, Loyola University Chicago(洛约奈大学芝加哥分校计算机科学系)

Arslan Bisharat, Brian Ortiz, Eric Spencer, Khushboo Bhadauria, TaiNing Wang, George K. Thiruvathukal, Konstantin Laufer, Mohammed Abuhamad

AI总结:

本文首次系统评估基于 LLM 从自然语言合成 TLA+ 规范的能力,发现模型在语义正确性上仅达 8.6%,且成功依赖于渐进式提示,揭示了模型大小与质量无关、代码专用模型表现不佳等关键发现。

摘要:

TLA+ 已支持亚马逊和微软等公司的工业验证,但从自然语言编写正确的 TLA+ 规范仍需时间和专业知识,这限制了其采用。LLM 显示出潜力,但尚无先前研究衡量它们是否能从自然语言生成语义正确的 TLA+ 规范。本文首次系统评估基于 LLM 的 TLA+ 规范合成。我们的研究在精心策划的 205 个 TLA+ 规范数据集上评估了来自八个系列的 30 个 LLM:四种提示策略下的 25 个开放权重模型(2600 次运行)和少样本提示下的 5 个专有模型(130 次运行),所有结果均由 SANY 解析器和 TLC 模型检查器验证。LLM 达到高达 26.6% 的语法正确性,但仅 8.6% 的语义正确性,成功仅出现在渐进式提示中。结果表明模型大小不能预测质量,例如 DeepSeek r1:8b 在所有策略上优于其 70B 变体,这表明推理对齐对形式语言的重要性。由于主流语言训练的负迁移,代码专用模型始终表现不佳。我们识别出五类重复出现的幻觉,所有幻觉均可追溯到特定的训练数据偏差。这些结果表明,当前 LLM 在没有专家监督的情况下无法生成可靠的 TLA+ 规范。我们发布了评估框架、代码和数据集,以支持可重复性和未来研究。

英文摘要:

TLA+ has supported industrial verification at companies such as Amazon and Microsoft, yet writing correct TLA+ specifications from natural language still requires time and expertise, which limits adoption. LLMs show promise, but no prior study measures whether they produce semantically correct TLA+ specifications from natural language. This paper presents the first systematic evaluation of LLM-based TLA+ specification synthesis from natural language. Our study evaluates 30 LLMs across eight families on a curated dataset of 205 TLA+ specifications: 25 open-weight models across four prompting strategies (2,600 runs) and 5 proprietary models under few-shot prompting (130 runs), all validated by the SANY parser and TLC model checker. LLMs achieve up to 26.6% syntactic correctness but only 8.6% semantic correctness, with successes exclusive to progressive prompting. Results show that model size does not predict quality, e.g., DeepSeek r1:8b outperforms its 70B variant across all strategies, which suggests the importance of reasoning alignment for formal languages. Code-specialized models consistently underperform due to negative transfer from mainstream language training. We identify five recurring hallucination categories, all traceable to specific training data biases. These results suggest that current LLMs do not generate reliable TLA+ specifications without expert oversight. We release the evaluation framework, code, and dataset to support reproducibility and future research.

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

↑