Title: Simplified and Generalized Masked Diffusion for Discrete Data
Venue: NeurIPS 2024
Accepted: yes
Keywords: diffusion

discrete

masked diffusion

absorbing diffusion

diffusion model
Abstract: Masked (or absorbing) diffusion is actively explored as an alternative to autoregressive models for generative modeling of discrete data. However, existing work in this area has been hindered by unnecessarily complex model formulations and unclear relationships between different perspectives, leading to suboptimal parameterization, training objectives, and ad hoc adjustments to counteract these issues. In this work, we aim to provide a simple and general framework that unlocks the full potential of masked diffusion models. We show that the continuous-time variational objective of masked diffusion models is a simple weighted integral of cross-entropy losses. Our framework also enables training generalized masked diffusion models with state-dependent masking schedules. When evaluated by perplexity, our models trained on OpenWebText surpass prior diffusion language models at GPT-2 scale and demonstrate superior performance on 4 out of 5 zero-shot language modeling tasks. Furthermore, our models vastly outperform previous discrete diffusion models on pixel-level image modeling, achieving 2.75 (CIFAR-10) and 3.40 (ImageNet 64x64) bits per dimension that are better than autoregressive models of similar sizes.

Simplified and Generalized Masked Diffusion for Discrete Data

Abstract

Masked (or absorbing) diffusion is actively explored as an alternative to autoregressive models for generative modeling of discrete data. However, existing work in this area has been hindered by unnecessarily complex model formulations and unclear relationships between different perspectives, leading to suboptimal parameterization, training objectives, and ad hoc adjustments to counteract these issues. In this work, we aim to provide a simple and general framework that unlocks the full potential of masked diffusion models. We show that the continuous-time variational objective of masked diffusion models is a simple weighted integral of cross-entropy losses. Our framework also enables training generalized masked diffusion models with state-dependent masking schedules. When evaluated by perplexity, our models trained on OpenWebText surpass prior diffusion language models at GPT-2 scale and demonstrate superior performance on 4 out of 5 zero-shot language modeling tasks. Furthermore, our models vastly outperform previous discrete diffusion models on pixel-level image modeling, achieving 2.75 (CIFAR-10) and 3.40 (ImageNet 64 × 64) bits per dimension that are better than autoregressive models of similar sizes. Our code is available at https://github.com/google-deepmind/md4 .

1 Introduction

Since their inception [1, 2, 3], diffusion models have emerged as the workhorse for generative media, achieving state-of-the-art in tasks such as image synthesis [4, 5, 6], audio [7, 8] and video generation [9, 10, 11, 12, 13]. The majority of existing successes are for continuous state space diffusions. While diffusion models have been extended to discrete state spaces [1, 14, 15] and have been successfully applied to applications ranging from graph generation [16], text-to-sound generation [17] or protein design [18], they remain not as widely used as their continuous counterparts as they are not competitive with autoregressive models in important domains such as text modeling. This has motivated the development of continuous space diffusion models where the discrete data are embedded in the Euclidean space [19, 20, 21, 22, 23] or the simplex [24, 25, 26, 27, 28]. We believe that one of the reasons for the limited success of discrete diffusions is that they have been hindered by fairly complex formulations and training objectives. This paper is a step towards closing this gap.

In this work, we focus on 'masked' (or 'absorbing') diffusions, a discrete diffusion formulation first presented by Austin et al. [14], and later explored by the literature from various perspectives [29, 30, 31, 32]. We follow here a continuous-time framework which has proven very useful to improve the training and understanding of continuous state space diffusions [see e.g., 3, 33, 34]. We make several technical contributions which simplify the training of these models and improve significantly their performance. Our contributions are as follows:

Using elementary arguments, we establish several properties for the forward process induced by this model and its corresponding time reversal, improving our understanding of this model class.

We provide a remarkably simple expression of the Evidence Lower Bound (ELBO) for masked diffusion models, showing that it corresponds to a weighted integral over time of cross-entropy losses. Similarly to continuous space diffusions [33], this objective can be rewritten in terms of signal-to-noise ratio and exhibits invariance properties.

We develop a unifying understanding of previously proposed continuous-time discrete diffusion models [29, 32, 35], revealing the changes they made to our ELBO objective and/or model parameterization. We show that these changes either lead to expensive model evaluations, or large variance in training, or breaking the consistency between forward and reverse processes.

On GPT-2 scale text modeling and pixel-level image modeling tasks, masked diffusions trained using our simple ELBO objective outperform previous proposals, leading to the best likelihood and zero-shot transfer performance among discrete diffusion models.

Finally, based on our simplified masked diffusion formulation, we propose a generalized masked diffusion model that allows state-dependent masking schedules. This generalized masked diffusion model further improves predictive performance measured by test likelihoods.

Concurrent work by Ou et al. [36] and Sahoo et al. [37] derives a similar simplified expression of the ELBO. Ou et al. [36]'s derivation relies on an observation similar to the one we made in Proposition 1.

2 Masked Diffusion

Consider a sentence where we progressively replace each word with a special mask token, transforming the sentence into a sequence of masks. Our goal is to train a generative model that reverses this process, effectively turning a sentence of masks back into meaningful text. More formally, assume our data consists of tokens from a finite discrete state space with m possible states, represented by integers 0 , 1 , . . . , m -1 and their corresponding one-hot vectors e 0 , e 1 , . . . , e m -1 . To accommodate the masking process, we augment this space with an additional mask state, denoted by the index m . The masking process transitions each token to the mask state at a random time. This process, known as the forward process, is applied independently to each token (e.g., each word), progressively converting the data into a sequence of mask tokens. By learning to reverse this masking process, we create a generative model capable of producing coherent discrete data.

Discrete-time forward process. We start with the case of a single token and later expand to multiple dimensions. We define the forward process as a Markovian sequence of discrete random variables x t indexed by time t , where t runs from 0 to 1. Throughout the work, we abuse the notation such that x t can be either an integer or its corresponding one-hot vector, whenever it is clear from the context. We divide [0 , 1] into T intervals, and let s ( i ) = ( i -1) /T , t ( i ) = i/T . Following Austin et al. [14], the state transition between [ s ( i ) , t ( i )] is determined by a transition matrix of size ( m + 1) × ( m + 1) : Q i = (1 -β i ) I + β i 1 e ⊤ m , where 1 is an all-one vector of size m + 1 , e m represents a one-hot vector where element at index m is 1. Each entry [ Q i ] jk denotes the probability of transition from the state j to the state k :

This means that, with probability 1 -β i , x t ( i ) = x s ( i ) , otherwise it jumps to the mask state. Given the above transition matrix, the marginal distribution at time t ( i ) given x 0 is

Here, we use Cat( x ; p ) to denote a Categorical distribution where p is the vector of probabilities of being in each category, and ¯ Q i ≜ ∏ i j =1 Q j = α i I + ( 1 -α i ) 1 e ⊤ m for α i = ∏ i j =1 (1 -β j ) . We expect α T to become very small or zero for a sufficiently large T such that q ( x 1 | x 0 ) for any x 0 will become a delta mass at the mask state.

Continuous-time limit. We can define a continuous-time forward process by taking a limit of the above discrete-time process. We first specify a continuous function β ( t ) such that β i = β ( t ( i )) /T . We then let T →∞ in the discrete-time process and compute the limit of ¯ Q i (proved in Austin et al. 14, Appendix A.6, see also App. A) as

0.00

0.25

0.50

0.75

1.00

t

0.0

0.5

1.0

t

0.00

0.25

0.50

0.75

1.00

t

20

15

10

5

0

t

t

/(1

t

)

linear

geometric

cosine

poly0.5

so that q ( x t | x 0 ) = Cat( x t ; ¯ Q ( t ) ⊤ x 0 ) . For two arbitrary times, 0 ≤ s < t ≤ 1 , the transition distribution that is compatible with the above marginal (i.e., q ( x t | x 0 ) = ∑ x s q ( x t | x s ) q ( x s | x 0 ) ) is

Note that Austin et al. [14] did not derive this explicit form of transition matrix between two arbitrary time s and t , which appeared later in Zhao et al. [38] concurrently with our work.

Masking schedules. From the definition of α t , we have that α 0 = 1 . And similar to the discretetime formulation, we would like α 1 be zero or very close to zero. We provide a summary of masking schedules from literature that satisfy these properties in Fig. 1. The linear schedule was proposed in Sohl-Dickstein et al. [1] for binary variables and then re-derived by Austin et al. [14] from mutual information for discrete-time models. The geometric schedule α t is plotted for ¯ β min = 10 -5 and ¯ β max = 20 . It was first used for continuous diffusions [3] and then for discrete by Lou et al. [32]. The cosine schedule was originally proposed in MaskGIT [39], an iterative unmasking generative model inspired by diffusion. This schedule has the property of slowing down the unmasking process at the beginning of the reverse generation. Aligning with their observation, we find that this results in a lower chance of conflicting tokens being unmasked simultaneously at the start of generation, thereby enhancing the overall generation quality.

Time reversal of the forward process given x 0 . The analytic property of our forward process allows to compute many quantities of interest in closed form. One such quantity frequently used in diffusion models is the time reversal of the forward process given x 0 : q ( x s | x t , x 0 ) for s ≤ t . We derive it in App. C as

From the transition matrix ¯ R x 0 ( t, s ) ∈ R ( m +1) × ( m +1) we can see the reverse process conditioned on x 0 has a very simple logic-if x t is a mask, with probability α s -α t 1 -α t , it will jump to the state x 0 at time s , otherwise it will stay masked. Once x t is unmasked, it remains in the same state until the end.

3 Model and Objective

For a discrete-time masked diffusion process, we define our generative model by approximately reversing the forward transitions using a reverse model p θ ( x s | x t ) . One way to define this model is

where µ θ ( x t , t ) ∈ ∆ m +1 is a probability vector parametrized by a neural network f θ with a softmax applied to the output logits (note the m -th output is forced to 0 since the clean data cannot be masks):

̸

This is known as mean-parameterization since it leverages a prediction model for the mean of x 0 . A matrix-form depiction of p θ ( x s | x t ) is shown in Fig. 7 (right). In fact, we can select a time-invariant parametrization µ θ ( x t , t ) = µ θ ( x t ) as [36] showed that p ( x 0 | x t ) given x t = x is identical for any t .

Besides p θ ( x s | x t ) , we also need to specify p ( x 0 | x t (1) ) and the prior distribution p ( x t ( T ) ) = p ( x 1 ) . Following the practice in continuous diffusion models [33], we choose p ( x 0 | x t (1) ) ∝ q ( x t (1) | x 0 ) . And since q ( x 1 | x 0 ) ≈ δ x 1 ,m for any x 0 as α 1 ≈ 0 , we set p ( x 1 ) ≈ δ x 1 ,m , see App. E.

We then write out the discrete-time diffusion model objective [1, 2], which is a lower bound of the log marginal likelihood of data x 0 under the model p (known as the Evidence Lower Bound, or ELBO):

where L T = ∑ T i =2 E q ( x t ( i ) | x 0 ) [KL( q ( x s ( i ) | x t ( i ) , x 0 ) ∥ p θ ( x s ( i ) | x t ( i ) ))] . For the above choices of the prior distribution, the term KL( q ( x 1 | x 0 ) ∥ p ( x 1 )) becomes zero. Under the reverse model (2), the KL divergence terms in L T becomes (proof in App. D)

which is a simple cross-entropy loss between the predicted logits and the clean data. In App. D, we show that L T is a Riemann sum and is lower bounded by the corresponding continuous integral:

where α ′ t denotes the derivative of α t with respect to t . Therefore, we can obtain an ELBO that is tighter than that of any finite T by pushing T →∞ . This ELBO can be further simplified by letting t (1) → 0 . As a result, E q ( x t (1) | x 0 ) [log p ( x 0 | x t (1) )] goes to 0 and the ELBO becomes -L ∞ .

For continuous state-space diffusions, the ELBO depends on the signal-to-noise ratio (SNR) at its endpoints but is otherwise invariant to the noise schedule [33]. We establish here a similar result for discrete diffusions. Consider choosing α t = σ ( λ t ) , where σ represents the sigmoid function σ ( x ) = 1 1+ e -x . In this context, the log-SNR is defined by λ t = log α t 1 -α t = log-SNR ( t ) . By making a change of variables in (4) to make everything a function of the log-SNR, we obtain

where ˜ µ θ ( x, λ ) := µ θ ( x, t ) and ˜ q ( x λ | x 0 ) := q ( x t | x 0 ) for t = log-SNR -1 ( λ ) . This shows that the only effect α t has on the loss is through the values of the SNR at the endpoints. Still, because we draw uniform samples of t to estimate the integral, the choice of masking schedule affects the variance.

Multidimensional data. In the previous sections, x t was assumed to be a single discrete token. To extend the method to multidimensional data, let x t be now a sequence ( x (1) t , x (2) t , . . . , x ( N ) t ) , where each element x ( n ) t represents a discrete token. We select a forward process which factorizes across all N tokens: q ( x t | x s ) = ∏ N n =1 q ( x ( n ) t | x ( n ) s ) . As a result, the forward marginals q ( x t | x 0 ) and reversal q ( x s | x t , x 0 ) also factorize. In this case, we define the reverse model as p θ ( x s | x t ) ≜ ∏ N n =1 q ( x ( n ) s | x ( n ) t , µ ( n ) θ ( x t , t )) , where µ θ ( x t , t ) is a neural network that takes the full N tokens as input and outputs N probability vectors. 2 The n -th output µ ( n ) θ ( x t , t ) is a prediction model for E [ x ( n ) 0 | x t ] , the mean value of the n -th token. Repeating above derivations gives

We term our simple masked diffusion model trained with loss (5) MD4 (Masked Discrete Diffusion for Discrete Data). A single step of MD4 training algorithm is described in Alg. 1 in Appendix.

4 Sampling

We use ancestral sampling from our discrete-time reverse process for generation. We have found this yields slightly higher sample quality compared to other methods such as Euler discretization [29, 32]. For conditional generation tasks such as infilling, we find that the simple approach works best - we keep the conditioning tokens unmasked throughout the generation process. A complete description of the sampling algorithm can be found in Alg. 2 in Appendix.

128

256

512

Total Steps

T

0

20

40

60

80

100

120

FID

Linear

t

Linear

t

, cosine grid

Cosine

t

Cosine

t

(class cond)

0

50

100

150

200

250

Steps

0

20

40

60

80

Tokens Revealed per Step

Linear

t

Cosine

t

Impact of schedules and discretization. For comparing different sampling configurations, we primarily use the FID score [40] on image datasets as our evaluation metric. We favor it over text generative perplexity 3 used in prior work [32], as the latter can be misleadingly reduced by lowering sample diversity [41]. We initially trained our model using the linear schedule, which achieves the best final ELBO overall; however, we found that sampling did not perform well with a standard uniform discretization grid t ( i ) = i T . We hypothesize that time discretization can lead to conflicts by generating multiple tokens in a single step. We then switched to the cosine schedule (Tab. 4) that slows down unmasking at the beginning of reverse process. This drastically improves the FID on ImageNet 64 × 64 from 70 to 17 for T = 256 steps (Fig. 2, left). Building on this observation, we suggest using a 'cosine' discretization grid for sampling in models trained with a linear schedule:

This induces the same discretization in α t as the cosine schedule with a uniform grid, leading to comparable sample quality, as shown in Fig. 2 (left). In Fig. 2 (right), we plot the number of tokens unmasked per step for linear and cosine schedules with a uniform grid. We believe the cosine schedule performs better because it leverages information redundancy: with more tokens revealed, the remaining tokens become more predictable, reducing conflicts when unmasking them in a single step.

Although these findings were originally developed on images, we find them translate well to text (see Fig. 10). we expect other techniques such as topp sampling [41], classifier-free guidance [42, 43], and predictor-correctors [29, 44] to further improve sample quality of our models. While we reserve these for future work, we note that the JAX [45] implementation of categorical sampling implicitly truncates small probabilities, creating a similar effect to topp sampling. See App. G for details.

5 Relation to Existing Work

We discuss how to unify several existing masked diffusion models using our framework.

Continuous-Time Markov Chains (CTMC). To show the connection with the CTMC view presented in Austin et al. [14], Campbell et al. [29], we can write out the forward and reverse masked diffusion using CTMC machinery. To see this, for a short time ∆ t , given x 0 , the Taylor expansions of our forward and reverse transition matrices at t are

where Q ( t ) and R x 0 ( t ) are known as the transition rate matrices. Austin et al. [14] derived the same Q ( t ) in App. A.6 of their paper. However, they did not explore the reverse process or a

continuous-time objective. Campbell et al. [29] derived an alternative ELBO expression using rate matrices, which Kitouni et al. [46] further simplified for absorbing diffusion. In App. H.1, we show how to recover their expression by separating out a constant from our ELBO expression (4) and applying a discrete 'integration-by-part'. A key limitation of their expression is that it needs N evaluations of the prediction model µ θ ( · , t ) to compute an inner summation. To circumvent this computational burden, they used a doubly stochastic estimate. However, this leads to significantly higher variance compared to the analytic cross-entropy (4) which only requires one pass of µ θ ( · , t ) . Please refer to App. H.2 for more details.

Score parameterization. While so far we used a prediction model µ θ ( x t , t ) for the mean of clean data given x t (i.e., mean parameterization), one can choose other ways of parameterizing the reverse model. Lou et al. [32], Benton et al. [35] proposed to parameterize the discrete 'score' s ( x t , t ) j ≜ q t ( j ) q t ( x t ) and introduced a score-based loss for discrete diffusions. In App. H.3, we provide an alternative derivation of their loss which is simpler. We show the link between score and mean parameterizations through the following proposition.

̸

Proposition 1 (Score Parameterization vs. Mean Parameterization) . Let q t be the marginal distribution of the masked diffusion defined in Sec. 2 at time t . The discrete score s ( x t , t ) j = q t ( j ) q t ( x t ) for a mask state x t = m and j = m can be expressed as

̸

Proposition 1 (proved in App. H.3) implies that a reasonable score model for a mask state is

Indeed, substituting (10) into the score-based loss of Lou et al. [32], Benton et al. [35] recovers our objective (4). In Lou et al. [32], the score is parameterized as a neural network without enforcing the constraint in (9). This means the learned reverse model can be incompatible with the forward process. We find that our parameterization, which enforces the constraint, leads to more stable training and better results.

Any-order autoregressive models. The continuous-time reverse process of our masked diffusion model can be viewed as an any-order autoregressive model (AO-ARM) [47]. To see this, we reorder the tokens according to the timing of their unmasking events in the reverse process. For all tokens, the cumulative distribution functions (CDFs) of unmasking times { τ n } N n =1 are identical and satisfy P ( τ n ≤ t ) = P ( x ( n ) t = m ) = 1 -α t . As a result, the ordering is uniformly random across all possible arrangements, and the token prediction during each unmasking event represents a prediction step in AO-ARMs. This connection was initially pointed out in Hoogeboom et al. [48, App. C]. The relation between our simplified ELBO (5) and the AO-ARM objective is independently clarified by Ou et al. [36]. Despite this equivalence, our work demonstrates that the masking schedule α t introduces a new degree of freedom in the design of such models. Variations in α t can lead to different distributions of unmasking times, significantly impacting performance in diffusion-style parallel sampling under time discretization, as shown in Fig. 2.

Other related work. Due to space constraint, we defer the discussion on other related work, including MaskGIT [39], discrete flow matching [49], SDDM [30], Blackout diffusion [50] and SUNDAE [51], to App. H.4.

6 Generalization to State-dependent Masking Schedules

Consider a scenario where some tokens hold more significance than others and we would like to unmask them earlier in the process. To achieve this, we introduce state-dependent masking schedules, where the probability of unmasking a token depends not only on time, but also on the token's value.

We first define the forward process for a single token x t . Let α t be a m + 1 dimensional vector function, i.e., there is a different function α t,i for each possible value i of the token x t . Also, by

Proprietary + Confidential

Mayor Muriel Bowser said after meetings with Commissioner Busby on

Thursday that the new plan will be on board in December.

Mayor � Bowser said � meetings � Commissioner � on

Thursday that � new plan will be � board in � �

Mayor Muriel Bowser said after meetings � Commissioner � on

Thursday that � new plan will be � board in December �

Mayor � � said � � � � � �

� that � new plan � � � � � � �

500 steps

700 steps

850 steps

1000 steps

vector α t α s we denote the element-wise division of the two vectors. We define the forward transition as q ( x t | x s ) = Cat( x t ; ¯ Q ( s, t ) ⊤ x s ) where

and diag ( α t α s ) is a diagonal matrix with the vector α t α s in its diagonal. The probability of moving from current state x s to a future state x t (either the same as x s or mask) is determined by a state-dependent rate ( α t α s ) ⊤ x s , while the marginal at time s given x 0 is

Further, for any time 0 ≤ s < t ≤ 1 it holds that q ( x t | x 0 ) = ∑ x s q ( x t | x s ) q ( x s | x 0 ) so the above is a valid continuous-time Markov chain.

Given the forward conditionals and marginals, we can now compute the time reversal conditioned on x 0 . The full form of q ( x s | x t , x 0 ) is derived in App. I.1. For x t = m , we have

This suggests that the reverse model given x t = m can be chosen as p θ ( x s | x t = m ) ≜ q ( x s | x t = m,µ θ ( x t , t ) , diag( µ θ ( x t , t ))) where µ θ ( x t , t ) is a neural network that approximates E [ x 0 | x t ] while diag( µ θ ( x t , t )) approximates E [ x 0 x ⊤ 0 | x t ] = diag( E [ x 0 | x t ]) . We show in App. I.1 that the negative continuous-time ELBO for the state-dependent rate case is

Here, α ′ t is the elementwise derivative of α t . This generalizes the MD4 loss (4), which is recovered when α t is a scalar schedule times a vector of ones. For N tokens, the model further generalize similarly to Sec. 3 and the loss is given in (32). We call this generalized model GenMD4 .

To learn the token dependent masking schedule using ELBO optimization, we parametrize the m +1 dimensional function α t using the polynomial schedule (see Fig. 1) as α t,i = 1 -t w i and optimize each parameter w i > 0 . 4 The value of w i , through the masking probability 1 -α t,i , determines how fast the token with value i jumps to the mask state. Since in the loss (12) the distribution q ( x t | x 0 ) depends on α t and thus the vector w , optimizing w poses a discrete gradient estimation problem [see, e.g., 52]. Naive autodiff leads to biased gradients and pushes w towards zero because the gradients cannot propagate through the (discrete) samples drawn from q ( x t | x 0 ) . To fix this, we used the REINFORCE leave-one-out estimator [53, 54] to compute low-variance unbiased gradients for optimizing w . Details are given in App. I.2.

7 Experiments

7.1 Text

Text is natural discrete data with rich structures. For comparison with prior work, we evaluate likelihood on two datasets: text8 [55], a character-level text modeling benchmark, and OpenWebText [56], an open clone of the unreleased WebText dataset used to train GPT-2 [57]. We also assess our model's performance on downstream tasks by training on FineWeb-Edu [58], a high-quality dataset of fine educational text commonly used by the open-source community for comparing LLMs. Unless otherwise specified, a linear schedule and a cosine sampling grid are employed.

OpenWebText. Wetrain MD4 of GPT-2 small (S) and GPT-2 medium (M) sizes on OpenWebText and evaluate zero-shot perplexity on five benchmark datasets used in Radford et al. [57]. We keep our evaluation setup the same as SEDD [32]. To ensure fair comparison, we reimplemented SEDD in our codebase. Our implementation led to slightly better results than those reported in their paper.

As seen in Tab. 1, our small model outperforms previous best discrete diffusion models on all five tasks. We are also better than GPT-2 on all tasks except LAMBADA where we are the second best method. When scaling up to medium size, MD4 similarly beats SEDD and GPT-2 on 4 out of 5 tasks.















 

  



  



 

  















To confirm that the strong zero-shot performance stems from improved training, we plot perplexity on 2% OpenWebText validation set in Fig. 4. Our models converge faster and have better final likelihoods than prior methods. We also observed that SEDD [32] has training instabilities, likely due to score parameterization breaking consistency between forward and reverse processes (Sec. 5). Although GenMD4 achieves lower perplexity than MD4, we observed that the learned w s can overfit to dataset statistics, making it less effective on zero-shot transfer tasks.

We also assess our models' generation quality. Fig. 3 shows a randomly selected, notably coherent sample from MD4-medium and its denoising process. Fig. 10 demonstrates MD4's text infilling ability and highlights a substantial quality gain when transitioning from uniform to cosine discretization (see Sec. 4). Despite MD4's strong performance on quantitative metrics like generative perplexity, we have placed these results in Appendix Fig. 8 due to the metric's inherent unreliability, as noted in Sec. 4. We emphasize the more reliable FID-based assessments found in our image experiments.

FineWeb-Edu. We train MD4 on FineWebEdu and evaluate its zero-shot accuracy on the Hellaswag dataset [60], a popular common sense inference benchmark for LLMs. We directly compared MD4 to its AR counterparts transformers with identical configurations (except for causal masking) trained on the same data. Results are summarized in Fig. 5.

MD4 demonstrates steady performance growth with increasing scale. While outperformed by AR models of the same size, the performance gap does not widen as model size increases. For example, AR-small reaches 30% accuracy in 50k steps, while MD4-small takes 200k steps (4x data efficiency difference). At the medium scale, AR achieves 37% in 270k steps, compared to MD4's 1 million steps.

7.2 Pixel-level image modeling

Unlike continuous diffusion which struggles with discrete data, we show that MD4, a discrete diffusion model, performs well on inherently continuous data, suggesting its potential for unifying

10 1

10 2

10 3

steps / 1000

25

30

35

40

45

MD4-S

MD4-M

MD4-L

AR-S

AR-M

AR-L

66

modalities. We follow Austin et al. [14] and train MD4 on order-agnostic image data from CIFAR-10 and downsampled ImageNet 64 × 64 [63]. Each image is treated as a set of 256-valued discrete tokens, making the model agnostic to pixel proximity. We compare to other discrete diffusion and AR models with reported likelihood results on these datasets, although to our knowledge there are no published result on discrete diffusion for ImageNet 64 × 64 that directly model raw pixel space.

Tab. 3 summarizes our results. We establish a new state-of-the-art for discrete diffusion models, outperforming previous work [14, 29] by a significant margin. Our CIFAR-10 result surpasses the best reported AR result. On ImageNet 64 × 64 , our results are competitive with Transformer AR models that are 4 × larger, as well as a strong continuous diffusion model VDM [33]. Notably, despite lacking knowledge of the ordinal structure of pixel values, MD4 outperforms models trained with this inductive bias, including D3PM Gauss and Campbell et al. [29] where the noising distribution is a discrete Gaussian that assigns larger probabilities to near pixel values. To isolate the differences caused by training objectives, we also implemented the Campbell et al. [29] objective with the absorbing process, showing its high variance hinders learning even with our architecture.

We provide a random sample from our ImageNet 64 × 64 model in Fig. 6. More results can be found in App. K. In Fig. 2, we plot the FID values of samples generated under different choices of schedules and discretization grids. We can see that the model with the linear schedule plus a cosine grid achieves an FID close to the model with cosine schedule, both significantly outperform the linear schedule with a uniform grid. We further trained a class-conditional model on ImageNet 64 × 64 that boosts the FID to around 7. Although these are not state-of-the-art FIDs on ImageNet 64 × 64, we emphasize our models are optimized for likelihood instead of sample quality.

8 Conclusion

In this work, we revisit masked diffusion models, focusing on a flexible continuous-time formulation. Existing works in this area are not easily accessible to non-specialists and present ELBOs that are difficult to optimize, often resulting in performance that is not competitive with continuous diffusions and AR models. The framework we propose provides a very simple expression of the ELBO as a weighted integral of cross-entropy losses. Additionally, we propose a generalized masked diffusion formulation (GenMD4), where the masking schedule depends on the current state of the process, and derive its corresponding ELBO. On text data, our MD4 models outperform existing discrete and continuous diffusion models. For pixel-level image modeling, we significantly improve discrete diffusion results, outperforming similar-sized AR models and achieving comparable likelihoods to continuous diffusion models such as VDM. GenMD4 provides further improvements in terms of likelihoods over the state-independent case.

Although we have improved masked diffusion models, they still suffer from limitations. First, in some tasks such as text8, masked diffusions are not yet competitive with AR models. We conjecture that this is because AR models can better leverage model capacity since they only require learning one order. It would be interesting to develop better architectures for discrete diffusions. Moreover, GenMD4 is promising, but it can easily overfit to the dataset, making it less effective for zero-shot transfer compared to simpler versions. Additionally, inference with a state-dependent schedule is more challenging.

References

Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In International Conference on Machine Learning , 2015.

Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. In Advances in Neural Information Processing Systems , 2020.

Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In International Conference on Learning Representations , 2020.

Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition , pages 10684-10695, 2022.

Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image generation with clip latents. arXiv preprint arXiv:2204.06125 , 1(2):3, 2022.

Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily L Denton, Kamyar Ghasemipour, Raphael Gontijo Lopes, Burcu Karagol Ayan, Tim Salimans, et al. Photorealistic text-toimage diffusion models with deep language understanding. In Advances in Neural Information Processing Systems , 2022.

Nanxin Chen, Yu Zhang, Heiga Zen, Ron J Weiss, Mohammad Norouzi, and William Chan. Wavegrad: Estimating gradients for waveform generation. In International Conference on Learning Representations , 2021.

Zhifeng Kong, Wei Ping, Jiaji Huang, Kexin Zhao, and Bryan Catanzaro. Diffwave: A versatile diffusion model for audio synthesis. In International Conference on Learning Representations , 2021.

Jonathan Ho, Tim Salimans, Alexey Gritsenko, William Chan, Mohammad Norouzi, and David J Fleet. Video diffusion models. In Advances in Neural Information Processing Systems , 2022.

Ruben Villegas, Mohammad Babaeizadeh, Pieter-Jan Kindermans, Hernan Moraldo, Han Zhang, Mohammad Taghi Saffar, Santiago Castro, Julius Kunze, and Dumitru Erhan. Phenaki: Variable length video generation from open domain textual descriptions. In International Conference on Learning Representations , 2023.

Omer Bar-Tal, Hila Chefer, Omer Tov, Charles Herrmann, Roni Paiss, Shiran Zada, Ariel Ephrat, Junhwa Hur, Yuanzhen Li, Tomer Michaeli, et al. Lumiere: A space-time diffusion model for video generation. arXiv preprint arXiv:2401.12945 , 2024.

OpenAI. Sora. https://openai.com/index/sora/ , 2024.

Fan Bao, Chendong Xiang, Gang Yue, Guande He, Hongzhou Zhu, Kaiwen Zheng, Min Zhao, Shilong Liu, Yaole Wang, and Jun Zhu. Vidu: a highly consistent, dynamic and skilled text-to-video generator with diffusion models. arXiv preprint arXiv:2405.04233 , 2024.

Jacob Austin, Daniel D Johnson, Jonathan Ho, Daniel Tarlow, and Rianne Van Den Berg. Structured denoising diffusion models in discrete state-spaces. In Advances in Neural Information Processing Systems , 2021.

Emiel Hoogeboom, Didrik Nielsen, Priyank Jaini, Patrick Forré, and Max Welling. Argmax flows and multinomial diffusion: Learning categorical distributions. In Advances in Neural Information Processing Systems , 2021.

Clément Vignac, Igor Krawczuk, Antoine Siraudin, Bohan Wang, Volkan Cevher, and Pascal Frossard. DiGress: Discrete denoising diffusion for graph generation. In International Conference on Learning Representations , 2023.

Dongchao Yang, Jianwei Yu, Helin Wang, Wen Wang, Chao Weng, Yuexian Zou, and Dong Yu. Diffsound: Discrete diffusion model for text-to-sound generation. IEEE/ACM Transactions on Audio, Speech, and Language Processing , 2023.

Nate Gruver, Samuel Stanton, Nathan Frey, Tim GJ Rudner, Isidro Hotzel, Julien Lafrance-Vanasse, Arvind Rajpal, Kyunghyun Cho, and Andrew G Wilson. Protein design with guided discrete diffusion. In Advances in Neural Information Processing Systems , 2023.

Sander Dieleman, Laurent Sartran, Arman Roshannai, Nikolay Savinov, Yaroslav Ganin, Pierre H Richemond, Arnaud Doucet, Robin Strudel, Chris Dyer, Conor Durkan, et al. Continuous diffusion for categorical data. arXiv preprint arXiv:2211.15089 , 2022.

Ting Chen, Ruixiang ZHANG, and Geoffrey Hinton. Analog bits: Generating discrete data using diffusion models with self-conditioning. In International Conference on Learning Representations , 2022.

Xiang Li, John Thickstun, Ishaan Gulrajani, Percy S Liang, and Tatsunori B Hashimoto. Diffusion-LM improves controllable text generation. In Advances in Neural Information Processing Systems , 2022.

Ishaan Gulrajani and Tatsunori B Hashimoto. Likelihood-based diffusion language models. In Advances in Neural Information Processing Systems , 2023.

Justin Lovelace, Varsha Kishore, Chao Wan, Eliot Shekhtman, and Kilian Q Weinberger. Latent diffusion for language generation. In Advances in Neural Information Processing Systems , 2024.

Pierre H Richemond, Sander Dieleman, and Arnaud Doucet. Categorical SDEs with simplex diffusion. arXiv preprint arXiv:2210.14784 , 2022.

Pavel Avdeyev, Chenlai Shi, Yuhao Tan, Kseniia Dudnyk, and Jian Zhou. Dirichlet diffusion score model for biological sequence generation. In International Conference on Machine Learning , 2023.

Alex Graves, Rupesh Kumar Srivastava, Timothy Atkinson, and Faustino Gomez. Bayesian flow networks. arXiv preprint arXiv:2308.07037 , 2023.

Kaiwen Xue, Yuhao Zhou, Shen Nie, Xu Min, Xiaolu Zhang, Jun Zhou, and Chongxuan Li. Unifying Bayesian flow networks and diffusion models through stochastic differential equations. arXiv preprint arXiv:2404.15766 , 2024.

Guan-Horng Liu, Tianrong Chen, Evangelos Theodorou, and Molei Tao. Mirror diffusion models for constrained and watermarked generation. In Advances in Neural Information Processing Systems , 2024.

Andrew Campbell, Joe Benton, Valentin De Bortoli, Thomas Rainforth, George Deligiannidis, and Arnaud Doucet. A continuous time framework for discrete denoising models. In Advances in Neural Information Processing Systems , 2022.

Haoran Sun, Lijun Yu, Bo Dai, Dale Schuurmans, and Hanjun Dai. Score-based continuous-time discrete diffusion models. In International Conference on Learning Representations , 2022.

Lin Zheng, Jianbo Yuan, Lei Yu, and Lingpeng Kong. A reparameterized discrete diffusion model for text generation. arXiv preprint arXiv:2302.05737 , 2023.

Aaron Lou, Chenlin Meng, and Stefano Ermon. Discrete diffusion language modeling by estimating the ratios of the data distribution. In International Conference on Machine Learning , 2024.

Diederik Kingma, Tim Salimans, Ben Poole, and Jonathan Ho. Variational diffusion models. In Advances in Neural Information Processing Systems , 2021.

Tero Karras, Miika Aittala, Timo Aila, and Samuli Laine. Elucidating the design space of diffusion-based generative models. In Advances in Neural Information Processing Systems , 2022.

Joe Benton, Yuyang Shi, Valentin De Bortoli, George Deligiannidis, and Arnaud Doucet. From denoising diffusions to denoising Markov models. arXiv preprint arXiv:2211.03595 , 2022.

Jingyang Ou, Shen Nie, Kaiwen Xue, Fengqi Zhu, Jiacheng Sun, Zhenguo Li, and Chongxuan Li. Your absorbing discrete diffusion secretly models the conditional distributions of clean data. arXiv preprint arXiv:2406.03736 , 2024.

Subham Sekhar Sahoo, Marianne Arriola, Yair Schiff, Aaron Gokaslan, Edgar Marroquin, Justin T Chiu, Alexander Rush, and Volodymyr Kuleshov. Simple and effective masked diffusion language models. arXiv preprint arXiv:2406.07524 , 2024.

Lingxiao Zhao, Xueying Ding, Lijun Yu, and Leman Akoglu. Improving and unifying discrete and continuous-time discrete denoising diffusion. arXiv preprint arXiv:2402.03701 , 2024.

Huiwen Chang, Han Zhang, Lu Jiang, Ce Liu, and William T Freeman. Maskgit: Masked generative image transformer. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition , 2022.

Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. GANs trained by a two time-scale update rule converge to a local Nash equilibrium. Advances in Neural Information Processing Systems , 30, 2017.

Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. The curious case of neural text degeneration. In International Conference on Learning Representations , 2019.

Jonathan Ho and Tim Salimans. Classifier-free diffusion guidance. arXiv preprint arXiv:2207.12598 , 2022.

Hunter Nisonoff, Junhao Xiong, Stephan Allenspach, and Jennifer Listgarten. Unlocking guidance for discrete state-space diffusion and flow models. arXiv preprint arXiv:2406.01572 , 2024.

Yixiu Zhao, Jiaxin Shi, Lester Mackey, and Scott Linderman. Informed correctors for discrete diffusion models. arXiv preprint arXiv:2407.21243 , 2024.

James Bradbury, Roy Frostig, Peter Hawkins, Matthew James Johnson, Chris Leary, Dougal Maclaurin, George Necula, Adam Paszke, Jake VanderPlas, Skye Wanderman-Milne, and Qiao Zhang. JAX: composable transformations of Python+NumPy programs, 2018. URL http://github.com/jax-ml/jax .

Ouail Kitouni, Niklas Nolte, James Hensman, and Bhaskar Mitra. Disk: A diffusion model for structured knowledge. arXiv preprint arXiv:2312.05253 , 2023.

Benigno Uria, Iain Murray, and Hugo Larochelle. A deep and tractable density estimator. In International Conference on Machine Learning , pages 467-475. PMLR, 2014.

Emiel Hoogeboom, Alexey A Gritsenko, Jasmijn Bastings, Ben Poole, Rianne van den Berg, and Tim Salimans. Autoregressive diffusion models. In International Conference on Learning Representations , 2021.

Andrew Campbell, Jason Yim, Regina Barzilay, Tom Rainforth, and Tommi Jaakkola. Generative flows on discrete state-spaces: Enabling multimodal flows with applications to protein co-design. In International Conference on Machine Learning , 2024.

Javier E Santos, Zachary R Fox, Nicholas Lubbers, and Yen Ting Lin. Blackout diffusion: generative diffusion models in discrete-state spaces. In International Conference on Machine Learning , pages 9034-9059. PMLR, 2023.

Nikolay Savinov, Junyoung Chung, Mikolaj Binkowski, Erich Elsen, and Aaron van den Oord. Stepunrolled denoising autoencoders for text generation. In International Conference on Learning Representations , 2022.

Jiaxin Shi, Yuhao Zhou, Jessica Hwang, Michalis Titsias, and Lester Mackey. Gradient estimation with discrete Stein operators. In Advances in Neural Information Processing Systems , 2022.

Tim Salimans and David A Knowles. On using control variates with stochastic approximation for variational bayes and its connection to stochastic linear regression. arXiv preprint arXiv:1401.1022 , 2014.

W. Kool, H. V. Hoof, and M. Welling. Buy 4 REINFORCE samples, get a baseline for free! In DeepRLStructPred@ICLR , 2019.

Matt Mahoney. Text8. https://mattmahoney.net/dc/textdata.html . Accessed: 2024-05-14.

Aaron Gokaslan and Vanya Cohen. Openwebtext corpus. http://Skylion007.github.io/ OpenWebTextCorpus , 2019.

Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. OpenAI blog , 1(8):9, 2019.

Guilherme Penedo, Hynek Kydlíˇ cek, Anton Lozhkov, Margaret Mitchell, Colin Raffel, Leandro Von Werra, Thomas Wolf, et al. The fineweb datasets: Decanting the web for the finest text data at scale. arXiv preprint arXiv:2406.17557 , 2024.

Dustin Tran, Keyon Vafa, Kumar Agrawal, Laurent Dinh, and Ben Poole. Discrete flows: Invertible generative models of discrete data. In Advances in Neural Information Processing Systems , 2019.

Rowan Zellers, Ari Holtzman, Yonatan Bisk, Ali Farhadi, and Yejin Choi. Hellaswag: Can a machine really finish your sentence? arXiv preprint arXiv:1905.07830 , 2019.

Andy Shih, Dorsa Sadigh, and Stefano Ermon. Training and inference on any-order autoregressive models the right way. In Advances in Neural Information Processing Systems , 2022.

Zachary Ziegler and Alexander Rush. Latent normalizing flows for discrete sequences. In International Conference on Machine Learning , 2019.

Aäron Van Den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. In International Conference on Machine Learning , 2016.

Aaron Van den Oord, Nal Kalchbrenner, Lasse Espeholt, Oriol Vinyals, and Alex Graves. Conditional image generation with pixelcnn decoders. In Advances in Neural Information Processing systems , 2016.

Tim Salimans, Andrej Karpathy, Xi Chen, and Diederik P Kingma. Pixelcnn++: Improving the pixelcnn with discretized logistic mixture likelihood and other modifications. In International Conference on Learning Representations , 2016.

Xi Chen, Nikhil Mishra, Mostafa Rohaninejad, and Pieter Abbeel. Pixelsnail: An improved autoregressive generative model. In International Conference on Machine Learning , 2018.

Niki Parmar, Ashish Vaswani, Jakob Uszkoreit, Lukasz Kaiser, Noam Shazeer, Alexander Ku, and Dustin Tran. Image transformer. In International Conference on Machine Learning , 2018.

Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509 , 2019.

Aurko Roy, Mohammad Saffar, Ashish Vaswani, and David Grangier. Efficient content-based sparse attention with routing transformers. Transactions of the Association for Computational Linguistics , 9: 53-68, 2021.

Aaron Van Den Oord, Oriol Vinyals, et al. Neural discrete representation learning. Advances in Neural Information Processing Systems , 30, 2017.

Kehang Han, Kathleen Kenealy, Aditya Barua, Noah Fiedel, and Noah Constant. Transfer learning for text diffusion models. arXiv preprint arXiv:2401.17181 , 2024.

Samy Bengio, Oriol Vinyals, Navdeep Jaitly, and Noam Shazeer. Scheduled sampling for sequence prediction with recurrent neural networks. In Advances in Neural Information Processing Systems , 2015.

Peter W. Glynn. Likelihood ratio gradient estimation for stochastic systems. Communications of the ACM , 33(10):75-84, 1990.

Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine Learning , 8(3-4):229-256, 1992.

William Peebles and Saining Xie. Scalable diffusion models with transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision , pages 4195-4205, 2023.

or more compactly written as

A Discrete-time derivation

We divide time from 0 to 1 into T intervals, and let s ( i ) = ( i -1) /T , t ( i ) = i/T . The forward transition matrix Q i ∈ R ( m +1) × ( m +1) ( m is vocabulary size) at time t ( i ) is

̸

̸

where 1 denotes an all-one vector of size m +1 , and e m is an one-hot vector of size m +1 with the m -th element (recall that counting starts from 0 ) being one. We use an one-hot vector x t of length m +1 to denote the discrete state. The forward conditionals are defined as

where Q ⊤ i x s ( i ) is the probabilities for each of the m +1 categories that x t ( i ) can take. The marginal forward distribution at time t ( i ) given x 0 is

where ¯ Q i = ∏ i j =1 Q j = ∏ i j =1 (1 -β j ) I + ( 1 -∏ i j =1 (1 -β j ) ) 1 e ⊤ m . To see what this leads to in continuous time, we let β i = β ( t ( i )) T and T →∞ :

We let ¯ Q ( t ) denote the limit of ¯ Q i in this case:

Here we define α t ≜ exp( -∫ t 0 β ( s )d s ) . And the marginal forward transition is

B Continuous-time derivation

We consider a continuous-time Markov chain with transition rates

For simplicity, we let Q = 1 e ⊤ m -I . The marginal forward distribution at time t given x 0 is q ( x t | x 0 ) = Cat( x t ; ¯ Q ( t ) ⊤ x 0 ) , where

Here we define ¯ β ( t ) ≜ ∫ t 0 β ( s )d s . The matrix exponential can be computed via eigendecomposition:

and thus exp(Λ) = α t I +(1 -α t ) e m e ⊤ m ,

A simpler derivation uses the following property:

where

Therefore,

This marginal forward transition matrix at time t coincides with the result (1) we get by taking the limit of discrete-time derivation.

Arbitrary discretization of the continuous-time forward process. For the discrete-time process we have defined the per-step transition in (13). For the continuous-time process, we can derive the transition matrix ¯ Q ( s, t ) ij ≜ q ( x t = j | x s = i ) between two arbitrary time s and t as the solution to the following differential equation (known as Kolmogorov forward equation)

with initial condition ¯ Q ( s, s ) = I . The solution is given by

Routine work (using the Woodbury matrix inversion lemma) shows that

Plugging the result back, we get the forward transition distribution from s to t :

MASK

MASK

1

1

1

1

1

1

1

1

1

MASK

0

as-at

0

1-αs

=αt μo(Ct, t)

1-αs

1-αt

1-αt

1-αt

1-αt

q(xs = ·|t =·,xo)

q(xs =·|t =·,μo(xt,t)

C Time reversal of the forward process given x 0

The analytic property of our forward process allows to compute many quantities of interest in closed form. One such quantity frequently used in diffusion models is the time reversal of the forward process given x 0 : q ( x s | x t , x 0 ) . We can compute it using (14) and (16) as

̸

̸

Visually, eqn (17) is a R ( m +1) × ( m +1) matrix (Fig. 7, left) whose first index is x t and the second is x s . The matrix is almost an identity matrix except the last row corresponding to x t is the mask token. The last row means with probability of α s -α t 1 -α t the mask token gets unmasked to become x 0 , and with probability of 1 -α s 1 -α t it remains masked.

Alternatively, we can rewrite the above using reverse transition matrix ¯ R x 0 ( t, s ) ∈ R ( m +1) × ( m +1) as

We are also interested in what would happen in the infinitesimal time limit, i.e., when s = t -∆ t and ∆ t → 0 . Note that

Plugging it into the original formula, we get

Comparing the above with the transition rate matrix R x 0 ( t ) definition

we have determined the transition rate matrix for the reverse process conditioned on x 0 :

D Details of the ELBO

Using (17) and (3), we compute the KL divergences between forward and reverse transitions

̸

̸

Note that 0 log 0 = 0 . Alternatively, this result can be easily obtained from the visual depictions of q ( x s | x t , x 0 ) and p θ ( x s | x t ) shown in Fig. 7. In this case, the reconstruction term becomes

̸

The prior KL term can be computed as

As usual, we take the continuous-time limit by letting T →∞ :

E Avoiding undefined KL divergence

When defining the forward process, we often do not want α 1 to be exactly 0, or equivalently, λ 1 to be ∞ for numerical stability reasons. Instead, we set λ 1 to be a finite value, and thereby α 1 has a small positive value. This has a problem that the support of q ( x 1 | x 0 ) is no longer { m } and instead becomes { m,x 0 } . As a result, the KL divergence between q ( x 1 | x 0 ) and p ( x 1 ) is undefined because q ( x 1 | x 0 ) is not absolutely continuous with respect to p ( x 1 ) = δ x 1 ,m . To resolve the issue, we modify the prior distribution p ( x 1 ) such that it has support over all m +1 values. One such choice is letting

̸

Then, the prior KL divergence term becomes

F Details of Training and Sampling with MD4

F.1 Training

Algorithm 1 A single step of training with MD4.

Sum over all weighted cross entropy losses for mask positions and optimize via autodiff

F.2 Sampling

Algorithm 2 Unconditional and conditional generation (e.g., infilling) with MD4.

G JAX Categorical Sampling and Implicit Topp

We noticed that the following equivalent implementation of Alg. 2 leads to significantly worse sample quality in JAX:

Algorithm 3 Variant of Alg. 2 that yields lower sample quality when implemented in JAX.

However, mathetically it is equivalent to Alg. 2 and should produce identical results. Our investigation revealed that the issue arises because Alg. 2 scales the output probabilities of µ θ by a small factor α s -α t 1 -α t as s is close to t , causing some categories to have very low probabilities. JAX, however, implements categorical sampling using Gumbel argmax, which is less numerically stable than methods like binary search. As a result, categories with low probabilities are rarely sampled, even when their cumulative probability is significant. In our experiment, we found that categories with probabilities below 1e-8 are rarely sampled out of a total of 50K categories. Thus, Alg. 2 implicitly performs topp sampling (with a dynamic p) under JAX's categorical sampling, yielding better sample quality than Alg. 3 where µ θ is not scaled by a small factor and has fewer categories truncated.

H Unifying Existing Masked Diffusion Models

H.1 The CTMC point of view

We first prove a lemma that connects the forward and reverse transition rate matrices. This follows from the results in [29] but we give a proof for completeness.

Lemma 2. The forward transition rate matrix Q ( t ) and the reverse transition rate matrix (given x 0 ) R x 0 ( t ) satisfy:

̸

̸

Proof Consider the reverse transition from time t + τ to t . For j = k , Bayes' rule yields

Then, it follows from the definition of the transition rate matrix that R x 0 ( t ) kj = Q ( t ) jk q t | 0 ( j | x 0 ) q t | 0 ( k | x 0 ) .

Proposition 3. We use the shorthand R θ ( t ) kj to denote the approximate reverse transition rate from the state k to j obtained by substituting our prediction model µ θ ( k ) for x 0 in R x 0 ( t ) kj . Then, the continuous-time objective (4) can be equivalently expressed as

̸

where C is a constant independent of θ .

Proof To rewrite our objective L ∞ with the transition rate matrices, we first go back to (19). There, instead of plugging in the explicit form of ¯ R x 0 ( t, s ) , we substitute it with (8) which leverages the transition rate R x 0 ( t ) . To simplify the notation, we assume x t = k and use the shorthand R θ ( t ) kj ≜ R µ θ ( k ) ( t ) kj . We then have

̸

̸

For the last identity, we have used the fact that log(1 + x ) = x + o ( x ) . To obtain L ∞ , we take the limit of L T as T →∞ , which is equivalent to letting ∆ t = 1 /T → 0 . We obtain

̸

̸

Note that R x 0 ( t ) is a constant matrix independent of θ . Absorbing all constant terms into C , we have

̸

Next, we subtitute R x 0 ( t ) with the forward transition rate using Lemma 2:

̸

̸

̸

where the last identity used the discrete analog to integration-by-part (or summation-by-part): ∑ k =0 ∑ j = k f ( j, k ) = ∑ k =0 ∑ j = k f ( k, j ) . Rearranging the terms then gives (21).

̸

H.2 Differences from Campbell et al. [29]

Campbell et al. [29] used the first term of (21) as the training loss. A key limitation of this loss function is from the inner summation term

̸

For single dimension case, the sum is analytically computable due to the sparse structure of R θ ( t ) -if x t = k is mask, the second term disappears; otherwise the only possible neighbor j is a mask. However, for multidimensional data, j will represent all N -1 neighbors in the forward process, i.e., the states we get from mask out a single unmasked dimension of x t = k . Recall that R θ ( t ) jk is computed as substituting our neural network prediction model µ θ ( j ) for x 0 in R x 0 ( t ) jk . Therefore, the summation together with R θ ( t ) kk requires N evaluations of µ θ ( · ) . This is prohibitive since the neural network model is usually expensive. To resolve this issue, Campbell et al. [29] proposed to rewrite the sum as

̸

and estimate it through Monte Carlo. Taking into account the outer expectation under q t | 0 ( k | x 0 ) , the computation of the loss then becomes a doubly stochastic estimate (using k ∼ q t | 0 ( k | x 0 ) and j ∼ ˜ q ( j | k ) ) which suffers from large variance. In contrast, the form of our loss (4) only requires evaluating µ θ once for a single stochastic estimation of the expectation w.r.t. q ( x t | x 0 ) .

̸

H.3 Score parameterization

We provide a simpler derivation of the score-based loss [32, 35] below. We start from the form of the ELBO in (21) and rewrite it as

̸

For the last identity we used the zero-row-sum property of transition rate matrix:

̸

If we plug (20) into (22) and reparameterize with a score model

we recover the score entropy loss function from Lou et al. [32], Benton et al. [35]:

̸

where ψ ( y ) ≜ y log y -y . Note that our derivation above is different and simpler than that of Campbell et al. [29] (which Lou et al. [32] is based on) since we leverage the conditional reverse transition rate given x 0 instead of the transition rate matrix of the reverse process. We can further simplify the loss with the following relationship between the conditional score and x 0 :

̸

̸

Note that only the result under the case k = m is needed. This is because when x t is unmasked, at any time between 0 and t , the state must stay unchanged and remain x 0 . As a result, KL( q ( x t -∆ t | x t , x 0 ) ∥ p θ ( x t -∆ t | x t )) = 0 for x t = m . From (15), we know Q ( t ) jk = β ( t )( δ mk -δ jk ) . Combining (25) and (24), we get

̸

Further, we can show the connection between (26) and (4) by reverting the score parameterization to a mean parameterization using (23), or equivalently s θ ( x t ) j = α t 1 -α t µ θ ( x t ) ⊤ e j . By doing so, we obtain

̸

̸

we conclude that this recovers the objective in (4). Interestingly, in Lou et al. [32] the score parameterization is not constrained to satisfy (27). That means the learned reverse model might be incompatible with the forward process.

Below, we prove Proposition 1 using the result from Eq. (25).

Proof of Proposition 1

Observing that

H.4 Other related work.

MaskGIT [39]. MaskGIT is a diffusion-inspired iterative denoising model for discrete image tokens obtained through models such as VQ-VAE [70]. Training of MaskGIT follows the steps: (a) Sample t ∈ [0 , 1] . (b) Given a mask scheduling function γ ( t ) , sample γ ( t ) N tokens to place masks. (c) For data x 0 of size ( m +1) × N and the partially masked state x t , minimize the negative log-likelihood

Our forward process satisfies q t | 0 ( m | x 0 ) = 1 -α t . Therefore, when we set the mask scheduling function as γ ( t ) = 1 -α t we obtain a loss similar to (5) without the α ′ t 1 -α t weighting. Note that there remains a difference in the sampling distribution of x t : in the masked diffusion forward process, tokens are sampled independently and do not necessarily yield exactly (1 -α t ) N mask tokens at time t , though the expected number is (1 -α t ) N . One might be interested in whether the uniform weighting can be recovered by selecting an appropriate schedule α t . However, solving α t such that α ′ t = α t -1 yields α t = ce t +1 and there is no c that satisfies both α 0 = 1 and α 1 = 0 . This shows that training with the MaskGIT loss (28) may not be faithfully optimizing the model likelihood.

Discrete flow matching [49]. For the linear schedule α t = 1 -t , our reverse transition rate matrix (8) conditioned on x 0 is:

This is the same as the conditional reverse transition rate used in Campbell et al. [49, Eq. (22)]-note that their time t is reversed, and the rate matrix was therefore in the form R x 0 ( t ) = 1 1 -t e m ( x 0 -e m ) ⊤ .

SDDM [30]. Sun et al. [30] proposed a pseudo-likelihood-like objective for training discrete diffusion models that can also be applied to masked diffusion. However, their objective encounters the same challenge as Campbell et al. [29] - requiring N passes of the mask prediction model. To mitigate this, they introduced a new transformer architecture, which unfortunately leads to some performance degradation.

Blackout diffusion [50]. Santos et al. [50] proposed a 'blackout' diffusion process that gradually diffuses images to a black state. While this approach is similar to masked diffusion on binary data, key differences emerge when dealing with larger state spaces. In their method, image pixel intensities gradually fade out, whereas ours directly transition to a mask state. Our method offers more flexibility, being applicable to general discrete state spaces without requiring predefined structural relationships. It also demonstrates competitive performance in image generation, achieving this without knowing pixel value proximity.

SUNDAE [51, 71]. Unlike masked diffusion, SUNDAE uniformly corrupts data with random tokens in the vocab (known as uniform discrete diffusion [14]). Additionally, it uses a second loss term from cross entropy between clean data and 1-step unrolled model prediction. Similar ideas have been proposed in [72].

I Details for state-dependent rates

I.1 Derivations and time continuous limit

All derivations in this section assume that x t is a single token, while for N tokens the masked diffusion with state-dependent rates factorises across the N tokens. Learning from data of N tokens using variational inference is discussed in App. I.2.

Given the forward transition q ( x t | x s ) and marginal q ( x s | x 0 ) derived in main text (Sec. 6) The reversal given x 0 is q ( x s | x t , x 0 ) = Cat( x s ; ¯ R x 0 ( t, s ) ⊤ x t ) for

̸

or alternatively can be written as

̸

To simplify this expression we consider the two cases: either x t = m (i.e. x t is mask) or x t = m where in the second case x t = x 0 . For the case x t = m , the denominator in (29) simplifies as

due to x ⊤ 0 x t = 0 since x 0 = m , i.e. the observed token x 0 cannot be a mask. Then given that x t = m the probability that x s = x t = m is

̸

while the remaining probability for x s = x 0 = m is

̸

̸

Then, combining (30) and (31) to write q ( x s | x t = m,x 0 ) in an unified way yields the expression (11) in the main Sec. 6. In the second case, when x t = x 0 = m , q ( x s | x t = m,x 0 ) from (29) simplifies dramatically and it becomes q ( x s | x t = m,x 0 ) = x ⊤ t x s which is a point mass that sets x s = x t .

̸

Derivation of the continuous-time limit of the loss in (12) . To simplify the notation, we let ξ s,t ≜ α s -α t 1 -α t . We first compute the KL divergence terms in the discrete-time ELBO as

̸

̸

Let ∆ t ≜ 1 T = t ( i ) -s ( i ) for all i . Plugging α t -∆ t = α t -α ′ t ∆ t + o (∆ t ) into the above formula and letting γ t = α ′ t 1 -α t , we get

̸

̸

Therefore,

Letting t (1) → 0 proves the result.

I.2 Training and gradient estimation

The model is applied to data consisted of N tokens where x 0 = ( x 1 0 , . . . , x ( N ) 0 ) and where each state in the masked diffusion is x t = ( x 1 t , . . . , x ( N ) t ) . The reverse generated model has a factorizing transition conditional of the form ∏ N n =1 p θ ( x ( n ) s | x t ) where p θ ( x ( n ) s | x t ) = q ( x ( n ) s | x ( n ) t , µ ( n ) θ ( x t , t )) has a form that depends on whether x ( n ) t = m or x ( n ) t = m . For the first case:

̸

̸

̸

where µ ( n ) θ ( x t , t ) = softmax ( f θ ( x t )) is a m +1 dimensional probability vector modelled by a NN (where the final value is constrained to be zero since µ ( n ) θ ( x t , t ) is a reconstruction of x ( n ) 0 which cannot be mask, so in practice the NN classifier needs to have a softmax output only over the m actual token classes). Crucially, note that the NN classifier receives as input the full state x t of all tokens, while additional time features to encode t are also included. When x ( n ) t = m the reverse transition model is set to be p θ ( x s | x ( n ) t = m, { x ( k ) t } k = n ) = ( x ( n ) t ) ⊤ x ( n ) s which matches precisely q ( x ( n ) s | x ( n ) t = m,x ( n ) 0 ) = ( x ( n ) t ) ⊤ x ( n ) s from the forward process.

̸

̸

The full negative lower bound for state-dependent rates and assuming N tokens is given by

Given that each α t,i = 1 -t w i , the reverse model becomes

̸

̸

where w is the m + 1 dimensional vector of all w i s. Note that the probability of x ( n ) s staying in the mask state, i.e., x ( n ) s = m depends on the full x t and it is given by ( e w log s t ) ⊤ µ ( n ) θ ( x t , t ) = ∑ m -1 i =0 e w i log s t µ ( n ) θ ( x t , t ) i while the probability for x ( n ) s to take a certain non-mask token value i is ( 1 -e w i log s t ) µ ( n ) θ ( x t , t ) i . The gradient wrt t is α ′ t,i = -w i t w i -1 and α ′ t,i 1 -α t,i = -w i t the above loss is written as

where w is the vector of all w i 's. An unbiased gradient over the NN parameters θ is straightforward to obtain since we just need to sample one time point t and an x t ∼ q ( x t | x 0 ) to approximate the integral and expectation and then use the gradient:

The gradient wrt the w parameters is more complex since these parameters appear also in the discrete distribution q ( x t | x 0 ) which is not reparametrizable. To deal with this we need REINFORCE

unbiased gradients [73, 74], and in our implementation we consider REINFORCE leave-one-out (RLOO) [53, 54] with two samples. Firstly, the exact gradient wrt w of the exact loss is written as

where

Note that g ( x t , x 0 ) is a vector while f ( x t , x 0 ) is a scalar. The left term in (33) is easy since it just requires sampling t and x t ∼ q ( x t | x 0 ) , while the right term is the REINFORCE term which could have high variance. For this second term we use RLOO with two samples x 1 t , x 2 t and construct the unbiased estimate

Thus, the overall unbiased gradient for w we use is

J Experimental Details

In all experiments, the model is trained with a continuous-time loss while samples are drawn from the discrete-time reverse model of 1000 timesteps unless otherwise noted. We used an exponential moving average factor 0.9999 for all evaluation including sample generation.

J.1 text8

We followed the standard dataset split as in Austin et al. [14], Lou et al. [32] and trained our models on text chunks of length 256 for 1 million steps with batch size 512. All models in the table used a standard 12-layer transformer architecture unless otherwise noted. Our transformer has also the same number of heads (12) and hidden dimension (784) as in Austin et al. [14], Lou et al. [32].

We used the continuous-time ELBO and drew one sample of t for each data to estimate the integral. To reduce the variance of training, we used the same antithetic sampling trick described in Kingma et al. [33] for continuous diffusion models. We used the linear masking schedule α t = 1 -t and added a small shift ϵ = 10 -4 when t is close to 0 and 1 to ensure numerical stability. The shifted schedule is α t = (1 -2 ϵ )(1 -t ) + ϵ . The shift leads to a support mismatch between q ( x 1 | x 0 ) and the prior p ( x 1 ) , leading to an undefined KL divergence term. We explain in app. E how to modify the prior distribution to allow small uniform probabilities in non-mask states to mitigate this problem. The shift leads to a non-zero reconstruction term and KL divergence term for the prior distribution but both are of negligible scale so we can safely ignore them when reporting the ELBO.

We used a cosine learning rate schedule with a linear warm up of 2000 steps. We applied channel-wise dropout of rate 0 . 05 and used AdamW optimizer with learning rate 0.0003 and a weight decay factor of 0.03. Our model is trained on 16 TPU-v5 lite for less than a day.

J.2 OpenWebText

We kept 2% of the original training set for validation. Our small and medium transformer model have the same number of layers, heads, and hidden dimensions as in Lou et al. [32] and our tokenizer was also kept the same with a vocabulary size of around 50k. The training objective, masking schedule and other architectural choices were kept the same with the text8 experiment. We kept the training hyperparameters the same as text8 experiment except that we reduced the dropout rate to 0.02.

J.3 FineWeb-Edu

We kept the same training setup as the OpenWebText experiments. Our transformer models have the same number of layers, heads, and hidden dimensions as those of GPT-2 models. We use the same GPT-2 tokenizer.

For Hellaswag evaluation, we concatenate question with each answer option, tokenize the concatenated string, pad to the length of 1024. The padded token sequence gets fed to our MD4 model's loss function for likelihood evaluation. We average 32 Monte Carlo samples to reduce variance. The answer with the highest likelihood estimate is the model's prediction.

J.4 Images

We used the same linear masking schedule as in previous experiments in all likelihood results. We used the same U-Net plus self-attention architectures from the continuous diffusion model described in Kingma et al. [33] for CIFAR-10, except that we did not use Fourier feature inputs and added an additional input embedding layer with embedding size the same as the hidden dimension of the model. For ImageNet 64 × 64 , we reduced the number of residual blocks (in one side of the U-Net structure) from 64 to 48 and added a 12-layer diffusion transformer [75] with 768 hidden dimension and 12 heads in the middle.

For both datasets we used AdamW optimizer and trained for 2M iterations. We used learning rate 0.0004, batch size 256, weight decay factor 0.01 for CIFAR-10 and learning rate 0.0002, batch size 512, weight decay factor 0.03 for ImageNet 64 × 64. The learning rate follows a cosine annealing after 100 warm up steps. Our CIFAR-10 model is trained on 32 TPU-v5 lite for 24 hours. Our ImageNet64 × 64 model is trained on 256 TPU-v5 lite for 3.5 days.

As explained in Sec. 4, we have observed that the cosine schedule leads to better sample quality so we used it to train a cheaper model for sample visualization. This model differs from the one that achieves best likelihood in that we used 8 residual blocks (in one side of the UNet structure) and a 20-layer diffusion transformer in the middle. All other configurations are kept the same.

K Additional Results

K.1 Sample quality evaluation by GPT-2

Weuse the GPT-2 large model to evaluate the perplexity of samples generated by our model, following Lou et al. [32]. Results are shown in Fig. 8.

240

Generative Perplexity by GPT-2 Large

120

60

SEDDSmall

SEDDMedium

MD4Medium

30

GPT-2 Small

GPT-2Medium

32

64

128

256

512

1000

DecodingSteps

K.2 Perplexity on OpenWebText validation set

Tab. 5 reports the final perplexity number achieved on OpenWebText validation set, corresponding to Fig. 4.

K.3 FID evaluation of MD4 trained on ImageNet 64 × 64

We provide the FID numbers corresponding to Fig. 2 in Tab. 6.

Table 6: FID of 50k samples generated by MD4 trained on ImageNet 64 × 64, corresponding to Fig. 2. Top three rows show results from an unconditional model, while the bottom row is from a model conditioned on class labels. Uniform discretization grid is used in Alg. 2 unless otherwise noted.

K.4 Additional unconditional generation from MD4 trained on ImageNet 64 × 64

We provide more unconditional generation results from our pixel-level modeling experiments on ImageNet 64 × 64 in Fig. 9.

K.5 Additional unconditional generation from MD4 trained on OpenWebText

Below we include two unconditioned text samples generated by our MD4 Medium model trained on OpenWebText.

K.5.1 MD4-M unconditional sample 1: 1024 tokens

like, I don't have to be alive? Sometimes there are things that are too real and you're really supposed to experience them. So that's a good feeling. That is the scary thing. Not actually, being able to experience things, being able to do these things, when you're doing them, which, for most people having to wake in a dream is something that seems the most significant, and then you think about it the next day. It's like the hope of the future, and you wake up right now thinking about it. What happens is,, then you have to stop and think about it and then all of a sudden, somebody always says, "You're dreaming."

And sometimes I wonder if this is a good time to teach your gut instincts to your actors when you're doing a show like this. Because even on this particular show, it feels like everyone's been through this all the time before, if even a few years ago. I mean, if you're doing a show together, at least not on continuous development, you you're a vet. I mean, you should really be along.

If you're not sure, well --

VS: I'm working on that one.

Did any of you guys feel that an instinct could work? I thought, "Well, because you didn't do 'Deadwood' you should stop doing this." But when I read the story for the first time, I thought, "I think this is going to work." What I can't picture is a way to hold this apart.

VS: That's me. It's what we have to do. So do we. When we wrote the first episode, we wrote a script that we felt like me and myself would want to see. I knew that I wanted to be able to be in something --and I wanted to be able to take refuge in something that was real, that you could see and just really step out of yourself. And then I saw it. Then, you get rehearsing it and doing it. And then I actually started shooting. I think I knew I didn't think it was going to be good. But, I know it was good. And now people are talked about because it's not good enough.

Growing up, you say that you just completely hated the show, "Lost." Isn't that what you wish for at the end of the day?

VS: I don't like the concept.

And so there's a lot that you don't know about that, so I think for me to have had these ideas, if you didn't understand even that it was coming out of this world that doesn't exist, we might never get together.

It's so weird. This happened to happen at the same time?

VS: Yes. It happened to happen at basically the same time.

Nobody's even had a show or had a movie/come out of the movie, but ...

VS: If I'm going to pretend I'm definitely not you and have to live through that stuff, I don't think I'm going to swallow that. I didn't expect it to do quite that long.

There are always things now that happen with 'Deadwood' where you don't know where it's going to end up next time, but I think there are occasions now where we have to keep the fight, even if 'Lost' was pretty consistent in the mindset and the form.

VS: I'm glad that we did fight the odds, because we should have understood that there was a direct link. But there was almost a sense of not that we had showed up on the same day, we know we work in the same pieces, but a lot of stuff we don't know about. Some of it, we need to deal with. We also just have to accept the language, and there are a lot of things where we take from them and we do this what they did because we want to

K.5.2 MD4-M unconditional sample 2: 1024 tokens

the groups let recreational vehicles use the three roads that will stay open in the meantime of fighting off the permit. "The purpose of the permit is to make sure that we work with the NPS and made roadways and rest areas. We're not just scaring guys kind of messing around." Community plans to build an urban bike facility marched forward at the ongoing staff meeting of the King County Commission.

Trail will be finished just south of the Greenview 5.

Instead of continuing with a pedestrian and bike trail to the MBTA's campus, these two trails could bridle the areas from Market to 14 and carry communities closer.

"This project will provide a car-free path to King County," said Andrew Weed. It's been put the brakes on in the past several months, but there are those residents still skeptical.

"I've addressed some of the community concerns that've been raised. They've expressed some of their concerns. I don't think it's terribly reasonable from a

transportation standpoint."

The trail had been set up to meet on for more than a year when the council approved funding for a different proposal.

Mayor Muriel Bowser said after meetings with Commissioner Bushell on Thursday that the new plan will be on board in December.

"There's enough of a finish for this project to roll out on time, and we're going to get it done," Bowser said.

For the public, the campaign appears over.

'There was one meeting that I feel like I lost at last night's meeting," said Shelley Potts, a local resident.

Local resident Joel Grimy, who lives on Uman Road, met residents there as well.

And in other groups that rode through Mayor assistant Stacey Land and even her son held fliers saying to look for light sign, and also met with Bowser's son, Deion Bowser, about a future plan to also have a dog park on the transit corridor.

Advocates at Brickley's event, many one waited at least 11 minutes in during the start of the public meeting, said they expect at least another month from the Board of Commissioners, even after a public hearing on Nov. 13.

"We've been trying to be a talkative board where we are meeting in advance, being respectful of folks," Bowser said.

He considered that the proposal for the section of trail between the Greenview 5 and 3 'has to move on a schedule. We have other historic preservation projects that would take over that.'

But Chad Routledge, a local advocate of the project, spoke out against the mayor's plan.

'The mayor has sent a new meeting to the public using the same route that resulted from the loud criticism and onslaught of complaints from the community committee back during the public hearing,' Routledge said.

The BDC doesn't have a particular plan-turns around for the end of the planned path, and says 'nothing practical can happen right now.' But, she said the agency still "looking to make investments in facilities along the route."

And still there is another part of the trail that might be just as much a wish for the dogs, as cars: the district wants to go west foot a couple blocks south, to make the trail safer for dogs.

'I feel that the accessibility of the trail is pretty important. I think the education of the trail, and the uses along different routes are very important pieces of a balanced outcome,' said Bushell.

Trams coming off Route 1

K.6 Conditional generation from MD4 trained on OpenWebText

We share conditionally generated text samples by MD4 Medium in Fig. 10 and observe that slow unmasking near t = 1 , enabled by the cosine schedule, tends to help produce more consist and meaningful samples than uniform unmasking counterpart.

Figure 10: Conditionally generated text samples from MD4-M. Top: MD4-M trained with the linear schedule, sampled with a uniform grid; Middle: MD4-M trained with the linear schedule, sampled with the cosine grid; Bottom: MD4-M trained with the cosine schedule, sampled with a uniform grid. Context text shown in blue, model-generated text in black.

K.7 Effect of discretization on zero-shot perplexity

We carried out ablation study on the effect of discretization on zero-shot perplexity. Results are included in Tab. 7. Note that this is an inference ablation with the same trained model (MD4-S trained with the continuou-time objective).

NeurIPS Paper Checklist

1. Claims

Question: Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope?

Answer: [Yes]

Justification: Our main theoretical and experimental contributions are claimed in the abstract and demonstrated in the paper. They reflect the paper's contributions and scope.

2. Limitations

Question: Does the paper discuss the limitations of the work performed by the authors?

Answer: [Yes] .

Justification: The limitations of our work are detailed in the very last paragraph of the paper (see Section 7).

3. Theory Assumptions and Proofs

Question: For each theoretical result, does the paper provide the full set of assumptions and a complete (and correct) proof?

Answer: [Yes] .

Justification: All the theoretical results are proven in the supplementary material.

4. Experimental Result Reproducibility

Question: Does the paper fully disclose all the information needed to reproduce the main experimental results of the paper to the extent that it affects the main claims and/or conclusions of the paper (regardless of whether the code and data are provided or not)?

Answer: [Yes]

Justification: We included all experimental details in App. J.

Guidelines:

The answer NA means that the paper does not include experiments.

If the paper includes experiments, a No answer to this question will not be perceived well by the reviewers: Making the paper reproducible is important, regardless of whether the code and data are provided or not.

If the contribution is a dataset and/or model, the authors should describe the steps taken to make their results reproducible or verifiable.

Depending on the contribution, reproducibility can be accomplished in various ways. For example, if the contribution is a novel architecture, describing the architecture fully might suffice, or if the contribution is a specific model and empirical evaluation, it may be necessary to either make it possible for others to replicate the model with the same dataset, or provide access to the model. In general. releasing code and data is often one good way to accomplish this, but reproducibility can also be provided via detailed instructions for how to replicate the results, access to a hosted model (e.g., in the case of a large language model), releasing of a model checkpoint, or other means that are appropriate to the research performed.

While NeurIPS does not require releasing code, the conference does require all submissions to provide some reasonable avenue for reproducibility, which may depend on the nature of the contribution. For example

(a) If the contribution is primarily a new algorithm, the paper should make it clear how to reproduce that algorithm.

(b) If the contribution is primarily a new model architecture, the paper should describe the architecture clearly and fully.

(c) If the contribution is a new model (e.g., a large language model), then there should either be a way to access this model for reproducing the results or a way to reproduce the model (e.g., with an open-source dataset or instructions for how to construct the dataset).

(d) We recognize that reproducibility may be tricky in some cases, in which case authors are welcome to describe the particular way they provide for reproducibility. In the case of closed-source models, it may be that access to the model is limited in some way (e.g., to registered users), but it should be possible for other researchers to have some path to reproducing or verifying the results.

5. Open access to data and code

Question: Does the paper provide open access to the data and code, with sufficient instructions to faithfully reproduce the main experimental results, as described in supplemental material?

Answer: [Yes]

Justification: The datasets we used are all public datasets. Our code is released at https: //github.com/google-deepmind/md4 .

Guidelines:

The answer NA means that paper does not include experiments requiring code.

Please see the NeurIPS code and data submission guidelines ( https://nips.cc/ public/guides/CodeSubmissionPolicy ) for more details.

While we encourage the release of code and data, we understand that this might not be possible, so 'No' is an acceptable answer. Papers cannot be rejected simply for not including code, unless this is central to the contribution (e.g., for a new open-source benchmark).

The instructions should contain the exact command and environment needed to run to reproduce the results. See the NeurIPS code and data submission guidelines ( https: //nips.cc/public/guides/CodeSubmissionPolicy ) for more details.

The authors should provide instructions on data access and preparation, including how to access the raw data, preprocessed data, intermediate data, and generated data, etc.

The authors should provide scripts to reproduce all experimental results for the new proposed method and baselines. If only a subset of experiments are reproducible, they should state which ones are omitted from the script and why.

At submission time, to preserve anonymity, the authors should release anonymized versions (if applicable).

Providing as much information as possible in supplemental material (appended to the paper) is recommended, but including URLs to data and code is permitted.

6. Experimental Setting/Details

Question: Does the paper specify all the training and test details (e.g., data splits, hyperparameters, how they were chosen, type of optimizer, etc.) necessary to understand the results?

Answer: [Yes]

Justification: Included in App. J.

Guidelines:

The answer NA means that the paper does not include experiments.

The experimental setting should be presented in the core of the paper to a level of detail that is necessary to appreciate the results and make sense of them.

The full details can be provided either with the code, in appendix, or as supplemental material.

7. Experiment Statistical Significance

Question: Does the paper report error bars suitably and correctly defined or other appropriate information about the statistical significance of the experiments?

Answer: [No]

Justification: We follow the practice in prior work [33] to not include error bars, partly because the models are expensive to train.

Guidelines:

The answer NA means that the paper does not include experiments.

The authors should answer "Yes" if the results are accompanied by error bars, confidence intervals, or statistical significance tests, at least for the experiments that support the main claims of the paper.

The factors of variability that the error bars are capturing should be clearly stated (for example, train/test split, initialization, random drawing of some parameter, or overall run with given experimental conditions).

The method for calculating the error bars should be explained (closed form formula, call to a library function, bootstrap, etc.)

The assumptions made should be given (e.g., Normally distributed errors).

It should be clear whether the error bar is the standard deviation or the standard error of the mean.

It is OK to report 1-sigma error bars, but one should state it. The authors should preferably report a 2-sigma error bar than state that they have a 96% CI, if the hypothesis of Normality of errors is not verified.

For asymmetric distributions, the authors should be careful not to show in tables or figures symmetric error bars that would yield results that are out of range (e.g. negative error rates).

If error bars are reported in tables or plots, The authors should explain in the text how they were calculated and reference the corresponding figures or tables in the text.

8. Experiments Compute Resources

Question: For each experiment, does the paper provide sufficient information on the computer resources (type of compute workers, memory, time of execution) needed to reproduce the experiments?

Answer: [Yes]

Justification: Included in App. J.

Guidelines:

The answer NA means that the paper does not include experiments.

The paper should indicate the type of compute workers CPU or GPU, internal cluster, or cloud provider, including relevant memory and storage.

The paper should provide the amount of compute required for each of the individual experimental runs as well as estimate the total compute.

The paper should disclose whether the full research project required more compute than the experiments reported in the paper (e.g., preliminary or failed experiments that didn't make it into the paper).

9. Code Of Ethics

Question: Does the research conducted in the paper conform, in every respect, with the NeurIPS Code of Ethics https://neurips.cc/public/EthicsGuidelines ?

Answer: [Yes] .

Justification: After careful review of the NeurIPS Code of Ethics, it is clear that the research presented in this paper conforms with the Code of Ethics in every respect.

Guidelines:

10. Broader Impacts

Question: Does the paper discuss both potential positive societal impacts and negative societal impacts of the work performed?

Answer: [NA] .

Justification: This paper is mostly theoretical and methodological. We do not see immediate societal impact of this work. However, we acknowledge that large scale implementation of our algorithm might suffer from the same societal biases as any other generative models.

11. Safeguards

Question: Does the paper describe safeguards that have been put in place for responsible release of data or models that have a high risk for misuse (e.g., pretrained language models, image generators, or scraped datasets)?

Answer: [NA] .

Justification: The paper poses no such risks.

Guidelines:

The answer NA means that the paper poses no such risks.

Released models that have a high risk for misuse or dual-use should be released with necessary safeguards to allow for controlled use of the model, for example by requiring that users adhere to usage guidelines or restrictions to access the model or implementing safety filters.

Datasets that have been scraped from the Internet could pose safety risks. The authors should describe how they avoided releasing unsafe images.

We recognize that providing effective safeguards is challenging, and many papers do not require this, but we encourage authors to take this into account and make a best faith effort.

12. Licenses for existing assets

Question: Are the creators or original owners of assets (e.g., code, data, models), used in the paper, properly credited and are the license and terms of use explicitly mentioned and properly respected?

Answer: [Yes]

Justification: We cited the dataset sources.

Guidelines:

The answer NA means that the paper does not use existing assets.

The authors should cite the original paper that produced the code package or dataset.

The authors should state which version of the asset is used and, if possible, include a URL.

The name of the license (e.g., CC-BY 4.0) should be included for each asset.

For scraped data from a particular source (e.g., website), the copyright and terms of service of that source should be provided.

If assets are released, the license, copyright information, and terms of use in the package should be provided. For popular datasets, paperswithcode.com/datasets has curated licenses for some datasets. Their licensing guide can help determine the license of a dataset.

For existing datasets that are re-packaged, both the original license and the license of the derived asset (if it has changed) should be provided.

If this information is not available online, the authors are encouraged to reach out to the asset's creators.

13. New Assets

Question: Are new assets introduced in the paper well documented and is the documentation provided alongside the assets?

Answer: [NA] .

Justification: This paper does not release new assets.

14. Crowdsourcing and Research with Human Subjects

Question: For crowdsourcing experiments and research with human subjects, does the paper include the full text of instructions given to participants and screenshots, if applicable, as well as details about compensation (if any)?

Answer: [NA] .

Justification: The paper does not involve crowdsourcing nor research with human subjects.

15. Institutional Review Board (IRB) Approvals or Equivalent for Research with Human Subjects

Question: Does the paper describe potential risks incurred by study participants, whether such risks were disclosed to the subjects, and whether Institutional Review Board (IRB) approvals (or an equivalent approval/review based on the requirements of your country or institution) were obtained?

Answer: [NA] .

Justification: The paper does not involve crowdsourcing nor research with human subjects.

Peer reviews:
{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThis paper proposes a new framework for masked diffusion models for generative modeling of discrete data. Masked diffusion models offer an alternative to autoregressive models for discrete data but have faced challenges due to complex formulations and unclear relationships between different approaches. This paper presents a simplified and generalized framework to address these issues, enhancing the performance and training of masked diffusion models.\n\nThe key contributions includes:\n\n1. Simplification of Model Formulation: The paper establishes properties for the forward process and its time reversal using elementary arguments, provides a simple expression for the Evidence Lower Bound (ELBO), demonstrating it as a weighted integral over time of cross-entropy losses, and shows invariance properties similar to continuous space diffusions.\n\n2. Re-derivation of Training Objectives: The paper demonstrates how various previously proposed discrete diffusion training objectives can be derived from the ELBO objective by altering parameterization, relaxing constraints, or modifying loss weighting.\n\n3. Performance Improvements: The paper demonstrates state-of-the-art likelihood and zero-shot transfer results on text and image tasks using the proposed ELBO objective.\n\n4. Generalized Masked Diffusion Model: The paper proposes a generalized masked diffusion model that allows state-dependent masking schedules, further improving predictive performance on test likelihoods.\n\nSTRENGTHS:\n1. The paper makes a notable contribution to the field of generative modeling for discrete data by introducing a simplified and generalized framework for masked diffusion models.\n2. The quality of the paper is reflected in the thoroughness of its methodology and the robustness of its experimental validation.\n3. The paper is well-written and clearly structured, making it accessible to both experts and those new to the field.\n4. The significance of the paper lies in its potential to impact a wide range of applications in generative modeling for discrete data.\n\nWEAKNESSES:\n1. While the paper provides a robust theoretical foundation, there could be more emphasis on practical applicability. The paper could benefit from additional practical guidelines for implementing the proposed framework, such as more detailed pseudocode and specific implementation challenges.\n2. The experimental results presented are strong, but the range of tasks and datasets could be expanded, such as VQ-Diffusion [1] for token-based text-to-image.\n3. I am unfamiliar with diffusion models for text generation. For image generation, the paper has reported likelihood results, missing some other common metrics, such as FID and IS.\n\n[1] Vector Quantized Diffusion Model for Text-to-Image Synthesis\n\nQUESTIONS:\nPlease see weaknesses.\n\nLIMITATIONS:\nThe authors have adequately described the limitations and potential negative societal impact of their work.", "TITLE": "Official Review", "RECOMMENDATION": 6, "REVIEWER_CONFIDENCE": 3, "SOUNDNESS_CORRECTNESS": 4, "DATE": "2024-07-07"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThe paper simplifies the mathematical formula for the absorbing state diffusion process. By doing so, the authors derive a continuous-time ELBO for masked diffusion models. Their method, MD4, achieves better perplexity scores than SEDD on text8 and zero-shot perplexity on numerous datasets.\n\nSTRENGTHS:\nSimplifies the complex mathematical formulations for the absorbing state diffusion for D3PM.\n\nWEAKNESSES:\nWeaknesses:\n\n1. Weak empirical results\n    1. The zero shot numbers for D3PM in Table 1 look fishy.  There are only 2 differences between Md4 and Absorbing State D3PM:\n        1. Mathematical simplification. In the discrete case (Eqn. 6), even though MD4 features a Simplified functional form for the ELBO, it shouldn't give it any performance benefits in terms of perplexity since it is mathematically equivalent to D3PM.\n        2. The improvement in ELBO could be because of the continuous time formulation. However, VDM [1]  has shown that for gaussian diffusion, improvement from discrete (T=1000) to continuous time (T = $\\infty$) barely improves the likelihood by less than 1%. For this reason, I request the authors to perform eval on an already trained model and report the  perplexity numbers on text8 or OWT using Eqn (6) with T=100, 1000, 10000. If the numbers reported for D3PM in Table 1 are indeed correct, and if the entire improvement is coming from the continuous time formulation, then the discrete time MD4 should get a number that's comparable to D3PM's zero shot ppl numbers. \n        \n        Questions: How did they retrain D3PM? Did they use the same transformer backbone as MD4? Did they use the same model size and data pre-processing scheme? Did they use  uniform state or absorbing state diffusion process? The authors need to clarify this.\n        \n    2. CIFAR10 Experiments. The AR baselines use old transformer models hence the comparison isn't quite fair. Current SOTA diffusion models on Imagenet 32 achieve a NLL of 2.55 [2] which is far better than the absorbing state diffusion models. So, I'm unsure about the takeaway from Table 3. In the conclusion section, the authors claim that \"… on text and image data, the resulting masked diffusions outperform existing discrete and continuous diffusion models …\" which is factually incorrect given that their method largely underperforms against gaussian diffusion [1, 2].\n2. Limited evaluation of GenMD4. The authors mention that GenMD4 performs poorly on zero-shot tasks. I request the authors to quantify this poor performance by providing \n    1. Validation ppl numbers on OWT\n    2. zero-shot ppl numbers.\n\n[1] Kingma, D., Salimans, T., Poole, B. and Ho, J., 2021. Variational diffusion models. *Advances in neural information processing systems*, *34*, pp.21696-21707.\n\n[2] Sahoo, S., Gokaslan, A., Sa, C., Kuleshov, V., 2024.  Diffusion Models With Learned Adaptive Noise. arXiv:2406.07524\n\nQUESTIONS:\n1. Clarification on D3PM experiments in Table 1 as mentioned in the \"weaknesses\" section in the reviews.\n2. Why did the authors decrease the dropout to 0.02 for OWT experiments and not set it to 0? Diffusion models are heavily regularized due to the randomness in the input to the model and oftentimes don't require additional regularization such as dropout. Hence, an intuitive or an empirical explanation would be helpful.\n\nLIMITATIONS:\nYes", "TITLE": "Official Review", "RECOMMENDATION": 6, "REVIEWER_CONFIDENCE": 5, "SOUNDNESS_CORRECTNESS": 2, "DATE": "2024-07-12"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThe paper proposes a streamlined and generalized framework for masked diffusion models, addressing the complexities and inefficiencies of existing models, including those based on Score Entropy Discrete Diffusion (SEDD). It introduces a continuous-time variational objective for masked diffusion models, simplifying the evidence lower bound (ELBO) to a weighted integral of cross-entropy losses. Additionally, the paper presents state-dependent masking schedules, enhancing the flexibility and performance of these models. The proposed methods demonstrate state-of-the-art results in text and image tasks, significantly improving likelihood and zero-shot transfer performance.\n\nSTRENGTHS:\n- The paper offers a novel theoretical formulation of the continuous-time variational objective for masked diffusion models, simplifying the training process and ensuring consistency between forward and reverse processes.\n- The introduction of state-dependent masking schedules provides a more adaptable approach, catering to the specific characteristics of the data and improving model performance.\n- The proposed methods achieve state-of-the-art performance in both text and image generative tasks, significantly enhancing likelihood and zero-shot transfer capabilities.\n- By reducing the ELBO to a weighted integral of cross-entropy losses, the paper makes the training and understanding of masked diffusion models more accessible and potentially more stable.\n- The paper includes comprehensive experimental validation on various datasets, demonstrating the robustness and superiority of the proposed methods.\n\nWEAKNESSES:\n-  Despite the theoretical simplifications, the practical implementation of state-dependent masking schedules can still be complex and computationally demanding. Specifically, obtaining the starting x_T is challenging, and since the sampling process lacks stochasticity, sampling cannot be done from the completely masked state.\n- The state-dependent models have a tendency to overfit to dataset statistics, which can limit their effectiveness in zero-shot transfer tasks.\n- While the paper demonstrates superior performance, a more detailed comparative analysis with other state-of-the-art methods, particularly regarding computational efficiency and training times, would provide a clearer picture of the advantages.\n\nQUESTIONS:\n- Could the authors provide more insights into the practical challenges faced during the implementation of the state-dependent masking schedules?\n- How does the proposed model ensure consistency between the forward and reverse processes, and how does this impact training stability compared to SEDD? \n- Could the authors provide a detailed and separate description of the training and sampling algorithms, similar to what is provided in the Appendix of the SEDD paper, to better and more easily understand the proposed method?\n- How sensitive is the proposed method to hyperparameter choices? Do multiple runs with the same hyperparameters yield consistent performance?\n\nLIMITATIONS:\nNone", "TITLE": "Official Review", "RECOMMENDATION": 7, "REVIEWER_CONFIDENCE": 4, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2024-07-12"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nSummary: This paper introduces a framework for masked diffusions that consolidates previous research on the topic and organizes it into a cohesive structure. The authors also present a generalized model within this framework, which enables the use of state-dependent masking schedules and optimization of scheduler parameters.\n\nSTRENGTHS:\n1. The GenMD4 framework offers a valuable approach to optimize the forward process. In earlier studies, forward processes were typically manually designed and set within the model. However, GenMD4 adjusts the forward distribution to align with the estimated distribution, thereby improving the forward process. This innovation may serve as a source of inspiration for developing more effective forward processes.\n\n2. This paper summarizes previous formulations of masked diffusion models and establishes the connections between them.\n\nWEAKNESSES:\n1. In line 90. The handling of $p(x _0|x _{t(1)})$ could be enhanced. Assuming $p(x _0|x _{t(1)}) \\propto q(x _{t(1)} | x _0)$ is equivalent to assuming that $q(x _0)$ is uniformly distributed. In reality, it should be treated the same as other $p(x _s|x _t)$.\n2. In line 114. When discussing multidimensional data, it is not straightforward to assume that the backward process factorizes across tokens. This is because the distribution $p(x _0)$ does not factorize across tokens. Achieving factorization necessitates a small time step dt, which may not be easily observable. Additionally, in the previous single-token scenario, dt dose not need to be small, indicating that one step is sufficient to model the distribution $p(x _0 | x _1)$. This aspect is crucial for multidimensional data and should be emphasized in a fundamental paper like this.\n3. In append F. The presence of a non-zero $\\alpha _1$ may result in the \"medium brightness problem\" [1]. However, there is no singularity when $\\alpha _1$ is zero if log-SNR is not introduced, and the time interval can be extended to [0, 1].\n4. In append G2. When applied to masked diffusion, $R_{kj}$ is zero when $ j \\ne k$ and $j \\ne m$. Given that $R_{kk} + R_{km} = 0$, $\\tilde{q}$ can only take on one value (m), resulting in no additional variance.\n5. In image experiments, MD4 employs masked noise, while $\\tau$LDR uses Gaussian noise. We recommend conducting experiments with the same noise scheduler to demonstrate conclusively that MD4 is superior. If the goal of this paper is solely to establish that masked noise outperforms Gaussian noise, we recommend explicitly stating this claim. Additionally, we advise detailing the sampling method, as variations in methodology can influence the quality of generated samples.\n\n[1] Common Diffusion Noise Schedules and Sample Steps are Flawed, Lin et al., 2024\n\nQUESTIONS:\n1. GenMD4 has not been tested on image datasets. Could you please share the results of GenMD4 when applied to image datasets?\n2. Since introducing GenMD4 results in additional variance, what if all tokens share the same w (referred to as \"simplified-GenMD4\")? This would result in less variance. Given that GenMD4's performance is close to MD4, can simplified-GenMD4 achieve the same BPC?\n\nLIMITATIONS:\nThe method is only applied to masked diffusions.", "TITLE": "Official Review", "RECOMMENDATION": 7, "REVIEWER_CONFIDENCE": 5, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2024-07-12"}