RepoHyper:面向仓库级代码补全的语义图搜索-扩展-精炼方法
RepoHyper: Search-Expand-Refine on Semantic Graphs for Repository-Level Code Completion
AI总结:
针对代码大模型难以理解仓库级上下文导致补全精度不足的问题,提出基于仓库级语义图的RepoHyper框架,结合扩展-精炼检索方法,在多数据集上显著优于现有基线。
摘要:
代码大语言模型(CodeLLMs)已在代码补全任务中展现出出色的能力,但它们往往无法充分理解项目仓库的广泛上下文,例如相关文件的复杂结构与类层次关系,这会导致补全精度下降。为克服这些局限,我们提出RepoHyper——一个多维度框架,旨在解决仓库级代码补全相关的复杂挑战。RepoHyper的核心是仓库级语义图(Repo-level Semantic Graph, RSG),这是一种新型语义图结构,可封装代码仓库的海量上下文。此外,RepoHyper采用扩展与精炼检索方法,包括应用于RSG的图扩展算法和链路预测算法,能够有效检索并排序相关代码片段。我们的评估显示,RepoHyper在仓库级代码补全任务中显著优于现有技术,与多个强基线模型相比,在各类数据集上均展现出更高的准确率。RepoHyper的实现可在https://github.com/FSoft-AI4Code/RepoHyper获取。
英文摘要:
Code Large Language Models (CodeLLMs) have demonstrated impressive proficiency in code completion tasks. However, they often fall short of fully understanding the extensive context of a project repository, such as the intricacies of relevant files and class hierarchies, which can result in less precise completions. To overcome these limitations, we present \tool, a multifaceted framework designed to address the complex challenges associated with repository-level code completion. Central to RepoHYPER is the {\em Repo-level Semantic Graph} (RSG), a novel semantic graph structure that encapsulates the vast context of code repositories. Furthermore, RepoHyper leverages Expand and Refine retrieval method, including a graph expansion and a link prediction algorithm applied to the RSG, enabling the effective retrieval and prioritization of relevant code snippets. Our evaluations show that \tool markedly outperforms existing techniques in repository-level code completion, showcasing enhanced accuracy across various datasets when compared to several strong baselines. Our implementation of RepoHYPER can be found at https://github.com/FSoft-AI4Code/RepoHyper.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。