{"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/incoder-a-generative-model-for-code-infilling","title":"InCoder: A Generative Model for Code Infilling and Synthesis","arxiv_id":"2204.05999","date":"2022-04-12","proceeding":null,"authors":["Daniel Fried","Armen Aghajanyan","Jessy Lin","Sida Wang","Eric Wallace","Freda Shi","Ruiqi Zhong","Wen-tau Yih","Luke Zettlemoyer","Mike Lewis"],"abstract":"Code is seldom written in a single left-to-right pass and is instead repeatedly edited and refined. We introduce InCoder, a unified generative model that can perform program synthesis (via left-to-right generation) as well as editing (via infilling). InCoder is trained to generate code files from a large corpus of permissively licensed code, where regions of code have been randomly masked and moved to the end of each file, allowing code infilling with bidirectional context. Our model is the first generative model that is able to directly perform zero-shot code infilling, which we evaluate on challenging tasks such as type inference, comment generation, and variable re-naming. We find that the ability to condition on bidirectional context substantially improves performance on these tasks, while still performing comparably on standard program synthesis benchmarks in comparison to left-to-right only models pretrained at similar scale. The InCoder models and code are publicly released. https://sites.google.com/view/incoder-code-models","url_abs":"https://arxiv.org/abs/2204.05999v3","url_pdf":"https://arxiv.org/pdf/2204.05999v3.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":"incoder-a-generative-model-for-code-infilling","repo_url":"https://github.com/dpfried/incoder","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"incoder-a-generative-model-for-code-infilling","repo_url":"https://github.com/eth-sri/sven","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":null},{"paper_slug":"incoder-a-generative-model-for-code-infilling","repo_url":"https://github.com/openai/human-eval-infilling","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"code-generation","task_name":"Code Generation"},{"task_slug":"comment-generation","task_name":"Comment Generation"},{"task_slug":"program-synthesis","task_name":"Program Synthesis"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/code-generation-on-mbpp","task":"Code Generation","dataset":"MBPP","model":"InCoder 6.7B (0-shot)","rank_in_archive_order":98,"of":99,"metrics":{"Accuracy":"19.4"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2204.05999","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2204.05999"}},"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/openai/human-eval-infilling","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/dpfried/incoder","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/eth-sri/sven","reach":null}],"summary":{"ran":2,"ran_draft_wrong":3,"ran_violates":1,"unverified":4},"by_repo_kind":{"official":{"samples":2,"ran":2,"repositories":1},"listed":{"samples":8,"ran":4,"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":2,"samples":[{"code_sha256_prefix":"0854e65df6769a95","entry":"XGLMAttention","repo":"eth-sri/sven","repo_kind":"listed","path":"sven/model.py","file_url":"https://github.com/eth-sri/sven/blob/HEAD/sven/model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0854e65df6769a95"}},{"code_sha256_prefix":"eb281e9c8335db3a","entry":"XGLMSinusoidalPositionalEmbedding","repo":"eth-sri/sven","repo_kind":"listed","path":"sven/model.py","file_url":"https://github.com/eth-sri/sven/blob/HEAD/sven/model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"eb281e9c8335db3a"}},{"code_sha256_prefix":"775a840572f4ed73","entry":"_expand_mask","repo":"eth-sri/sven","repo_kind":"listed","path":"sven/model.py","file_url":"https://github.com/eth-sri/sven/blob/HEAD/sven/model.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"775a840572f4ed73"}},{"code_sha256_prefix":"336749dd7d699ef6","entry":"create_position_ids_from_input_ids","repo":"eth-sri/sven","repo_kind":"listed","path":"sven/model.py","file_url":"https://github.com/eth-sri/sven/blob/HEAD/sven/model.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"336749dd7d699ef6"}},{"code_sha256_prefix":"bd9a376893413836","entry":"make_sentinel","repo":"dpfried/incoder","repo_kind":"official","path":"example_usage.py","file_url":"https://github.com/dpfried/incoder/blob/HEAD/example_usage.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"bd9a376893413836"}},{"code_sha256_prefix":"0aa9acb3da041d44","entry":"remove_extra_code","repo":"dpfried/incoder","repo_kind":"official","path":"example_batched_usage.py","file_url":"https://github.com/dpfried/incoder/blob/HEAD/example_batched_usage.py","link_basis":"first_harvest_node","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"0aa9acb3da041d44"}},{"code_sha256_prefix":"54f7e0d1438b01d9","entry":"IncoderPrefixLM","repo":"eth-sri/sven","repo_kind":"listed","path":"sven/model.py","file_url":"https://github.com/eth-sri/sven/blob/HEAD/sven/model.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":"54f7e0d1438b01d9"}},{"code_sha256_prefix":"0f9421d915df42a2","entry":"XGLMDecoderLayer","repo":"eth-sri/sven","repo_kind":"listed","path":"sven/model.py","file_url":"https://github.com/eth-sri/sven/blob/HEAD/sven/model.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":"0f9421d915df42a2"}},{"code_sha256_prefix":"b7b3190b983be614","entry":"XGLMForCausalLM","repo":"eth-sri/sven","repo_kind":"listed","path":"sven/model.py","file_url":"https://github.com/eth-sri/sven/blob/HEAD/sven/model.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":"b7b3190b983be614"}},{"code_sha256_prefix":"85ea2ae534378080","entry":"XGLMModel","repo":"eth-sri/sven","repo_kind":"listed","path":"sven/model.py","file_url":"https://github.com/eth-sri/sven/blob/HEAD/sven/model.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":"85ea2ae534378080"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}