Diffusion Language Models › The Absorbing-Mask Forward Process

Michael BrenndoerferNovember 17, 20264 min read
Language AI HandbookAll chapters
Part 19 of 67Alternative Sequence and Generative Architectures
Chapter 136Diffusion Language Models › The Absorbing-Mask Forward Process
Reading section 3 of 13 · The Absorbing-Mask Forward Process · 4 minSection 3 of 13 · 4 min

Section 3 of 13 · 4 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Set up notation. A sequence is x0=(x01,…,x0L)x_0 = (x_0^1, \dots, x_0^L) with x0i∈Vx_0^i \in V for a vocabulary of size KK. The diffusion state space adds one symbol: Vˉ=V∪{m}\bar V = V \cup \{m\}, where mm denotes [MASK]. The model's output distribution will always be over the KK real tokens; it never predicts mm.

Fix a schedule 0=αˉT<⋯<αˉ1<αˉ0=10 = \bar\alpha_T < \dots < \bar\alpha_1 < \bar\alpha_0 = 1. The forward process masks each position independently conditional on the clean sequence:

q(xti=x0i∣x0)=αˉt,q(xti=m∣x0)=1−αˉt.q(x_t^i = x_0^i \mid x_0) = \bar\alpha_t, \qquad q(x_t^i = m \mid x_0) = 1 - \bar\alpha_t.

The quantity αˉt\bar\alpha_t has a direct reading: it is the probability that a given position has survived unmasked after tt steps, which is why it decreases from one to zero as tt grows. The mask rate, the fraction of positions expected to be masked, is 1−αˉt1-\bar\alpha_t. At t=0t=0 nothing is masked; at the terminal step t=Tt=T with αˉT=0\bar\alpha_T = 0 everything is masked.

Write βt\beta_t for the per-step masking probability, so αˉt=∏s=1t(1−βs)\bar\alpha_t = \prod_{s=1}^{t}(1-\beta_s). The terminal step uses βT=1\beta_T=1 to mask every remaining token. The single-position transition matrix is

Qt=(1−βt)I+βt1em⊤,Q_t = (1-\beta_t)I + \beta_t \mathbf{1}e_m^\top,

where:

  • QtQ_t: the single-position transition matrix over Vˉ=V∪{m}\bar V = V \cup \{m\}
  • βt\beta_t: the probability of masking a visible token at step tt
  • II: the identity matrix over Vˉ\bar V
  • 1\mathbf{1}: the all-ones column vector
  • eme_m: the one-hot column vector for the mask symbol mm

From any visible token the chain stays put with probability 1−βt1-\beta_t and jumps to mm with probability βt\beta_t. The mask is absorbing, so the chain stays at mm with probability one. By the chain rule, surviving tt steps means multiplying the per-step survival probabilities conditional on being visible at the start of each step.

Because positions are corrupted independently, the joint conditional factorizes:

q(xt∣x0)=∏i=1Lq(xti∣x0i).q(x_t \mid x_0) = \prod_{i=1}^{L} q(x_t^i \mid x_0^i).

Let S⊆{1,…,L}S\subseteq\{1,\dots,L\} be the set of masked positions in xtx_t. Independent masking gives the probability of that mask set. To give the probability of the entire corrupted state, also require that its visible values match the clean sequence:

q(xt∣x0)=(1−αˉt)∣S∣ αˉtL−∣S∣⋅1 ⁣[xtSˉ=x0Sˉ],q(x_t \mid x_0) = (1-\bar\alpha_t)^{|S|}\,\bar\alpha_t^{L-|S|}\cdot\mathbb{1}\!\left[x_t^{\bar S} = x_0^{\bar S}\right],

where:

  • SS: the set of masked positions at time tt
  • ∣S∣|S|: the number of masked positions
  • Sˉ\bar S: the complement of SS (the visible positions)
  • xtSˉx_t^{\bar S}: the sub-vector of state xtx_t at the visible positions
  • 1[⋅]\mathbb{1}[\cdot]: the indicator function, one when the argument holds and zero otherwise

Only patterns consistent with the visible positions get probability mass, and among those, the probability depends only on the count of masks, not on which positions they are or what values they hold. The indicator enforces consistency: if the state claims a visible position holds a particular token, the clean sequence had better agree, or the pattern is impossible. The factor (1−αˉt)∣S∣αˉtL−∣S∣(1-\bar\alpha_t)^{|S|}\bar\alpha_t^{L-|S|} is the probability of that particular mask pattern under independent masking, and it depends on the pattern only through its size. That symmetry is what makes the exact computations below come out in closed form.

The schedule chooses how quickly survival drops between its endpoints. Let u=k/Tu=k/T be the normalized forward step.

  • Linear mask rate. αˉk=1−u\bar\alpha_k=1-u, so the mask rate is uu. The worked examples use this choice.
  • Cosine-squared survival. Set g(u)=cos⁡2 ⁣(π2u+s1+s)g(u)=\cos^2\!\left(\frac{\pi}{2}\frac{u+s}{1+s}\right) with s≥0s\ge 0, and use αˉk=g(u)/g(0)\bar\alpha_k=g(u)/g(0). This adapts the normalized image-diffusion schedule with an exact all-mask endpoint for this discrete process. Nichol and Dhariwal (2021), §3.2
  • Exponential survival with terminal masking. For k<Tk<T, use αˉk=exp⁡[−σ(u)]\bar\alpha_k=\exp[-\sigma(u)], where σ(0)=0\sigma(0)=0 and σ\sigma increases. If σ\sigma remains finite at the endpoint, set αˉT=0\bar\alpha_T=0 with a final full-mask step.

Changing the schedule changes the weights and the intermediate states in a finite-step loss. In continuous time, a differentiable, strictly increasing mask rate from zero to one can replace time as the integration coordinate. The expected objective is invariant under this change when predictions depend only on the partial string, or when any time-dependent predictor is reparameterized to give the same predictions at matching mask rates. Finite grids, sampling variance, and decoding can still depend on the schedule.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy