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
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.
Chiseling Out Efficiency: Structured Skeleton Supervision for Efficient Code Generation
Shandong Normal University(山东师范大学);Nanjing University(南京大学);Tsinghua University(清华大学);Huazhong University of Science and Technology(华中科技大学);Chongqing University(重庆大学);Institute of Information Engineering at Chinese Academy of Sciences(中国科学院信息工程研究所);Peking University(北京大学)