Learning Unmasking Policies for Diffusion Language Models

Metod Jazbec, Theo X. Olausson, Louis Béthune, Pierre Ablin, Michael Kirchhof, Joao Monteiro, Victor Guilherme Turrisi da Costa, Jason Ramapuram, marco cuturi

TL;DR

Researchers have developed a way to use Reinforcement Learning (RL) to teach Diffusion Language Models (dLLMs) the best way to "unmask" text during generation. By replacing handcrafted heuristics with a lightweight, trained transformer policy, they achieved state-of-the-art performance and significantly improved efficiency, especially in "full-diffusion" settings where traditional methods often fail.

What Problem Does This Paper Address?

Standard Large Language Models (like GPT-4) are autoregressive (AR), meaning they generate text one token at a time, from left to right. This is reliable but slow. Diffusion Language Models (dLLMs), specifically Masked Diffusion Models (MDMs), offer a faster alternative: they start with a sequence of "mask" tokens and iteratively reveal the underlying text. Because they can unmask multiple tokens in parallel, they have the potential for massive speedups.

The million-dollar question is: Which tokens should you unmask first?

Currently, researchers use "heuristics"—manual rules like "unmask every token where the model is more than 90% confident." While these work okay in "semi-autoregressive" modes (generating in small blocks), they are hard to tune and perform poorly when trying to generate long sequences all at once. They often get "tricked" by high-confidence padding tokens, leading to incoherent results.

Methods

The authors treat the unmasking process as a Markov Decision Process (MDP) and solve it using Reinforcement Learning.

  1. The Policy ($\pi_\phi$): Instead of a complex model, they use a "lightweight" single-layer transformer (only ~300k parameters). This policy doesn't look at the text itself; it only looks at the confidence scores and mask positions provided by the underlying dLLM.
  2. The Training (GRPO): They use Group Relative Policy Optimization, a modern RL technique that compares a group of different generation attempts for the same prompt to determine which unmasking "actions" led to better results.
  3. Multiplicative Reward: To balance accuracy and speed, they use a reward function that multiplies a "correctness" score (did it solve the math problem?) by an efficiency penalty. This prevents the model from "reward hacking"—i.e., just guessing quickly to get a small time bonus even if the answer is wrong.
  4. Expert Steering (ES): To jumpstart the learning process, they occasionally show the RL agent examples of successful unmasking from existing high-performing heuristics.

Datasets

The models were trained and evaluated on several challenging benchmarks:

  • GSM8k: Grade school math word problems.
  • MATH-500: More complex mathematical reasoning.
  • HumanEval & MBPP: Python coding tasks (used to test how well a policy trained on math transfers to code).
  • KodCode: A synthetic coding dataset used to train domain-specific policies.

Key Insights and Ideas

  • Heuristics are Fragile: The paper shows that popular heuristics like Fast-dLLM collapse when you stop generating in small blocks. They tend to unmask tokens from right-to-left because they over-index on the high confidence of trailing padding tokens.
  • RL Discovers "Left-to-Right" Naturally: Even when allowed to unmask anywhere, the RL-trained policy naturally learns that unmasking in a generally left-to-right order (like a human writing) produces the most accurate results.
  • Sparsity is a Feature: Interestingly, the learned policy is less likely to unmask adjacent tokens simultaneously compared to heuristics. It prefers a "scattered" approach, likely gathering broader context before committing to a specific local word choice.
  • Confidence is Universal: Because the policy only looks at confidence scores (not text embeddings), a policy trained on one model (like LLaDA) can be plugged into a completely different model (like Dream) and still work effectively.

Key Results

  • Full-Diffusion Dominance: In the "full-diffusion" setting (generating 256 tokens at once), the RL policy crushed the heuristics. On GSM8k, it achieved ~50% accuracy in just 12 steps, whereas heuristics struggled to break 30% even with more steps.
  • Matching the Best: In the standard "semi-AR" block setting, the learned policy matched the performance of the best manually-tuned heuristics, proving that RL can automate what used to require weeks of human engineering.
  • Negligible Overhead: Because the policy is so small (<0.01% of the size of an 8B parameter model), the extra computation time to run the policy is basically zero.
  • Better Diversity: Using a stochastic (Bernoulli) policy instead of a deterministic threshold improved "pass@k" rates, meaning the model is better at exploring different ways to solve a problem.

Limitations and Future Work

While powerful, the approach has a few hurdles:

  • Controllability: Currently, you have to train a different policy for different "speeds" (the $\alpha$ parameter). The authors suggest "test-time tempering" as a workaround, but it's not yet perfect.
  • Domain Specificity: A policy trained on math doesn't perfectly transfer to code. You still need a bit of domain-specific data to get the best results.
  • Remasking: The current policy only decides what to reveal. Future work could allow the policy to "re-mask" or erase tokens if it realizes it made a mistake earlier in the diffusion process.

Summary updated

BibTeX
@inproceedings{jazbec2026learning,
  author = {Metod Jazbec and Theo X. Olausson and Louis Béthune and Pierre Ablin and Michael Kirchhof and Joao Monteiro and Victor Guilherme Turrisi da Costa and Jason Ramapuram and marco cuturi},
  title = {{Learning Unmasking Policies for Diffusion Language Models}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=F9NDKf5oPy},
}
Figure