D ENOISING D IFFUSION I MPLICIT M ODELS
A BSTRACT
Denoising diffusion probabilistic models ( DDPMs) have achieved high qual - ity image generation without adversarial training, yet they require simulating a
Markov chain for many steps in order to produce a sample.
To accelerate sam - pling, we present denoising diffusion implicit models (DDIMs), a more efﬁcient class of iterative implicit probabilistic models with the same training procedure as
DDPMs.
In DDPMs, the generative process is deﬁned as the reverse of a particular
Markovian diffusion process.
We generalize DDPMs via a class of non-Markovian diffusion processes that lead to the same training objective.
These non-Markovian processes can correspond to generative processes that are deterministic, giving rise to implicit models that produce high quality samples much faster.
We empirically demonstrate that DDIMs can produce high quality samples 10 × to 50 × faster in terms of wall-clock time compared to DDPMs, allow us to trade off computation for sample quality , perform semantically meaningful image interpolation directly in the latent space and reconstruct observations with very low error
I NTRODUCTION
Deep generative models have demonstrated the ability to produce high quality samples in many domains (Karras et al., 2020; van den Oord et al., 2016a).
In terms of image generation, generative adversarial networks (GANs, Goodfellow et al.
(2014)) currently exhibits higher sample quality than likelihood-based methods such as variational autoencoders (Kingma & Welling, 2013), autoregressive models (van den Oord et al., 2016b) and normalizing ﬂows (Rezende & Mohamed, 2015;
Dinh et al., 2016).
However, GANs require very speciﬁc choices in optimization and architectures in order to stabilize training (Arjovsky et al., 2017; Gulrajani et al., 2017; Karras et al., 2018; Brock et al., 2018), and could fail to cover modes of the data distribution (Zhao et al., 2018).
Recent works on iterative generative models (Bengio et al., 2014), such as denoising diffusion probabilistic models (DDPM, Ho et al.
and noise conditional score networks (NCSN, Song &
Ermon (2019)) have demonstrated the ability to produce samples comparable to that of GANs, without having to perform adversarial training.
To achieve this, many denoising autoencoding models are trained to denoise samples corrupted by various levels of Gaussian noise.
Samples are then produced by a Markov chain which, starting from white noise, progressively denoises it into an image.
This generative Markov Chain process is either based on Langevin dynamics (Song & Ermon, 2019) or obtained by reversing a forward diffusion process that progressively turns an image into noise (Sohl-Dickstein et al., 2015).
A critical drawback of these models is that they require many iterations to produce a high quality sample.
For DDPMs, this is because that the generative process (from noise to data) approximates the reverse of the forward diffusion process (from data to noise), which could have thousands of steps; iterating over all the steps is required to produce a single sample, which is much slower compared to GANs, which only needs one pass through a network.
For example, it takes aroundhours to sample 50k images of size 32 × 32 from a DDPM, but less than a minute to do so from a GAN on a Nvidia 2080 Ti GPU.
This becomes more problematic for larger images as sampling 50k images of size 256 × 256 could take nearly 1000 hours on the same GPU.
To close this efﬁciency gap between DDPMs and GANs, we present denoising diffusion implicit models (DDIMs).
DDIMs are implicit probabilistic models (Mohamed & Lakshminarayanan, 2016) and are closely related to DDPMs, in the sense that they are trained with the same objective function.
In Section 3, we generalize the forward diffusion process used by DDPMs, which is Markovian, to non-Markovian ones, for which we are still able to design suitable reverse generative Markov chains.
We show that the resulting variational training objectives have a shared surrogate objective, which is exactly the objective used to train DDPM.
Therefore, we can freely choose from a large family of generative models using the same neural network simply by choosing a different, nonMarkovian diffusion process (Section 4.1) and the corresponding reverse generative Markov Chain.
In particular, we are able to use non-Markovian diffusion processes which lead to ”short” generative
Markov chains (Section 4.2) that can be simulated in a small number of steps.
This can massively increase sample efﬁciency only at a minor cost in sample quality.
In Section 5, we demonstrate several empirical beneﬁts of DDIMs over DDPMs.
First , DDIMs have superior sample generation quality compared to DDPMs, when we accelerate sampling by 10 × to 100 × using our proposed method.
Second , DDIM samples have the following “consistency” property, which does not hold for DDPMs: if we start with the same initial latent variable and generate several samples with Markov chains of various lengths, these samples would have similar high-level features.
Third , because of “consistency” in DDIMs, we can perform semantically meaningful image interpolation by manipulating the initial latent variable in DDIMs, unlike DDPMs which interpolates near the image space due to the stochastic generative process.
B ACKGROUND
Given samples from a data distribution q ( x 0 ) , we are interested in learning a model distribution p θ ( x 0 ) that approximates q ( x 0 ) and is easy to sample from.
Denoising diffusion probabilistic models (DDPMs, Sohl-Dickstein et al. (2015);
Ho et al.
(2020)) are latent variable models of the form
[Equation]
where p [Equation] ( x 0: T
[Equation]
[Equation]
where x 1 , . .
, x T are latent variables in the same sample space as x 0 (denoted as X ).
The parameters θ are learned to ﬁt the data distribution q ( x 0 ) by maximizing a variational lower bound:
[Equation]
[Equation]
) where q ( x 1: T | x 0 ) is some inference distribution over the latent variables.
Unlike typical latent variable models (such as the variational autoencoder (Rezende et al., 2014)), DDPMs are learned with a ﬁxed (rather than trainable) inference procedure q ( x 1: T | x 0 ) , and latent variables are relatively high dimensional.
For example, Ho et al.
(2020) considered the following Markov chain with Gaussian transitions parameterized by a decreasing sequence α 1: T ∈ (0 , 1] T : q [Equation] [Equation] t
[Equation]
q ( x t | x t
[Equation]
1 ) , where q ( x t | x t − 1 ) :
[Equation]
N
[Equation]
α
[Equation]
(3) where the covariance matrix is ensured to have positive terms on its diagonal.
This is called the forward process due to the autoregressive nature of the sampling procedure (from x 0 to x T ).
We call the latent variable model p θ ( x 0: T ) , which is a Markov chain that samples from x T to x 0 , the generative process , since it approximates the intractable reverse process q ( x t − 1 | x t ) .
Intuitively, the forward process progressively adds noise to the observation x 0 , whereas the generative process progressively denoises a noisy observation (Figure 1, left).
A special property of the forward process is that
[Equation]
so we can express x t as a linear combination of x 0 and a noise variable (cid:15) :
[Equation]
where (cid:15) ∼ N ( 0 , I ) .
[Equation]
[Equation]
When we set α T sufﬁciently close to 0 , q ( x T | x 0 ) converges to a standard Gaussian for all x 0 , so it is natural to set p θ ( x T ) :
= N ( 0 , I ) .
If all the conditionals are modeled as Gaussians with trainable mean functions and ﬁxed variances, the objective in Eq.
(2) can be simpliﬁed to 1 :
[Equation]
where (cid:15) θ := { (cid:15) ( t ) θ } Tt =1 is a set of T functions, each (cid:15) ( t ) θ : X → X (indexed by t ) is a function with trainable parameters θ ( t ) , and γ :=
[ γ 1 , . . . , γ T ] is a vector of positive coefﬁcients in the objective that depends on α 1: T .
In Ho et al.
(2020), the objective with γ = 1 is optimized instead to maximize generation performance of the trained model; this is also the same objective used in noise conditional score networks (Song & Ermon, 2019) based on score matching (Hyv¨arinen, 2005; Vincent, 2011).
From a trained model, x 0 is sampled by ﬁrst sampling x T from the prior p θ ( x T ) , and then sampling x t − 1 from the generative processes iteratively.
The length T of the forward process is an important hyperparameter in DDPMs.
From a variational perspective, a large T allows the reverse process to be close to a Gaussian (Sohl-Dickstein et al., 2015), so that the generative process modeled with Gaussian conditional distributions becomes a good approximation; this motivates the choice of large T values, such as T = 1000 in Ho et al.
However, as all T iterations have to be performed sequentially, instead of in parallel, to obtain a sample x 0 , sampling from DDPMs is much slower than sampling from other deep generative models, which makes them impractical for tasks where compute is limited and latency is critical.
V ARIATIONAL I NFERENCE FOR NON -M ARKOVIAN F ORWARD P ROCESSES
Because the generative model approximates the reverse of the inference process, we need to rethink the inference process in order to reduce the number of iterations required by the generative model.
Our key observation is that the DDPM objective in the form of L γ only depends on the marginalsq ( x t | x 0 ) , but not directly on the joint q ( x 1: T | x 0 ) .
Since there are many inference distributions (joints) with the same marginals, we explore alternative inference processes that are non-Markovian, which leads to new generative processes (Figure 1, right).
These non-Markovian inference process lead to the same surrogate objective function as DDPM, as we will show below.
In Appendix A, we show that the non-Markovian perspective also applies beyond the Gaussian case.
3. N ON -M ARKOVIAN FORWARD PROCESSES
Let us consider a family Q of inference distributions, indexed by a real vector σ ∈ R T ≥ 0 :
[Equation]
where q σ ( x T | x 0 )
=
N ( √ α T x 0 , (1 − α T ) I )
and for all t > 1 ,
[Equation]
The mean function is chosen to order to ensure that q σ ( x t | x 0 ) =
N ( √ α t x 0 , (1 − α t ) I ) for all t (see Lemma 1 of Appendix B), so that it deﬁnes a joint inference distribution that matches the “marginals” as desired.
The forward process 3 can be derived from Bayes’ rule:
[Equation]
which is also Gaussian (although we do not use this fact for the remainder of this paper).
Unlike the diffusion process in Eq.
(3), the forward process here is no longer Markovian, since each x t could depend on both x t − 1 and x 0 .
The magnitude of σ controls the how stochastic the forward process is; when σ → 0 , we reach an extreme case where as long as we observe x 0 and x t for some t , then x t − 1 become known and ﬁxed.
3. G ENERATIVE PROCESS AND UNIFIED VARIATIONAL INFERENCE OBJECTIVE
Next, we deﬁne a trainable generative process p θ ( x 0: T ) where each p ( t ) θ ( x t − 1 | x t ) leverages knowledge of q σ ( x t − 1 | x t , x 0 ) .
Intuitively, given a noisy observation x t , we ﬁrst make a predictionof the corresponding x 0 , and then use it to obtain a sample x t − 1 through the reverse conditional distribution q σ ( x t − 1 | x t , x 0 ) , which we have deﬁned.
For some x 0 ∼ q ( x 0 ) and (cid:15) t ∼ N ( 0 , I ) , x t can be obtained using Eq.
The model (cid:15) ( t ) θ ( x t ) then attempts to predict (cid:15) t from x t , without knowledge of x 0 .
By rewriting Eq.
(4), one can then predict the denoised observation , which is a prediction of x 0 given x t :
[Equation]
We can then deﬁne the generative process with a ﬁxed prior p θ ( x T ) =
N ( 0 , I ) and
[Equation]
where q σ ( x t − 1 | x t , f ( t ) θ ( x t )) is deﬁned as in Eq.
(7) with x 0 replaced by f ( t ) θ ( x t ) .
We add some
Gaussian noise (with covariance σ 21 I ) for the case of t = 1 to ensure that the generative process is supported everywhere.
We optimize θ via the following variational inference objective (which is a functional over (cid:15) θ ):
[Equation]
where we factorize q σ ( x 1: T | x 0 ) according to Eq.
(6) and p θ ( x 0: T ) according to Eq.
From the deﬁnition of J σ , it would appear that a different model has to be trained for every choice of σ , since it corresponds to a different variational objective (and a different generative process).
However, J σ is equivalent to L γ for certain weights γ , as we show below.
Theorem 1.
For all σ > 0 , there exists γ ∈ R T> 0 and C ∈ R , such that J σ =
L γ + C .
The variational objective L γ is special in the sense that if parameters θ of the models (cid:15) ( t ) θ are not shared across different t , then the optimal solution for (cid:15) θ will not depend on the weights γ (as global optimum is achieved by separately maximizing each term in the sum).
This property of L γ has two implications.
On the one hand, this justiﬁed the use of L 1 as a surrogate objective function for the variational lower bound in DDPMs; on the other hand, since J σ is equivalent to some L γ from
Theorem 1, the optimal solution of J σ is also the same as that of L 1 .
Therefore, if parameters are not shared across t in the model (cid:15) θ , then the L 1 objective used by Ho et al.
(2020) can be used as a surrogate objective for the variational objective J σ as well.
S AMPLING FROM G ENERALIZED G ENERATIVE P ROCESSES
With L 1 as the objective, we are not only learning a generative process for the Markovian inference process considered in Sohl-Dickstein et al.
(2015) and Ho et al.
(2020), but also generative processes for many non-Markovian forward processes parametrized by σ that we have described.
Therefore, we can essentially use pretrained DDPM models as the solutions to the new objectives, and focus on ﬁnding a generative process that is better at producing samples subject to our needs by changing σ .
4. D ENOISING D IFFUSION I MPLICIT M ODELS
From p θ ( x 1: T ) in Eq.
(10), one can generate a sample x t − 1 from a sample x t via:
[Equation]
[Figure]
[Equation]
[Figure]
[Equation]
where (cid:15) t ∼ N ( 0 , I ) is standard Gaussian noise independent of x t , and we deﬁne α 0 :
= 1 .
Different choices of σ values results in different generative processes, all while using the same model (cid:15) θ , so re-training the model is unnecessary.
When σ t = (cid:112) (1 − α t − 1 ) / (1 − α t ) (cid:112) 1 − α t /α
t − 1 for all t , the forward process becomes Markovian, and the generative process becomes a DDPM.
We note another special case when σ t = 0 for all t 5 ; the forward process becomes deterministic given x t − 1 and x 0 , except for t = 1 ; in the generative process, the coefﬁcient before the random noise (cid:15) t becomes zero.
The resulting model becomes an implicit probabilistic model (Mohamed &
Lakshminarayanan, 2016), where samples are generated from latent variables with a ﬁxed procedure (from x T to x 0 ).
We name this the denoising diffusion implicit model (DDIM, pronounced /d:Im/ ), because it is an implicit probabilistic model trained with the DDPM objective (despite the forward process no longer being a diffusion).
4. A CCELERATED GENERATION PROCESSES
In the previous sections, the generative process is considered as the approximation to the reverse process; since of the forward process has T steps, the generative process is also forced to sample T steps.
However, as the denoising objective L 1 does not depend on the speciﬁc forward procedure as long as q σ ( x t | x 0 ) is ﬁxed, we may also consider forward processes with lengths smaller than T , which accelerates the corresponding generative processes without having to train a different model.
Let us consider the forward process as deﬁned not on all the latent variables x 1: T , but on a subset { x τ 1 , . . .
, x τ S } , where τ is an increasing sub-sequence of [1 , . . .
, T ] of length S .
In particular, we deﬁne the sequential forward process over x τ 1 , . . .
, x τ S such that q ( x τ i | x 0 ) =
N ( √ α τ i x 0 , (1 − α τ i ) I ) matches the “marginals” (see Figure 2 for an illustration).
The generative process now samples latent variables according to reversed ( τ ) , which we term (sampling) trajectory .
When the length of the sampling trajectory is much smaller than T , we may achieve signiﬁcant increases in computational efﬁciency due to the iterative nature of the sampling process.
Using a similar argument as in Section 3, we can justify using the model trained with the L 1 objective, so no changes are needed in training.
We show that only slight changes to the updates in
Eq.
(12) are needed to obtain the new, faster generative processes, which applies to DDPM, DDIM, as well as all generative processes considered in Eq.
We include these details in Appendix C.1.
In principle, this means that we can train a model with an arbitrary number of forward steps but only sample from some of them in the generative process.
Therefore, the trained model could consider many more steps than what is considered in (Ho et al., 2020) or even a continuous time variable t (Chen et al., 2020).
We leave empirical investigations of this aspect as future work.
4. R ELEVANCE TO N EURAL ODE S
Moreover, we can rewrite the DDIM iterate according to Eq.
(12), and its similarity to Euler integration for solving ODEs becomes more apparent:
[Equation]
We can reparameterize ( √ 1 − α/ √ α ) with λ and ( x / √ α ) with H ( λ ) then sampling x 0 with Equation (13) can be treated as integration over the following ODE:
[Equation]
for some very large M (which corresponds to the case of α ≈ 0 ).
This suggests that with enough
T (discretization steps), the we can also reverse the generation process (going from t = 0 to T ), which encodes x 0 to x T and simulates the reverse of the ODE in Eq.
This suggests that unlike
DDPM, we can use DDIM to obtain encodings of the observations (as the form of x T ), which might be useful for other downstream applications that requires latent representations of a model.
E XPERIMENTS
In this section, we show that DDIMs outperform DDPMs in terms of image generation when fewer iterations are considered, giving speed ups of 10 × to 100 × over the original DDPM generation process.
Moreover, unlike DDPMs, once the initial latent variables x T are ﬁxed, DDIMs retain highlevel image features regardless of the generation trajectory, so they are able to perform interpolation directly from the latent space.
DDIMs can also be used to encode samples that reconstruct them from the latent code, which DDPMs cannot do due to the stochastic sampling process.
For each dataset, we use the same trained model with T = 1000 and the objective being L γ from Eq.
(5) with γ = 1 ; as we argued in Section 3, no changes are needed with regards to the training procedure.
The only changes that we make is how we produce samples from the model ; we achieve this by controlling τ (which controls how fast the samples are obtained) and σ (which interpolates between the deterministic DDIM and the stochastic DDPM).
We consider different sub-sequences τ of [1 , . .
, T ] and different variance hyperparameters σ indexed by elements of τ .
To simplify comparisons, we consider σ with the form:
[Equation]
where η ∈ R ≥ 0 is a hyperparameter that we can directly control.
This includes an original DDPM generative process when η = 1 and DDIM when η = 0 .
We also consider DDPM where the random noise has a larger standard deviation than σ (1) , which we denote as ˆ σ
[Equation]
This is used by the implementation in Ho et al.
(2020) only to obtain the CIFAR10 samples , but not samples of the other datasets.
We include more details in Appendix D.
5. S AMPLE QUALITY AND EFFICIENCY
In Table 1, we report the quality of the generated samples with models trained on CIFAR10 and
CelebA, as measured by Frechet Inception Distance (FID (Heusel et al., 2017)), where we vary the number of timesteps used to generate a sample ( dim( τ ) ) and the stochasticity of the process ( η ).
As expected, the sample quality becomes higher as we increase dim( τ ) , presenting a tradeoff between sample quality and computational costs.
We observe that DDIM ( η = 0 ) achieves the best sample quality when dim( τ ) is small, and DDPM ( η = 1 and ˆ σ ) typically has worse sample quality compared to its less stochastic counterparts with the same dim( τ ) , except for the case for dim( τ ) = 1000 and ˆ σ reported by Ho et al.
(2020) where DDIM is marginally worse.
However, the sample quality of ˆ σ becomes much worse for smaller dim( τ ) , which suggests that it is ill-suited for shorter trajectories.
DDIM, on the other hand, achieves high sample quality much more consistently.
In Figure 3, we show CIFAR10 and CelebA samples with the same number of sampling steps and varying σ .
For the DDPM, the sample quality deteriorates rapidly when the sampling trajectory has
[Table]
[Figure]
10 steps.
For the case of ˆ σ , the generated images seem to have more noisy perturbations under short trajectories; this explains why the FID scores are much worse than other methods, as FID is very sensitive to such perturbations (as discussed in Jolicoeur-Martineau et al.
In Figure 4, we show that the amount of time needed to produce a sample scales linearly with the length of the sample trajectory.
This suggests that DDIM is useful for producing samples more efﬁciently, as samples can be generated in much fewer steps.
Notably, DDIM is able to produce samples with quality comparable to 1000 step models within 20 to 100 steps, which is a 10 × to 50 × speed up compared to the original DDPM.
Even though DDPM could also achieve reasonable sample quality with 100 × steps, DDIM requires much fewer steps to achieve this; on CelebA, the
FID score of the 100 step DDPM is similar to that of the 20 step DDIM.
5. S AMPLE CONSISTENCY IN DDIM S
For DDIM, the generative process is deterministic, and x 0 would depend only on the initial state x T .
In Figure 5, we observe the generated images under different generative trajectories (i.e. different τ ) while starting with the same initial x T .
Interestingly, for the generated images with the same initial x T , most high-level features are similar, regardless of the generative trajectory.
In many cases, samples generated with only 20 steps are already very similar to ones generated with 1000 steps in terms of high-level features, with only minor differences in details.
Therefore, it would appear that x T alone would be an informative latent encoding of the image; and minor details that affects sample quality are encoded in the parameters, as longer sample trajectories gives better quality samples but do not signiﬁcantly affect the high-level features.
We show more samples in Appendix D.4.
[Figure]
1000 s a m p l e t i m e s t e p s  s a m p l e t
i m e s t e p s  s a m p l e t i m e s t e p s
5. I NTERPOLATION IN DETERMINISTIC GENERATIVE PROCESSES
Since the high level features of the DDIM sample is encoded by x T , we are interested to see whether it would exhibit the semantic interpolation effect similar to that observed in other implicit probabilistic models, such as GANs (Goodfellow et al., 2014).
This is different from the interpolation procedure in Ho et al.
(2020), since in DDPM the same x T would lead to highly diverse x 0 due to the stochastic generative process 6 .
In Figure 6, we show that simple interpolations in x T can lead to semantically meaningful interpolations between two samples.
We include more details and samples in Appendix D.5.
This allows DDIM to control the generated images on a high level directly through the latent variables, which DDPMs cannot.
5. R ECONSTRUCTION FROM L ATENT S PACE
As DDIM is the Euler integration for a particular ODE, it would be interesting to see whether it can encode from x 0 to x T (reverse of Eq.
and reconstruct x 0 from the resulting x T (forward
[Table]
of Eq.
We consider encoding and decoding on the CIFAR-10 test set with the CIFARmodel with S steps for both encoding and decoding; we report the per-dimension mean squared error (scaled to [0 , 1] ) in Table 2.
Our results show that DDIMs have lower reconstruction error for larger S values and have properties similar to Neural ODEs and normalizing ﬂows.
The same cannot be said for DDPMs due to their stochastic nature.
R ELATED W ORK
Our work is based on a large family of existing methods on learning generative models as transition operators of Markov chains (Sohl-Dickstein et al., 2015; Bengio et al., 2014; Salimans et al., 2014;
Song et al., 2017; Goyal et al., 2017; Levy et al., 2017).
Among them, denoising diffusion probabilistic models (DDPMs, Ho et al.
and noise conditional score networks (NCSN, Song & Ermon (2019; 2020)) have recently achieved high sample quality comparable to GANs (Brock et al., 2018; Karras et al., 2018).
DDPMs optimize a variational lower bound to the log-likelihood, whereas NCSNs optimize the score matching objective (Hyv¨arinen, 2005) over a nonparametric
Parzen density estimator of the data (Vincent, 2011; Raphan & Simoncelli, 2011).
Despite their different motivations, DDPMs and NCSNs are closely related.
Both use a denoising autoencoder objective for many noise levels, and both use a procedure similar to Langevin dynamics to produce samples (Neal et al., 2011).
Since Langevin dynamics is a discretization of a gradient ﬂow (Jordan et al., 1998), both DDPM and NCSN require many steps to achieve good sample quality.
This aligns with the observation that DDPM and existing NCSN methods have trouble generating high-quality samples in a few iterations.
DDIM, on the other hand, is an implicit generative model (Mohamed & Lakshminarayanan, 2016) where samples are uniquely determined from the latent variables.
Hence, DDIM has certain properties that resemble GANs (Goodfellow et al., 2014) and invertible ﬂows (Dinh et al., 2016), such as the ability to produce semantically meaningful interpolations.
We derive DDIM from a purely variational perspective, where the restrictions of Langevin dynamics are not relevant; this could partially explain why we are able to observe superior sample quality compared to DDPM under fewer iterations.
The sampling procedure of DDIM is also reminiscent of neural networks with continuous depth (Chen et al., 2018; Grathwohl et al., 2018), since the samples it produces from the same latent variable have similar high-level visual features, regardless of the speciﬁc sample trajectory.
D ISCUSSION
We have presented DDIMs – an implicit generative model trained with denoising auto-encoding / score matching objectives – from a purely variational perspective.
DDIM is able to generate highquality samples much more efﬁciently than existing DDPMs and NCSNs, with the ability to perform meaningful interpolations from the latent space.
The non-Markovian forward process presented here seems to suggest continuous forward processes other than Gaussian (which cannot be done in the original diffusion framework, since Gaussian is the only stable distribution with ﬁnite variance).
We also demonstrated a discrete case with a multinomial forward process in Appendix A, and it would be interesting to investigate similar alternatives for other combinatorial structures.
Moreover, since the sampling procedure of DDIMs is similar to that of an neural ODE, it would be interesting to see if methods that decrease the discretization error in ODEs, including multistep methods such as Adams-Bashforth (Butcher & Goodwin, 2008), could be helpful for further improving sample quality in fewer steps (Queiruga et al., 2020).
It is also relevant to investigate whether DDIMs exhibit other properties of existing implicit models (Bau et al., 2019).
A N ON -M ARKOVIAN F ORWARD P ROCESSES FOR A D ISCRETE C ASE
In this section, we describe a non-Markovian forward processes for discrete data and corresponding variational objectives.
Since the focus of this paper is to accelerate reverse models corresponding to the Gaussian diffusion, we leave empirical evaluations as future work.
For a categorical observation x 0 that is a one-hot vector with K possible values, we deﬁne the forward process as follows.
First, we have q ( x t | x 0 ) as the following categorical distribution: [Equation]
[Equation]
where 1 K ∈ R K is a vector with all entries being 1 /K , and α t decreasing from α 0 = 1 for t = 0 to α T = 0 for t = T .
Then we deﬁne q ( x t − 1 | x t , x 0 ) as the following mixture distribution:
[Equation]
with probability σ t
Cat( x 0 ) with probability ( α t − 1 − σ t α t )
Cat( 1 K ) with probability (1 − α t − 1 ) − (1 − α t ) σ t , (17) or equivalently:
[Equation] [Equation]
which is consistent with how we have deﬁned q ( x t | x 0 ) .
Similarly, we can deﬁne our reverse process p θ ( x t − 1 | x t ) as:
[Equation]
(19) where f ( t ) θ ( x t ) maps x t to a K -dimensional vector.
As (1 − α t − 1 ) − (1 − α t ) σ t → 0 , the sampling process will become less stochastic, in the sense that it will either choose x t or the predicted xwith high probability.
The KL divergence
[Equation]
is well-deﬁned, and is simply the KL divergence between two categoricals.
Therefore, the resulting variational objective function should be easy to optimize as well.
Moreover, as KL divergence is convex, we have this upper bound (which is tight when the right hand side goes to zero):
[Equation]
The right hand side is simply a multi-class classiﬁcation loss (up to constants), so we can arrive at similar arguments regarding how changes in σ t do not affect the objective (up to re-weighting).
B P ROOFS
Lemma 1.
For q σ ( x 1: T | x 0 ) deﬁned in Eq.
(6) and q σ ( x t − 1 | x t , x 0 ) deﬁned in Eq.
(7), we have:
[Equation]
Proof.
Assume for any t ≤ T , q σ ( x t | x 0 )
=
N ( √ α t x 0 , √ 1 − α t I ) holds, if:
[Equation]
(22) then we can prove the statement with an induction argument for t from T to 1 , since the base case ( t = T ) already holds.
First, we have that
[Equation]
and
[Equation]
From Bishop (2006) (2.115), we have that ˆ q ( x t − 1 | x 0 ) is Gaussian and
[Equation] [Equation]
and
[Equation]
Therefore, q σ ( x t − 1 | x 0 ) =
N ( √ α t − 1 x 0 , √ 1 − α t − 1 I ) , which allows us to apply the induction argument.
Theorem 1.
For all σ > 0 , there exists γ ∈ R T> 0 and C ∈ R , such that J σ =
L γ + C .
Proof.
From the deﬁnition of J σ :
[Equation]
where we use ≡ to denote “equal up to a value that does not depend on (cid:15)
θ (but may depend on q σ )”.
For t > 1 :
[Equation]
where d is the dimension of x 0 .
For t = 0 :
[Equation]
Therefore, when γ t = 1 / (2 dσ 2 t α t ) for all t ∈ { 1 , . . .
, T } , we have
[Equation] [Equation]
for all (cid:15) θ .
From the deﬁnition of “ ≡ ”, we have that J σ =
L γ + C .
C A DDITIONAL D ERIVATIONS C. A CCELERATED SAMPLING PROCESSES
In the accelerated case
[Equation]
we can consider the inference process to be factored as:
[Equation]
) where τ is a sub-sequence of [
[Equation]
[Equation]
T ] of length S with τ S = T
[Equation]
and let ¯ τ := { 1 , . .
. , T } \ τ be its complement.
Intuitively, the graphical model of { x τ i } Si =1 and x 0 form a chain, whereas the graphical model of { x t } t ∈ ¯ τ and x 0 forms a star graph.
We deﬁne:
[Equation] [Equation]
where the coefﬁcients are chosen such that:
[Equation]
[Equation]
i
[Equation]
e., the “marginals” match.
The corresponding “generative process” is deﬁned as:
[Equation]
where only part of the models are actually being used to produce samples.
The conditionals are:
[Equation]
where we leverage q σ,τ ( x τ i − 1 | x τ i , x 0 ) as part of the inference process (similar to what we have done in Section 3).
The resulting variational objective becomes (deﬁne x τ L +1 = ∅ for conciseness):
[Equation]
where each KL divergence is between two Gaussians with variance independent of θ .
A similar argument to the proof used in Theorem 1 can show that the variational objective J can also be converted to an objective of the form L γ .
C. D ERIVATION OF DENOISING OBJECTIVES FOR DDPM S
We note that in Ho et al.
(2020), a diffusion hyperparameter β t 8 is ﬁrst introduced, and then relevant variables α t := 1 − β t and ¯ α t = (cid:81)
Tt
=1 α t are deﬁned.
In this paper, we have used the notation α t to represent the variable ¯ α t in Ho et al.
(2020) for three reasons.
First, it makes it more clear that we only need to choose one set of hyperparameters, reducing possible cross-references of the derived variables.
Second, it allows us to introduce the generalization as well as the acceleration case easier, because the inference process is no longer motivated by a diffusion.
Third, there exists an isomorphism between α 1: T and 1 , . .
, T , which is not the case for β t .
In this section, we use β t and α t to be more consistent with the derivation in Ho et al.
(2020), where
[Equation]
[Equation]
can be uniquely determined from α t (i.e. ¯ α t ).
First, from the diffusion forward process:
[Equation]
Ho et al.
(2020) considered a speciﬁc type of p ( t ) θ ( x t − 1 | x t
[Equation]
[Equation]
which leads to the following variational objective:
[Equation]
 
One can write:
[Equation]
Ho et al.
(2020) chose the parametrization
[Equation]
which can be simpliﬁed to:
[Equation]
D E XPERIMENTAL D ETAILS D. D ATASETS AND ARCHITECTURES
We consider 4 image datasets with various resolutions: CIFAR10 ( 32 × 32 , unconditional), CelebA ( 64 × 64 ), LSUN Bedroom ( 256 × 256 ) and LSUN Church ( 256 × 256 ).
For all datasets, we set the hyperparameters α according to the heuristic in (Ho et al., 2020) to make the results directly comparable.
We use the same model for each dataset, and only compare the performance of different generative processes.
For CIFAR10, Bedroom and Church, we obtain the pretrained checkpoints from the original DDPM implementation; for CelebA, we trained our own model using the denoising objective L 1 .
Our architecture for (cid:15) ( t ) θ ( x t ) follows that in Ho et al.
(2020), which is a U-Net (Ronneberger et al., 2015) based on a Wide ResNet (Zagoruyko & Komodakis, 2016).
We use the pretrained models from Ho et al.
(2020) for CIFAR10, Bedroom and Church, and train our own model for the CelebA 64 × 64 model (since a pretrained model is not provided).
Our CelebA model has ﬁve feature map resolutions from 64 × 64 to 4 × 4 , and we use the original CelebA dataset (not CelebA-HQ) using the pre-processing technique from the StyleGAN (Karras et al., 2018) repository.
[Table]
D. R EVERSE PROCESS SUB - SEQUENCE SELECTION
We consider two types of selection procedure for τ given the desired dim( τ ) <
T :
• Linear : we select the timesteps such that τ i = (cid:98) ci (cid:99) for some c ;
• Quadratic : we select the timesteps such that τ i = (cid:98) ci 2 (cid:99) for some c
The constant value c is selected such that τ − 1 is close to T .
We used quadratic for CIFAR10 and linear for the remaining datasets.
These choices achieve slightly better FID than their alternatives in the respective datasets.
D. C LOSED FORM EQUATIONS FOR EACH SAMPLING STEP
From the general sampling equation in Eq.
(12), we have the following update equation:
[Equation]
where
[Equation]
For the case of ˆ σ (DDPM with a larger variance), the update equation becomes:
[Equation]
which uses a different coefﬁcient for (cid:15) compared with the update for η = 1 , but uses the same coefﬁcient for the non-stochastic parts
This update is more stochastic than the update for η = 1 , which explains why it achieves worse performance when dim( τ ) is small.
D. S AMPLES AND C ONSISTENCY
We show more samples in Figure 7 (CIFAR10), Figure 8 (CelebA), Figure 10 (Church) and consistency results of DDIM in Figure 9 (CelebA).
D. I NTERPOLATION
To generate interpolations on a line, we randomly sample two initial x T values from the standard
Gaussian, interpolate them with spherical linear interpolation (Shoemake, 1985), and then use the
DDIM to obtain x 0 samples.
[Equation]
where θ = arccos (cid:18) (
[Equation]
[Equation] (cid:107) x
[Equation]
0) T (cid:107)(cid:107) x (1) T (cid:107) (cid:19) .
These values are used to produce DDIM samples.
To generate interpolations on a grid, we sample four latent variables and separate them in to two pairs; then we use slerp with the pairs under the same α , and use slerp over the interpolated samples across the pairs (under an independently chosen interpolation coefﬁcient).
We show more grid interpolation results in Figure 11 (CelebA), Figure 12 (Bedroom), and Figure 13 (Church).
[Figure]