多语言代码库中的上下文感知定位与推理:Multi-CoLoR
Multi-CoLoR: Context-Aware Localization and Reasoning across Multi-Language Codebases
AI总结:
Multi-CoLoR通过结合组织知识检索与图推理,提升多语言代码库中的定位准确性与效率。
摘要:
大型语言模型在代码生成方面表现出强大的能力,但在导航复杂的多语言仓库以定位相关代码方面存在困难。有效的代码定位需要理解组织上下文(例如历史问题修复模式)和异构代码库中的结构关系。现有方法要么(i)局限于单一语言基准,要么(ii)通过浅层文本相似性跨语言检索代码,要么(iii)假设没有先前上下文。我们提出了Multi-CoLoR,一个用于多语言代码库中上下文感知定位与推理的框架,它集成了组织知识检索与基于图的推理,以遍历复杂的软件生态系统。Multi-CoLoR分两个阶段运行:(i)相似问题上下文(SIC)模块检索语义和组织相关的过往问题以缩小搜索空间,(ii)代码图遍历代理(LocAgent的扩展版本,一种最先进的定位框架)在C++和QML代码库中执行结构推理。在真实企业数据集上的评估表明,结合SIC可以减少搜索空间并提高定位准确性,基于图的推理在超越仅Python代码库的情况下也表现出色。综合来看,Multi-CoLoR在词法和基于图的基线之上提高了Acc@5,同时在AMD代码库上减少了工具调用次数。
英文摘要:
Large language models demonstrate strong capabilities in code generation but struggle to navigate complex, multi-language repositories to locate relevant code. Effective code localization requires understanding both organizational context (e.g., historical issue-fix patterns) and structural relationships within heterogeneous codebases. Existing methods either (i) focus narrowly on single-language benchmarks, (ii) retrieve code across languages via shallow textual similarity, or (iii) assume no prior context. We present Multi-CoLoR, a framework for Context-aware Localization and Reasoning across Multi-Language codebases, which integrates organizational knowledge retrieval with graph-based reasoning to traverse complex software ecosystems. Multi-CoLoR operates in two stages: (i) a similar issue context (SIC) module retrieves semantically and organizationally related historical issues to prune the search space, and (ii) a code graph traversal agent (an extended version of LocAgent, a state-of-the-art localization framework) performs structural reasoning within C++ and QML codebases. Evaluations on a real-world enterprise dataset show that incorporating SIC reduces the search space and improves localization accuracy, and graph-based reasoning generalizes effectively beyond Python-only repositories. Combined, Multi-CoLoR improves Acc@5 over both lexical and graph-based baselines while reducing tool calls on an AMD codebase.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。