一句话:RepoGenix 通过相似与相关双上下文的感知选择压缩提示,在不增加延迟的前提下提升仓库级代码补全性能。
仓库级代码补全利用整个代码库的上下文来提升预测准确率,但更全面的上下文也带来更高的推理延迟,如何在精度与计算效率之间取得平衡是实际应用中的关键难题。本文提出 RepoGenix,一种不增加延迟即可增强仓库级代码补全的方案:它同时引入相似上下文(analogous context)与相关上下文(relevant context),并借助 Context-Aware Selection 技术将这两类上下文高效压缩为有限长度的提示,从而在有限预算内保留最有价值的信息。作者在 CrossCodeEval 上进行实验,结果显示 RepoGenix 不仅将推理时间大幅减少 48.41%,性能还优于基线方法。该方案已在蚂蚁集团的开发环境中实现并验证,并正在扩展到多种编程语言且计划开源,以提升更广泛开发者社区的代码补全效率。
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 comprehensive context comes at a cost: while it enhances model performance, it also increases inference latency. This balance between improved accuracy and computational efficiency poses a significant challenge in real-world applications. We present RepoGenix, a solution that enhances repository-level code completion without increased latency. RepoGenix combines analogous context and relevant context, using Context-Aware Selection technology to efficiently compress these contexts into limited-size prompts. Our experiments on CrossCodeEval demonstrate that RepoGenix not only achieves a substantial 48.41% reduction in inference time, but also yields improvement in performance compared to baseline methods. We have successfully implemented and tested RepoGenix within AntGroup's development environments. This approach is being extended to multiple programming languages and will be open-sourced, aiming to enhance code completion efficiency for the broader developer community.
@inproceedings{paperbot8299,
title = {RepoGenix: Dual Context-Aided Repository-Level Code Completion with Language Models},
author = {Ming Liang and Xiaoheng Xie and Gehao Zhang and Xunjin Zheng and Peng Di and Wei Jiang and Hongwei Chen and Chengpeng Wang and Gang Fan},
booktitle = {ASE},
year = {2024},
doi = {10.1145/3691620.3695331}
}