用于代码生成的自分解扩散模型
Self-Decomposing Diffusion for Code Generation
AI总结:
针对扩散语言模型代码生成中准确率与延迟的权衡难题,本文提出自分解扩散框架SDDC,通过先分解程序再并行实现的方式,大幅提升了代码生成的准确率与解码速度。
摘要:
扩散语言模型(DLMs)正成为代码生成领域极具潜力的范式,具备快速并行解码的优势。然而,生成复杂程序仍具挑战,因其相互依赖的组件需保持一致的接口、数据流及共享假设;激进的并行解码会破坏这些依赖、损害程序正确性,而保守解码则会牺牲效率。为解决该权衡问题,本文提出在实现前规划程序分解,以在并行生成期间协调相互依赖的单元。我们引入用于代码的自分解扩散模型(SDDC),这是一种新型框架,可完全通过扩散分解复杂程序并并行实现其单元:SDDC首先生成指定程序分解及单元间依赖的契约,再用其指导协调的并行实现。在五个基准测试及两个7B规模的扩散骨干模型上,SDDC显著改善了准确率-延迟权衡,使pass@1提升最多31.1个百分点,解码速度比基础模型快7.5至13.7倍,且在延迟更低的情况下,比微调基线模型的pass@1提升最多23.5个百分点。
英文摘要:
Diffusion language models (DLMs) are emerging as a promising paradigm for code generation, offering the potential for fast, parallel decoding. However, generating complex programs remains challenging, as their interdependent components must maintain consistent interfaces, data flows, and shared assumptions. Aggressive parallel decoding can compromise these dependencies and undermine program correctness, while conservative decoding sacrifices efficiency. To address this trade-off, we propose planning program decomposition before implementation to coordinate interdependent units during parallel generation. We introduce Self-Decomposing Diffusion for Code (SDDC), a novel framework that decomposes complex programs and implements their units in parallel, entirely through diffusion. SDDC first generates a contract specifying the program's decomposition and inter-unit dependencies, then uses it to guide coordinated parallel implementation. Across five benchmarks and two 7B diffusion backbones, SDDC substantially improves the accuracy--latency trade-off, raising pass@1 by up to 31.1 percentage points while decoding 7.5--13.7$\times$ faster than the base models, and outperforming a fine-tuning baseline by up to 23.5 points with lower latency.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。