Instruction-tuned Diffusion Large Language Models (dLLMs) offer a promising alternative to traditional autoregressive (AR) models by enabling flexible, non-left-to-right generation orders. However, they suffer from a paradoxical vulnerability known as <eos> overflow: providing a larger generation budget causes the model to produce shorter, broken responses, often collapsing into early termination. "Rainbow Padding" introduces a simple, highly effective structural fix to this issue by decoupling sequence termination from sequence padding.
The <eos> Overflow Problem
While AR models generate text strictly sequentially and stop at the first <eos> (end-of-sequence) token, dLLMs operate on a fixed-length "canvas" simultaneously. During standard instruction tuning, variable-length responses are padded to this fixed length using repeated <eos> tokens.
Because training data is heavily skewed with <eos> tokens at the end of sequences, the model develops an overwhelming positional bias. During inference, dLLMs often utilize confidence-based decoding, selecting the most certain tokens first. Since the model is highly confident that the tail end of the sequence should be padding, it predicts <eos> tokens there early on. This high probability mass at the tail "leaks" backward, tricking the model into terminating the sequence prematurely. Consequently, the more generation space allocated, the more likely the model is to collapse into a stream of empty <eos> tokens.
The Rainbow Padding Solution
To resolve this, the authors propose Rainbow Padding. Instead of overloading the <eos> token to act as both a semantic marker ("I am done talking") and a structural placeholder ("this space is empty"), <eos> is reserved strictly for termination.
The remaining padding positions are filled with a deterministic, cyclic palette of distinct padding tokens:
$$\mathcal{P} = \{ \langle pad_0 \rangle, \langle pad_1 \rangle, \dots, \langle pad_{K-1} \rangle \}$$
By rotating through these tokens, the probability mass is distributed across multiple vocabulary entries rather than concentrating on a single <eos> token. This breaks the dominance of <eos> and provides a weak structural signal of length without taxing the model's capacity. The authors found that a cycle of just seven distinct tokens is sufficient to stabilize the model. Crucially, this method can be retrofitted onto existing models using lightweight LoRA fine-tuning for just a single epoch.
Key Results and Performance
The researchers evaluated Rainbow Padding on high-stakes reasoning and coding benchmarks (MATH, GSM8K, HumanEval) as well as general tasks (MMLU, HellaSwag). The performance gains are substantial, particularly under large generation budgets (e.g., max_length = 1024).
- Accuracy Recovery: On the MATH dataset, accuracy jumped from a collapsed 0.1% (with standard padding) to 28.6% with Rainbow Padding. GSM8K saw a similar leap from 3.0% to 73.8%, and HumanEval improved from 11.0% to 38.4%.
- Response Length: Standard dLLMs produced an average response length of just 1.4 tokens on MATH when given a 1024-token budget. Rainbow Padding restored this to a healthy 252.9 tokens.
- Robustness: Unlike heuristic fixes that manually lower the probability of
<eos>, Rainbow Padding allows the model to terminate naturally when the answer is actually finished, preventing endless repetitions.
Limitations and Future Work
While highly effective, Rainbow Padding currently requires identifying rare tokens in the existing vocabulary to act as pads (e.g., sequences of rare signs) or expanding the vocabulary entirely. Additionally, while seven tokens work for current sequence lengths, extremely long-context dLLMs (e.g., 100k+ tokens) might require a larger set of distinct padding tokens. Future work will likely explore incorporating Rainbow Padding directly into the initial pre-training phase of dLLMs to prevent the <eos> bias from forming in the first place.
Summary updated