让AI代码真正理解用户意图,是提升软件可靠性的关键挑战。
Intent Formalization: A Grand Challenge for Reliable Coding in the Age of AI Agents
- 将用户模糊需求转化为可验证的正式规范,缩小意图与代码的差距。
- 通过交互式测试和自动生成断言,显著提升生成代码的正确性。
- 适合关注AI生成代码可靠性、形式化验证与人机协作的研究者。
当前的智能体式AI系统能流畅生成代码,但核心问题依然存在:生成的代码是否真正实现了用户的意图?从非正式自然语言要求到精确程序行为之间的‘意图鸿沟’始终困扰软件工程,而AI生成代码使其放大至前所未有的规模。本文提出,‘意图形式化’——将非正式用户意图转化为可验证的正式规范——是决定AI能否使软件更可靠而非仅更丰富的关键挑战。该方法在不同可靠性需求下提供可调的权衡:从轻量级测试以消除歧义,到完整功能规范用于形式化验证,再到领域特定语言实现自动正确代码合成。核心瓶颈在于‘规范有效性验证’:因缺乏规范正确性的标准答案,需借助轻量级用户交互和测试等代理物,发展半自动化评估指标。现有研究已展示其潜力:交互式测试驱动的形式化方法提高程序正确性,AI生成的后置条件捕捉到先前方法遗漏的真实漏洞,端到端验证流程可从非正式规范生成可证明正确的代码。文章还梳理了开放挑战:突破基准局限、支持变更的组合性、规范质量评估指标、处理复杂逻辑、设计人-机规范交互机制,构成涵盖人工智能、编程语言、形式化方法与人机交互的跨学科研究议程。
原文摘要 · Abstract (English)
Agentic AI systems can now generate code with remarkable fluency, but a fundamental question remains: \emph{does the generated code actually do what the user intended?} The gap between informal natural language requirements and precise program behavior -- the \emph{intent gap} -- has always plagued software engineering, but AI-generated code amplifies it to an unprecedented scale. This article argues that \textbf{intent formalization} -- the translation of informal user intent into a set of checkable formal specifications -- is the key challenge that will determine whether AI makes software more reliable or merely more abundant. Intent formalization offers a tradeoff spectrum suitable to the reliability needs of different contexts: from lightweight tests that disambiguate likely misinterpretations, through full functional specifications for formal verification, to domain-specific languages from which correct code is synthesized automatically. The central bottleneck is \emph{validating specifications}: since there is no oracle for specification correctness other than the user, we need semi-automated metrics that can assess specification quality with or without code, through lightweight user interaction and proxy artifacts such as tests. We survey early research that demonstrates the \emph{potential} of this approach: interactive test-driven formalization that improves program correctness, AI-generated postconditions that catch real-world bugs missed by prior methods, and end-to-end verified pipelines that produce provably correct code from informal specifications. We outline the open research challenges -- scaling beyond benchmarks, achieving compositionality over changes, metrics for validating specifications, handling rich logics, designing human-AI specification interactions -- that define a research agenda spanning AI, programming languages, formal methods, and human-computer interaction.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。