扩散语言模型应如何编辑代码?四种接口与组合鸿沟
原标题:How Should Diffusion Language Models Edit Code?
AI 摘要
该研究系统比较了掩码扩散语言模型(MDLM)在代码编辑中的四种接口:整文件重写、搜索替换、先定位后填充、token级编辑。在CanItEdit基准上的实验揭示了一个“组合鸿沟”:当给定正确的编辑位置时,扩散模型能协调多处修改,但一旦需要模型自己预测编辑位置,这种能力就大幅丧失。研究进一步分离出两个独立要求——覆盖所有必要修改区域,以及精确划定区域边界;扩大区域以保证覆盖反而会因需要重新生成未改动代码而降低成功率。
正文节选
How Should Diffusion Language Models Edit Code? 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 locati