How Should Diffusion Language Models Edit Code?

Xijia Tao, Ziru Liu, Shansan Gong, Jiacheng Ye, Kecheng Chen +5 more
9/29/2026
cs.SEcs.AI
diffusion-flow

No confident code implementation found for this paper.

Abstract

Code editing requires a model to decide where to make changes, generate the new content, and preserve everything else. We study how masked diffusion language models divide these responsibilities across four editing interfaces: whole-file rewriting, search-and-replace, locate-then-infill, and token-level editing.

Show full abstract

Experiments on CanItEdit reveal a composition gap: diffusion models can generate coordinated changes when the correct edit locations are supplied, but much of this capability is lost when those locations must be predicted. Access to the intact original code helps the model fill multiple edit regions, yet does not resolve the difficulty of selecting those regions. By varying the editable regions while holding the generation model and decoding procedure fixed, we identify two distinct requirements for successful editing: covering every required change and placing precise boundaries around it. Missing a required region prevents the corresponding change, while widening regions to ensure coverage can sharply reduce success by requiring unchanged code to be regenerated. A sentence-level Wiki editing probe shows the same qualitative gap between supplied and predicted locations beyond code. These findings show why strong infilling capability alone does not ensure reliable editing: the interface must expose all required changes while limiting regeneration of unchanged code.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{tao2026should,
  title  = {How Should Diffusion Language Models Edit Code?},
  author = {Xijia Tao and Ziru Liu and Shansan Gong and Jiacheng Ye and Kecheng Chen and Zirui Wu and Lin Zheng and Xinyu Fu and Rui Liu and Lingpeng Kong},
  year   = {2026},
  eprint = {2609.38257},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2609.38257v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2609.38257.svg)](https://codeofpaper.com/paper/2609.38257)

Discussion