kefirski.me
ICMLPaper 02202610 min read

Guided Star-Shaped Mask Diffusion

A star-shaped sampler lets masked diffusion models revisit their own tokens, and a tiny learned error detector aims each correction, making few-step generation faster and better at once.

Masked diffusion cannot take anything back

A masked diffusion language model generates by running corruption in reverse. The forward process replaces tokens with a special m=[MASK]m = \texttt{[MASK]} symbol according to a schedule αt\alpha_t, giving the marginal q(xtx0)=Cat(xt;αtx0+(1αt)m)q(x_t \mid x_0) = \mathrm{Cat}(x_t;\, \alpha_t x_0 + (1-\alpha_t)\, m). A denoiser fθf_\theta is trained to look at a partially masked sequence and predict the clean text; sampling walks from fully masked to fully revealed.

The trouble hides in the reverse transition that standard MDLM sampling uses. Conditioned on the current state and the model's prediction, it is

q(xt1xt,x0)={δxt(xt1),xtmCat ⁣(xt1;  (1αt1)m+(αt1αt)x01αt),xt=mq(x_{t-1} \mid x_t, x_0) = \begin{cases} \delta_{x_t}(x_{t-1}), & x_t \neq m \\[6pt] \mathrm{Cat}\!\left(x_{t-1};\; \dfrac{(1-\alpha_{t-1})\,m + (\alpha_{t-1}-\alpha_t)\,x_0}{1-\alpha_t}\right), & x_t = m \end{cases}

The first case is the villain of this story: any token that is already revealed is copied forward with probability one. A wrong commitment made at step three is still there at step three hundred. That rigidity is tolerable when tokens are revealed one at a time, but parallel generation, the whole reason to use diffusion for text, reveals many tokens per step and inevitably plants inconsistencies that the sampler is then forbidden to repair.

Existing escape hatches each stumble. Random remasking, as in ReMDM by Wang and colleagues, revisits correct tokens as often as wrong ones and burns steps on chance. Confidence-based selection is built on sand, because the training loss 1(xti=m)logpθi\mathbf{1}(x_t^i = m)\log p_\theta^i touches only masked positions, so the model's probabilities on already revealed tokens are never calibrated. And refiners trained to spot uniform random corruptions learn an easier task than catching the plausible, in-context mistakes a diffusion model actually makes.

Point every state at the data, not at its neighbor

Our fix changes the graph, not the model. In the star-shaped formulation, borrowed in spirit from Okhotin and colleagues, the latent states are conditionally independent given the data: q(x1:Tx0)=t=1Tq(xtx0)q(x_{1:T} \mid x_0) = \prod_{t=1}^{T} q(x_t \mid x_0). The reverse posterior then collapses to q(xt1xt,x0)=q(xt1x0)q(x_{t-1} \mid x_t, x_0) = q(x_{t-1} \mid x_0), and a sampling step becomes two moves: form a complete clean hypothesis x^0pθ(xt)\hat{x}_0 \sim p_\theta(\cdot \mid x_t), then renoise that hypothesis, xt1q(x^0)x_{t-1} \sim q(\cdot \mid \hat{x}_0), with no dependence on xtx_t at all. Nothing is copied forward by decree, so any token can return to mm and be rewritten.

One step, two samplers

The mechanism
MDLM reveals masked positions and freezes everything else, so one early slip survives to the final text. A G-Star step proposes a full candidate, lets the error predictor point at the suspicious token, and remasks exactly that.

The formulation costs nothing to adopt. We prove that the variational bound of the star-shaped process simplifies to the same weighted cross-entropy objective as standard masked diffusion, only with different timestep weights, so off-the-shelf MDLM checkpoints drop in with zero fine-tuning. The sampler even turns out to be mathematically equivalent to ReMDM with its remasking parameter pinned to 1αs1-\alpha_s, which quietly deletes the per-schedule search over that hyperparameter.

There is a price, and we report it plainly: because xt1x_{t-1} no longer conditions on xtx_t, consecutive states can drift apart. Run the star sampler from the very first step and the generation loses the thread of its own draft.

Generation has two phases, and remasking belongs to one

Early in generation most positions are masked, so each full hypothesis x^0\hat{x}_0 invents many tokens against almost no context. The inventions are individually plausible but mutually incoherent, and the independent renoising step then randomly keeps some of them while masking the context they depended on. Errors compound, step-to-step agreement between consecutive hypotheses collapses, and pure star sampling degenerates into near-zero MAUVE text.

Late in generation the same move becomes a repair tool: with a dense, coherent draft as context, remasking a few tokens and repredicting them from the global picture fixes mistakes instead of creating them. Sweeping the switch point tont_{\mathrm{on}} confirms the split cleanly, with quality peaking when standard MDLM drafts for roughly the first 60 to 80 percent of steps and the star-shaped sampler refines the rest. Both pure extremes lose.

Teach a small head where the mistakes are

Even in its proper phase, unguided renoising is wasteful, since q(xt1x^0)q(x_{t-1} \mid \hat{x}_0) is as happy to mask a correct token as a broken one. So we add a second, much smaller model: an error predictor gϕg_\phi whose only job is to guess which tokens of x^0\hat{x}_0 the denoiser got wrong.

Where the error labels come from

Training signal
We simulate generation on training data and diff the model's sampled candidate against the truth, so the predictor studies the denoiser's real failure modes rather than injected random noise.

The training loop matters more than the architecture. We corrupt a clean text to a random noise level, let the frozen denoiser predict and sample a candidate, and mark every position where the candidate disagrees with the truth. Those disagreements, the model's own mistakes, become binary labels for gϕg_\phi. A classification head on the frozen backbone is enough, and the learned detector generalizes: trained on web text, it keeps an AUC-ROC of at least 0.90 on unseen code, mathematics, and news without any fine-tuning.

At inference each guided step scores the candidate, scales the error logits by a temperature τremask\tau_{\mathrm{remask}}, and draws N=(1αt1)LN = \lceil (1-\alpha_{t-1}) L \rceil positions without replacement by Gumbel-Top-K, remasking exactly those. The star-shaped structure is what makes the training honest: a refiner conditioned on xtx_t would only ever see ground-truth context during training and would collapse into copying it, while our decoupled transition never lets it treat observed tokens as sacred.

Fewer steps, better text

On 512-token OpenWebText generation we trace full quality-diversity Pareto fronts by sweeping the denoiser temperature, and the guided sampler dominates them: G-Star with a 4x smaller budget of 128 steps reaches better perplexity and diversity than every 512-step baseline that works with a frozen backbone, including per-schedule-tuned ReMDM, confidence-based P2 and RDM, and the planner DDPD. The wall clock agrees, 3.43 seconds per sample against 9.16 for the 512-step samplers, while DDPD runs a second full backbone every step and doubles its passes.

Guidance is cheap by construction. With BB predictor blocks on a DD-block backbone and a guided fraction Δ\Delta of the trajectory, the total cost is (1+ΔB/D)T(1 + \Delta B/D)\,T forward passes; the single-block variant lands at 133 passes for a 128-step run, about four percent over the baseline. The full-depth head-only predictor is the robust choice, and since only a classification head is trained, it adds essentially no parameters worth storing.

Code generation quality under a shrinking step budget

conditional perplexity, lower is better
MDLMReMDM-capG-Star-loopG-Star+
Code generation quality under a shrinking step budget Conala code generation scored by a Qwen2.5-Coder judge. Both guided variants beat the strongest tuned ReMDM at every budget; a 32-step G-Star+ run already produces better code than a 128-step MDLM. 32 steps: MDLM 29.8; ReMDM-cap 27.3; G-Star-loop 22.5; G-Star+ 20.4 64 steps: MDLM 25.5; ReMDM-cap 22.5; G-Star-loop 17.8; G-Star+ 18.9 128 steps: MDLM 26.7; ReMDM-cap 19.1; G-Star-loop 17.8; G-Star+ 16.4 08162432 29.8MDLM: 32 steps, 29.827.3ReMDM-cap: 32 steps, 27.322.5G-Star-loop: 32 steps, 22.520.4G-Star+: 32 steps, 20.432 steps25.5MDLM: 64 steps, 25.522.5ReMDM-cap: 64 steps, 22.517.8G-Star-loop: 64 steps, 17.818.9G-Star+: 64 steps, 18.964 steps26.7MDLM: 128 steps, 26.719.1ReMDM-cap: 128 steps, 19.117.8G-Star-loop: 128 steps, 17.816.4G-Star+: 128 steps, 16.4128 steps conditional perplexity, lower is better
Conala code generation scored by a Qwen2.5-Coder judge. Both guided variants beat the strongest tuned ReMDM at every budget; a 32-step G-Star+ run already produces better code than a 128-step MDLM.

Code makes the few-step story concrete. At 32 steps, guided refinement reaches a conditional perplexity of 20.4 where the MDLM baseline needs four times the compute to reach a worse 26.7, and the ranking repeats at every budget we test.

The same head helps a 7B instruction model

To test the recipe where it matters, we bolt G-Star onto Dream-Instruct 7B: the backbone stays frozen, a classification head trains on Tulu 3, and ten percent of the unchanged step budget is spent as refinement steps. Every one of the seven benchmarks we evaluate moves in our favor.

Dream-Instruct 7B, before and after guided refinement

benchmark score
Dream-Instruct+ G-Star
69.9 71.2
MMLU
46.9 47.9
MMLU-PRO
81.5 81.6
GSM8K
31.0 32.8
GPQA
53.7 54.9
HumanEval
58.0 59.4
MBPP
56.4 59.3
IFEval
Against our reproduced baseline, guided refinement adds up to 2.9 points (IFEval) and 1.8 on GPQA, with no benchmark regressing. The gains come from correcting the model's own tokens, not from extra steps.

The honest caveats: intensive refinement eventually trades diversity for quality, so MAUVE peaks and then declines if the loop runs too long; the full-depth predictor adds roughly fifty percent latency even though its memory cost is a rounding error; and the star phase must stay in the late stages where context is dense. Within those bounds, targeted correction beats stochastic correction everywhere we measured it.

The denoiser always knew how to fix its own text; the sampler just never let it. Star-shaped transitions open that door, and a small learned error detector walks through it.