arXiv:2605.16352cs.IRcs.AI2026-05被引 1

让代码搜索同时懂语义和结构,提升定位准确率。

LARGER: Lexically Anchored Repository Graph Exploration and Retrieval

论文配图:LARGER: Lexically Anchored Repository Graph Exploration and Retrieval
图 1 · 摘自论文原文
  • 从关键词匹配出发,用图结构扩展相关代码位置
  • 在四个基准上文件定位准确率最高提升13.9分
  • 无需外部工具,可直接嵌入现有代码助手

代码库级编程代理需先定位任务相关的文件与符号,此阶段失误会连锁影响后续补丁生成、测试编写与代码库问答等目标。现有代理主要依赖关键词搜索,常遗漏导入关系、调用链、类型层级与代码-测试关联等结构信息。基于图的检索虽能恢复依赖,但通常需独立图工具或遍历阶段,割裂了代理的交互流程。我们提出将代码库上下文定位形式化为「词法锚定结构定位」,关键在于将词法匹配转化为高精度结构入口,并在代理现有搜索循环中暴露最可信的局部邻域。为此引入LARGER(Lexically Anchored Repository Graph Exploration and Retrieval),一个词法锚定的主动集检索框架:从词法匹配开始,对齐图锚点,并在代理原有搜索循环内进行置信度过滤的局部扩展。LARGER可直接集成至现有命令行编程代理,无需外部图数据库或专用图接口。在覆盖定位、测试生成与代码库理解的四个基准上,LARGER在LocBench上文件级Acc@5较最强基线提升+13.9分(调参后),即使固定超参数仍保持+11.8分提升;在MuLocBench、SWE-Atlas Test Writing与SWE-Atlas Codebase QA上也实现稳定增益。

原文摘要 · Abstract (English)

Repository-level coding agents must first localize the files and symbols relevant to a task; failures at this stage can cascade across downstream objectives ranging from patch generation to test writing and codebase question answering. Existing agents navigate repositories primarily through lexical search, often missing structural relations such as imports, call chains, type hierarchies, and code-test links. Graph-based retrieval can recover such dependencies, but existing approaches often require separate graph tools or traversal stages that fragment the agent's interaction loop. We formalize repository context localization as Lexically Anchored Structural Localization, where success depends on turning lexical matches into high-precision structural entry points and exposing the most useful confidence-filtered local neighborhoods within the agent's existing search loop. We introduce LARGER (Lexically Anchored Repository Graph Exploration and Retrieval), a lexically anchored active-set retrieval framework that starts from lexical matches, aligns them to graph anchors, and performs confidence-filtered local expansion within the agent's existing search loop. LARGER integrates directly into existing CLI coding agents without requiring external graph databases or specialized graph interfaces. Across four benchmarks spanning localization, test generation, and codebase understanding, LARGER improves file-level Acc@5 on LocBench by +13.9 points with tuned hyperparameters and still gains +11.8 points with fixed hyperparameters over the strongest baseline, while delivering consistent gains on MuLocBench, SWE-Atlas Test Writing, and SWE-Atlas Codebase QA.

代码搜索图神经网络编程代理

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。