Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

Train for the Worst, Plan for the Best: Understanding Token Ordering in Masked Diffusions

  • Problem Masked diffusion models train on exponentially many infilling subproblems, and some of them are hard to learn.
  • Method Adaptive inference picks which masked positions to unmask using Top probability or Top probability margin scores from a pretrained MDM, without retraining it.
  • Results Raised Sudoku accuracy for a 6M MDM from 6.88% with vanilla inference to 89.49% with Top probability margin.

Figure 3: Generative Perplexity. We compare the resulting gener-
ative perplexity (GenPPL) of adaptive vs. vanilla MDM inference.
We employ a pretrained 170M M…

Figure 3 . Generative Perplexity. We compare the resulting gener- ative perplexity (GenPPL) of adaptive vs. vanilla MDM inference. We employ a pretrained 170M MDM and LLaMA-7B (Touvron et al., 2023) as inference and evaluation, respectively. Adaptive MDM inference (Blue) leads to a substantial reduction in genera- tive perplexity, while maintaining the entropy.

Original paper · CC BY 4.0 · Jaeyeon Kim, Kulin Shah, Vasilis Kontonis, Sham Kakade, Sitan Chen · Train for the Worst, Plan for the Best: Understanding Token Ordering in Masked Diffusions · Original paper figure · Extracted the figure area from page 7 of the original PDF.

Why decoding order matters for masked diffusion

Masked diffusion models (MDMs) learn to reverse a process that masks tokens at random, and they are a leading variant of discrete diffusion. On language modeling they still trail autoregressive models (ARMs), yet they look stronger on reasoning, planning and infilling.

The study weighs two effects that pull in opposite directions. At training time an MDM must predict a token from an arbitrary set of visible positions, whereas an ARM only conditions on a prefix. At inference time an MDM can fill positions in any order, while an ARM is locked to left-to-right decoding.

The central question is whether that inference flexibility is worth the harder training task. The authors answer in two parts: training on all orders produces hard subproblems, and choosing the decoding order at inference can avoid them.

How MDM training covers every masking problem

Each training sequence is corrupted by independent masking: at noise level t, every token is replaced by the mask token with probability 1 minus α_t and is kept otherwise. The forward distribution is \(q_{t|0}(x_t^i \mid x_0^i)=\mathrm{Cat}(\alpha_t e_{x_0^i}+(1-\alpha_t)e_0)\), with α_0 close to 1 and α_1 close to 0.

The denoiser is trained only on positions that are still masked, and its loss integrates negative log-likelihoods of those positions over the noise level t. Because the number of masked tokens already encodes the noise level, the denoiser usually takes no time embedding.

Proposition 2.1 rewrites this loss as a weighted sum over every infilling mask M and every position i in M, with weights that depend on the size of M and on L. Under the stated assumptions the loss upper-bounds the negative expected log-likelihood, \(L_\theta \le -\mathbb{E}_{x_0\sim p_{data}}[\log p_\theta(x_0)]\). A minimizer must therefore give the posterior marginal of each token under every masking pattern.

Left-to-right ARM training corresponds to one term per position, where the suffix from position i onward is masked. MDM training averages over permutations drawn uniformly, \(L_\theta=-\mathbb{E}_{x_0,\pi\sim \mathrm{Unif}(S_L)}[\sum_{i=0}^{L-1}\log p_\theta(x_0^{\pi(i)}\mid x_0[\pi\{i,\dots,L-1\}])]\). Since the identity permutation alone gives the autoregressive loss, MDM training covers exponentially more subproblems and prefers no particular order.

Benign data with hard masking subproblems

The authors use latents-and-observations (L&O) distributions: latent tokens are drawn from a prior, and observation tokens are functions of those latents. The observation functions are efficiently learnable in the PAC sense, so a learner could in principle recover them from samples.

Under the natural order of an L&O distribution, predicting a latent is trivial, and an observation depends only on latents that come earlier. Training in that known order is therefore tractable.

Order-agnostic training asks for predictions under masking patterns that need not match the generation order. A cryptographic hash construction makes such predictions intractable, but it is worst-case and does not reflect typical data. The authors instead use sparse predicate observations: each observation applies a predicate g to a k-subset of latents, with arity k ≥ 2.

In that band, with probability Ω_k(1) over the masking, no polynomial-time algorithm predicts any masked latent position. The statement is conditional on the 1RSB cavity prediction, which is Conjecture B.13.

Training order on natural text

A π-learner, for a permutation π, predicts each token from the clean tokens earlier in π and the masked tokens later in π. Its log-likelihood is \(\log p_\theta(x_0)=\sum_{i=0}^{L-1}\log p_\theta(x_0^{\pi(i)}\mid x_0[\pi\{i,\dots,L-1\}])\). With the identity permutation this reduces to standard left-to-right autoregressive training.

Experiments use Slimpajama, a causal transformer and sequence length 2048 with permuted inputs. The authors replace RoPE with a learnable positional embedding, since RoPE favors left-to-right order, and they re-run the RoPE baselines as well. Permutations are sampled from the uniform distribution and from two distributions that interpolate between uniform and the identity.

A π-learner with uniformly random π scores worse than an ARM. As π moves closer to the identity, its scaling curve moves closer to the ARM curve. The authors attribute the small gap between MDM and the random-order learner to task diversity, which may help optimization and validation performance.

Error differs across masking positions

On L&O-NAE-SAT, each observation is a NAE constraint on a randomly chosen triple of latent tokens. Error for each masking task is a squared gap between the model's log-probability and a Bayes-optimal reference. That reference is unavailable, so the authors train a second MDM for a much larger number of iterations as a proxy.

Errors are larger on latent positions than on observation positions. This matches the earlier argument that some masking problems are harder than others.

For text, no Bayes-optimal predictor is available, so the authors sum per-position log-probabilities across the order-based subproblems. This sum shows a clear gap between different subproblems. The authors conclude that some subproblems are estimated better than others, so vanilla inference should avoid the poorly estimated ones.

Choosing positions to unmask

Each selected token is then sampled from p_θ(x^i | x_t). Because the random draw ignores confidence, the sampler can land on poorly estimated subproblems.

Adaptive inference replaces the random draw with an oracle F(θ, x_t) that selects S from the model's own predictions. No retraining is involved, since a pretrained MDM supplies both the scores and the token values. If the model solved every masking problem exactly, any unmasking order would give the same likelihood, so order matters only because the model is imperfect.

Top probability scores each masked position by its largest probability over vocabulary values and selects the top K positions. It is written as \(F(\theta,x_t)=\mathrm{TopK}\big(\max_j p_\theta(x^i=j\mid x_t)\big)\).

When one value clearly dominates, the two oracles rank positions much alike; they differ when two values compete. The oracles choose which position to decode, not which value, so they differ from nucleus sampling in ARMs.

Likelihood matching on L&O-NAE-SAT and text

On L&O-NAE-SAT, accuracy on observation tokens is compared between vanilla and adaptive inference over five (N, P) settings. At (N, P) = (25, 275), adaptive inference reaches 93.76%, against 78.06% for vanilla inference. Adaptive inference is higher in all five settings, ranging from 88.91% at (100, 200) to 93.76%. Vanilla values fall to 74.60%, 67.94% and 62.84% at (40, 260), (50, 250) and (100, 200), below the 75% that naive guessing gives.

For text, samples come from a pretrained 170M MDM and are scored by LLaMA-7B through generative perplexity. Adaptive inference gives a substantial reduction in generative perplexity, and entropy stays at a similar level. The entropy check guards against lower perplexity coming from less diverse samples.

Sudoku with a 6M MDM

Some blanks in a Sudoku grid are much easier to fill than others, so the choice of next blank matters. Vanilla inference with the 6M MDM solves 6.88% of puzzles. Top probability reaches 18.51%, and Top probability margin reaches 89.49%. The 42M ARM (w/o ordering) reaches 9.73%, and the 42M ARM (with ordering) reaches 87.18%.

The margin oracle does better because it still gives a useful signal when two competing values have similar high probabilities, which is common in Sudoku. The abstract summarizes the gain on pretrained MDMs as rising from < 7% to ≈ 90%.

Top probability reaching only 18.51% on this dataset suggests the earlier dataset is easier than this one.

Zebra puzzles

The natural generation order of Zebra puzzles differs from left-to-right and depends on the sequence. The ARM baseline is trained both without and with the order for each training sequence, and the second version is the stronger baseline.

Top probability reaches 98.5% and Top probability margin reaches 98.3%, against 76.9% for vanilla MDM inference. The ARM (with ordering) reaches 91.17%, and the ARM (w/o ordering) reaches 80.31%. Both adaptive oracles are above the ARM trained with ordering.

The authors describe the unsupervised search for the order as less computationally intensive than the supervised route through teacher forcing.

Harder Sudoku puzzles

Training puzzles come from the Shah et al. (2024) dataset, which keeps puzzles solvable with 7 fixed strategies and without backtracking. The hard test set is the remaining puzzles from Radcliffe (2020), which use a strategy unseen in training or require backtracking.

Top probability margin reaches 49.88% on the hard set, against 32.57% for the ARM (with ordering). Top probability reaches 9.44%, and random-order MDM reaches 3.62%. Accuracy falls for both methods on the harder set.

The authors conjecture that MDMs hold up better because they solve exponentially more infilling problems than ARMs do. This explanation is presented as a conjecture rather than as a tested result.

LLaDA 8B on coding and math

Both adaptive strategies improve on vanilla inference on most of the listed tasks. The one exception is Top probability on ROCStories, at 21.10% against 21.23% for vanilla inference.

On HumanEval-Multi, vanilla inference reaches 16.5%, Top probability 20.8%, and Top probability margin 25.4%. On Math, the three strategies reach 28.5%, 31.3% and 34.3%. The authors attribute the margin oracle's edge on these harder tasks to cases where several tokens have similar probabilities.

Limitations and open questions

Top probability can give misleading uncertainty when a model splits probability between two values. Top probability margin addresses this case, but it is still a heuristic ordering rule, and the authors list finding better generation orders as future work.

The text comparison uses one 170M MDM with LLaMA-7B as evaluator. The L&O-NAE-SAT error reference is a second MDM trained for much longer, not the Bayes-optimal predictor. The Sudoku dataset differs from the one in Ye et al. (2024), which suggests the two datasets differ in difficulty.

The robustness of adaptive MDMs to harder Sudoku puzzles is presented as a conjecture.

Paper info

Authors
Jaeyeon Kim, Kulin Shah, Vasilis Kontonis, Sham Kakade, Sitan Chen
Venue
arXiv · Preprint
First published
2025-2-10
Added
2026-10-30
Updated
2025-8-19
Version
v3
arXiv
2502.06768
Category
cs.LG
Original paper terms
CC BY 4.0
What we show
Paper info, commentary and permitted figures from the original paper

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

Abstract

In recent years, masked diffusion models (MDMs) have emerged as a promising alternative approach for generative modeling over discrete domains. Compared to autoregressive models (ARMs), MDMs trade off complexity at training time with flexibility at inference time. At training time, they must learn to solve an exponentially large number of infilling problems, but at inference time, they can decode tokens in essentially arbitrary order. In this work, we closely examine these two competing effects. On the training front, we theoretically and empirically demonstrate that MDMs indeed train on computationally intractable subproblems compared to their autoregressive counterparts. On the inference front, we show that a suitable strategy for adaptively choosing the token decoding order significantly enhances the capabilities of MDMs, allowing them to sidestep hard subproblems. On logic puzzles like Sudoku, we show that adaptive inference can boost solving accuracy in pretrained MDMs from $<7$% to $\approx 90$%, even outperforming ARMs with $7\times$ as many parameters and that were explicitly trained via teacher forcing to learn the right order of decoding.

Quote from the paper

Jaeyeon Kim, Kulin Shah, Vasilis Kontonis, Sham Kakade, Sitan Chen (2025). Train for the Worst, Plan for the Best: Understanding Token Ordering in Masked Diffusions. arXiv:2502.06768v3. https://arxiv.org/abs/2502.06768v3

BibTeX
@misc{kim2025train,
  title = {{Train for the Worst, Plan for the Best: Understanding Token Ordering in Masked Diffusions}},
  author = {Jaeyeon Kim and Kulin Shah and Vasilis Kontonis and Sham Kakade and Sitan Chen},
  year = {2025},
  eprint = {2502.06768},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.06768v3}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up