arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2604.05407cs.AIcs.SE
收藏

CODESTRUCT: 结构化动作空间中的代码代理

CODESTRUCT: Code Agents over Structured Action Spaces

AWS AI Labs(AWS人工智能实验室)

Myeongsoo Kim, Joe Hsu, Dingmin Wang, Shweta Garg, Varun Kumar, Murali Krishna Ramanathan

AI总结:

CODESTRUCT通过将代码库视为结构化动作空间,改进了代码代理的编辑能力,提升准确率并降低资源消耗。

摘要:

基于大语言模型的代码代理通常将仓库视为无结构文本,通过脆弱的字符串匹配应用编辑,常因格式漂移或模糊模式而失败。我们提出将代码库重新构造成结构化动作空间,使代理在命名AST实体上操作而非文本跨度。我们的框架CODESTRUCT提供readCode检索完整语法单元和editCode应用经过语法验证的转换到语义程序元素。在SWE-Bench上评估六个LLM,CODESTRUCT在Pass@1准确率上提升1.2-5.0%,同时减少12-38%的token消耗。对于频繁在基于文本的界面中无法生成有效补丁的模型,GPT-5-nano提升20.8%,空补丁失败率从46.6%降至7.2%。在CodeAssistBench上观察到一致的准确率提升(+0.8-4.4%)和高达33%的成本降低。我们的结果表明,结构感知界面为代码代理提供了更可靠的基石。

英文摘要:

LLM-based code agents treat repositories as unstructured text, applying edits through brittle string matching that frequently fails due to formatting drift or ambiguous patterns. We propose reframing the codebase as a structured action space where agents operate on named AST entities rather than text spans. Our framework, CODESTRUCT, provides readCode for retrieving complete syntactic units and editCode for applying syntax-validated transformations to semantic program elements. Evaluated on SWE-Bench Verified across six LLMs, CODESTRUCT improves Pass@1 accuracy by 1.2-5.0% while reducing token consumption by 12-38% for most models. Models that frequently fail to produce valid patches under text-based interfaces benefit most: GPT-5-nano improves by 20.8% as empty-patch failures drop from 46.6% to 7.2%. On CodeAssistBench, we observe consistent accuracy gains (+0.8-4.4%) with cost reductions up to 33%. Our results show that structure-aware interfaces offer a more reliable foundation for code agents.

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

↑