arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2610.17831cs.SEcs.AIcs.CL
收藏

Diff Diffusion:基于扩散模型预测编辑路径的高效代码编辑方法

Diff Diffusion: Predicting Edit Paths with Diffusion Models for Efficient Code Editing

ByteDance(字节跳动)

Xiaolong Xu, Hao Jiang, Bo Jiang, Zhiwen Deng, Ningyuan Sun, Bingzhou Chen, Jin Chen, Chenxing Wei

AI总结:

Diff Diffusion是一种基于扩散模型的代码编辑LLM框架,通过结构化编辑操作与多阶段训练等技术,实现了高效低延迟的代码编辑,性能优于或匹配自回归基线。

摘要:

扩散大语言模型(dLLM)因能并行更新多个token而在代码生成领域颇具吸引力,但多数dLLM针对序列合成而非编辑预测进行优化,该设置与现代AI辅助集成开发环境(IDE)的需求不匹配——IDE中编辑预测需基于近期编辑、当前文件及光标局部上下文推断下一次代码变更,这类变更通常是稀疏的,会保留大部分源token,因此重新生成完整代码段会浪费计算资源。本文提出Diff Diffusion,一种受扩散启发的代码编辑LLM框架,可从原始代码片段预测其修订形式的编辑路径;Diff Diffusion将去噪过程表示为结构化编辑操作,并结合该形式化方法与多阶段训练及高效并行解码,通过将计算聚焦于变更区域,Diff Diffusion支持准确低延迟编辑及多位置并行修改。在公开编辑完成基准、编辑预测评估及在线验证中,Diff Diffusion的性能与自回归基线相当或更优,同时在公开编辑完成基准上实现了2.78倍的推理速度提升,在生产环境中P50模型延迟降低了39.0%;本研究为需要高精度和低延迟的AI应用提供了新的建模视角。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑