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 RepoGenix, a pioneering solution designed to enhance repository-level code completion without the latency trade-off. RepoGenix uniquely fuses two types of contexts: 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 RepoGenix to deliver precise code completions while maintaining inference efficiency. Through testing with the CrossCodeEval suite, RepoGenix 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, RepoGenix has been integrated into the workflow of a large enterprise, where it actively supports various coding tasks.
翻译:语言模型在代码辅助方面的成功推动了仓库级代码补全的提出,旨在通过利用整个代码库的上下文来提高预测准确性。然而,这种增强的上下文会无意中增加推理延迟,可能损害开发者体验并阻碍工具采用——我们将此挑战称为"上下文-延迟困境"。本文介绍了RepoGenix,一种旨在无延迟权衡条件下增强仓库级代码补全的前沿解决方案。RepoGenix独特地融合了两种上下文:基于代码类比的类比上下文,以及涵盖深层语义关系的原理上下文。我们提出了一种新颖的秩截断生成(RTG)技术,该技术将这些上下文高效压缩为受限尺寸的提示。这使得RepoGenix能在保持推理效率的同时提供精确的代码补全。通过CrossCodeEval套件的测试,RepoGenix在现有模型基础上取得了显著提升:代码补全的精确匹配(EM)准确率提升了40.90%至59.75%,推理速度提高了26.8%。除实验验证外,RepoGenix已集成到一家大型企业的工作流程中,积极支持各类编码任务。