arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2610.38214cs.SEcs.AIcs.LG
收藏

骨架编码:将程序结构作为智能体的规范

Skeleton Coding: Program Structure as Control for AI Agents

AWS Agentic AI(AWS 智能代理人工智能)
Aditya Golatkar, Alessandro Achille, Renos Zabounidis, Vlad Sobal, Yangruibo Ding, Baishakhi Ray, Jonathan Buck, Guy Van den Broeck, Maryam Fazel, Pietro Perona… 展开作者

Aditya Golatkar, Alessandro Achille, Renos Zabounidis, Vlad Sobal, Yangruibo Ding, Baishakhi Ray, Jonathan Buck, Guy Van den Broeck, Maryam Fazel, Pietro Perona, Wei Xia, Stefano Soatto

AI总结:

该研究提出骨架编码方法,将程序结构作为智能体的规范,可大幅减少所需测试用例数量,降低实现成本,缩小模型性能差距并减少代码侵蚀。

摘要:

编码智能体通常会被提供其生成代码应满足的端到端行为规范,例如测试用例和输入输出示例。开发者需要提供多少个此类规范,以及提供哪些规范,才能让智能体生成开发者预期的程序?我们认为这无法先验确定,因为这取决于实现的结构,而结构由智能体决定。智能体首先确定一种结构——即分解为数据类型、模块和函数——这确定了候选程序的类别;随后行为规范会在该类别中选择一个程序。对于一种结构而言足够的测试用例,可能会使另一种结构的规范严重不足,需要不同的边界情况或成倍增加的示例。由于结构由智能体选择,开发者若不从数千行生成代码中进行逆向工程,就无法确保其规范是完整的。为解决这一问题,我们提出了骨架编码,其中开发者会以类似代码的高级格式共同指定结构,同时提供行为规范。理论上,我们将AI辅助编码建模为一个控制问题,证明骨架可将开发者为引导智能体生成可接受程序所需提供的测试用例数量指数级减少。实验上,在四个模型和三个基准测试中,表现最佳的骨架规范相较于最佳端到端行为规范,将平均测试误差降低了48.4%;即使智能体可查询完整的参考实现,添加骨架仍可将平均测试误差相对降低多达27.0%。骨架还将大小模型之间的平均差距缩小了约52.4%,同时将实现成本降低了15至26倍,平均减少代码侵蚀24.7%。

英文摘要:

Coding agents are typically provided end-to-end behavioral specifications that the code they produce should satisfy, such as tests and input-output examples. How many such specifications must users provide, and which ones, for the agent to implement a program that fulfills their intent? We argue that this cannot be determined a priori, because it depends on the structure of the implementation, which is left to the agent to decide. An agent first commits to a structure - that is, a decomposition into data types, modules, and functions - which fixes a class of candidate programs; behavioral specifications then select a program within that class. A set of tests that suffices for one structure may leave another underdetermined, requiring different edge cases or exponentially more examples. Since the structure is chosen by the agent, users cannot ensure their specification is complete without reverse-engineering such structure from thousands of lines of generated code. To address this issue, we introduce Skeleton Coding, a process in which humans jointly specify the structure in high-level, code-like format, alongside behavioral specifications for the desired outcome. Theoretically, we model AI-assisted coding as a control problem, and show that skeletons can reduce exponentially the number of tests users must supply to steer an agent toward an acceptable program. Empirically, across four models and three benchmarks, the best-performing skeleton specifications reduce mean test error by 48.4% relative to the best end-to-end behavioral specifications. Even when the agent can query a complete reference implementation, adding a skeleton reduces mean test error relatively by up to 27%. Skeletons also narrow the average gap between small and large models by about 52.4% while lowering implementation cost by 15-26x, and reduce code erosion by 24.7% on average.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑