ReMaRL: Learning to Unmask and Remask in Frozen Diffusion Language Models

Egor Shibaev, Danila Biktimirov, Ivan Klimov, Artem Makoian, Viacheslav Meshchaninov, Dmitry VetrovarXiv 2026 · arXiv

TL;DR

ReMaRL (Remasking with Reinforcement Learning) is a lightweight, 0.3M-parameter policy that optimizes the decoding process of frozen masked diffusion language models. By learning to strategically unmask new tokens or "remask" earlier ones to fix errors—optimized directly for final-answer correctness via Group Relative Policy Optimization (GRPO)—it achieves state-of-the-art performance on math and code benchmarks with very few model calls.

What Problem Does This Paper Address?

Masked Diffusion Language Models (MDLMs) generate text by predicting tokens in parallel across the entire sequence. However, this parallel nature introduces a "coordination problem": if two tokens depend on each other, predicting them simultaneously can lead to a set of tokens that are individually plausible but collectively inconsistent.

To fix this, decoding algorithms must decide which tokens to reveal (unmask) at each step. Some advanced methods also allow "remasking"—hiding a previously revealed token so the model can try again with more context. Existing strategies rely on hand-tuned heuristics or supervised models trained to detect errors. The gap is that these methods don't directly optimize for the ultimate goal: is the final answer correct?

Methods

The authors introduce ReMaRL, a policy that learns to select which positions to unmask, retain, or remask.

  • Frozen Backbone: The underlying diffusion model (e.g., LLaDA-8B) remains completely frozen, making training highly efficient.
  • Lightweight Policy: The policy is a small MLP (0.3M parameters) that takes features like token confidence, mask status, and the diffusion model's internal hidden states to output a "correction" to the standard confidence score.
  • Stochastic Selection (P2'): It builds on a new stochastic adaptation of the P2 planner. It uses a Gumbel top-k sampling strategy to choose positions, allowing for exploration during training.
  • Reinforcement Learning (GRPO): The policy is trained using Group Relative Policy Optimization. It generates groups of potential answers for a prompt and receives a binary reward based on whether the final answer is correct. This aligns the decoding strategy directly with task performance.

Datasets

The researchers evaluated ReMaRL on two primary domains:

  • Mathematics: Training on a mixture of GSM8K and MATH (~15k questions); evaluation on GSM8K and MATH500.
  • Coding: Training on KodCode (~9.1k problems); evaluation on HumanEval and MBPP.
  • Backbones: The primary experiments used LLaDA-8B-Instruct, with additional validation on Dream-v0-Instruct-7B.

Key Insights and Ideas

  • Emergent Autoregression: Interestingly, even without being told to do so, the learned policy tends to prioritize unmasking tokens from left to right, mimicking autoregressive models. This suggests that the "left-to-right" bias in human language is a naturally efficient strategy for these models (see Figure 6a).
  • Remasking is a Safety Net: ReMaRL remasks tokens less frequently than heuristic baselines but does so more effectively. It learns to identify which "uncertain" tokens are actually wrong and need a second look.
  • Extreme Data Efficiency: The policy is remarkably data-efficient. Training on as few as 32 questions per dataset allowed the model to approach the performance of the full-data policy (see Figure 4).
  • Tuning Matters: The authors found that simply tuning the "temperature" of the position selection (the P2' baseline) yields a very strong decoder even without RL, ranking second in many tests.
Math accuracy vs inference budget. ReMaRL (solid blue) consistently leads at low model call counts (NFE).

Key Results

  • Math Superiority: On GSM8K and MATH500, ReMaRL achieved the highest scores among all compared policies within the 4–64 model call range. For example, at 8 calls on GSM8K, it reached ~54% accuracy, significantly outperforming standard confidence-based unmasking (~13%).
  • Coding Excellence: At inference budgets of 8 and 16 calls, ReMaRL achieved the highest pass@1 scores on both HumanEval and MBPP.
  • Transferability: A policy trained for a specific budget (e.g., 32 calls) generalizes well when given more calls at inference time (see Figure 3).
  • Model Agnostic: The method successfully improved the Dream-7B model, proving it isn't overfitted to a single architecture.
Code pass@1 vs inference budget. ReMaRL leads at the 8-16 NFE range.

Limitations and Future Work

  • Fixed Schedules: ReMaRL learns which positions to unmask, but the number of tokens unmasked at each step follows a fixed linear schedule. Learning an adaptive unmasking rate is a logical next step.
  • Reward Dependency: The current training relies on objective binary rewards (correct/incorrect). Applying this to open-ended text generation (like creative writing) would require integrating complex reward models (LLM-as-a-judge).
  • Wall-clock Time: The paper measures efficiency in "Number of Function Evaluations" (NFE). While the policy is lightweight, the authors note that NFE doesn't perfectly capture real-world speedups due to factors like KV-caching and sequence length overhead.

Summary updated

Abstract

Masked diffusion language models generate tokens in parallel, and the order in which tokens are unmasked affects final-answer accuracy. Several methods learn unmasking policies from task rewards, but these policies cannot remask earlier predictions. Remasking lets the model correct those predictions using newly generated context. Heuristic rules guide both unmasking and remasking, while supervised remaskers learn to detect token errors. Neither approach directly optimizes these decisions for final-answer correctness. To address this gap, we introduce ReMaRL (Remasking with Reinforcement Learning), a lightweight policy that learns which tokens to unmask, retain, or remask. We train this roughly 0.3M-parameter policy with Group Relative Policy Optimization (GRPO) from final-answer rewards while keeping the diffusion model frozen. With LLaDA-8B-Instruct, ReMaRL achieves the highest scores among the compared unmasking and remasking policies within the tested inference budgets of 4-32 model calls on math and 8-16 calls on code.
BibTeX
@misc{shibaev2026remarl,
  author = {Egor Shibaev and Danila Biktimirov and Ivan Klimov and Artem Makoian and Viacheslav Meshchaninov and Dmitry Vetrov},
  title = {{ReMaRL: Learning to Unmask and Remask in Frozen Diffusion Language Models}},
  year = {2026},
  eprint = {2611.22576},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.22576},
}
Figure