arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2512.14792cs.AIcs.SE
收藏

利用LLM生成IaC:错误分类法与配置知识注入研究

IaC Generation with LLMs: An Error Taxonomy and A Study on Configuration Knowledge Injection

Jheronimus Academy of Data Science(Jheronimus数据科学学院);Tilburg University(蒂尔堡大学);Eindhoven University of Technology(埃因霍温理工大学);University of Sannio(萨诺尼大学)

Roman Nekrasov, Stefano Fossati, Indika Kumara, Damian Andrew Tamburri, Willem-Jan van den Heuvel

AI总结:

本研究探讨了如何通过系统性地注入结构化配置知识来提高LLM生成正确且意图一致的基础设施即代码(IaC)能力,特别是在Terraform中,提出了新的错误分类法,并评估了多种知识注入技术。

摘要:

大型语言模型(LLMs)目前在生成正确且意图一致的基础设施即代码(IaC)方面表现出较低的成功率。本研究调查了改进基于LLM的IaC生成方法,特别是针对Terraform,通过系统性地注入结构化配置知识。为此,现有的IaC-Eval基准测试被显著增强,加入了云模拟和自动错误分析。此外,开发了一种新的用于LLM辅助IaC代码生成的错误分类法。实现并评估了一系列知识注入技术,从简单的检索增强生成(RAG)到更复杂的图RAG方法。这些包括图组件的语义增强和资源间依赖关系的建模。实验结果表明,尽管基线LLM性能较差(整体成功率为27.1%),注入结构化配置知识将技术验证成功率提高到75.3%,整体成功率提高到62.6%。尽管这些进步在技术正确性方面有所提升,但意图一致性却停滞不前,揭示了“正确性-一致性鸿沟”,即LLMs可以成为熟练的“程序员”,但作为满足复杂用户意图的“架构师”却受限。

英文摘要:

Large Language Models (LLMs) currently exhibit low success rates in generating correct and intent-aligned Infrastructure as Code (IaC). This research investigated methods to improve LLM-based IaC generation, specifically for Terraform, by systematically injecting structured configuration knowledge. To facilitate this, an existing IaC-Eval benchmark was significantly enhanced with cloud emulation and automated error analysis. Additionally, a novel error taxonomy for LLM-assisted IaC code generation was developed. A series of knowledge injection techniques was implemented and evaluated, progressing from Naive Retrieval-Augmented Generation (RAG) to more sophisticated Graph RAG approaches. These included semantic enrichment of graph components and modeling inter-resource dependencies. Experimental results demonstrated that while baseline LLM performance was poor (27.1% overall success), injecting structured configuration knowledge increased technical validation success to 75.3% and overall success to 62.6%. Despite these gains in technical correctness, intent alignment plateaued, revealing a "Correctness-Congruence Gap" where LLMs can become proficient "coders" but remain limited "architects" in fulfilling nuanced user intent.

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

↑