一句话:提出执行驱动的精确知识注入框架 Exact-IaC,用编译器反馈迭代修复显著提升小模型 IaC 合成的可靠性。
IaC 合成可借助 LLM 自动化,但闭源云 API 带来数据隐私风险,本地小模型(SLM)又受 schema 幻觉与长上下文注意力稀释困扰;现有 RAG、多轮修复和语义拓扑解析难以处理复杂的声明式资源依赖。本文提出 Exact-IaC,采用分而治之策略:先做语义意图近似,再进入利用编译器反馈进行确定性 schema 注入的迭代修复循环,从而把参数记忆负担从 SLM 卸载出去。在 IaC-Eval 基准上,该方法对多种开源权重 SLM 取得 55.0%–69.8% 的相对提升;以 30B 的 Qwen3-Coder 为骨干时,Pass@1 由基线上限 31.00% 提升至 49.34%(相对提升 59.2%),并超过 GPT-5.2-Codex 在其最强基线下的 48.47%。轨迹级错误分析还揭示了 L6 Paradox:即便基础设施极度复杂,SLM 的失败也主要源于微观参数幻觉而非宏观拓扑推理缺陷。该框架实现了零数据泄漏的编排流水线。
The deployment and maintenance of software systems rely heavily on Infrastructure-as-Code (IaC) to translate high-level infrastructure intent into deployable configurations. While Large Language Models (LLMs) show potential in automating IaC synthesis, relying on closed-source cloud APIs poses severe data privacy risks. Conversely, deploying Small Language Models (SLMs) locally often encounters performance bottlenecks due to schema hallucinations and attention dilution in long-context scenarios. Furthermore, existing retrieval-augmented generation (RAG), multi-turn repair, and semantic topology parsing approaches struggle to resolve complex declarative resource dependencies. In this paper, we propose Exact-IaC, an execution-driven framework designed to enhance SLMs for reliable IaC synthesis. It employs a divide-and-conquer strategy: it transitions from initial semantic intent approximation to an iterative repair loop that utilizes compiler feedback for deterministic schema injection. This approach effectively offloads the SLM’s parametric memorization burden. Extensive experiments on the IaC-Eval benchmark demonstrate the effectiveness and generalizability of Exact-IaC across diverse open-weight SLMs, yielding 55.0% to 69.8% relative gains. Specifically, for our primary 30B backbone (Qwen3-Coder), the framework elevates the Pass@1 rate from 31.00% (the performance ceiling of evaluated baselines) to 49.34%, achieving a 59.2% relative improvement. Notably, this locally deployed SLM, augmented by Exact-IaC, outperforms a top-tier proprietary model (GPT-5.2-Codex) operating under its strongest baseline setting (48.47%). Furthermore, our trajectory-level error analysis reveals the L6 Paradox: even at extreme infrastructure complexity, SLMs fail predominantly due to micro-parameter hallucinations rather than macroscopic topological reasoning deficits. Ultimately, Exact-IaC establishes a zero-data-leakage orchestration pipeline, proving empirically that deterministic context precision can effectively substitute raw parameter scale for secure enterprise cloud provisioning.