TL;DR
Generating cloud infrastructure configurations (Infrastructure-as-Code, or IaC) from natural language is notoriously error-prone due to vague user prompts and the high risk of testing live deployments. This paper introduces a training-free, structure-aware clarification framework that resolves ambiguity by generating diverse candidate configurations, identifying key architectural disagreements, and asking targeted yes/no questions. The method significantly improves configuration accuracy while using a fraction of the compute required by prior active disambiguation methods.
What Problem Does This Paper Address?
Large Language Models (LLMs) are increasingly used to generate Infrastructure-as-Code (IaC) frameworks like Terraform from natural language descriptions. However, human requests are often high-level and highly ambiguous (e.g., "Set up AWS infrastructure for a web application...").
In traditional code generation, an AI agent can resolve ambiguity through an execution feedback loop: run the code, observe the test failures, and iteratively repair it. Cloud configuration offers no such luxury. Executing an IaC program requires provisioning real, live cloud infrastructure, which is slow, expensive, and potentially dangerous—the authors cite a real-world incident where an AI-assisted workflow accidentally deleted a production database, causing a 24-hour recovery effort. Furthermore, standard dry-run tools like terraform plan only catch syntax and type errors; they cannot detect whether the generated architecture actually aligns with what the user intended.
Methods
The authors observe that ambiguity in cloud infrastructure is hierarchical and compositional, spanning three distinct axes:
- Resources: Which components to provision (e.g., ECS vs. EKS vs. EC2).
- Topology: How these components connect to one another.
- Attributes: The specific settings applied to each resource (e.g., CIDR blocks, scaling policies).
Instead of relying on expensive training or fine-tuning, they propose a multi-level, disagreement-driven disambiguation framework:
- Candidate Generation: The system uses temperature sampling to generate a pool of diverse candidate configurations based on the user's initial prompt.
- Symbolic Disagreement Computation: The framework programmatically extracts and compares the candidates across the three structural axes to find exactly where they diverge.
- Entropy-Based Ranking: Disagreements are ranked using Shannon entropy. A split that divides the candidate pool evenly (50/50) is highly informative, whereas a near-consensus split is ignored. Questions are selected across the three axes in a round-robin fashion to ensure balanced coverage.
- Targeted Clarification: The top-ranked disagreement is translated by an LLM into a simple, natural language yes/no question (e.g., "Should the infrastructure include a NAT gateway?").
- Deterministic Pruning & Regeneration: Based on the user's answer, incompatible candidates are immediately pruned. If the pool shrinks too much, the system regenerates new candidates conditioned on the updated interaction history.
Datasets
The authors introduce AMBIG-IAC, an expert-verified benchmark consisting of 300 validated IaC tasks with intentionally ambiguous, goal-oriented prompts.
- It was constructed by taking tasks from the existing IaC-Eval benchmark and using an LLM to rewrite specific technical prompts into realistic, vague user requests (e.g., transforming a detailed routing policy prompt into: "Our database is getting slow for users in other regions—need to fix that and make reads faster globally").
- The dataset covers 167 unique AWS resource types across 44 service families (including VPC, S3, IAM, RDS, and Lambda).
Key Insights and Ideas
- Syntactic Validity $\neq$ Intent Alignment: The authors find that roughly 90% of blindly generated configurations pass
terraform plandry-runs, yet they frequently deploy the completely wrong architecture. This highlights why interactive clarification is a first-class requirement for IaC. - Consensus Does Not Equal Informativeness: Standard test-time techniques like Self-Consistency (which selects the most common or consensus question) perform poorly. In highly structured configuration spaces, the most useful questions are those that target the precise points where alternative interpretations diverge.
- Tracking Ambiguity Matters: As the interaction rounds progress, resource-level disagreements are typically resolved first, followed by topology, and finally fine-grained attributes, steadily narrowing down the configuration space.
Key Results
The framework was evaluated against multiple interactive baselines using Graph Edit Distance (GED) for structural accuracy and an exact-match F1 score for attributes:
- Superior Accuracy: Across question budgets of 5, 10, and 15 rounds, the proposed method consistently outperformed structure-agnostic baselines, with its lead widening as the interaction budget grew.
- Massive Efficiency Gains: Compared to Active Task Disambiguation (ATD)—a baseline that also uses information-gain principles—the proposed method achieved better structural scores while consuming 4× fewer tokens and running 11× faster (wall-clock time) per task.
- Cross-Model Generalization: The gains held true across five different major LLM backbones, including GPT-4o-mini, Claude Opus 4.6, Qwen3-Coder, and Llama-4-Scout.
Limitations and Future Work
- Simulated Users: The evaluation relies on an LLM-based user proxy grounded strictly in the reference configuration rather than live user testing. The authors note that validating these interaction dynamics with real human operators is a crucial next step.
- Binary Constraints: The current framework restricts communication to a binary (yes/no) question interface. Exploring richer response formats or persistent user-preference models could further improve performance.
- Broader Applications: While tailored to cloud infrastructure, the concept of disagreement-driven clarification based on symbolic diffs could be generalized to other highly structured synthesis tasks, such as database schema design or complex build pipelines.
Summary updated