arXiv:2604.13100cs.SEcs.AI2026-04ACL

用形式化契约解决代码生成中的意图模糊问题,提升大型项目生成的稳定性。

Contract-Coding: Towards Repo-Level Generation via Structured Symbolic Paradigm

  • 通过形式化语言契约将模糊需求转化为可执行结构
  • 在Greenfield-5上实现47%功能成功率,结构完整度近乎完美
  • 适合需要高可靠性、大规模代码自动生成的工程场景

从以意图为中心的软件工程(常称“Vibe Coding”)转向,暴露出关键的上下文保真度权衡:模糊的用户意图会淹没线性推理链,导致复杂仓库级生成中的架构崩溃。我们提出Contract-Coding,一种结构化符号范式,通过自主符号锚定,将非结构化意图与可执行代码相连接。通过将模糊意图投影到正式语言契约中,该框架作为单一事实来源(SSOT),实现了拓扑独立性,有效隔离模块间实现细节,降低拓扑执行深度,释放架构并行性。实证显示,在Greenfield-5基准测试中,当前最先进代理存在多种幻觉问题,而Contract-Coding实现47%的功能成功率,同时保持近乎完美的结构完整性。本工作标志着迈向仓库级自主工程的关键一步:从严格“规范遵循”转向鲁棒的意图驱动架构合成。代码已公开于https://github.com/imliinyi/Contract-Coding。

原文摘要 · Abstract (English)

The shift toward intent-driven software engineering (often termed "Vibe Coding") exposes a critical Context-Fidelity Trade-off: vague user intents overwhelm linear reasoning chains, leading to architectural collapse in complex repo-level generation. We propose Contract-Coding, a structured symbolic paradigm that bridges unstructured intent and executable code via Autonomous Symbolic Grounding. By projecting ambiguous intents into a formal Language Contract, our framework serves as a Single Source of Truth (SSOT) that enforces topological independence, effectively isolating inter-module implementation details, decreasing topological execution depth and unlocking Architectural Parallelism. Empirically, while state-of-the-art agents suffer from different hallucinations on the Greenfield-5 benchmark, Contract-Coding achieves 47\% functional success while maintaining near-perfect structural integrity. Our work marks a critical step towards repository-scale autonomous engineering: transitioning from strict "specification-following" to robust, intent-driven architecture synthesis. Our code is available at https://github.com/imliinyi/Contract-Coding.

代码生成符号系统架构合成

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。