CoRet提升代码编辑检索效果,精准定位修复或新增功能所需的代码片段。
CoRet: Improved Retriever for Code Editing
- 融合代码语义、仓库结构与调用图关系,实现更精准的代码检索。
- 在SWE-bench和Long Code Arena上召回率提升至少15个百分点。
- 适合需要高效定位代码问题的开发者或自动化编程助手使用。
本文提出CoRet,一种专为代码编辑任务设计的密集检索模型,整合代码语义、仓库结构及调用图依赖关系。该模型根据自然语言查询(如新增功能或修复漏洞)从代码仓库中检索相关代码段,供用户或第二阶段代码编辑模型使用。为训练CoRet,我们设计了针对仓库级检索的专用损失函数。在SWE-bench和Long Code Arena的漏洞定位数据集上,我们的模型相较现有方法召回率提升至少15个百分点。通过消融实验验证了各项设计选择的重要性。
原文摘要 · Abstract (English)
In this paper, we introduce CoRet, a dense retrieval model designed for code-editing tasks that integrates code semantics, repository structure, and call graph dependencies. The model focuses on retrieving relevant portions of a code repository based on natural language queries such as requests to implement new features or fix bugs. These retrieved code chunks can then be presented to a user or to a second code-editing model or agent. To train CoRet, we propose a loss function explicitly designed for repository-level retrieval. On SWE-bench and Long Code Arena's bug localisation datasets, we show that our model substantially improves retrieval recall by at least 15 percentage points over existing models, and ablate the design choices to show their importance in achieving these results.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。