Diff Diffusion: Predicting Edit Paths with Diffusion Models for Efficient Code Editing
作者: Xiaolong Xu, Hao Jiang, Bo Jiang, Zhiwen Deng, Ningyuan Sun, Bingzhou Chen, Jin Chen, Chenxing Wei
分类: cs.SE, cs.AI, cs.CL
发布日期: 2026-10-13
备注: 15 pages, 3 figures, 6 tables. Accepted at the NeurIPS 2026 Workshop on Diffusion Language Models: Foundations, Efficiency, and Reasoning
💡 一句话要点
提出Diff Diffusion以解决代码编辑中的高效编辑路径预测问题
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 扩散模型 代码编辑 编辑路径预测 高效推理 多阶段训练 低延迟 AI辅助IDE
📋 核心要点
- 现有的扩散模型主要优化于序列生成,难以满足代码编辑中对编辑预测的需求,导致计算资源浪费。
- Diff Diffusion框架通过将去噪过程视为结构化编辑操作,结合多阶段训练和并行解码,提升了编辑路径的预测效率。
- 在公共编辑完成基准测试中,Diff Diffusion在编辑预测评估中表现优异,推理速度提升显著,延迟降低效果明显。
📝 摘要(中文)
扩散大语言模型(dLLMs)在代码生成中具有吸引力,因为它们可以并行更新多个标记。然而,许多模型优化于序列合成,而非编辑预测,这与现代AI辅助IDE的需求不匹配。为此,本文提出Diff Diffusion框架,通过将去噪表示为结构化编辑操作,结合多阶段训练和高效并行解码,预测从原始代码片段到修订形式的编辑路径。Diff Diffusion专注于变化区域的计算,支持准确的低延迟编辑和多位置并行修改。实验结果表明,该方法在公共编辑完成基准测试中实现了2.78倍的推理速度提升,并在生产环境中减少了39.0%的模型延迟。
🔬 方法详解
问题定义:本文旨在解决代码编辑中编辑路径预测的效率问题。现有方法往往侧重于序列生成,无法有效处理稀疏的代码变化,导致计算资源的浪费。
核心思路:Diff Diffusion框架通过将去噪过程建模为结构化编辑操作,专注于变化区域的计算,从而实现高效的编辑路径预测。这样的设计使得模型能够在保持大部分源代码不变的情况下,快速推断出必要的编辑。
技术框架:Diff Diffusion的整体架构包括多个阶段的训练和高效的并行解码模块。首先,通过多阶段训练优化模型的编辑预测能力;其次,利用并行解码技术提升推理速度。
关键创新:Diff Diffusion的主要创新在于将去噪过程视为结构化编辑操作,这一方法与传统的序列生成模型有本质区别,能够更好地适应代码编辑的需求。
关键设计:在模型设计中,Diff Diffusion采用了特定的损失函数来优化编辑预测的准确性,并在网络结构上进行了调整,以支持多位置的并行修改,确保了低延迟的编辑体验。
🖼️ 关键图片
📊 实验亮点
在公共编辑完成基准测试中,Diff Diffusion的推理速度提升达到2.78倍,同时在生产环境中实现了39.0%的模型延迟降低。这些结果表明,Diff Diffusion在编辑预测任务中超越了自回归基线,展示了其高效性和实用性。
🎯 应用场景
Diff Diffusion框架在AI辅助IDE中具有广泛的应用潜力,能够显著提升代码编辑的效率和准确性。其高效的编辑路径预测能力可为开发者提供实时的代码建议,减少开发时间,提升编程体验。未来,该技术还可能扩展到其他需要高效编辑和实时反馈的领域,如文档编辑和内容创作。
📄 摘要(原文)
Diffusion large language models (dLLMs) are appealing for code generation because they can update many tokens in parallel, yet many are optimized for sequence synthesis rather than edit prediction. This setting is poorly matched to modern AI-assisted IDEs, where edit prediction must infer the next code change from recent edits, the current file, and cursor-local context. Such changes are usually sparse and preserve most source tokens, so regenerating a full code segment wastes computation. We propose Diff Diffusion, a diffusion-inspired LLM framework for code editing that predicts edit paths from an original snippet to its revised form. Diff Diffusion represents denoising as structured edit operations, and combines this formulation with multi-stage training and efficient parallel decoding. By focusing computation on changed regions, Diff Diffusion supports accurate low-latency edits and multi-position parallel modification. Across public edit-completion benchmarks, edit-prediction evaluations, and online validation, Diff Diffusion matches or leads autoregressive baselines while delivering 2.78 times faster inference on public edit-completion benchmarks and a 39.0% P50 model-latency reduction in production. This work provides a new modeling perspective for AI applications that require high accuracy and low latency.