IaC Generation with LLMs: An Error Taxonomy and A Study on Configuration Knowledge Injection
On the map: Retrieval-augmented generation → RAG for code
Abstract (arXiv)
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.
Key facts. Cited by 2 papers in the map (data through 14 Oct 2026). Placed in RAG for code, one of 15 directions in Retrieval-augmented generation. Builds on 33 of its 71 references that are in the map. First posted on arXiv 16 Dec 2025.
Builds on
33 of 71 references.
References · 33
- 2017Attention Is All You Needcited by 60,361
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2022Training language models to follow instructions with human feedbackcited by 15,971
- 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Taskscited by 9,297
- 2019Sentence-BERT: Sentence Embeddings using Siamese BERT-Networkscited by 9,170
- 2021Evaluating Large Language Models Trained on Codecited by 8,320
- 2020Dense Passage Retrieval for Open-Domain Question Answeringcited by 3,824
- 2023A Survey on Hallucination in Large Language Models: Principles, Taxonomy, Challenges, and Open Questionscited by 1,601
- 2024From Local to Global: A Graph RAG Approach to Query-Focused Summarizationcited by 1,453
- 2021Improving language models by retrieving from trillions of tokenscited by 1,293
- 2023Unifying Large Language Models and Knowledge Graphs: A Roadmapcited by 668
- 2020Knowledge Graphscited by 621
21 more
- 2018Deep learning for time series classification: a reviewcited by 576
- 2024A Survey on RAG Meeting LLMs: Towards Retrieval-Augmented Large Language Modelscited by 452
- 2024Graph Retrieval-Augmented Generation: A Surveycited by 324
- 2024G-Retriever: Retrieval-Augmented Generation for Textual Graph Understanding and Question Answeringcited by 223
- 2022Large Language Models Meet NL2Code: A Surveycited by 138
- 2022Improving the Domain Adaptation of Retrieval Augmented Generation (RAG) Models for Open Domain Question Answeringcited by 127
- 2023Refining ChatGPT-Generated Code: Characterizing and Mitigating Code Quality Issuescited by 79
- 2023Can ChatGPT replace StackOverflow? A Study on Robustness and Reliability of Large Language Model Code Generationcited by 73
- 2024Bugs in Large Language Models Generated Code: An Empirical Studycited by 60
- 2025Knowledge Graph-Guided Retrieval Augmented Generationcited by 58
- 2023Enhancing Text-based Knowledge Graph Completion with Zero-Shot Large Language Models: A Focus on Semantic Enhancementcited by 14
- 2024Advanced RAG Models with Graph Structures: Optimizing Complex Knowledge Reasoning and Text Generationcited by 13
- 2019A Survey of DevOps Concepts and Challengescited by 12
- 2024Insights into Natural Language Database Query Errors: From Attention Misalignment to User Handling Strategiescited by 12
- 2024DocCGen: Document-based Controlled Code Generationcited by 11
- 2024A Survey of using Large Language Models for Generating Infrastructure as Codecited by 10
- 2025Cloud Infrastructure Management in the Age of AI Agentscited by 9
- 2023CloudEval-YAML: A Practical Benchmark for Cloud Configuration Generationcited by 8
- 2024Large Language Model Enhanced Knowledge Representation Learning: A Surveycited by 7
- 2021KGSecConfig: A Knowledge Graph Based Approach for Secured Container Orchestrator Configurationcited by 5
- 2020The 'as Code' Activities: Development Anti-patterns for Infrastructure as Codecited by 2
Built on by
Citing papers per year: 2026: 2.
2 papers.
Similar, not cited
Close in wording, no citation either way
- 2026Verifier-First Evaluation of Agentic LLMs for Infrastructure-as-Code Generation
- 2026TerraFormer: Automated Infrastructure-as-Code with LLMs Fine-Tuned via Policy-Guided Verifier Feedback
- 2024Using a Feedback Loop for LLM-based Infrastructure as Code Generation
- 2026TerraRepair: A Tool-Grounded LLM Agent for Infrastructure-as-Code Repair
- 2025Multi-Agent Code-Orchestrated Generation for Reliable Infrastructure-as-Code
- 2025Towards Advancing Code Generation with Large Language Models: A Research Roadmap
- 2025Holistic Evaluation of State-of-the-Art LLMs for Code Generation
- 2026SWE-InfraBench: Evaluating Language Models on Cloud Infrastructure Code ↗