arXiv:2512.15596cs.LG2025-12被引 10

让语言模型学会自我纠错,精准修正错误词元。

Corrective Diffusion Language Models

  • 设计可纠正的扩散语言模型,通过显式监督错误词元提升信心判别力。
  • 在代码修订任务中,显著优于传统模型,尤其在并行解码不确定性高时。
  • 提出可执行的纠错评估基准,支持可控误差定位与修复测试。

尽管扩散语言模型(DLMs)因非因果结构理论上适合迭代修正,但实践中常无法可靠修正错误词元。核心挑战在于模型难以区分可见序列中正确与错误的词元。标准掩码扩散语言模型(MDLM)训练仅聚焦于去掩码目标,削弱了基于置信度的修正效果。本文研究了DLMs的纠正行为,即对错误词元赋予更低置信度并迭代修正,同时保留正确内容的能力。我们发现该能力并非由传统掩码扩散目标自然产生,因此提出一种以纠正为导向的后训练原则,显式监督可见错误词元,实现差异化置信度与针对性修正。为评估纠正行为,我们引入代码修订基准(Code Revision Benchmark),一个可控且可执行的评测框架,用于评估错误定位与原地修正能力。在代码修订任务和并行解码场景中的实验表明,采用本方法训练的模型显著优于标准MDLM,尤其在并行解码引发高不确定性、需迭代修正时表现更优。代码已公开于https://github.com/zhangshuibai/CDLM。

原文摘要 · Abstract (English)

While Diffusion Language Models (DLMs) are theoretically well-suited for iterative refinement due to their non-causal structure, they often fail to reliably revise incorrect tokens in practice. The key challenge lies in the model's inability to distinguish between correct and erroneous tokens in a visible sequence. Standard masked diffusion language model (MDLM) training is restricted to the objective of unmasking, undermining the effectiveness of refinement guided by confidence. Based on this observation, we study corrective behavior in DLMs, defined as the ability to assign lower confidence to incorrect tokens and iteratively refine them while preserving correct content. We show that this capability is not induced by conventional masked diffusion objectives and propose a post-training principle oriented by correction that explicitly supervises visible incorrect tokens, enabling discriminative confidence and targeted refinement. To evaluate corrective behavior, we introduce the Code Revision Benchmark, a controllable and executable benchmark for assessing error localization and in-place correction. Experiments on code revision tasks and parallel decoding scenarios demonstrate that models trained with our approach substantially outperform standard MDLMs, with gains that are most pronounced when parallel decoding introduces substantial uncertainty and iterative refinement becomes essential. Our code is publicly available at https://github.com/zhangshuibai/CDLM.

扩散模型语言模型纠错自修正

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。