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 RepoHyper, a multifaceted framework designed to address the complex challenges associated with repository-level code completion. Central to RepoHyper is the 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 RepoHyper markedly outperforms existing techniques in repository-level code completion, showcasing enhanced accuracy across various datasets when compared to several strong baselines.
翻译:代码大语言模型(CodeLLMs)在代码补全任务中展现出卓越的能力。然而,它们通常难以完全理解项目仓库的广泛上下文,例如相关文件和类层次结构的复杂性,这可能导致补全结果不够精确。为克服这些局限性,我们提出了RepoHyper——一个旨在应对仓库级代码补全复杂挑战的多层面框架。该框架的核心是仓库级语义图(RSG),一种新颖的语义图结构,能够封装代码仓库的广泛上下文。此外,RepoHyper利用扩展与精炼检索方法,包括对RSG应用的图扩展与链接预测算法,从而实现对相关代码片段的有效检索与优先级排序。我们的评估表明,RepoHyper在仓库级代码补全方面显著优于现有技术,在多个数据集上与多个强基线方法相比均展现出更高的准确率。