Mask-Aware Policy Gradients for Diffusion Language Models
SourceFull paper
Article overview
Verdict
The method convincingly shows that optimizing token probabilities alone is incomplete for masked diffusion language models: explicitly training the unmasking order yields consistent gains of roughly 2–4 points under the reported settings. Superiority is established only on the listed tasks, models, and configurations.
Main idea
An MDLM trajectory is treated as making two coupled decisions: which tokens to predict and which positions to unmask. The policy gradient is therefore extended with a masking component that directly optimizes unmasking order without extra architecture or forward passes.
Mechanism
The state is a partially masked sequence; the decisions are token probabilities and the unmasking set Uₜ. At each step, tokens are scored from the model logits. Uₜ is sampled without replacement from a Plackett–Luce distribution proportional to exp(log-likelihood/temperature), followed by deterministic remasking. The trajectory log-likelihood contains token and position decisions; only these contribute gradients because remasking is deterministic. GSPO uses separate clipping for token and position ratios; rollouts use block-wise semi-autoregressive decoding with temperatures 0.9 for tokens and 0.5 for positions. The main setting is |Uₜ|=2. Position log-probabilities come from the same logits, so no extra parameters or forward passes are needed. Implementation: LLaDA-8B-Instruct, LoRA rank 128, scale 64, dropout 0.05 on attention and MLP projections, NF4 frozen base weights, bfloat16 adapters and computation, and Flash Attention 2. Reproduction: (1) start from LLaDA-8B-Instruct without prior SFT; (2) add the specified LoRA adapters and NF4; (3) generate block-wise rollouts with Plackett–Luce sampling; (4) compute token and masking log-ratios; (5) train with GSPO and separate clipping; (6) compare against a token-only baseline at lengths 128/256/512. Reward-construction details and the exact GSPO architecture are not specified in the records.
What this is useful for
The approach is useful for masked diffusion LMs where unmasking order affects final reward, especially for mathematical reasoning, code generation, and discrete planning. It is attractive when quality must improve without adding a position-specific network and when a reward signal is available for policy-gradient training. It also applies to models compatible with LoRA and block-wise diffusion decoding.
Risks / not proven
Evidence is limited to the listed models, benchmarks, lengths, and rollout settings. Improvement depends on joint optimization and likely on an appropriate reward signal; the records do not show behavior under other rewards, scales, budgets, or fully autoregressive models. Exact reward construction, the full GSPO configuration, and statistical uncertainty are not provided. The small degradation at |Uₜ|=8 indicates some sensitivity to unmasking-set size.
Full abstract
Reinforcement learning has proven effective for improving reasoning in large language models, but extending it to Masked Diffusion Language Models (MDLMs) remains challenging due to the intractability of the log-likelihood estimation. Existing approaches approximate this log-likelihood by modeling only the token predictions, ignoring the order in which positions are unmasked during generation. We observe that MDLM generation involves two decisions at each step: what tokens to place at each masked position and which positions to remask. We formalize this as a two-stage action MDP, showing that the policy gradient naturally decomposes into a token term and a masking term. Combining optimization of both terms leads to state-of-the-art outcomes on mathematical reasoning and coding benchmarks, with scores of 87.1% on GSM8K and 53.4% on MBPP.