REPOFUSE:融合双上下文的仓库级代码补全
REPOFUSE: Repository-Level Code Completion with Fused Dual Context
AI总结:
REPOFUSE通过融合类比与原因双上下文并提出秩截断生成技术,在保持推理效率的同时显著提升仓库级代码补全的精确匹配准确率与推理速度。
摘要:
语言模型在代码辅助中的成功推动了仓库级代码补全的提出,该方法利用整个代码库的上下文来提高预测准确性。然而,这种增强的上下文可能无意中增加推理延迟,从而可能损害开发者体验并阻碍工具采用——我们将这一挑战称为“上下文-延迟难题”。本文介绍了REPOFUSE,这是一种开创性的解决方案,旨在在不牺牲延迟的情况下增强仓库级代码补全。REPOFUSE独特地融合了两种类型的上下文:基于代码类比的类比上下文,以及包含深层语义关系的原因上下文。我们提出了一种新颖的秩截断生成(RTG)技术,该技术能高效地将这些上下文压缩为大小受限的提示。这使得REPOFUSE能够提供精确的代码补全,同时保持推理效率。通过使用CrossCodeEval套件进行测试,REPOFUSE已证明相比现有模型有显著飞跃,在代码补全的精确匹配(EM)准确率上实现了40.90%至59.75%的提升,并在推理速度上实现了26.8%的增强。除了实验验证之外,REPOFUSE已被集成到一家大型企业的工作流程中,在那里它积极支持各种编码任务。
英文摘要:
The success of language models in code assistance has spurred the proposal of repository-level code completion as a means to enhance prediction accuracy, utilizing the context from the entire codebase. However, this amplified context can inadvertently increase inference latency, potentially undermining the developer experience and deterring tool adoption - a challenge we termed the Context-Latency Conundrum. This paper introduces REPOFUSE, a pioneering solution designed to enhance repository-level code completion without the latency trade-off. REPOFUSE uniquely fuses two types of context: the analogy context, rooted in code analogies, and the rationale context, which encompasses in-depth semantic relationships. We propose a novel rank truncated generation (RTG) technique that efficiently condenses these contexts into prompts with restricted size. This enables REPOFUSE to deliver precise code completions while maintaining inference efficiency. Through testing with the CrossCodeEval suite, REPOFUSE has demonstrated a significant leap over existing models, achieving a 40.90% to 59.75% increase in exact match (EM) accuracy for code completions and a 26.8% enhancement in inference speed. Beyond experimental validation, REPOFUSE has been integrated into the workflow of a large enterprise, where it actively supports various coding tasks.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。