about
RepoCoder: Repo-Level Code Completion Through Iterative Retrieval and Generation (arxiv.org)
4 points by Jimmc414 on Mar 25, 2023 | hide | past | pdf | discuss on HN

In plain words: To finish code, it searches the repository for similar snippets, writes a draft, then searches again using that draft to find better context before finalizing. This beat using only the current file by over 10% in every test setting.

Abstract · RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generation

The task of repository-level code completion is to continue writing the unfinished code based on a broader context of the repository. While for automated code completion tools, it is difficult to utilize the useful information scattered in different files. We propose RepoCoder, a simple, generic, and effective framework to address the challenge. It streamlines the repository-level code completion process by incorporating a similarity-based retriever and a pre-trained code language model in an iterative retrieval-generation pipeline. RepoCoder makes effective utilization of repository-level information for code completion and has the ability to generate code at various levels of granularity. Moreover, we propose a new benchmark RepoEval, which consists of the latest and high-quality real-world repositories covering line, API invocation, and function body completion scenarios. Experimental results indicate that RepoCoder significantly improves the In-File completion baseline by over 10% in all settings and consistently outperforms the vanilla retrieval-augmented code completion approach. Furthermore, we validate the effectiveness of RepoCoder through comprehensive analysis, providing valuable insights for future research. Our source code and benchmark are publicly available: https://github.com/microsoft/CodeT/tree/main/RepoCoder

Fengji Zhang, Bei Chen, Yue Zhang, Jacky Keung, Jin Liu, Daoguang Zan, Yi Mao, Jian-Guang Lou, Weizhu Chen
arXiv:2303.12570 · cs.CL, cs.AI, cs.PL, cs.SE · submitted Mar 22, 2023 · updated Oct 20, 2023
abstract · pdf · html · accepted by EMNLP 2023 main conference

add comment on HN