Diffusion LMs Can Approximate Optimal Infilling Lengths Implicitly

Hengchang Liu, Zhao Yang, Bing Su
1/31/2026
cs.LGcs.CL

Official code: NiuHechang/Calibrated_Adaptive_Length (39 stars, last commit 2026-02-10).

Abstract

Diffusion language models (DLMs) provide a bidirectional generation framework naturally suited for infilling, yet their performance is constrained by the pre-specified infilling length. In this paper, we reveal that DLMs possess an inherent ability to discover the correct infilling length. We identify two key statistical phenomena in the first-step denoising confidence: a local \textit{Oracle Peak} that emerges near the ground-truth length and a systematic \textit{Length Bias} that often obscures this signal. By leveraging this signal and calibrating the bias, our training-free method \textbf{CAL} (\textbf{C}alibrated \textbf{A}daptive \textbf{L}ength) enables DLMs to approximate the optimal length through an efficient search before formal decoding. Empirical evaluations demonstrate that CAL improves Pass@1 by up to 47.7\% over fixed-length baselines and 40.5\% over chat-based adaptive methods in code infilling, while boosting BLEU-2 and ROUGE-L by up to 8.5\% and 9.9\% in text infilling. These results demonstrate that CAL paves the way for robust DLM infilling without requiring any specialized training. Code is available at https://github.com/NiuHechang/Calibrated_Adaptive_Length.

View on arXivView PDF

Code Implementations(1)

Official implementation of Diffusion LMs Can Approximate Optimal Infilling Lengths Implicitly

390PythonJan 31, 20268 months ago

Similar Papers

Cite this paper

@article{liu2026diffusion,
  title  = {Diffusion LMs Can Approximate Optimal Infilling Lengths Implicitly},
  author = {Hengchang Liu and Zhao Yang and Bing Su},
  year   = {2026},
  eprint = {2602.00476},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2602.00476v1}
}

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/2602.00476.svg)](https://codeofpaper.com/paper/2602.00476)

Discussion