测量智能体合成智能合约时意图的丢失位置
Measuring Where Intent Gets Lost in Agentic Smart Contract Synthesis
AI总结:
该研究针对AI智能体合成智能合约时的意图丢失问题,提出需求 elicitation 为先的架构,通过执行比对评估合约,发现提前询问需求可有效恢复遗漏意图,成果可推广至AI生成程序的场景。
摘要:
AI智能体如今能够根据纯自然语言描述编写软件,但可运行的代码与符合需求的代码并不等同。这一差距在智能合约领域尤为关键,智能合约是Web3应用背后的程序,用于在区块链上转移资金,一旦部署便无法修复。我们研究如何检查AI生成的合约是否符合预期行为,以及请求的行为在何处丢失。我们设计了基于执行而非主观判断的评估方法:在AI生成的合约与应复刻的原始合约上重放相同交易,测量两者行为的一致性频率。我们在植入错误的情况下测试各类评分工具,与未基于描述编写的答案密钥进行对比,并审核自身评分器直至已知错误答案无法通过。常见方法如AI评判器和标准分析工具会遗漏明显错误,评分选择也至关重要;仅检查各系统包含的函数会隐藏约一半的流水线差异。随后我们提出了以 elicitation(需求 elicitation,即需求 elicitation 流程)为先的架构:在编写代码前,智能体向客户端询问简短的检查清单问题,将合约与独立编写的可执行答案密钥进行比对,并将分歧反馈给客户端而非静默重写代码。在三种AI模型上的实验显示,提前询问的效果远优于事后审查或修补,而自动化安全修复常破坏请求的行为。少量精心设计的问题可恢复短描述遗漏的大部分内容,且其价值无需原始合约即可评估。据我们所知,这是首个在智能合约合成中于生成前收集缺失需求、并将结果与独立编写的可执行模型比对的研究,相关经验可推广至任何AI智能体将请求转化为程序的场景。我们发布了工具、600个任务及所有结果。
英文摘要:
AI agents can now write software from a plain-English description, but code that runs is not the same as code that does what was asked. This gap matters most for smart contracts, the programs behind Web3 applications that move money on a blockchain and cannot be fixed once deployed. We ask how to check whether an AI-written contract behaves as it should, and where the requested behavior gets lost. We design an evaluation built on execution rather than opinion. We replay the same transactions on an AI-written contract and on the original it should reproduce and measure how often they agree. We test every grading tool on planted mistakes, compare against an answer key written without the description, and audit our own scorer until known wrong answers cannot pass. Common methods, such as AI judges and standard analysis tools, miss obvious mistakes, and scoring choices matter too. Checking only the functions every system includes hid about half the difference between pipelines. We then propose an elicitation-first architecture. Before writing code, the agent asks the client a short checklist of questions, checks the contract against an independently written executable answer key, and returns disagreements to the client instead of silently rewriting code. Asking first matters far more than reviewing or patching afterwards, across three AI models, while automated security fixes often break requested behavior. A few well-chosen questions recover much of what a short description omits, and their value can be estimated without the original contract. To our knowledge, this is the first study in smart contract synthesis to gather missing requirements before generation and check the result against an independently written executable model. The lessons extend to any setting where AI agents turn requests into programs. We release our tools, 600 tasks and all results.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。