arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2611.07286cs.SEcs.AI
收藏

智能体应如何看待代码?重新思考智能体软件工程中的代码表示

How Should Agents See Code? Rethinking Code Representations for Agentic Software Engineering

York University(约克大学)

Melika Sepidband, Jiho Shin, Song Wang, Hadi Hemmati

AI总结:

本文研究五种代码表示工作流对LLM智能体在四项仓库级软件工程任务中的检索、成功率、令牌使用等的影响,发现其益处因任务而异,定位瓶颈时节省令牌效果显著。

摘要:

大语言模型(LLM)智能体正越来越多地被用于仓库级软件工程任务。然而,大多数智能体仍通过原始文件、词法搜索和Shell命令访问仓库,将代码主要视为文本。本文将基于映射的代码表示工作流作为智能体软件工程中的一个设计变量进行研究,考察不同的仓库视图如何改变智能体的检索行为、任务成功率、令牌使用量和延迟。本文研究了五种代码表示工作流:抽象语法树、调用图、模块依赖、文档增强搜索,以及结合这些的混合工作流。每种工作流都提供了智能体在任务期间可查询的仓库映射。我们在四个仓库级任务上评估了Claude Code with Haiku 4.5与原始工具基线的表现:使用LinuxFLBench进行故障定位、使用SWE-bench Pro进行仓库级代码生成与修复、使用SWT-bench进行测试生成,以及使用SecBench进行安全补丁。结果表明,当定位是瓶颈时,表示工作流作为节省令牌的工具最有用,而当决定性步骤是补丁或测试编写时,它们的成功增益会缩小。在LinuxFLBench上,所有五种工作流的recall@10均优于基线(0.757-0.829 vs. 0.717),并减少25-39%的令牌使用量;在SWE-bench Pro上,解决率与基线接近(44.3-50.6% vs. 49.0%),令牌使用量下降17-26%;在SecBench上,Callgraph在该样本中的补丁解决率最高(34.3% vs. 28.9%)且令牌使用更少,但所有工作流都增加了延迟;在SWT-bench上,Hybrid和Docs在该样本中的复现测试率最高(47.8%和47.2% vs. 44.7%),但所有工作流都使用更多令牌且耗时更长。总体而言,基于映射的工作流既改变了智能体检查的内容,也改变了其资源消耗,但它们的益处是任务依赖的,而非普遍适用的。

英文摘要:

LLM agents are increasingly used for repository-level software engineering tasks. However, most agents still access repositories through raw files, lexical search, and shell commands, treating code primarily as text. This paper investigates map-based code-representation workflows as a design variable in agentic software engineering, examining how different repository views change agents' retrieval behavior, task success, token use, and latency. In this paper, we study five code-representation workflows: abstract syntax trees, call graphs, module dependencies, documentation-enriched search, and a hybrid workflow that combines them. Each workflow exposes a repository map that the agent can query during a task. We evaluate Claude Code with Haiku 4.5 against a raw-tool baseline on four repository-level tasks: fault localization with LinuxFLBench, repository-level code generation and repair with SWE-bench Pro, test generation with SWT-bench, and security patching with SecBench. The results show that representation workflows are most useful as token-saving tools when localization is the bottleneck, while their success gains narrow when the decisive step is patch or test authoring. On LinuxFLBench, all five workflows improve recall@10 over the baseline (0.757-0.829 vs. 0.717) and reduce token usage by 25-39%. On SWE-bench Pro, resolution remains close to the baseline (44.3-50.6% vs. 49.0%) while token usage drops by 17-26%. On SecBench, Callgraph has the highest patch-resolution rate in this sample (34.3% vs. 28.9%) and uses fewer tokens, but all workflows increase latency. On SWT-bench, Hybrid and Docs have the highest reproducing-test rates in this sample (47.8% and 47.2% vs. 44.7%), but all workflows use more tokens and take longer. Overall, map-based workflows change both what the agent inspects and how much it spends, but their benefits are task-dependent rather than universal.

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

↑