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

Fengji Zhang, Bei Chen, Yue Zhang, Jacky Keung, Jin Liu +4 more
3/22/2023
cs.CLcs.AIcs.PL

Official code: microsoft/CodeT (678 stars, MIT, last commit 2024-11-01). 1 more implementation below.

Abstract

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

View on arXivView PDF

Code Implementations(2)

microsoft/CodeTOfficial100%
MIT
67886PythonJul 12, 20221 years agoMIT
MIT

Replication Implementation of RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generation

20PythonJul 5, 20242 years agoMIT

Similar Papers

Cite this paper

@article{zhang2023repocoder,
  title  = {RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generation},
  author = {Fengji Zhang and Bei Chen and Yue Zhang and Jacky Keung and Jin Liu and Daoguang Zan and Yi Mao and Jian-Guang Lou and Weizhu Chen},
  year   = {2023},
  eprint = {2303.12570},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2303.12570v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2303.12570.svg)](https://codeofpaper.com/paper/2303.12570)

Discussion