# Diffusion Language Models Can Approximate Optimal Infilling Lengths Implicitly

*Hengchang Liu, Zhao Yang, Bing Su*

[NeurIPS page](https://neurips.cc/virtual/2026/poster/154873) · [Open on the map](../papers.html#p154873)

Category: [LLM Reasoning, Memory & RAG](../pcat/19.md) › [Diffusion Language Model Decoding](../pgroup/271.md) · Type: new method · Keywords: diffusion language models, infilling length, adaptive length, code infilling, text infilling

## Summary
CAL is a training-free method that lets diffusion language models automatically discover the optimal infilling length by exploiting confidence signals and correcting a systematic bias.

## Explained to a 5-year-old
Diffusion language models are like drawing pictures word by word in the middle of a sentence. They need to know how many words to fill in, but picking the right number is hard. The researchers looked at how confident the model is after the first step and saw a hint that points to the right length. They fixed a mistake the model makes that makes it think the length is wrong. Now the model can guess the perfect number of words to fill in without any extra training.

## Explained to a 5-year-old, longer
Imagine you have a long story and you want to add a missing part in the middle. A diffusion language model is a kind of computer program that helps fill in those missing parts. Usually, you have to tell it how many words to write, but that can be tricky. The new idea is to let the program figure out the right number by itself. It looks at how sure the program is about its first guess. The researchers noticed a special bump in confidence when the guess is close to the right length. They also saw a steady bias that pushes the guess away from the correct size. By measuring this bump and correcting the bias, the model can search for the best length quickly. This search happens before the actual filling, so the model knows exactly how many words to add. The result is a smoother, more natural insertion that matches what the surrounding text expects. This works for both coding tasks and normal writing, helping the model produce better completions without any extra training.

## For a technical reader
CAL leverages the confidence of the first-step denoising in diffusion language models to locate an oracle peak near the true length and corrects a systematic length bias. By performing an efficient search over possible lengths, it selects the optimal infilling length before decoding, achieving up to 47.7% higher Pass@1 on code infilling and significant BLEU-2/ROUGE-L gains on text infilling. The method is training-free, making it easy to deploy with existing diffusion models.

## Problem
Infilling tasks in language models often require specifying the length of the inserted text, which can be suboptimal and limits performance. Existing diffusion language models use a fixed length, making it difficult to generate the right amount of text.

## Method
The approach analyzes the confidence of the first-step denoising in diffusion language models, identifying a peak near the true length and a systematic bias that obscures it. By calibrating this bias and performing an efficient search, the model approximates the optimal length before decoding.

## Results
The approach 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.

## Contributions
It provides a training-free way for diffusion language models to adaptively select infilling lengths and demonstrates substantial gains on both code and text infilling benchmarks.

## Practical relevance
Enables robust, training-free infilling for code and text, making diffusion models more practical for real-world applications without specialized training.

## Research questions this paper is counted under

- [How can diffusion language models achieve fast parallel token generation while maintaining high sample quality and preserving token dependencies?](../q/7.md)

This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. [Suggest a correction](../feedback/?on=p/154873)
