Efficient Token-Level Policy Optimization for Masked Diffusion Models via Velocity Alignment
Organizations: Shenzhen University, China · Guangming Laboratory, China · ByteDance, China · Southeast University, China ·
Abstract
Reinforcement Learning with Verifiable Rewards (RLVR) successfully aligns autoregressive models in rigorous domains like mathematical reasoning and code generation. However, applying RLVR to Diffusion Large Language Models (dLLMs) is hindered by intractable sequence-level likelihoods, forcing existing methods to rely on unstable, high-variance approximations. We propose Sequence Likelihood-Free Policy Optimization (LFPO), an efficient framework that circumvents this bottleneck by formulating policy alignment as discrete velocity alignment. Inspired by continuous flow matching, LFPO eschews trajectory-level estimation and directly optimizes denoising logits via contrastive token-level updates, providing a stable, low-variance surrogate. Furthermore, predicting terminal solutions from intermediate states implicitly straightens the generation trajectory, enabling high-quality sampling with significantly fewer denoising iterations. Extensive experiments on reasoning and coding benchmarks demonstrate that LFPO matches or exceeds the accuracy of likelihood-based baselines while substantially accelerating inference.
Figures & tables
| Model | HumanEval | HumanEval+ | MBPP | MBPP+ | EvalPlus | BigCodeBench | BigCodeBench | Avg. |
|---|---|---|---|---|---|---|---|---|
| Full | Hard | |||||||
| DiffuCoder | 72.0 | 65.2 | 75.1 | 61.9 | 63.6 | 35.7 | 12.2 | 55.1 |
| + diffu-GRPO | 73.1 (+1.1) | 66.1 (+0.9) | 77.3 (+2.2) | 67.3 (+5.4) | 67.9 (+4.3) | 39.2 (+3.5) | 12.5 (+0.3) | 57.6 (+2.5) |
| + UniGRPO | 74.5 (+2.5) | 67.2 (+2.0) | 78.9 (+3.8) | 68.8 (+6.9) | 70.3 (+6.7) | 42.6 (+6.9) | 12.9 (+0.7) | 59.3 (+4.2) |
| + SPG | 74.6 (+2.6) | 69.1 (+3.9) | 80.2 (+5.1) | 69.2 (+7.3) | 68.9 (+5.3) | 42.1 (+6.4) | 12.9 (+0.7) | 59.6 (+4.5) |
| + coupled-GRPO | 73.2 (+1.2) | 68.3 (+3.1) | 78.6 (+3.5) | 67.5 (+5.6) | 67.9 (+4.3) | 40.4 (+4.7) | 10.8 (-1.4) | 58.1 (+3.0) |
| Model | GSM8K | MATH | GPQA | Hellaswag | WinoGrande | PIQA | Avg. |
|---|---|---|---|---|---|---|---|
| LLaDA 8B | 69.7 | 30.6 | 25.3 | 70.3 | 75.8 | 71.6 | 57.2 |
| + diffu-GRPO | 74.3 (+4.6) | 33.7 (+3.1) | 26.1 (+0.8) | 80.1 (+9.8) | 83.2 (+7.4) | 79.3 (+7.7) | 62.8 (+5.6) |
| + UniGRPO | 77.2 (+7.5) | 34.5 (+3.9) | 26.2 (+0.9) | 82.3 (+12.0) | 84.7 (+8.9) | 81.2 (+9.6) | 64.4 (+7.2) |
| + SPG | 76.2 (+6.5) | 34.1 (+3.5) | 25.9 (+0.6) | 83.1 (+12.8) | 84.3 (+8.5) | 80.9 (+9.3) | 64.1 (+6.9) |
| + coupled-GRPO | 75.1 (+5.4) | 33.9 (+3.3) | 25.7 (+0.4) | 82.5 (+12.2) | 85.6 (+9.8) | 83.2 (+11.6) | 64.3 (+7.1) |
| + AGRPO | 78.3 1.3 (+8.6) | 36.1 0.9 (+5.5) | 27.3 1.1 (+2.0) | 85.1 1.0 (+14.8) | 87.3 1.2 (+11.5) | 85.6 0.8 (+14.0) | 66.6 1.0 (+9.4) |
| Model | Code Generation | Reasoning | ||||||
|---|---|---|---|---|---|---|---|---|
| HumanEval | MBPP | BCB-Full | Avg. | GSM8K | MATH | Hellaswag | Avg. | |
| Base Model † | 253.7 | 317.2 | 426.3 | 332.4 | 1034.2 | 1536.3 | 1036.7 | 1202.4 |
| + diffu-GRPO | 254.3 (+0.6) | 305.4 (-11.8) | 430.7 (+4.4) | 330.1 (-2.3) | 1048.4 (+14.2) | 1547.4 (+11.1) | 1027.8 (-8.9) | 1207.9 (+5.5) |
| + UniGRPO | 248.0 (-5.7) | 319.3 (+2.1) | 443.3 (+17.0) | 336.9 (+4.5) | 1020.3 (-13.9) | 1539.3 (+3.0) | 985.8 (-50.9) | 1181.8 (-20.6) |
| + SPG | 243.7 (-10.0) | 305.8 (-11.4) | 416.7 (-9.6) | 322.1 (-10.3) | 1071.0 (+36.8) | 1576.7 (+40.4) | 1009.1 (-27.6) | 1218.9 (+16.5) |
| + coupled-GRPO | 262.2 (+8.5) | 326.5 (+9.3) | 431.2 (+4.9) | 340.0 (+7.6) | 1015.9 (-18.3) | 1601.6 (+65.3) | 1025.8 (-10.9) | 1214.4 (+12.0) |
Appendix figures & tables14 assets
Supplementary material from the paper’s appendix.
Appendix
| Component | DiffusionNFT / Flow-GRPO | AGRPO | LFPO |
|---|---|---|---|
| Positive–negative or reward-induced target direction | Inspired by this line of diffusion RL/FM work Zheng et al. (2026) ; Liu et al. (2025) | Not the central design | Adopted as a detached contrastive target in discrete logit space |
| Discrete masked-dLLM token-level formulation | Continuous/image or flow-matching setting | Likelihood-based dLLM policy-gradient estimator | Token-level CE/logit surrogate for masked dLLMs |
| Sequence/trajectory likelihood handling | Not designed for masked dLLM sequence likelihood | Estimates or approximates policy-gradient quantities | Avoids sequence/trajectory likelihood estimation; retains token-level CE/logit supervision |
| Perturbation space | Model/flow-space target construction | Policy-gradient style update | Logit-space perturbation to keep simplex constraints smooth |
| Temporal credit assignment | Method-specific continuous-time sampling | Trajectory-level PG sampling | Stratified timestep sampling over denoising trajectories |
| Scalable implementation | Not focused on dLLM token-logit memory | Monte Carlo estimator for dLLMs | Block-wise logit parallelization for training samples |
| Aspect | Naive reward-weighted CE | LFPO |
|---|---|---|
| Target construction | Pull toward sampled high-reward outputs | Detached positive/negative implicit policies |
| Geometric view | Supervised attraction heuristic | Shared-origin residual rectification |
| Update effect | Attraction-only signal | Pull high-reward directions and push away low-reward directions |
| Empirical check | Pos. Only variant | All Loss variant in Tables 1 – 2 |
| Property | Probability Space | Log-Prob. Space | Logit Space (Ours) |
|---|---|---|---|
| Domain | |||
| Linear perturbation | Requires clipping | Shift-normalized | Unconstrained before Softmax |
| Simplex constraint | Broken before truncation | Recovered by normalization | Recovered by Softmax |
| Gradient continuity | Fragmented by clipping | Mostly smooth | Smooth relative update |
| HumanEval check | 73.9 with clipping | – | 75.6 with full LFPO |
| Hyperparameter | Value | Hyperparameter | Value |
|---|---|---|---|
| Contrastive Coefficient ( ) | 1.0 | Block-wise Partition Size | 8 |
| Learning Rate (Policy) | Trajectories per Prompt ( ) | 10 | |
| EMA Decay Rate ( ) | Max Generation Length | 512 | |
| Stratified Timesteps ( ) | 8 | Max Diffusion Steps | 2048 |
| Optimizer | AdamW | Warm-up Ratio | 0.1 |
| Weight Decay | 0.01 | Gradient Clipping | 1.0 |
| Parameter | Value |
|---|---|
| Max Diffusion Steps ( ) | 2048 |
| Noise Schedule | Cosine |
| Confidence Metric | Max softmax probability |
| Dynamic Parallel Update | revealed positions |
| Confidence Threshold ( ) | 0.99 |
| Patience (Early Stopping) | 3 identical sequence predictions |
| Model | Hardware / Decode Setting | Avg. Steps | Examples/s | Tokens/s | Generated Tokens/Forward |
|---|---|---|---|---|---|
| LLaDA 8B Base | 8 H20, max answer length 512, CoT prompt | 1034.2 | 0.051 | 23 | 0.436 |
| + AGRPO | 8 H20, max answer length 512, CoT prompt | 1004.8 | 0.053 | 24 | 0.451 |
| + LFPO | 8 H20, max answer length 512, CoT prompt | 891.2 | 0.057 | 29 | 0.571 |
| Method | Checkpoint | Training Strategy | Hardware | Wall-clock Hours/Seed | GSM8K Acc. (%) |
|---|---|---|---|---|---|
| AGRPO | Converged | Diffusion PG estimator | 8 H20 | 152 | |
| JustGRPO | Converged (step 253) | AR-style GRPO training | 8 H20 | ||
| LFPO | Converged | Token-level velocity alignment | 8 H20 |
| Domain | Mean Difference | Approx. 95% CI | Performance Interpretation |
|---|---|---|---|
| Code Avg. | +0.2 | Comparable Mean, Superior Stability | |
| Reasoning Avg. | +0.5 | Comparable Mean, Superior Stability |
| Control | Purpose | Observed Outcome |
|---|---|---|
| No stratified sampling | Tests whether dense temporal coverage matters | Uniform timestep sampling yields higher gradient variance and lower GSM8K accuracy (Table 15 ) |
| No block-wise accumulation | Tests implementation feasibility of the full training tensor | Default configuration is not memory-feasible in our implementation; block-wise accumulation bounds peak VRAM to approximately 92.7 GB (Table 14 ) |
| Probability space perturbation | Tests whether targets can be constructed directly in probability space | Requires clipping or truncation at simplex boundaries, which fragments gradients; we therefore enforce logit space perturbation (Table 6 ) |
| Fixed EMA | Tests whether dynamic reference updates matter | Fixed drops HumanEval accuracy to 70.8% (Table 14 ) |
| Hard reference update | Tests whether replacing EMA with periodic old-policy replacement is stable | Hard update is substantially less stable in dLLM training and drops HumanEval accuracy to 60.1% (Table 13 ) |
| Low , low , high | Tests sensitivity to trajectories, timesteps, and perturbation scale | Reduces computational cost but lowers accuracy, or destabilizes training due to overly aggressive targets (Table 14 ) |
| Reference Update | Update Rule | HumanEval Acc. (%) |
|---|---|---|
| Dynamic EMA (LFPO) | 75.6 | |
| Fixed EMA | 70.8 | |
| Hard update | Periodic replacement | 60.1 |
| Config | Peak VRAM (GB) | GPU Hours | HumanEval Acc. (%) | ||||
|---|---|---|---|---|---|---|---|
| Default | 1.0 | 8 | 10 | 92.7 | 96 | 75.6 | |
| Low | 1.0 | 8 | 5 | 92.6 | 49 | 74.1 | |
| Low | 1.0 | 4 | 10 | 92.5 | 52 | 74.2 | |
| High | 1.5 | 8 | 10 | 92.7 | 96 | 73.9 | |
| Fixed EMA | 1.0 | 8 | 10 | 0.9 | 92.7 | 96 | 70.8 |
| Sampling Method | Gradient Variance | Accuracy (%) |
|---|---|---|
| Uniform | High | |
| Stratified (Ours) | Low |
| Masking Schedule | Threshold ( ) | Accuracy (%) | Avg. Steps | Step Trade-off |
|---|---|---|---|---|
| Linear | 0.99 | 76.3 | 229.6 | Suboptimal step allocation. |
| Cosine (Ours) | 1.00 (No Early Stop) | 76.9 | 2048 (Max) | Upper bound accuracy, max cost. |
| Cosine (Ours) | 0.99 (Default) | 76.5 | 218.3 | Favorable accuracy and step balance. |
| Cosine (Ours) | 0.95 | 74.8 | 197.5 | Fewer steps, minor accuracy drop. |
| Cosine (Ours) | 0.90 | 73.5 | 173.2 | Fewest steps, noticeable degradation. |
| Method | HumanEval (%) | MATH (%) |
|---|---|---|
| Base Model (Dream) | 79.3 | 32.7 |
| + AGRPO | 80.7 | 34.9 |
| + LFPO | 81.9 (+1.2) | 36.1 (+1.5) |
RL for Diffusion Models
Reinforcement learning for diffusion models adapts denoising and sampling to rewards, preferences, and task outcomes.
See all 179 papers