{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/repocoder-repository-level-code-completion","title":"RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generation","arxiv_id":"2303.12570","date":"2023-03-22","proceeding":null,"authors":["Fengji Zhang","Bei Chen","Yue Zhang","Jacky Keung","Jin Liu","Daoguang Zan","Yi Mao","Jian-Guang Lou","Weizhu Chen"],"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","url_abs":"https://arxiv.org/abs/2303.12570v3","url_pdf":"https://arxiv.org/pdf/2303.12570v3.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"repocoder-repository-level-code-completion","repo_url":"https://github.com/microsoft/codet","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"code-completion","task_name":"Code Completion"},{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"retrieval","task_name":"Retrieval"}],"methods":[{"method_slug":"test","method_name":"Test"}],"datasets_introduced":[{"slug":"repoeval","name":"RepoEval","full_name":""}],"methods_introduced":[],"results":[{"leaderboard":"/sota/code-completion-on-defects4j","task":"Code Completion","dataset":"Defects4J","model":"RepoCoder","rank_in_archive_order":2,"of":2,"metrics":{"BLEU":"63.52","Compilation Rate":"74.02","Pass@1":"59.8"},"uses_additional_data":false},{"leaderboard":"/sota/code-completion-on-rambo-benchmark","task":"Code Completion","dataset":"Rambo Benchmark","model":"RepoCoder","rank_in_archive_order":2,"of":2,"metrics":{"BLEU":"46.22","Compilation Rate":"58.09"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2303.12570","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2303.12570"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/microsoft/codet","reach":null}],"summary":{"ran":1,"unverified":6},"by_repo_kind":{"official":{"samples":7,"ran":1,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"74b37a5216d34c36","entry":"SimilarityScore","repo":"microsoft/codet","repo_kind":"official","path":"RepoCoder/search_code.py","file_url":"https://github.com/microsoft/codet/blob/HEAD/RepoCoder/search_code.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"74b37a5216d34c36"}},{"code_sha256_prefix":"aac23a4e9ef0a307","entry":"CONSTANTS","repo":"microsoft/codet","repo_kind":"official","path":"RepoCoder/search_code.py","file_url":"https://github.com/microsoft/codet/blob/HEAD/RepoCoder/search_code.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"aac23a4e9ef0a307"}},{"code_sha256_prefix":"db55ed299b704178","entry":"CodeSearchWorker","repo":"microsoft/codet","repo_kind":"official","path":"RepoCoder/search_code.py","file_url":"https://github.com/microsoft/codet/blob/HEAD/RepoCoder/search_code.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"db55ed299b704178"}},{"code_sha256_prefix":"37595c0010840fc2","entry":"CodeSearchWrapper","repo":"microsoft/codet","repo_kind":"official","path":"RepoCoder/search_code.py","file_url":"https://github.com/microsoft/codet/blob/HEAD/RepoCoder/search_code.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"37595c0010840fc2"}},{"code_sha256_prefix":"bfd38b5649b8ff48","entry":"CodexTokenizer","repo":"microsoft/codet","repo_kind":"official","path":"RepoCoder/search_code.py","file_url":"https://github.com/microsoft/codet/blob/HEAD/RepoCoder/search_code.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bfd38b5649b8ff48"}},{"code_sha256_prefix":"bdcee9ded5797ebb","entry":"FilePathBuilder","repo":"microsoft/codet","repo_kind":"official","path":"RepoCoder/search_code.py","file_url":"https://github.com/microsoft/codet/blob/HEAD/RepoCoder/search_code.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bdcee9ded5797ebb"}},{"code_sha256_prefix":"bd434a0643ef85ee","entry":"Tools","repo":"microsoft/codet","repo_kind":"official","path":"RepoCoder/search_code.py","file_url":"https://github.com/microsoft/codet/blob/HEAD/RepoCoder/search_code.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"bd434a0643ef85ee"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}