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.


翻译:当前,大语言模型在生成正确且意图对齐的基础设施即代码方面成功率较低。本研究通过系统性地注入结构化配置知识,探索了改进基于大语言模型的基础设施即代码生成的方法,特别针对Terraform平台。为此,我们在现有IaC-Eval基准测试中大幅增强了云仿真与自动化错误分析功能。此外,本研究还提出了一种针对大语言模型辅助基础设施即代码生成的新型错误分类体系。我们实施并评估了一系列知识注入技术,从基础的检索增强生成方法逐步演进至更复杂的图检索增强生成方案,包括图组件的语义增强与跨资源依赖关系建模。实验结果表明:虽然基线大语言模型性能较差(总体成功率27.1%),但注入结构化配置知识可将技术验证成功率提升至75.3%,总体成功率提升至62.6%。尽管技术正确性显著提升,意图对齐度却出现平台期,这揭示了“正确性-一致性鸿沟”——大语言模型能成为熟练的“编码者”,但在满足复杂用户意图方面仍受限于“架构师”角色。

0
下载
关闭预览

相关内容

代码(Code)是专知网的一个重要知识资料文档板块,旨在整理收录论文源代码、复现代码,经典工程代码等,便于用户查阅下载使用。
【KDD2024】面向课程图稀疏化的轻量级图神经网络搜索
专知会员服务
18+阅读 · 2024年6月25日
[ICML2024]消除偏差:微调基础模型以进行半监督学习
专知会员服务
17+阅读 · 2024年5月23日
【ACL2020-Facebook AI】大规模无监督跨语言表示学习
专知会员服务
34+阅读 · 2020年4月5日
基于模型的强化学习综述
专知
42+阅读 · 2022年7月13日
大数据分析研究组开源Easy Machine Learning系统
中国科学院网络数据重点实验室
17+阅读 · 2017年6月13日
国家自然科学基金
8+阅读 · 2015年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
6+阅读 · 2014年12月31日
国家自然科学基金
17+阅读 · 2008年12月31日
VIP会员
相关资讯
基于模型的强化学习综述
专知
42+阅读 · 2022年7月13日
大数据分析研究组开源Easy Machine Learning系统
中国科学院网络数据重点实验室
17+阅读 · 2017年6月13日
相关基金
国家自然科学基金
8+阅读 · 2015年12月31日
国家自然科学基金
46+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
6+阅读 · 2014年12月31日
国家自然科学基金
17+阅读 · 2008年12月31日
Top
微信扫码咨询专知VIP会员