AnCoder:通过离散扩散模型实现锚定代码生成
AnCoder: Anchored Code Generation via Discrete Diffusion Models
AI总结:
AnCoder通过结构化锚定扩散模型实现高质量代码生成,解决了传统方法无法尊重编程语言结构的问题。
摘要:
扩散语言模型为自回归代码生成提供了一个有吸引力的替代方案,能够实现复杂程序逻辑的全局规划和迭代优化。然而,现有方法未能尊重编程语言的严格结构,因此常常生成无法执行的破碎程序。为此,我们引入了AnchorTree框架,该框架通过代码中固有的结构化、层次化先验来显式锚定扩散过程。具体而言,AnchorTree利用抽象语法树优先处理语法和语义上显著的标记,例如关键字(如if、while)和标识符(如变量名),从而建立一个结构框架,引导剩余的生成。我们通过AnCoder模型族验证了这一框架,证明结构锚定的扩散方法为高质量代码生成提供了一条参数高效的方法。
英文摘要:
Diffusion language models offer a compelling alternative to autoregressive code generation, enabling global planning and iterative refinement of complex program logic. However, existing approaches fail to respect the rigid structure of programming languages and, as a result, often produce broken programs that fail to execute. To address this, we introduce AnchorTree, a framework that explicitly anchors the diffusion process using structured, hierarchical priors native to code. Specifically, AnchorTree uses the abstract syntax tree to prioritize resolving syntactically and semantically salient tokens, such as keywords (e.g., if, while) and identifiers (e.g., variable names), thereby establishing a structural scaffold that guides the remaining generation. We validate this framework via AnCoder, a family of models showing that structurally anchored diffusion offers a parameter-efficient path to high-quality code generation.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。