R2C2-Coder:增强并基准测试代码大语言模型的真实仓库级代码补全能力
R2C2-Coder: Enhancing and Benchmarking Real-world Repository-level Code Completion Abilities of Code Large Language Models
AI总结:
针对现有仓库级代码补全方法上下文利用不足、基准场景有限的问题,提出包含R2C2-Enhance提示构建方法和R2C2-Bench基准的R2C2-Coder,有效提升并更准确地基准测试代码大模型的真实仓库级补全能力。
摘要:
代码补全模型近年来取得了显著进展。近期,仓库级代码补全在现代软件开发中受到更多关注,已有若干基线方法和基准被提出。然而,现有仓库级代码补全方法往往未能充分利用项目仓库的广泛上下文,例如相关文件的复杂结构和类层次结构。此外,现有基准通常聚焦于有限的代码补全场景,无法很好地反映现有方法的仓库级代码补全能力。为解决这些局限,我们提出R2C2-Coder,用于增强并基准测试代码大语言模型(code Large Language Models)的真实仓库级代码补全能力,其中R2C2-Coder包含一种代码提示构建方法R2C2-Enhance和一个精心设计的基准R2C2-Bench。具体而言,首先在R2C2-Enhance中,我们先构建候选检索池,再针对每个补全光标位置从检索池中检索内容,组装补全提示。其次,基于R2C2-Enhance,我们可以构建更具挑战性和多样性的R2C2-Bench,包含训练集、验证集和测试集,其中提出了一种上下文扰动策略以很好地模拟真实场景下的仓库级代码补全。在多个基准上的大量实验结果证明了我们的R2C2-Coder的有效性。
英文摘要:
Code completion models have made significant progress in recent years. Recently, repository-level code completion has drawn more attention in modern software development, and several baseline methods and benchmarks have been proposed. However, existing repository-level code completion methods often fall short of fully using the extensive context of a project repository, such as the intricacies of relevant files and class hierarchies. Besides, the existing benchmarks usually focus on limited code completion scenarios, which cannot reflect the repository-level code completion abilities well of existing methods. To address these limitations, we propose the R2C2-Coder to enhance and benchmark the real-world repository-level code completion abilities of code Large Language Models, where the R2C2-Coder includes a code prompt construction method R2C2-Enhance and a well-designed benchmark R2C2-Bench. Specifically, first, in R2C2-Enhance, we first construct the candidate retrieval pool and then assemble the completion prompt by retrieving from the retrieval pool for each completion cursor position. Second, based on R2C2 -Enhance, we can construct a more challenging and diverse R2C2-Bench with training, validation and test splits, where a context perturbation strategy is proposed to simulate the real-world repository-level code completion well. Extensive results on multiple benchmarks demonstrate the effectiveness of our R2C2-Coder.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。