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 \tool is the {\em Repo-level Semantic Graph} (RSG), a novel semantic graph structure that encapsulates the vast context of code repositories. Furthermore, RepoHyper leverages \textit{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~\url{https://github.com/FSoft-AI4Code/RepoHyper}.
翻译:代码大语言模型(CodeLLMs)在代码补全任务中展现了卓越的能力。然而,它们往往难以完全理解项目仓库的广泛上下文,如相关文件和类层次结构的复杂性,这可能导致补全结果不够精确。为了克服这些限制,我们提出了\ tool,一个多层面框架,旨在应对仓库级代码补全相关的复杂挑战。\ tool的核心是{\em 仓库级语义图}(RSG),一种新颖的语义图结构,用于封装代码仓库的广泛上下文。此外,RepoHyper 利用{\it 扩展与精炼}检索方法,包括对RSG应用图扩展和链接预测算法,从而实现相关代码片段的有效检索与优先排序。我们的评估表明,\ tool 在仓库级代码补全中显著优于现有技术,与多个强基线相比,在不同数据集上展现出更高的准确性。我们的 RepoHyper 实现可在~\url{https://github.com/FSoft-AI4Code/RepoHyper}中找到。