用迭代图搜索定位代码问题,提升修复准确率。
Issue Localization via LLM-Driven Iterative Code Graph Searching
- 分两阶段搜索:先文件级广度探索,再函数级深度迭代
- 在SWE-bench Lite上达43.3%的定位准确率,优于现有方法96%
- 无需训练或索引,适合集成到自动化修复系统中
Issue solving旨在根据问题描述生成修复补丁。问题定位是准确修复的基础。近期基于大模型的方法虽表现优异,但或仅搜索问题提及文件,或盲目遍历整个仓库,难以平衡搜索范围与深度,且缺乏方向控制,易偏离目标。本文提出CoSIL,一种无需训练或索引的、基于大模型的函数级问题定位方法。它采用双阶段代码图搜索策略:先通过动态构建的模块调用图进行文件级广度探索,再将模块图扩展为函数调用图并执行迭代搜索。为精准控制方向,设计剪枝器过滤无关路径和上下文;为避免长上下文中格式错误,引入独立短查询的反思机制以增强格式化能力。实验表明,使用Qwen2.5-Coder-32B时,CoSIL在SWE-bench Lite和SWE-bench Verified上分别达到43.3%和44.6%的Top-1定位准确率,平均超越当前最优方法96.04%。当集成至Agentless修复框架时,问题解决率提升2.98%–30.5%。
原文摘要 · Abstract (English)
Issue solving aims to generate patches to fix reported issues in real-world code repositories according to issue descriptions. Issue localization forms the basis for accurate issue solving. Recently, LLM-based issue localization methods have demonstrated state-of-the-art performance. However, these methods either search from files mentioned in issue descriptions or in the whole repository and struggle to balance the breadth and depth of the search space to converge on the target efficiently. Moreover, they allow LLM to explore whole repositories freely, making it challenging to control the search direction to prevent the LLM from searching for incorrect targets. This paper introduces CoSIL, an LLM-driven, powerful function-level issue localization method without training or indexing. CoSIL employs a two-phase code graph search strategy. It first conducts broad exploration at the file level using dynamically constructed module call graphs, and then performs in-depth analysis at the function level by expanding the module call graph into a function call graph and executing iterative searches. To precisely control the search direction, CoSIL designs a pruner to filter unrelated directions and irrelevant contexts. To avoid incorrect interaction formats in long contexts, CoSIL introduces a reflection mechanism that uses additional independent queries in short contexts to enhance formatted abilities. Experiment results demonstrate that CoSIL achieves a Top-1 localization accuracy of 43.3\% and 44.6\% on SWE-bench Lite and SWE-bench Verified, respectively, with Qwen2.5-Coder-32B, average outperforming the state-of-the-art methods by 96.04\%. When CoSIL is integrated into an issue-solving method, Agentless, the issue resolution rate improves by 2.98\%--30.5\%.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。