InCoder:一种用于代码填充与合成的生成模型
InCoder: A Generative Model for Code Infilling and Synthesis
AI总结:
提出统一生成模型InCoder,通过随机掩码训练实现双向上下文代码填充,在零样本类型推断等任务上性能显著提升,且在标准程序合成基准上表现与从左到右模型相当。
摘要:
代码很少通过单次从左到右的编写完成,而是被反复编辑和优化。我们引入了InCoder,这是一种统一的生成模型,能够执行程序合成(通过从左到右生成)以及编辑(通过填充)。InCoder通过在大量宽松许可的代码语料库上训练生成代码文件来构建,其中代码区域被随机掩码并移至每个文件末尾,从而允许利用双向上下文进行代码填充。我们的模型是首个能够直接执行零样本代码填充的生成模型,我们在类型推断、注释生成和变量重命名等具有挑战性的任务上对其进行了评估。我们发现,基于双向上下文的条件化能力显著提升了这些任务的性能,同时在标准程序合成基准上,与相似规模预训练的仅从左到右模型相比,表现依然相当。InCoder模型和代码已公开发布。https://sites.google.com/view/incoder-code-models
英文摘要:
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
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。