arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2409.13122cs.SE
收藏

RepoGenReflex:利用言语强化与检索增强生成增强仓库级代码补全

RepoGenReflex: Enhancing Repository-Level Code Completion with Verbal Reinforcement and Retrieval-Augmented Generation

Jicheng Wang, Yifeng He, Hao Chen

AI总结:

针对仓库级代码补全中难以动态优化检索与生成过程的问题,提出RepoGenReflex框架,结合言语强化学习与检索增强生成(RAG-VRL)循环,利用Reflector反馈和经验缓存动态选择最优结果,并在新基准RepoGenEval上验证了其准确性与鲁棒性的显著提升。

摘要:

在真实世界的软件工程任务中,解决问题通常需要理解并修改大型代码库中的多个函数、类和文件。因此,在仓库级别,提取相关信息以有效实现准确的代码补全至关重要。现有的代码补全工具取得了一定成功,但难以动态优化检索和生成过程。在本文中,我们提出了 RepoGenReflex,一个通用、动态、有效的框架来解决这一挑战。通过利用由言语强化学习(VRL)增强的检索增强生成(RAG),它可以动态地为仓库级代码补全选择最优结果。RepoGenReflex 使用 Reflector 为下一轮循环提供方向性反馈。RepoGenReflex 基于 RAG-VRL 循环选择存储在 Experience cache 中的最优结果。为了验证框架的泛化能力,我们提出了一个新基准 RepoGenEval,它由符合行补全场景的最新、高质量的真实世界仓库组成。我们的实验表明,RepoGenReflex 在优化 Reflector 组件后取得了显著改进,从而提高了代码补全的准确性和相关性。此外,RepoGenReflex 在标准代码补全任务中始终表现出卓越的性能和有效性,突显了我们框架的鲁棒性和适应性。

英文摘要:

In real-world software engineering tasks, solving a problem often requires understanding and modifying multiple functions, classes, and files across a large codebase. Therefore, on the repository level, it is crucial to extract the relevant information to achieve accurate code completion effectively. Existing code completion tools have achieved some success, but they struggle to optimize the retrieval and generation process dynamically. In this paper, we propose RepoGenReflex, a generic, dynamic, effective framework to address this challenge. By leveraging the Retrieval-Augmented Generation (RAG) enhanced with Verbal Reinforcement Learning (VRL), it can dynamically choose the optimal results for repository-level code completion. RepoGenReflex uses Reflector to give directional feedback to the next loop. RepoGenReflex chooses the optimal results stored in the Experience cache based on the RAG-VRL loop. To validate the framework's generalization ability, we propose a new benchmark RepoGenEval, which consists of the latest, high-quality real-world repositories in line completion scenarios. Our experiments demonstrate that RepoGenReflex achieves significant improvements after optimizing the Reflector component, resulting in enhanced accuracy and relevance of code completions. Additionally, RepoGenReflex consistently demonstrates superior performance and effectiveness across standard code completion tasks, highlighting the robustness and adaptability of our framework.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑