TensorX
返回文献探索

Paper · arXiv 2310.17680

CodeFusion: A Pre-trained Diffusion Model for Code Generation

Mukul Singh, José Cambronero, Sumit Gulwani, Vu Le, Carina Negreanu, Gust Verbruggen

75 upvotesOctober 26, 2023arXiv 预印本
AI 摘要

CodeFusion, a diffusion model for code generation, outperforms auto-regressive models in natural language to code tasks by iteratively refining the entire program.

diffusion code generation modeliteratively denoisingnatural language to code generationBashPythonMicrosoft Excel conditional formatting (CF) rulestop-1 accuracytop-3 accuracytop-5 accuracydiversity versus quality

Abstract

Imagine a developer who can only change their last line of code, how often would they have to start writing a function from scratch before it is correct? Auto-regressive models for code generation from natural language have a similar limitation: they do not easily allow reconsidering earlier tokens generated. We introduce CodeFusion, a pre-trained diffusion code generation model that addresses this limitation by iteratively denoising a complete program conditioned on the encoded natural language. We evaluate CodeFusion on the task of natural language to code generation for Bash, Python, and Microsoft Excel conditional formatting (CF) rules. Experiments show that CodeFusion (75M parameters) performs on par with state-of-the-art auto-regressive systems (350M-175B parameters) in top-1 accuracy and outperforms them in top-3 and top-5 accuracy due to its better balance in diversity versus quality.

北京市昌平区探索星信息技术及软件开发工作室

京ICP备2026059466号