Raghuram Shankar
← Diffusion Language Models

Part 4 · The Maths II: Masked Discrete Diffusion

The objective: BERT, integrated

With SUBS in place, the discrete-time ELBO telescopes, and taking the number of corruption levels to infinity gives MDLM’s continuous-time objective:

L∞ = ∫01 −α′t1−αt · 𝔼q [ ∑ℓ: masked −log ⟨xθ,ℓ(zt, t), xℓ⟩ ]  dt

xθ the model's predicted distribution for a masked position · ℓ indexes the masked positions · the integral runs over the continuous time variable t, weighting each noise level

Unpack it: sample a corruption level t, mask the sentence accordingly, and charge the model cross-entropy for every masked position — that inner sum is exactly BERT’s masked-language-modeling loss. The integral averages it over all masking ratios, weighted by w(t) = −α′t/(1−αt). For the linear schedule αt = 1−t this weight is 1/t: lightly-masked sentences carry large per-token weight but contain few masked tokens, and the two effects balance. The punchline deserves its own sentence: the venerable fill-in-the-blank objective, integrated over all masking ratios, is a variational bound on log-likelihood. That is what lets dLLMs report honest perplexities comparable against AR models — and MDLM used it to close most of the historical gap.

Invariance theorem. MDLM proves the continuous-time NELBO’s value does not depend on the functional form of αt at all — only the endpoints matter. Schedules still differ in gradient variance and in how you'd like to sample, but not in the objective they optimize. (This is why cutting sampler steps needs no retraining: the model was never trained for a step count in the first place.)

See the invariance from the other side — how different the schedules look while optimizing the identical objective:

Switch schedules with the buttons; hover for exact values (w is clipped at 6). Every schedule blows up its weight near t = 0 (few masked tokens, each heavily weighted) and differs everywhere else — yet the NELBO’s value is identical for all three. What the schedule really redistributes is which corruption levels you practice most, i.e. gradient variance, not the optimization target.
Faded derivation: reveal probability & the NELBO weight
1Write the one-jump masking marginal q(zt | x).
q(zt | x) = Cat( zt ; αt·x + (1−αt)·m )

Survive with probability αt, absorb into the mask otherwise; independent per position.

2For s < t, apply Bayes to a token that is masked at t: q(zs | zt = m, x) ∝ q(zt = m | zs) · q(zs | x). Enumerate the two cases for zs.

Case zs = x (still visible at s, masked between s and t): weight αs · (probability of masking in (s,t]) = αs·(1 − αt/αs) = αs − αt. Case zs = m (already masked by s): weight 1 − αs (mask is absorbing, so it stays masked at t with probability 1).

3Normalize the two weights. What are the stay and reveal probabilities?
P(stay) = 1−αs1−αt,   P(reveal) = αs−αt1−αt

The weights sum to 1 − αt, the total probability of being masked at t. When revealed, the token is always the true x.

4Write the continuous-time NELBO as a weighted integral of masked cross-entropies. What is the weight?
L∞ = ∫01 −α′t1−αt · 𝔼q[ ∑ℓ: masked −log ⟨xθ,ℓ(zt, t), xℓ⟩ ] dt

The discrete-time bound telescopes; SUBS zeroes the other terms; the infinitesimal limit leaves w(t) = −α′t/(1−αt).

5Specialize to the linear schedule αt = 1 − t. What does the weight become, and why doesn’t the blow-up at t → 0 hurt?
w(t) = 1/t

−α′t = 1 and 1 − αt = t. Near t = 0 each masked token is weighted heavily, but an expected fraction t of tokens is masked — the two factors cancel in expectation, keeping the integrand finite.

Same drill: write each step before revealing. Step 2 is the one worth sweating — it is the only genuine derivation on this page that fits on an index card.