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.
Figures & tables
Figure 1: Diff Diffusion models real-time IDE code edit prediction.
Figure 2: Diff Diffusion framework.
Model
Result Accuracy (%)
Steps per Sample
Inference Time per Sample (ms)
Speedup Relative to AR
AR
83.18
14.62
403
−
Diff Diffusion
81.33
3.90
145
2.78×
Table 1: Performance comparison on the C3PO edit-completion task.
Model
Act (%) ↑
Stay (%) ↑
Multi-line (%) ↑
Roll-back (%) ↓
Delete (%) ↓
AR
45.90
91.73
68.42
9.0
1.0
Mercury-Coder
31.97
54.32
36.84
52.5
19.5
Diff Diffusion + CT
41.80
89.21
68.42
7.0
0.5
Diff Diffusion + CT + SFT
49.18
89.21
73.68
9.5
0.5
Diff Diffusion + CT + SFT + DPO
49.18
92.45
68.42
7.5
0.5
Diff Diffusion + CT + SFT + AGRPO
50.00
96.40
73.68
10.0
0.5
Table 2: Results on the IDE edit-prediction evaluation set.
Method
Edit Range (tokens)
Output Length
Decoding Steps
Total Time (ms)
AR
140
126
126
3964
Diff Diffusion
140
110
4.90
415
Diff Diffusion + PIE
140
110
5.00
420
Diff Diffusion
1024
1008
7.56
784
Diff Diffusion + PIE
1024
1012
8.78
676
Table 3: Inference speed on the edit-prediction evaluation set.
Model
Acceptance rate
CPO
Accepted lines
P50 model latency
AR
23.8%
1.06
93.6
116 ms
Diff Diffusion
24.0%
1.05
102.6
70.8 ms
Table 4: Production A/B results for IDE edit prediction.
Figure 3: Latency by edit-distance bucket.
Appendix figures & tables2 assets
Supplementary material from the paper’s appendix.
Appendix
Method
Initial State
Edit Actions
Edit Task Focused
Main Goal
Production Grade
Seed Diffusion [ 38 ]
Masked sequence
Mask-to-token
Partial
Quality + latency
No
LLaDA2.1 [ 4 ]
Masked sequence
Mask-to-token, token replacement
No
Latency + quality
No
LLaDA2.2 [ 3 ]
Masked sequence
Keep, substitute, delete, insert
Partial
Self-correction
No
Edit Flows [ 15 ]
Random sequence
Insert, delete, substitute
No
Variable length
No
DID [ 11 ]
Masked sequence
Delete, insert
No
Variable length
No
DreamOn [ 44 ]
Masked span
Expand, delete, fill mask
Partial
Variable-length infilling
No
Appendix
Table 5: Representative dLLMs with edit operations.
Dataset / Benchmark
Role
Scope
Scale
CommitPack subset
Stage I edit-path pretraining
Git commit diffs in Python, C++, Java, JavaScript, Go, and Rust
87B tokens
Edit prediction training data
Stage II / III IDE post-training
High-quality next-edit examples collected from multiple scenarios
30M examples
C3PO Edit Completion
Public benchmark and SFT data
C# code edit examples from 53 GitHub projects
39K train / 5K eval examples
Edit prediction evaluation set
In-house IDE benchmark
Act, Stay, Multi-line, Roll-back, and Delete cases