Manuscript Offprint

arXiv:2610.17831

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

Abstract

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×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.

Autoregressive baseline

Diff Diffusion (ours)

Figure

Figure 1: Diff Diffusion models real-time IDE code edit prediction.

1 Introduction

Large language models (LLMs) have achieved remarkable progress in natural language understanding and generation, and have gradually extended this success to code intelligence tasks. Beyond the

∗^{*}The first three authors contributed equally.

†^{\dagger}Corresponding author.

40th Conference on Neural Information Processing Systems (NeurIPS 2026). Workshop: Diffusion Language Models: Foundations, Efficiency, and Reasoning.

autoregressive (AR) paradigm, diffusion-based large language models (dLLMs) have become a promising alternative because they support parallel decoding and faster generation [2, 22]. By progressively denoising discrete noise tokens, dLLMs provide parallel generation capabilities and can make more efficient use of modern hardware computation. In terms of task performance, proprietary systems such as Mercury, Gemini Diffusion, and Seed Diffusion, as well as open-source projects such as DiffuCoder and Dream-Coder, have demonstrated competitive code-related capabilities [18, 13, 38, 12, 45].

However, current dLLMs mainly rely on masked diffusion to regenerate sequences from scratch, which does not match real programming workflows. In actual development, developers more often edit and refine existing code, and the changes are often small, local, and context-dependent. In IDE edit-prediction tasks, the system needs to predict one or more next code modifications in real time based on the user's edit history, the current file, and the rewrite range around the cursor. This latency-sensitive workflow is illustrated in Figure 1. Autoregressive models must serially output many unchanged fragments token by token in this task, cannot go back to correct already generated content, and are not well suited to processing multiple edits in parallel; masked diffusion often needs to denoise an entire sequence even when only a small change is required. Over the past year, a number of works on discrete diffusion and discrete flow matching have discussed token insertion, modification, and deletion [38, 43, 23, 49, 15, 21, 11, 44, 35]. However, they do not formulate edit operations as source-conditioned edit-path diffusion for latency-critical editing tasks, where unchanged source tokens should be preserved and skipped while only a few regions are revised.

Therefore, we propose Diff Diffusion, a diffusion-inspired LLM framework for code edit prediction. In addition to modeling variable-length generation with inserted and deleted tokens, Diff Diffusion builds edit-path prediction from the initial state and optimizes around low-latency inference. Unlike existing masked diffusion methods, Diff Diffusion explicitly models edit paths and predicts the sequence of edit operations required to transform an original code snippet into the revised code. By incorporating structured edit representations into the diffusion process, the framework avoids redundant regeneration and instead focuses on local updates. We also design a multi-stage training paradigm to progressively strengthen edit-prediction ability, and propose parallel decoding and inference-system optimization strategies to accelerate inference while maintaining accuracy. We first validate public edit-prediction ability on the C3PO open edit-prediction benchmark, then construct a dedicated edit-prediction evaluation benchmark to analyze improvements on Stay, Act, Multi-line, Roll-back, Delete, and other specific metrics, and finally validate the method in production.

In summary, our contributions are:

• We propose Diff Diffusion, a source-conditioned diffusion-inspired framework that explicitly models and predicts code edit paths.

• We apply the framework to in-IDE edit prediction, using same, delete, insert, replace, and mask-to-token actions to reduce repeated decoding of unchanged code and support multi-position parallel modification.

• We design a multi-stage training paradigm and an efficient parallel decoding strategy to support accurate and fast inference.

• We evaluate the method on public benchmarks, edit-prediction evaluations, and production validation, demonstrating improvements in accuracy and latency.

References (47)