2022/04/12 by Daniel Fried, Fried, Daniel, Armen Aghajanyan +16 · 142 citations
Computer Science · #Artificial intelligence #Code (set theory) #Code generation #Computer science #Context (archaeology) #Generative grammar #Generative model #Inference #Key (lock) #Programming language #Set (abstract data type) #Software Engineering Research #Software Reliability and Analysis Research #Software Testing and Debugging Techniques
paper · pdf · doi:10.48550/arxiv.2204.05999
published in arXiv (Cornell University) (Cornell University)
openalex publication_date 2022/04/12 · openalex created_date 2025/10/10 · openalex updated_date 2026/08/05
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