Skip to content

How Should Diffusion Language Models Edit Code?

Sep 2026 · arXiv.org · Vol abs/2609.38257 · 0 citations · 20 references
Computer Science

TL;DR

This work identifies two distinct requirements for successful editing: covering every required change and placing precise boundaries around it, and shows why strong infilling capability alone does not ensure reliable editing.

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

Similar papers

#artificial intelligence Preprint Oct 2026

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

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

Xiao-Long Xu, Hao-Zhe Jiang, Bo Jiang et al. · 0 citations

When Edit Flows are Edit Jumps: replicating Edit Flows and EvoFlows

The first open implementation of the antibody lead optimization framework is introduced, with a single generalist antibody editor trained on 1.66M Observed Antibody Space homolog pairs to propose homolog-like variants of a seed sequence, editing unseen leads zero-shot, without the per-family retraining original approac...

Gabriel Bénédict, Melanie Buechler, Gerard Riera-Solà et al. · 0 citations
Preprint Oct 2026

Diffusion Language Models Change Speed Across Tasks and Languages

Diffusion language models can write several tokens in one forward pass, and they decide during generation how many passes to spend. Two outputs of the same token length can therefore vary a lot in cost. To understand the underlying factors of this cost variation, we analyze two diffusion models across 10 tasks. We find...

Mohsen Fayyaz, Ali Modarressi, Daniel Mingyi Israel et al. · 0 citations

Spectral Feedback for Test-Time Alignment of Protein Diffusion Models

Discrete diffusion models have become leading architectures for inverse protein folding. Test-time alignment guides these models during inference to generate proteins with desirable attributes. Alignment methods for discrete diffusion models often treat inference as a unidirectional process, lacking effective mechanism...

Shai Dickman, M. Cemri, Landon Butler et al. · 0 citations
#machine learning Preprint Oct 2026

Mind the Gaps: From Failure Attribution to Closed-Form Repair of Code Language Models

Code language models must be maintained like the software around them: when a library evolves, a model keeps writing the interface that it saw during training. Repairing the model itself lets one correction reach all downstream uses. Existing repair methods attribute a failure to neurons, select the highest-ranked ones...

Jian Gu, Hong-Yu Zhang, Chun-Yang Chen et al. · 0 citations

Related blog posts

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.