Papers › InCoder: A Generative Model for Code Infilling and Synthesis

InCoder: A Generative Model for Code Infilling and Synthesis

12 Apr 2022arXiv:2204.05999archive 2025-07-28

Daniel Fried, Armen Aghajanyan, Jessy Lin, Sida Wang, Eric Wallace, Freda Shi, Ruiqi Zhong, Wen-tau Yih, Luke Zettlemoyer, Mike Lewis

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

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2204.05999")

Code

Syntology Ran 6 of 10 code samples harvested from 2 repositories linked to this paper; 4 have no recorded run. Of those that ran: 1 ran · violated contract; 3 ran · our draft was wrong; 2 ran with no contract checked.

By repository: official repository: 2 samples from 1 repository, 2 ran; community (archive-listed): 8 samples from 1 repository, 4 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

dpfried/incoder officialmentioned on GitHubpytorch report
eth-sri/sven mentioned on GitHub report
openai/human-eval-infilling mentioned on GitHubMIT report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

10 samples harvested; 6 ran; 0 honoured the contract we drafted; 4 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · violated contract
3ran · our draft was wrong
2ran
4unverified

Licence: 2 of the 10 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from 2 repositories linked to this paper, official or community; each sample names its own and says which. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: 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. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

make_sentinel dpfried/incoder/example_usage.py official repository ran · our draft was wrong fingerprinted no licence file found · pointer only · bd9a376893413836 · report
remove_extra_code dpfried/incoder/example_batched_usage.py official repository ran · violated contract fingerprinted no licence file found · pointer only · 0aa9acb3da041d44 · report
XGLMAttention eth-sri/sven/sven/model.py community (archive-listed) ran MIT (permissive) · 0854e65df6769a95 · report
XGLMSinusoidalPositionalEmbedding eth-sri/sven/sven/model.py community (archive-listed) ran · metamorphic tier: invariant fingerprinted MIT (permissive) · eb281e9c8335db3a · report
_expand_mask eth-sri/sven/sven/model.py community (archive-listed) ran · our draft was wrong MIT (permissive) · 775a840572f4ed73 · report
create_position_ids_from_input_ids eth-sri/sven/sven/model.py community (archive-listed) ran · our draft was wrong fingerprinted MIT (permissive) · 336749dd7d699ef6 · report
IncoderPrefixLM eth-sri/sven/sven/model.py community (archive-listed) unverified MIT (permissive) · 54f7e0d1438b01d9 · report
XGLMDecoderLayer eth-sri/sven/sven/model.py community (archive-listed) unverified MIT (permissive) · 0f9421d915df42a2 · report
XGLMForCausalLM eth-sri/sven/sven/model.py community (archive-listed) unverified MIT (permissive) · b7b3190b983be614 · report
XGLMModel eth-sri/sven/sven/model.py community (archive-listed) unverified MIT (permissive) · 85ea2ae534378080 · report

Tasks

Code GenerationComment GenerationProgram Synthesis

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Code Generation MBPP InCoder 6.7B (0-shot) Accuracy 19.4 #98 of 99 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections