S CORE -B ASED G ENERATIVE M ODELING WITH C RITICALLY -D AMPED L ANGEVIN D IFFUSION
Anonymous authors
Paper under double-blind review
A BSTRACT
Score based generative models (
SGMs) have demonstrated remarkable synthesis quality
SGMs rely on a diffusion process that gradually perturbs the data towards a tractable distribution
, while the generative model learns to denoise
The complexity of this denoising task is, apart from the data distribution itself, uniquely determined by the diffusion process.
We argue that current SGMs employ overly simplistic diffusions, leading to unnecessarily complex denoising processes, which limit generative modeling performance.
Based on connections to statistical mechanics, we propose a novel critically-damped Langevin diffusion (CLD) and show that CLD-based SGMs achieve superior performance.
CLD can be interpreted as running a joint diffusion in an extended space, where the auxiliary variables can be considered “velocities” that are coupled to the data variables as in Hamiltonian dynamics.
We derive a novel score matching objective for CLD and show that the model only needs to learn the score function of the conditional distribution of the velocity given data, an easier task than learning scores of the data directly.
We also derive a new sampling scheme for efﬁcient synthesis from
CLD-based diffusion models.
We ﬁnd that CLD outperforms previous SGMs in synthesis quality for similar network architectures and sampling compute budgets.
We show that our novel sampler for CLD signiﬁcantly outperforms solvers such as
Euler–
Maruyama
Our framework provides new insights into score-based denoising diffusion models and can be readily used for high-resolution image synthesis.
I NTRODUCTION
Score-based generative models (SGMs) and denoising diffusion probabilistic models have emerged as a promising class of generative models (Sohl-Dickstein et al., 2015;
Song et al., 2021c;b; Vahdat et al., 2021; Kingma et al., 2021).
SGMs offer high quality synthesis and sample diversity, do not require adversarial objectives, and have found applications in image (Ho et al., 2020; Nichol &
Dhariwal, 2021; Dhariwal & Nichol, 2021; Ho et al., 2021), speech (Chen et al., 2021; Kong et al., 2021; Jeong et al., 2021), and music synthesis (Mittal et al., 2021), image editing (Meng et al., 2021; Sinha et al., 2021; Furusawa et al., 2021), super-resolution (Saharia et al., 2021; Li et al., 2021), image-to-image translation (Sasaki et al., 2021), and 3D shape generation (Luo & Hu, 2021;
Zhou et al., 2021).
SGMs use a diffusion process to gradually add noise to the data, transforming a complex data distribution to an analytically tractable prior distribution.
A neural network is then utilized to learn the score function—the gradient of the log probability density—of the perturbed data.
The learnt scores can be used to solve a stochastic differential equation (SDE) to synthesize new samples.
This corresponds to an iterative denoising process, inverting the forward diffusion.
In the seminal work by Song et al.
(2021c)
, it has been shown that the score function that needs to be learnt by the neural network is uniquely determined by the forward diffusion process.
Consequently, the complexity of the learning problem depends, other than on the data itself, only on the diffusion.
Hence, the diffusion process is the key component of SGMs that needs to be revisited to further improve SGMs, for example, in terms of synthesis quality or sampling speed.
Inspired by statistical mechanics (Tuckerman, 2010), we propose a novel forward diffusion process, the critically-damped Langevin diffusion (CLD) .
In CLD, the data variable, x t (time t along the diffusion), is augmented with an additional “velocity” variable v t and a diffusion process is run in the joint data-velocity space.
Data and velocity are coupled to each other as in Hamiltonian dynamics, and noise is injected only into the velocity variable.
Similarly as in Hamiltonian Monte
Carlo (Neal, 2011), the Hamiltonian component helps to efﬁciently traverse the joint data-velocity space and to transform the data distribution into the prior distribution more smoothly.
We derive the corresponding score matching objective and show that for CLD the neural network is tasked with learning only the score of the conditional distribution of velocity given data ∇ v t log p t ( v t | x t ) , which is arguably easier than learning the score of diffused data distribution directly.
Using techniques from molecular dynamics (Bussi & Parrinello, 2007; Tuckerman, 2010; Leimkuhler & Matthews, 2013), we also derive a novel SDE integrator tailored to CLD’s reverse-time synthesis SDE.
We extensively validate CLD and the new SDE solver: (i) We show that the neural networks learnt in CLD-based SGMs are smoother than those of previous SGMs.
(ii)
On the CIFAR-10 image modeling benchmark, we demonstrate that CLD-based models outperform previous diffusion models in synthesis quality for similar network architectures and sampling compute budgets.
We attribute these positive results to the Hamiltonian component in the diffusion and to CLD’s easier score function target, the velocity-data conditional distribution.
(iii)
We show that our novel sampling scheme for CLD signiﬁcantly outperforms the popular Euler–Maruyama method.
(iv) We perform ablations on various aspects of CLD and ﬁnd that CLD does not have difﬁcult-to-tune hyperparameters.
In summary, we make the following technical contributions: (i)
We propose CLD, a novel diffusion process for SGMs.
(ii)
We derive a score matching objective for CLD, which requires only the conditional distribution of velocity given data.
(iii)
We propose a new type of denoising score matching ideally suited for scalable training of CLD-based SGMs.
(iv) We derive a tailored SDE integrator that enables efﬁcient sampling from CLD-based models.
(v) Overall, we provide novel insights into SGMs and point out important new connections to statistical mechanics.
B ACKGROUND
Consider a diffusion process u t ∈ R d deﬁned by the Itˆo SDE
[Equation]
with continuous time variable t ∈ [0 , T ] , standard Wiener process w t , drift coefﬁcient f : R d × [0 , T ] → R d and diffusion coefﬁcient G : R d × [0 , T ] → R d × d .
Deﬁning ¯
u t :=
u T − t , a correspond- ing reverse-time diffusion process that inverts the above forward diffusion can be derived (Anderson, 1982; Haussmann & Pardoux, 1986; Song et al., 2021c)
(with positive dt and t ∈ [0 , T ] ):
[Equation]
where ∇ ¯ u t log p T − t (¯ u t ) is the score function of the marginal distribution over ¯ u t at time T − t .
The reverse-time process can be used as a generative model.
In particular, Song et al.
(2021c) model data x , setting p ( u 0 )=
p data ( x ) .
Currently used SDEs (Song et al., 2021c; Kim et al., 2021) have drift and diffusion coefﬁcients of the simple form f ( x t , t )=
f ( t ) x t and G ( x t , t )
=
g ( t ) I d .
Generally, f and G are chosen such that the SDE’s marginal, equilibrium density is approximately Normal at time T , i.e., p ( u T ) ≈N ( 0 , I d ) .
We can then initialize x 0 based on a sample drawn from a complex data distribution, corresponding to a far-from-equilibrium state.
While we let the state xrelax towards equilibrium via the forward diffusion, we can learn a model s θ ( x t , t ) for the score ∇ x t log p t ( x t ) , which can be used for synthesis via the reverse-time SDE in Eq.
If f and G take the simple form from above, the denoising score matching (Vincent, 2011) objective for this task is:
[Equation] [Equation]
If f and G are afﬁne, the conditional distribution p t ( x t | x 0 ) is Normal and available analytically (S¨arkk¨a & Solin, 2019).
Different λ ( t ) result in different trade-offs between synthesis quality and likelihood in the generative model deﬁned by s θ ( x t , t ) (Song et al., 2021b; Vahdat et al., 2021).
C RITICALLY -D AMPED L ANGEVIN D IFFUSION
We propose to augment the data x t ∈ R d with auxiliary velocity 1 variables v t ∈ R d and utilize a diffusion process that is run in the joint x t - v t -space.
With u t = ( x t , v t ) (cid:62) ∈ R 2 d , we set
[Equation]
where ⊗ denotes the Kronecker product.
The coupled SDE that describes the diffusion process is
[Equation]
which corresponds to Langevin dynamics in each dimension.
That is, each x i is independently coupled to a velocity v i , which explains the blockwise structure of f and G .
The mass M ∈ R
+ is a hyperparameter that determines the coupling between the x t and v t variables; β ∈ R
+ is a constant time rescaling chosen such that the diffusion converges to its equilibrium distribution within t ∈ [0 , T ] (in practice, we set T =1 ) when initialized from a data-deﬁned non-equilibrium state and is analogous to β ( t ) in previous diffusions (we could also use time-dependent β ( t ) , but found constant β ’s to work well, and therefore opted for simplicity); Γ ∈ R + is a friction coefﬁcient that determines the strength of the noise injection into the velocities.
Notice that the SDE in Eq.
(5) consists of two components.
The H term represents a Hamiltonian component.
Hamiltonian dynamics are frequently used in Markov chain Monte Carlo methods to accelerate sampling and efﬁciently explore complex probability distributions (Neal, 2011).
The Hamiltonian component in our diffusion process plays a similar role and helps to quickly and smoothly converge the initial joint data-velocity distribution to the equilibrium, or prior (see Fig. 1).
Furthermore, Hamiltonian dynamics on their own are trivially invertible (Tuckerman, 2010), which intuitively is also beneﬁcial in our situation when using this diffusion for training SGMs.
The O term corresponds to an OrnsteinUhlenbeck process (S ¨ arkk ¨ a & Solin, 2019) in the velocity component, which injects noise such that the diffusion dynamics properly converge to equilibrium for any Γ > 0 .
It can be shown that the equilibrium distribution of this diffusion is p EQ ( u ) =
N ( x ; 0 d , I d ) N ( v ; 0 d , M I d ) (see App.
B.2).
There is a crucial balance between M and Γ (McCall, 2010):
For Γ 2 < 4 M ( underdamped Langevin dynamics) the Hamiltonian component dominates, which implies oscillatory dynamics of x t and v t that slow down convergence to equilibrium.
For Γ 2 > 4 M ( overdamped Langevin dynamics)
the Oterm dominates which also slows down convergence, since the accelerating effect by the Hamiltonian component is suppressed due to the strong noise injection.
For Γ 2 =4 M ( critical damping ), an ideal balance is achieved and convergence to p EQ ( u ) occurs as fast as possible in a smooth manner without oscillations (also see discussion in App. A.1)
(McCall, 2010).
Hence, we propose to set Γ 2 =4 M and call the resulting diffusion critically-damped Langevin diffusion (CLD) (see Fig. 1).
Diffusions such as the VPSDE (Song et al., 2021c) correspond to overdamped Langevin dynamics with high friction coefﬁcients Γ (see App.
A.2).
Furthermore, in previous works noise is injected directly into the data variables (pixels, for images).
In CLD, only the velocity variables are subject to direct noise and the data is perturbed only indirectly due to the coupling between x t and v t .
3. S CORE M ATCHING O BJECTIVE
Considering the appealing convergence properties of
CLD, we propose to utilize
CLD as forward diffusion process in SGMs.
To this end, we initialize the joint p ( u 0 )
=
p ( x 0 ) p ( v 0 )
=
p data ( x 0 ) N ( v 0 ; 0 d , γM I d ) with hyperparameter γ< 1 and let the distribution diffuse towards the tractable equilibrium—or prior—distribution p EQ ( u ) .
We can then learn the corresponding score functions and deﬁne CLD-based SGMs.
Following a similar derivation as Song et al.
(2021b), we obtain the score matching (SM) objective (see App.
B.3):
[Equation]
Notice that this objective requires only the velocity gradient of the log-density of the joint distribution, i.e., ∇ v t log p t ( u t ) .
This is a direct consequence of injecting noise into the velocity variables only .
Without loss of generality, p t ( u t )=
p t ( x t , v t )=
p t ( v t | x t
[Equation]
p t ( x t ) .
Hence,
[Equation] [Equation]
This means that in CLD the neural network-deﬁned score model s θ ( u t , t ) only needs to learn the score of the conditional distribution p t ( v t | x t ) , an arguably easier task than learning the score of p t ( x t ) , as in previous works, or of the joint p t ( u t ) .
This is the case, because our velocity distribution is initialized from a simple Normal distribution, such that p t ( v t | x t ) is closer to a Normal distribution for all t ≥ 0 (and for any x t ) than p t ( x t ) itself.
This is most evident at t =0 :
The data and velocity distributions are independent at t =
and the score of p 0 ( v 0 | x 0 )
=
p 0 ( v 0 ) simply corresponds to the score of the Normal distribution p 0 ( v 0 ) from which the velocities are initialized, whereas the score of the data distribution p 0 ( x 0 ) is highly complex and can even be unbounded (Kim et al., 2021).
We empirically verify the reduced complexity of the score of p t ( v t | x t ) in
Fig.
We ﬁnd that the score that needs to be learnt by the model is more similar to a score corresponding to a
Normal distribution for CLD than for the VPSDE.
We also measure the complexity of the neural networks that were learnt to model this score via the squared Frobenius norm of their Jacobians.
We ﬁnd that the CLD-based SGMs have signiﬁcantly simpler and smoother neural networks than
VPSDE-based SGMs for most t , in particular when leveraging a mixed score formulation (see next section).
3. S CALABLE T RAINING
A Practical Objective.
We cannot train directly with
Eq.
(6), since we do not have access to the marginal distribution p t ( u t ) .
As presented in Sec. 2, we could employ denoising score matching (DSM) and instead sample u 0 , and diffuse those samples, which would lead to a tractable objective.
However, recall that in CLD the distribution at t =0 is the product of a complex data distribution and a Normal distribution over the initial velocity.
Therefore, we propose a hybrid version of score matching (Hyv¨arinen, 2005) and denoising score matching (Vincent, 2011), which we call hybrid score matching (HSM).
In
HSM, we draw samples from p 0 ( x 0 )=
p data ( x 0 ) as in DSM, but then diffuse those samples while marginalizing over the full initial velocity distribution p 0 ( v 0 )=
N ( v ; 0 d , γM I d ) as in regular SM (HSM is discussed in detail in App. C).
Since p 0 ( v 0 ) is Normal (and f and G afﬁne), p ( u t | x 0 ) is also Normal and this remains tractable.
We can write this HSM objective as:
[Equation]
In HSM, the expectation over p 0 ( v 0 ) is essentially solved analytically, while DSM would use a sample-based estimate.
In particular, when drawing a sample u 0 to diffuse in DSM, we are essentially placing an inﬁnitely sharp Normal with unbounded score (Kim et al., 2021) at u 0 , which requires undesirable modiﬁcations or truncation tricks for stable training (Song et al., 2021c; Vahdat et al., 2021).
Hence, with DSM we could lose some beneﬁts of the CLD framework discussed in
Sec. 3.1, whereas HSM is tailored to CLD and fundamentally avoids such unbounded scores.
Closed form expressions for the perturbation kernel p t ( u t | x 0 ) are provided in App.
B.1.
Score Model Parametrization.
(i)
Ho et al.
(2020) found that it can be beneﬁcial to parameterize the score model to predict the noise that was used in the reparametrized sampling to generate perturbed samples u t .
For CLD, u t = µ t ( x 0 )
+ L t (cid:15) 2 d , where Σ t =
L t L (cid:62) t is the Cholesky decomposition of p t ( u t | x 0 ) ’s covariance matrix, (cid:15)
2 d ∼ N ( (cid:15) 2 d ; 0 2 d , I 2 d ) , and µ t ( x 0 ) is p t ( u t | x 0 )
’s mean.
Furthermore, ∇ v t log p t ( u t | x 0 ) =
− (cid:96) t (cid:15) d :2 d , where (cid:15) d :2 d denotes those d components of (cid:15) 2 d that actually affect ∇ v t log p t ( u t | x 0 ) (since we take velocity gradients only, not all are relevant).
With
[Equation]
we have (cid:96)
[Equation]
(ii) Vahdat et al. (2021) showed that it can be beneﬁcial to assume that the diffused marginal distribution is Normal at all times and parametrize the model with a Normal score and a residual “correction”.
For CLD, the score is indeed Normal at t =
(due to the independently initialized x and v at t =0 ).
Similarly, the target score is close to Normal for large t , as we approach the equilibrium.
Based on (i) and (ii) , we parameterize s θ ( u t , t ) =
− (cid:96) t
α θ ( u t , t ) with α θ ( u t , t ) =
(cid:96) − 1 t v t / Σ vvt + α (cid:48) θ ( u t , t ) , where Σ vvt corresponds to the v - v component of the “per-dimension” covariance matrix of the Normal distribution p t ( u t | x 0 = 0 d ) .
In other words, we assumed p 0 ( x 0 )
=
δ ( x ) when deﬁning the analytic term of the score model.
Formally, − v / Σ vvt is the score of a Normal distribution with covariance ˆ Σ vv t I d .
Following Vahdat et al.
, we refer to this parameterization as mixed score parameterization .
Alternative model parameterizations are possible, but we leave their exploration to future work.
With this deﬁnition, the HSM training objective becomes (details in App.
B.3):
[Equation]
which corresponds to training the model to predict the noise only injected into the velocity during reparametrized sampling of u t , similar to noise prediction in Ho et al.
Song et al.
(2021c).
Objective Weightings.
For λ ( t ) =
Γ β , the objective corresponds to maximum likelihood learning (Song et al., 2021b)
(see App. B.3).
Analogously to prior work (Ho et al., 2020; Vahdat et al., 2021;
Song et al., 2021b), an objective better suited for high quality image synthesis can be obtained by setting λ ( t ) =
(cid:96) − 2 t , which corresponds to “dropping the variance prefactor” (cid:96) 2 t .
3. S AMPLING FROM CLD- BASED SGM S
To sample from the CLD-based SGM we can either directly simulate the reverse-time diffusion process (Eq.
(2)) or, alternatively, solve the corresponding probability ﬂow ODE (Song et al., 2021c;b) (see App. B.5).
To simulate the SDE of the reverse-time diffusion process, previous works often relied on Euler-Maruyama (EM) (Kloeden & Platen, 1992) and related methods (Ho et al., 2020; Song et al., 2021c;
Jolicoeur-Martineau et al., 2021a).
We derive a new solver, tailored to CLD-based models.
Here, we provide the high-level ideas and derivations (see App.
D for details).
Our generative SDE can be written as (with ¯ u t =
u T − t , ¯ x t = x T − t , ¯ v
[Equation]
−
[Equation] [Equation]
It consists of a Hamiltonian component A H , an Ornstein-Uhlenbeck process A O , and the score model term S .
We could use EM to integrate this SDE; however, standard Euler methods are not well-suited for Hamiltonian dynamics (Leimkuhler & Reich, 2005; Neal, 2011).
Furthermore, if S was 0 , we could solve the SDE in closed form.
This suggests the construction of a novel integrator.
We use the Fokker-Planck 2 operator formalism (Tuckerman, 2010; Leimkuhler & Matthews, 2013; 2015).
Using a similar notation as Leimkuhler & Matthews (2013), the Fokker-Planck equation corresponding to the generative SDE is ∂p t (¯ u t ) /∂t =(
ˆ L ∗
A + ˆ L ∗ S )
p t (¯ u t ) , where ˆ L ∗ A and ˆ L ∗ S are the non-commuting Fokker-Planck operators corresponding to the A :
=
A
H + A O and S terms, respectively.
Expressions for ˆ L ∗ A and ˆ L ∗ S are in App.
D. We can construct a formal, but intractable solution of the generative SDE as ¯ u t =
e t ( ˆ L ∗ A
+ ˆ L ∗ S )
¯ u 0 , where the operator e t ( ˆ L ∗
A + ˆ L ∗ S ) (known as the classical propagator in statistical physics) propagates states ¯ u 0 for time t according to the dynamics deﬁned by the combined operators ˆ L ∗ A + ˆ L ∗ S .
Although this operation is not analytically tractable, it can serve as starting point to derive a practical integrator.
Using the symmetric Trotter theorem or Strang splitting formula as well as the Baker–Campbell–Hausdorff formula (Trotter, 1959; Strang, 1968;
Tuckerman, 2010), it can be shown that:
[Equation]
with time step δt :=
t/N , where N ∈ N + .
The expression suggests that instead of directly evaluating the intractable e t ( ˆ L ∗ A + ˆ L ∗ S ) , we can discretize the dynamics over t into N pieces of step size δt , such that we only need to apply the individual e δt 2 ˆ L ∗ A and e δt ˆ L ∗ S
many times one after another for small time steps δt .
A ﬁner discretization results in a smaller error (since N = t/δt the error effectively scales as O ( δt 2 ) for ﬁxed t ).
Hence, this implies an integration method.
Indeed, e δt 2 ˆ L ∗
A ¯ u t is available in closed form, as mentioned before.
However, e δt ˆ L ∗ S ¯ u t is not.
Therefore, we approximate this latter component of the integrator via a standard Euler step.
Thus, the integrator formally has an error of the same order as standard EM methods.
Nevertheless, as long as the dynamics is not dominated by the S component, our proposed integration scheme is expected to be more accurate than
EM, since we split off the analytically tractable part and only use an Euler approximation for the S term.
Recall that the model only needs to learn the score of the conditional distribution p t ( v t | x t ) , which is close to Normal for much of the diffusion, in which case the S term will indeed be small.
This suggests that the generative SDE dynamics are in fact dominated by A H and A O in practice.
Note that only the propagator e δt ˆ L ∗ S is computationally expensive, as it involves evaluating the neural network.
We coin our novel SDE integrator for CLD-based SGMs Symmetric Splitting CLD
Sampler (SSCS).
A detailed derivation, analyses, and a formal algorithm are presented in App.
D.
R ELATED W ORK
Relations to Statistical Mechanics and Molecular Dynamics.
Learning a mapping between a simple, tractable and a complex distribution as in SGMs is inspired by annealed importance sampling (Neal, 2001) and the Jarzynski equality from non-equilibrium statistical mechanics (Jarzynski, 1997a;b; 2011).
However, after Sohl-Dickstein et al. (2015), little attention has been given to the origins of SGMs in statistical mechanics.
Intuitively, in SGMs the diffusion process is initialized in a non-equilibrium state u
and we would like to bring the system to equilibrium, i.e., the tractable prior distribution, as quickly and as smoothly as possible to enable efﬁcient denoising.
This “equilibration problem” is a much-studied problem in statistical mechanics, particularly in molecular dynamics, where a molecular system is often simulated in thermodynamic equilibrium.
Algorithms to quickly and smoothly bring a system to and maintain at equilibrium are known as thermostats .
In fact, CLD is inspired by the Langevin thermostat (Bussi & Parrinello, 2007).
In molecular dynamics, advanced thermostats are required in particular for “multiscale” systems that show complex behaviors over multiple time- and length-scales.
Similar challenges are also encountered when modeling complex data, such as natural images.
Hence, the vast literature on thermostats (Andersen, 1980; Nos´e, 1984;
Hoover, 1985; Martyna et al., 1992; H¨unenberger, 2005; Bussi et al., 2007; Ceriotti et al., 2009; 2010; Tuckerman, 2010) may be valuable for the development of future SGMs.
Also the framework for developing SSCS is borrowed from statistical mechanics.
The same techniques have been used to derive molecular dynamics algorithms (Tuckerman et al., 1992; Bussi & Parrinello, 2007; Ceriotti et al., 2010; Leimkuhler & Matthews, 2013; 2015; Kreis et al., 2017).
Further Related Work.
Generative modeling by learning stochastic processes has a long history (Movellan, 2008; Lyu, 2009; Sohl-Dickstein et al., 2011; Bengio et al., 2014; Alain et al., 2016;
Goyal et al., 2017; Bordes et al., 2017; Song & Ermon, 2019;
Ho et al., 2020).
We build on Song et al.
(2021c), which introduced the SDE framework for modern SGMs.
Nachmani et al.
(2021) recently introduced non-Gaussian diffusion processes with different noise distributions.
However, the noise is still injected directly into the data, and no improved sampling schemes or training objectives are introduced.
Vahdat et al.
(2021) proposed LSGM, which is complementary to CLD: we improve the diffusion process itself, whereas LSGM “simpliﬁes the data” by ﬁrst embedding it into a smooth latent space.
LSGM is an overall more complicated framework, as it is trained in two stages and relies on additional encoder and decoder networks.
Recently, techniques to accelerate sampling from pre-trained SGMs have been proposed (San-Roman et al., 2021; Watson et al., 2021;
Kong & Ping, 2021; Song et al., 2021a).
Importantly, these methods usually do not permit straightforward likelihood estimation (Song et al., 2021a). Therefore, it is unclear whether they suffer from decreased diversity in the few-step limit.
Furthermore, they are usually developed for discrete-step diffusion models and not the continuous time framework, which we use.
A complementary work to CLD is “Gotta Go Fast” (GGF)
(Jolicoeur-Martineau et al., 2021a), which introduces an adaptive SDE solver for SGMs, tuned towards image synthesis.
GGF uses standard
Euler-based methods under the hood (Kloeden & Platen, 1992; Roberts, 2012), in contrast to our
SSCS that is derived from ﬁrst principles.
Furthermore, our SDE integrator for CLD does not make any data-speciﬁc assumptions and performs extremely well even without adaptive step sizes.
Some works study SGMs for maximum likelihood training (Song et al., 2021b; Kingma et al., 2021;
Huang et al., 2021).
Note that we did not focus on training our models towards high likelihood.
Furthermore, Chen et al.
and
Huang et al.
(2020) recently trained augmented Normalizing
Flows, which have conceptual similarities with our velocity augmentation.
Methods leveraging auxiliary variables similar to our velocities are also used in statistics—such as Hamiltonian Monte
Carlo (Neal, 2011)—and have found applications, for instance, in Bayesian machine learning (Chen et al., 2014;
Ding et al., 2014; Shang et al., 2015).
As shown in Ma et al.
(2019), our velocity is equivalent to momentum in gradient descent and related methods (Polyak, 1964; Kingma & Ba, 2015).
Momentum accelerates optimization; the velocity in CLD accelerates mixing in the diffusion process.
Lastly, our CLD method can be considered as a second-order Langevin algorithm, but even higher-order schemes are possible (Mou et al., 2021) and could potentially further improve SGMs.
E XPERIMENTS
Architectures.
We focus on image synthesis and implement CLD-based SGMs using NCSN++ and
DDPM++ (Song et al., 2021c) with 6 input channels (for velocity and data) instead of 3.
Relevant Hyperparameters.
CLD’s hyperparameters are chosen as β =4 , Γ=1 (or equivalently
M − 1 =4 ) in all experiments.
We set the variance scaling of the inital velocity distribution to γ =0 .and
use the proposed HSM objective with the weighting λ ( t )=
(cid:96) − 2 t , which promotes image quality.
Sampling.
We generate model samples via:
(i) Probability ﬂow using a Runge–Kutta 4(5) method; reverse-time generative SDE sampling using either (ii) EM or (iii) our SSCS.
For methods without adaptive stepsize (EM and SSCS), we use evaluation times chosen according to a quadratic function, like previous work (Song et al., 2021a; Kong & Ping, 2021; Watson et al., 2021)
(indicated by QS).
Evaluation.
We measure image sample quality for CIFAR-10 via Fr ´ echet inception distance (FID) with 50k samples (Heusel et al., 2017).
We also evaluate an upper bound on the negative loglikelihood (NLL): − log p ( x 0 ) ≤− E v 0 ∼ p ( v 0 ) log p ε ( x 0 , v 0 ) − H , where H is the entropy of p ( v 0 ) and log p ε ( x 0 , v 0 ) is an unbiased estimate of log p ( x 0 , v 0 ) from the probability ﬂow ODE (Grathwohl et al., 2019; Song et al., 2021c).
As in Vahdat et al.
(2021), the stochasticity of log p ε ( x , v ) prevents us from performing importance weighted NLL estimation over the velocity distribution (Burda et al., 2015).
We also record the number of function—neural network—evaluations (NFEs) during synthesis when comparing sampling methods.
All implementation details in App.
B.5 and E.
5. I MAGE G ENERATION
Following Song et al.
(2021c), we focus on the widely used CIFAR-10 unconditional image generation benchmark.
Our CLD-based SGM achieves an FID of 2.25 based on the probability ﬂow ODE and an FID of 2.23 via simulating the generative SDE (Tab. 1).
The only models marginally outperforming CLD are LSGM (Vahdat et al., 2021) and NSCN++/VESDE with 2,000 step predictorcorrector sampling (Song et al., 2021b).
However, LSGM uses a model with ≈ 475 M parameters to achieve its high performance, while we obtain our numbers with a model of ≈ 100 M parameters.
For a fairer comparison, we trained a smaller LSGM also with ≈ 100 M parameters, which is reported as “LSGM-100M” in Tab. 1 (details in App. E.2.7).
Our model has a signiﬁcantly lower FID score than “LSGM-100M”.
In contrast to NSCN++/VESDE, we achieve extremely strong results with much fewer NFEs (for example see n ∈{ 150 , 275 , 500 } in Tab. 3 and also Tab.
2)—the VESDE performs poorly in this regime.
We conclude that when comparing models with similar network capacity and under NFE budgets ≤ 500 , our CLD-based SGM outperforms all published results in terms of FID.
We attribute these positive results to our easier score matching task.
Furthermore, our model reaches an NLL bound of 3 . 31 , which is on par with recent works such as Nichol & Dhariwal (2021); Austin
[Table]
[Figure]
(Luhman & Luhman, 2021) -
[Figure]
SNGAN (Miyato et al., 2018) -
[Figure]
+DGﬂow (Ansari et al., 2021) -
[Figure]
(Gong et al., 2019) -
[Figure]
(Jiang et al.,
[Figure]
[Figure] [Figure]
(Karras et al.,
[Figure] [Figure]
[Figure]
al
[Figure]
[Figure] [Figure]
[Figure] [Figure]
al
[Figure]
[Figure] [Figure]
(Jun et al.,
[Figure] [Figure]
[Figure]
et al.,
[Figure]
[Figure] [Figure]
Dhariwal, 2018)
[Figure] [Figure]
[Figure]
(Chen et al.,
[Figure] [Figure]
(Vahdat & Kautz, 2020)
[Figure] [Figure]
et al
[Figure]
[Figure] [Figure]
et al
[Figure]
[Figure] [Figure]
[Figure] [Figure]
[Figure] [Figure]
et al.,
[Figure] [Figure]
[Figure] [Figure]
et al.
; Vahdat et al.
and indicates that our model is not dropping modes.
However, our bound is potentially quite loose (see discussion in App. B.5) and the true NLL might be signiﬁcantly lower.
We did not focus on training our models towards high likelihood.
To demonstrate that CLD is also suitable for high-resolution image synthesis, we additionally trained a CLD-SGM on CelebA-HQ-256, but without careful hyperparameter tuning due to limited compute resources.
Model samples in Fig.
4 appear diverse and high-quality (additional samples in App. F).
5. S AMPLING S PEED AND S YNTHESIS Q UALITY T RADE -O FFS
We analyze the sampling speed vs. synthesis quality trade-off for CLD-SGM and study SSCS’s performance under different NFE budgets in Tabs.
2 and 3.
We compare to Song et al.
(2021c)
and use EM to solve the generative SDE for their VPSDE models and PC (reverse-diffusion + Langevin sampler) for VESDE models, which corresponds to their recommended settings 3 .
We also compare to the GGF (Jolicoeur-Martineau et al., 2021a) solver for the generative SDE as well as probability ﬂow sampling with a higher-order adaptive stepsize solver.
Further, we compare to LSGM (Vahdat et al., 2021) (using our LSGM-100M model), which also relies on probability ﬂow sampling.
We do not compare to few-step sampling methods such as DDIM (Song et al., 2021a), since they do not permit likelihood estimation. This may imply that they trade off synthesis quality for diversity, which makes a fair comparison difﬁcult.
With one exception (VESDE with 2,000 NFE) our CLDSGM outperforms all baselines, both when comparing to adaptive and ﬁxed-step size methods.
Several observations stand out: (i) As expected (Sec. 3.3), for CLD, SSCS signiﬁcantly outperforms
EM under limited NFE budgets.
When using a ﬁne discretization of the SDE (high NFE), the two perform similarly, which is also expected, as the errors of both methods will become negligible.
(ii)
In the adaptive solver setting, using a simpler ODE solver, we even outperform GGF, which is tuned towards image synthesis.
(iii) Our CLD-SGM also outperforms the LSGM-100M model in terms of FID.
It is worth noting, however, that LSGM was designed primarily for faster synthesis, which it achieves by modeling a smooth distribution in latent space instead of the more complex data distribution directly.
This suggests that it would be promising to combine LSGM with CLD and train a CLD-based LSGM, to combine the strengths of the two approaches.
It would also be
[Table]
interesting to develop a more advanced, adaptive SDE solver that leverages SSCS as the backbone and, for example, potentially test our method within a framework like GGF.
Our current SSCS only allows for ﬁxed step sizes—nevertheless, it achieves excellent performance.
5. A BLATION S TUDIES
[Table]
[Table] [Table]
We perform ablation studies to study CLD’s new hyperparameters (run with a smaller version of our CLD-SGM used above; App.
E for details).
Mass Parameter: Tab. 4 shows results for a CLD-SGM trained with different M − 1 (also recall that M − 1 and Γ are tied together via Γ 2 = 4 M ; we are always in the critical-damping regime).
Different mass values perform mostly similarly.
Intuitively, training with smaller M − 1 means that noise ﬂows from the velocity variables v t into the data x t more slowly, which necessitates a larger time rescaling β .
We found that simply tying M − 1 and β together via β =8 √ M works well and did not further ﬁne-tune.
Initial Velocity Distribution: Tab. 5 shows results for a CLD-SGM trained with different initial velocity variance scalings γ .
Varying γ similarly has only a small effect, but small γ seems slightly beneﬁcial for FID, while the NLL bound suffers a bit.
Due to our focus on synthesis quality as measued by FID, we opted for small γ .
Intuitively, this means that the data at t =0 is “at rest”, and noise ﬂows from the velocity into the data variables only slowly.
Mixed Score: Similar to previous work (Vahdat et al., 2021), we ﬁnd training with the mixed score (MS) parametrization (Sec. 3.2) beneﬁcial.
With MS, we achieve an FID of 3.14, without only 3.56.
Hybrid Score Matching: We also tried training with regular DSM, instead of HSM.
However, training often became unstable.
As discussed in Sec. 3.2, this is likely because when using standard
DSM our CLD would suffer from unbounded scores close to t =0 , similar to previous SDEs (Kim et al., 2021).
Consequently, we consider our novel HSM a crucial element for training CLD-SGMs.
We conclude that CLD does not come with difﬁcult-to-tune hyperparameters.
We expect our chosen hyperparameters to immediately translate to new tasks and models.
In fact, we used the same M − 1 , γ , MS and HSM settings for CIFAR-10 and CelebA-HQ-256 experiments without ﬁne-tuning.
C ONCLUSIONS
We presented critically-damped Langevin diffusion , a novel diffusion process for training SGMs.
CLD diffuses the data in a smoother, easier-to-denoise manner compared to previous SGMs, which results in smoother neural network-parametrized score functions, fast synthesis, and improved expressivity.
Our experiments show that CLD outperforms previous SGMs on image synthesis for similar-capacity models and sampling compute budgets, while our novel SSCS is superior to EM in
CLD-based SGMs.
From a technical perspective, in addition to proposing CLD, we derive CLD’s score matching objective termed as HSM, a variant of denoising score matching suited for CLD, and we derive a tailored SDE integrator for CLD.
Inspired by methods used in statistical mechanics, our work provides new insights into SGMs, and implies promising directions for future research.
We believe that CLD can potentially serve as the backbone diffusion process of next generation
SGMs.
Future work includes using CLD-based SGMs for generative modeling tasks beyond images, combining CLD with techniques for accelerated sampling from SGMs, adapting CLD-based SGMs towards maximum likelihood, and utilizing other thermostating methods from statistical mechanics.
E THICS AND R EPRODUCIBILITY
Our paper focuses on fundamental algorithmic advances to improve the generative modeling performance of SGMs.
As such, the proposed CLD does not imply immediate ethical concerns.
However, we validate CLD on image synthesis benchmarks.
Generative modeling of images has promising applications, for example for digital content creation and artistic expression (Bailey, 2020), but can also be used for nefarious purposes (Vaccari & Chadwick, 2020; Mirsky & Lee, 2021;
Nguyen et al., 2021).
It is worth mentioning that compared to generative adversarial networks (Goodfellow et al., 2014), a very popular class of generative models, SGMs have the promise to model the data more faithfully, without dropping modes and introducing problematic biases.
Generally, the ethical impact of our work depends on its application domain and the task at hand.
To aid reproducibility of the results and methods presented in our paper, we will make source code to reproduce all quantitative and qualitative results of the paper publicly available, including detailed instructions.
Furthermore, all training details and hyperparameters are already in detail described in the Appendix, in particular in App.
E.
A L ANGEVIN D YNAMICS
Here, we discuss different aspects of Langevin dynamics.
Recall the Langevin dynamics, Eq.
(5), from the main paper:
[Equation]
Ornstein
[Equation]
Uhlenbeck
[Equation]
A. D IFFERENT D AMPING R ATIOS
As discussed in Sec. 3, Langevin dynamics can be run with different ratios between mass M and squared friction Γ 2 .
To recap from the main paper:
(i) For Γ 2 < 4 M ( underdamped Langevin dynamics), the Hamiltonian component dominates, which implies oscillatory dynamics of x t and v t that slow down convergence to equilibrium.
(ii) For Γ 2 > 4 M ( overdamped Langevin dynamics), the O -term dominates which also slows down convergence, since the accelerating effect by the Hamiltonian component is suppressed due to the strong noise injection.
(iii) For Γ 2 = 4 M ( critical-damping ), an ideal balance is achieved and convergence to p EQ ( u ) occurs as fast as possible in a smooth manner without oscillations.
In Fig.
5, we visualize diffusion trajectories according to Langevin dynamics run in the different damping regimes.
We observe that underdamped Langevin dynamics show undesired oscillatory behavior, while overdamped Langevin dynamics perform very inefﬁciently, too.
Critical-damping achieves a good balance between the two and mixes and converges quickly.
In fact, it can be shown to be optimal in terms of convergence; see, for example, McCall (2010).
Consequently, we propose to set Γ 2 =
Γ 2 critical :
= 4 M in CLD.
A. V ERY H IGH F RICTION L IMIT AND C ONNECTION TO PREVIOUS SDE S IN SGM S
Let us re-write the above Langevin dynamics and consider the more general case with timedependent β ( t ) :
[Equation]
To solve this SDE
[Equation]
let us assume a simple Euler-based integration scheme
[Equation]
with the update equation for a single step at time t (this integration scheme would not be optimal, as discussed in Sec. 3.3.
, however, it would be accurate for sufﬁciently small time steps
and we just need this to make the connection to previous works like the VPSDE):
[Equation]
Now, let’s assume a friction coefﬁcient Γ =
Γ max :=
M β ( t ) δt .
Since the time step δt is usually very small, this correspond to a very high friction.
In fact, it can be considered the maximum friction limit, at which the friction is so large that the current step velocity (i) is completely cancelled out by the friction term (iii) .
We obtain:
[Equation] [Equation]
Now the velocity update, Eq.
(19), does not depend on the current step velocity on the right-handside anymore.
Hence, we can insert Eq.
(19) directly into Eq.
(18) and obtain:
[Equation] [Equation]
[Equation]
Re-deﬁning δt (cid:48) :
=
δt 2 and β (cid:48) ( t ) :
= β ( t ) 2 , we obtain
[Equation]
which corresponds to the high-friction overdamped Langevin dynamics that are frequently run, for example, to train energy-based generative models (Du & Mordatch, 2019; Xiao et al., 2021).
Let’s further absorb the mass M − 1 and the time step δt (cid:48) into the time rescaling, deﬁning ˆ β ( t ) :
= 2 β (cid:48) ( t ) M
[Equation]
δt
[Equation]
We obtain:
[Equation] [Equation]
where the last approximation is true for sufﬁciently small ˆ β ( t ) .
However, this expression corresponds to
[Equation]
which is exactly the transition kernel of the VPSDE’s
Markov chain (Ho et al., 2020; Song et al., 2021c).
We see that the VPSDE corresponds to the high-friction limit of a more general Langevin dynamics-based diffusion process of the form of Eq.
If we assume a diffusion as above but with the potential term (ii) set to 0 , we can similarly derive the VESDE Song et al.
(2021c) as a high-friction limit of the corresponding diffusion.
Generally, all previously used diffusions that inject noise directly into the data variables correspond to such high-friction diffusions.
In conclusion, we see that previous high-friction diffusions require an excessive amount of noise to be injected to bring the dynamics to the prior, which intuitively makes denoising harder.
For our
CLD in the critical damping regime we can run the diffusion for a much shorter time or, equivalently, can inject less noise to converge to the equilibrium, i.e., the prior.
[Equation]
L ANGEVIN D IFFUSION
Here, we present further details about our proposed critically-damped Langevin diffusion (CLD).
We provide the derivations and formulas that were not presented in the main paper in the interest of brevity.
B. P ERTURBATION K ERNEL
To recap from the main text, in this work we propose to augment the data x t ∈ R d with auxiliary velocity variables v t ∈ R d .
We then run the following diffusion process in the joint x t - v t -space
[Equation]
where w t is a standard Wiener process in R 2 d and β : [0 , T ] → R +0 is a time rescaling 4 .
In particular, we consider the critically-damped Langevin diffusion which can be obtained by setting M =
Γ 2 / 4 , resulting in the following drift kernel
[Equation]
Since we only consider the critically-damped cased in this work, we redeﬁne f := f CLD and f := f CLD for simplicity.
Since our drift f and diffusion G coefﬁcients are afﬁne, u t is Normally distributed for all t ∈ [0 , T ] if u t (cid:48) is Normally distributed for some t (cid:48)
[Equation]
Solin, 2019).
In particular, given that u t (cid:48) ∼ N ( u t (cid:48) ; µ t (cid:48) , Σ t (cid:48) =
Σ t (cid:48) ⊗ I d ) , we derive expressions for µ t and Σ t =
Σ t ⊗ I d , the mean and the covariance matrix of u t , respectively.
Here Σ t (cid:48) is a positive-deﬁnite diagonal 2-by-2 matrix and Σ t is a symmetric positive-deﬁnite 2-by-2 matrix.
Following (Section 6.1, S¨arkk¨a & Solin, 2019), the mean and covariance matrix of u t follow the following respective ordinary differential equations (ODEs)
[Equation]
Notating µ t (cid:48) =
( x t (cid:48) , v t (cid:48) ) (cid:62) , the solutions to the above ODEs are
[Equation]
and Σ
[Equation] [Equation]
[Equation]
where B ( t ) = (cid:82) t t (cid:48) β (ˆ t )
d ˆ t .
For constant β ( t ) =
β (as is used in all our experiments), we simply have
B ( t ) =
( t − t (cid:48) )
β .
The correctness of the proposed mean and covariance matrix can be veriﬁed by simply plugging them back in their respective ODEs.
With the above derivations, we can ﬁnd analytical expression for perturbation kernels p ( u t | · ) .
For example, when conditioning on the the inital data and variance (used in denoising score matching (DSM)), the mean and covariance matrix of the perturbation kernel p ( u t | u 0 ) can be obtained by setting µ 0 = ( x 0 , v 0 ) (cid:62) , Σ xx
= 0 , and Σ vv 0 = 0 .
In our experiments, the initial velocity distribution is set to N ( 0 d , γM I d ) .
Conditioning only on the initial data and marginalizing over the full initial velocity distribution (used in hybrid score matching (HSM), see Sec. C), the mean and covariance matrix of the perturbation kernel p ( u t | x 0 ) can be obtained by setting µ
= ( x 0 , 0 d ) (cid:62) , Σ xx
= 0 , and Σ vv 0 = γM .
B. C ONVERGENCE AND E QUILIBRIUM
Our CLD-based training of SGMs—as well as denoising diffusion models more generally—relies on the fact that the diffusion converges towards an analytically tractable equilibrium distribution for sufﬁciently large t .
In fact, from the above equations we can easily see that,
[Equation] [Equation]
which establishes p EQ ( u
[Equation]
= N ( x
[Equation]
Notice that our CLD is an instantiation of the more general Langevin dynamics deﬁned by
[Equation]
which has the equilibrium distribution ˆ p EQ ( u )
= p pot ( x ) N ( v ; 0 d , M I d ) (Leimkuhler & Matthews, 2015; Tuckerman, 2010).
However, the perturbation kernel of this Langevin dynamics is not available analytically anymore for arbitrary p pot ( x ) .
In our case, however, we have the analytically tractable p pot ( x ) =
N ( x ; 0 d , I d ) .
Note that this correspond to the classical “harmonic oscillator” problem from physics.
B. CLD O BJECTIVE
To derive the objective for training CLD-based SGMs, we start with a derivation that targets maximum likelihood training in a similar fashion to Song et al.
(2021b).
Let p 0 and q 0 be two densities, then
[Equation]
where p t and q t are the marginal densities of p 0 and q 0 , respectively, diffused by our criticallydamped Langevin diffusion.
As has been shown in Song et al.
(2021b), Eq .equation 48 can be written as a mixture of score matching losses.
To this end, let us consider the Fokker–Planck equation associated with the the critically-damped Langevin diffusion:
[Equation]
Similarly
[Equation]
we have ∂q t ( u t ) ∂t = ∇ u t · [ h q ( u t , t ) q t ( u t )] .
Assuming log p t ( u t ) and log q t ( u t ) are smooth functions with at most polynomial growth at inﬁnity
[Equation]
we have
[Equation]
Using the above fact
[Equation]
we can compute the time-derivative of the Kullback–Leibler divergence between p t and q t as
[Equation]
[Equation]
Notice that due to the form of G , we now have only gradients with respect to the velocity component v t .
Combining the above with Eq.
(48), we have
[Equation] [Equation]
where λ ( t ) =
Γ β ( t ) .
Note that the approximation holds if D KL ( p T (cid:107) q T ) is insigniﬁcantly small
[Equation]
As shown in App.
C, the above can be rewritten, up to irrelevant constant terms, as either of the following two objectives:
[Equation]
For both HSM and DSM, we have shown in App.
B.1 that the perturbation kernels p t ( u t | x 0 ) and p t ( u t | x 0 ) are Normal distributions with the following structure of the covariance matrix:
[Equation]
We can use this fact to compute the gradient ∇ u t p t ( u
[Equation]
| · )
[Equation]
where (cid:15)
d ∼ N ( 0 , I 2 d ) and Σ t =
L t L (cid:62) t is the Cholesky factorization of the covariance matrix Σ t .
Note that the structure of Σ t implies that L t =
L t ⊗ I d , where L t L (cid:62) t is the Cholesky factorization of Σ t , i.e,
L t =
[Equation] [Equation]
Furthermore, we have
[Equation] [Equation]
Using the above, we can compute
[Equation]
where (cid:96)
[Equation]
72) and (cid:15)
d :2 d denotes those (latter)
d components of (cid:15) 2 d that actually affect ∇ v t log p t ( u t |· ) .
Note that (cid:96) t depends on the conditioning in the perturbation kernel, and therefore (cid:96) t is different for
DSM, which is based on p ( u t | u 0 ) , and HSM, which is based on p ( u t | x 0 ) .
Therefore, we will henceforth refer to (cid:96) HSM t and (cid:96) DSM t
if distinction of the two cases is necessary (otherwise we will simply refer to (cid:96) t for both).
As discussed in Section 3.2, we model ∇ v t log q t ( u t ) as s θ ( u t , t )
= − (cid:96) t
α θ ( u t , t ) .
Plugging everything back in the maximum likelihood objective function, Eq.
(58) and Eq.
(59), we obtain
HSM : E t ∼U [0 , 1] , x 0 ∼ p 0 ( x 0 ) , u t ∼ p t ( u t | x 0 ) (cid:104)
[Equation]
where u t is sampled via reparameterization:
[Equation]
[Figure]
Note again that L t is different for HSM and DSM.
Analogously to prior work (Ho et al., 2020; Vahdat et al., 2021; Song et al., 2021b)
an objective better suited for high quality image synthesis can be obtained by “dropping the variance prefactor”:
HSM
[Equation]
79) where we set λ HSMreweighted ( t ) =
(cid:0) (cid:96) HSM t (cid:1) − 2 and λ DSMreweighted ( t ) =
(cid:0) (cid:96) DSM t (cid:1) − 2 .
In App C, we show that
HSM is equal to DSM (up to addition of a constant).
B. CLD- SPECIFIC I MPLEMENTATION D ETAILS
Analytically, (cid:96) HSM t is bounded (in particular, (cid:96) HSM0 = 1 / √ γM ), whereas (cid:96) DSM t is diverging for t → 0 .
In practice, however, we found that computation of (cid:96) HSM t can also be numerically unstable, even when using double precision.
As is common practice for computing Cholesky decompositions, we add a numerical stabilization matrix (cid:15) num I 2 d to Σ t before computing (cid:96) t .
In Figure 6, we visualize (cid:96) HSM t and (cid:96) DSM t for different values of (cid:15) num using our main experimental setup of M
B. L OWER B OUNDS AND P ROBABILITY F LOW ODE
Given the score model s θ ( u t , t ) , we can synthesize novel samples via simulating the reverse-time diffusion SDE, Eq.
(2) in the main text.
This can be achieved, for example, via our novel SSCS,
Euler-Maruyama, or methods such as GGF (Jolicoeur-Martineau et al., 2021a).
However, Song et al.
(2021b;c) have shown that a corresponding ordinary differential equation can be deﬁned that generates samples from the same distribution, in case s θ ( u t , t ) models the ground truth scores perfectly.
This ODE is:
[Equation]
This ODE is often referred to as the probability ﬂow ODE.
We can use it to generate novel data by sampling the prior and solving this ODE, like previous works (Song et al., 2021c).
Note that in practice s θ ( u t , t ) won’t be a perfect model, though, such that the generative models deﬁned by simulating the reverse-time SDE and the probability ﬂow ODE are not exactly equivalent (Song et al., 2021b).
Nevertheless, they are very closely connected and it has been shown that their performance is usually very similar or almost the same, when we have learnt a good s θ ( u t , t ) .
In addition to sampling the generative SDE in our paper, we also sample from our CLD-based SGMs via this probability ﬂow approach.
With the deﬁnition of our CLD, the ODE becomes:
[Equation]
Notice the interesting form of this probability ODE for CLD:
It corresponds to Hamiltonian dynamics ( A (cid:48) H ) plus the score function term S (cid:48) .
Compared to the generative SDE (Sec. 3.3), the
Ornstein-Uhlenbeck term disappears.
Generally, symplectic integrators are best suited for integrating Hamiltonian systems (Neal, 2011; Tuckerman, 2010; Leimkuhler & Reich, 2005).
However, our ODE is not perfectly Hamiltonian, due to the score term, and modern non-symplectic methods, such as the higher-order adaptive-step size Runge-Kutta 4(5) integrator (Dormand & Prince, 1980), which we use in practice to solve the probability ﬂow ODE, can also accurately simulate
Hamiltonian systems over limited time horizons.
Importantly, the ODE formulation also allows us to estimate the log-likelihood of given test data, as it essentially deﬁnes a continuous Normalizing ﬂow (Chen et al., 2018;
Grathwohl et al., 2019), that we can easily run in either direction.
However, in CLD the input into this ODE is not just the data x 0 , but also the velocity variable v 0 .
In this case, we can still calculate a lower bound on the log-likelihood:
[Equation]
[Equation]
where H ( p ( v 0 )) denotes the entropy of p ( v 0 )
(we have H ( p ( v 0 ))
= 12 log (2 πeγM ) ).
We can obtain a stochastic, but unbiased estimate of log p ( x 0 , v 0 )
≈ log p ε ( x 0 , v 0 ) via solving the probability ﬂow ODE with initial conditions ( x 0 , v 0 ) and calculating a stochastic estimate of the logdeterminant of the Jacobian via Hutchinson’s trace estimator (and also calculating the probability of the output under the prior), as done in Normalizing ﬂows (Chen et al., 2018; Grathwohl et al., 2019) and previous works on SGMs (Song et al., 2021c;b).
In the main paper, we report the negative of
Eq.
(85) as our upper bound on the negative log-likelihood (NLL).
Note that this bound can be potentially quite loose.
In principle, it would be desirable to perform an importance-weighted estimation of the log-likelihood, as in importance-weighted autoencoders (Burda et al., 2015), using multiple samples from the velocity distribution.
However, this isn’t possible, as we only have access to a stochastic estimate log p ε ( x 0 , v 0 ) .
The problems arising from this are discussed in detail in Appendix F of Vahdat et al.
We could consider training a velocity encoder network, somewhat similar to Chen et al.
(2020), to improve our bound,
but we leave this for future research.
B. O N I NTRODUCING A H AMILTONIAN C OMPONENT INTO THE D IFFUSION
Here, we provide additional high-level intuitions and motivations about adding the Hamiltonian component to the diffusion process, as is done in our CLD.
Let us recall how the data distribution evolves in the forward diffusion process of SGMs: The role of the diffusion is to bring the initial non-equilibrium state quickly towards the equilibrium or prior distribution.
Suppose for a moment, we could do so with “pure” Hamiltonian dynamics (no noise injection).
In that case, we could generate data from the backward model without learning a score or neural network at all, because Hamiltonian dynamics is analytically invertible (ﬂipping the sign of the velocity, we can just integrate backwards in reverse time direction).
Now, this is not possible in practice, since Hamiltonian dynamics alone usually cannot convert the non-equilibrium distribution to the prior distribution.
Nevertheless, Hamiltonian dynamics essentially achieves a certain amount of mixing on its own; moreover, since it is deterministic and analytically invertible, this mixing comes at no cost in the sense that we do not have to learn a complex score function to invert the
Hamiltonian dynamics.
Our thought experiment clearly shows that we should strive for a diffusion process that behaves as deterministically (meaning that deterministic implies easily invertible) as possible with as little noise injection as possible.
And this is exactly what is achieved by adding the Hamiltonian component in the overall diffusion process.
In fact, recall that it is the diffusion coefﬁcient G of the forward SDE that ultimately scales the score function term of the backward generative SDE (and it is the score function that is hard to approximate with complex neural nets).
Therefore, in other words, relying more on a deterministic Hamiltonian component for enhanced mixing (mixing just like in MCMC in that it brings us quickly towards the target distribution, in our case the prior) and less on pure noise injection will lead to a nicer generative SDE that relies less on a score function that requires complex and approximate neural network-based modeling, but more on a simple and analytical Hamiltonian component.
Such a SDE could then be solved easier with an appropriate integrator (like our SSCS).
In the end, we believe that this is the reason why our networks are “smoother” and why given the same network capacity and limited compute budgets we essentially outperform all previous results in the literature (on CIFAR-10).
We would also like to offer a second perspective, inspired by the MCMC literature.
In MCMC, “mixing” helps to quickly traverse the high probability parts of the target distribution and, if an
MCMC chain is initialized far from the high probability manifold, to quickly converge to this manifold.
However, this is precisely the situation we are in with the forward diffusion process of SGMs:
The system is initialized in a far-from-equilibrium state (the data distribution) and we need to traverse the space as efﬁciently as possible to converge to the equilibrium distribution, this is, the prior.
Without efﬁcient mixing, it takes longer to converge to the prior, which also implies a longer generation path in the reverse direction—which intuitively corresponds to a harder problem.
Therefore, we believe that ideas from the MCMC literature that accelerate mixing and traversal of state space may be beneﬁcial also for the diffusions in SGMs.
C HSM: H YBRID S CORE M ATCHING
We begin by recalling our maximum likelihood objective function from App.
B.3:
[Equation]
(86) where s θ ( u , t ) is our score model.
In the following, we dissect the “score matching” part of the above objective:
[Equation]
where C 2 :
=
E u t ∼ p t ( u t ) (cid:104) (cid:107)∇ v t log p t ( u t ) (cid:107) 22 (cid:105) and S ( θ ) is the cross term discussed below.
Following Vincent (2011), we can rewrite L SM as an equivalent (up to addition of a time dependent
[Table]
matching
[Table]
L
[Table]
[Equation]
where C 3 :
=
E u
[Equation]
∼
[Equation]
log p t
[Equation]
u t | u 0 )
[Equation]
22 (cid:105) .
Something that might not necessarily be quite obvious is that there is no fundamental need to “denoise” with the distribution p ( u 0 ) .
“Denoising” only with the data distribution p ( x 0 ) and marginalizing over the entire initial velocity distribution p ( v 0 ) results in
[Equation]
where C 4 :
=
E x
[Equation]
log p t ( u t | x 0 ) (cid:107) 22 (cid:105) .
In our case, this makes sense since p ( v 0 ) is Normal, and therefore (as shown in App B.1), the perturbation kernel p t ( u t | x 0 ) is still
Normal.
In the following, only for completeness
[Equation]
we redo the derivation of Vincent (2011) and show that
L SM is equivalent to L HSM (up to addition of a constant).
Starting from S ( θ ) , we have
[Equation]
where (cid:104)· , ·(cid:105) donates the inner product (notation chosen to be consistent with Vincent (2011)).
Hence, we have that
[Equation]
This further implies that
[Equation]
Using the analysis from App B.1, we realize that C 3 and C 4 can be simpliﬁed to d (cid:0) (cid:96) DSM t (cid:1) 2 and d (cid:0) (cid:96) HSM t (cid:1) 2 .
Here, we used the fact that the expected squared norm of a multivariate standard Normal random variable is equal to its dimension, i.e., E ε ∼N ( 0 d , I d ) (cid:107) ε (cid:107)
= d .
This analysis then simpliﬁes Equation (101) to
[Equation]
Using this relation, we can also ﬁnd a connection between the maximum likelihood objective functions.
In particular, we have
[Equation]
where HSM and DSM are deﬁned in Equation (73) and in Equation (74), respectively.
Furthermore, we have the following relation for our reweighted objectives
[Equation]
C. G RADIENT V ARIANCE R EDUCTION VIA HSM
Above, we derived that L HSM =
L DSM + C , so one might wonder why we advocate for HSM over DSM.
In practice, we never solve expectations analytically but rather approximate them using
Monte Carlo estimates.
In the remainder of this section, we will show that in practice (Monte Carlo) gradients based on HSM have lower variance than those based on DSM.
From Eq.
(103) and Eq.
(104), we have
[Equation]
where θ are the learnable parameters of the neural network.
Instead of comparing the above expectations directly, we instead compare λ ( t ) ∇ θ L HSM with λ ( t ) ∇ θ L DSM for t ∈ [0 , 1] at discretized time values (as is done in practice).
Replacing
L HSM and L DSM with a single Monte Carlo estimate (as is used in practice), we have
[Equation]
where we applied the chain-rule.
In both Eq.
(112) and Eq.
(114), u t is sampled from the same distribution.
Hence, λ ( t ) ∇ θ
s θ ( u t , t ) acts as a common scaling factor, with the variance difference between HSM and DSM originating from the squared norm term.
Hence, we ignore λ ( t ) ∇ θ s θ ( u t , t ) and only focus our analysis on the gradient of the norm terms, which we can further simplify:
[Equation]
HSM
[Equation]
and
[Equation]
We explore this difference in a realistic setup; in particular, we evaluate K HSM and K DSM for all data points in the CIFAR-10 training set.
We choose s θ to be our trained ablation CLD model (with the standard setup of M − 1 =
β = 4 , see Sec.
E.2.1 for model details).
We then use these samples to estimate the covariance matrices Cov HSM and Cov DSM of the random variables K HSM and K DSM , respectively.
As is common practice in statistics, we consider only the trace of the estimated covariance matrices 5 .
The trace of the covariance matrix (of a random variable) is also commonly referred to as the total variation (of a random variable).
We visualize our results in Fig.
For HSM, there is barely any visual difference in Tr(Cov) for γ = 0 . 04 and γ = 1 .
For DSM, both γ = 0 . 04 and γ = 1 result in very large Tr(Cov) values for small t .
For large t , Tr(Cov) is considerably smaller for γ = 0 .
04 than for γ = 1 .
However, in practice, we found that DSM is even unstable for small γ .
Given this analysis, we believe this is due to the large gradient variance for small t .
In conclusion, these results demonstrate a clear variance reduction by the HSM objective, in particular for large γ .
Note that re-introducing λ ( t ) weightings would allow us to scale the Tr(Cov) curves according to the “reweighted” objective or the maximum likelihood objective.
However, we believe it is most instructive to directly analyze the gradient of the norm term itself.
D S YMMETRIC S PLITTING CLD S AMPLER (SSCS)
In this section, we present a more complete derivation and analysis of our novel Symmetric Splitting
CLD Sampler (SSCS).
D. B ACKGROUND
Our derivation is inspired by methods from the statistical mechanics and molecular dynamics literature.
In particular, we are leveraging symmetric splitting techniques as well as (Fokker–Planck) operator concepts.
The high-level idea of symmetric splitting as well as the operator formalism are well-explained in Tuckerman (2010), in particular in Section 3.10, including simple examples.
Symmetric splitting methods for stochastic dynamics in particular are discussed in detail in Leimkuhler & Matthews (2015).
We also recommend Leimkuhler & Matthews (2013), which discusses splitting methods for Langevin dynamics in a concise but insightful manner.
D. D ERIVATION AND A NALYSIS
Generative SDE.
From Sec. 3.3, recall that our generative SDE can be written as (with ¯ u t = u T − t , ¯ x
[Equation] [Equation]
d ¯ x t d
[Equation]
t
[Equation]
Fokker–Planck Equation and Fokker–Planck Operators.
The evolution of the probability distribution p T − t (¯ u t ) is described by the general Fokker Planck equation (S¨arkk¨a & Solin, 2019):
[Equation]
with
[Equation]
For our SDE, we can write the Fokker Planck equation in short form as
[Equation]
with the Fokker–Planck operators (deﬁned via their action on functions of the variables φ (¯ u t ) ):
[Equation]
We are providing these formulas for transparency and completeness.
We do not directly leverage them.
However, working with these operators can be convenient.
In particular, the operators describe the time evolution of states ¯ u t under the stochastic dynamics deﬁned by the SDE.
Given an initial state ¯ u 0 , we can construct a formal solution to the generative SDE via (Tuckerman, 2010;
Leimkuhler & Matthews, 2015):
[Equation]
where the operator e t ( ˆ L ∗ A φ + ˆ L ∗ S φ ) is known as the classical propagator that propagates states ¯ u 0 for time t according to the dynamics deﬁned by the combined Fokker–Planck operators ˆ L ∗ A + ˆ L ∗ S (to avoid confusion, note that in Eq.
(125) the operator e t ( ˆ L ∗ A φ + ˆ L ∗ S φ ) is applied on ¯ u 0 in an elementwise or “vectorized” fashion on all elements of ¯ u 0 in parallel).
The problem with that expression is that we cannot analytically evaluate it.
However, we can leverage it to design an integration method.
Symmetric Splitting Integration.
Using the symmetric Trotter theorem or Strang splitting formula as well as the Baker–Campbell–Hausdorff formula (Trotter, 1959; Strang, 1968; Tuckerman, 2010), it can be shown that:
[Equation]
with time step δt :=
t/N , where N ∈ N + .
The expression suggests that instead of directly evaluating the intractable e t ( ˆ L ∗ A + ˆ L ∗ S ) , we can discretize the dynamics over t into N pieces of step size δt , such that we only need to apply the individual e δt 2 ˆ L ∗ A and e δt ˆ L ∗ S
many times one after another for small time steps δt .
A ﬁner discretization implies a smaller error (since N = t/δt the error effectively scales as O ( δt 2 ) for ﬁxed t ).
Hence, this implies an integration method.
The general idea of such splitting schemes is to split an initially intractable propagator into separate terms, each of which is analytically tractable.
In that case, the overall integration error for many steps is only due to the splitting scheme error 6 , but not due to the evaluation of the individual updates.
Such techniques are, for example, popular in molecular dynamics to develop symplectic integrators as well as accurate samplers (Tuckerman et al., 1992; Tuckerman, 2010; Leimkuhler & Matthews, 2013; 2015; Bussi &
Parrinello, 2007).
Analyzing the Splitting Terms.
Next, we need to analyze the two individual terms: (i) Let us ﬁrst analyze e δt 2 ˆ L ∗
A ¯ u t : This term describes the stochastic evolution of ¯ u t under the dynamics of a SDE like Eq.
(118), but with S set to zero.
However, if S is set to zero, the remaining
SDE has afﬁne drift and diffusion coefﬁcients.
In that case, if the input is Normal (or a discrete state corresponding to a Normal with 0 variance) then the distribution is Normal at all times and we can calculate the evolution analytically.
In particular, we can solve the differential equations for the mean ¯ µ δt 2 and covariance ¯ Σ δtn 2 of the Normal (these differential equation are, for example, presented in S¨arkk¨a & Solin (2019), also see Sec.
B.1.
The result below can be validated by inserting it into the differential equations—similar to Sec. B.1), and obtain
[Equation]
as well as
[Equation]
Hence, we can write the action of the the propagator e δt
ˆ
L ∗ A on a state ¯ u t as:
[Equation]
(ii) : Next, we need to analyze e δt ˆ L ∗ S ¯ u t .
Unfortunately, we cannot calculate the action of the propagator e δt ˆ L ∗ S on ¯ u t analytically and we need to make an approximation.
From Eq.
(118), we can easily see that the propagator e δt ˆ L ∗ S describes the evolution of the velocity component ¯ v t for time step δt under the ODE:
[Equation]
[Equation]
We propose to simply solve this ODE for the step δt via a simple step of Euler’s method, resulting in:
[Equation]
with the informal deﬁnition
[Equation]
Error Analysis.
It is now instructive to study the overall error of our proposed integrator.
With the additional Euler integration in one of the splitting terms
[Equation]
we have
[Equation]
where we used N = tδt and only kept the highest error terms.
We see that, just like Euler’s method, also our SSCS is a ﬁrst-order integrator with local error ∼ δt 2 and global error ∼ δt .
This is of course expected, considering that we used an Euler step for the S term.
Nevertheless, as long as the dynamics is not dominated by the S component, our proposed integration scheme is expected to still be more accurate than EM, since we split off the analytically tractable part and only use an Euler approximation for the S term.
To this end, recall that the model only needs to learn the score of the conditional distribution p t ( v t | x t ) , which is close to Normal for much of the diffusion, in which case the S term will indeed be small.
This suggests that the generative SDE dynamics are in fact dominated by A H and
A O in practice.
From another perspective, note that (recalling that s θ ( u t , t ) =
− (cid:96) t
α θ ( u t , t ) with α θ ( u t , t ) =
(cid:96)
[Equation]
1 t v t / Σ vvt + α (cid:48) θ ( u t , t ) from Sec. 3.2):
[Equation] [Equation]
For large parts of the diffusion, Σ vvt is indeed close to 1 /M , such that the ¯ v t term is very small (this cancellation is the reason why we pulled the M − 1 ¯ v t term into the S component).
In Sec. 3, we have also seen that our neural network component can be much smoother than that of previous
SGMs.
Overall, this suggests that the error of SSCS indeed might be smaller than the error we would obtain when applying a naive Euler–Maruyama integrator to the full generative SDE.
Our positive experimental results in Sec.
5.2 validate that.
Only in the limit for very small steps, both our SSCS and EM make only very small errors and are expected to perform equally well, which is exactly what we observe in our experiments.
Our SSCS turns out to be well-suited for integrating the generative
SDE with relatively few synthesis steps.
Note that in practice we do not use SSCS to integrate all the way from t = 0 to t = T , but only up to t =
T − (cid:15) , and perform a denoising step, similar to previous works (Jolicoeur-Martineau et al., 2021a; Song et al., 2021c).
It is worth noting that our SSCS scheme would also be applicable when we used time-dependent β ( t ) , as in our more general derivation of the CLD perturbation kernel in
App.
B.
However, since we only used constant β in the main paper, we also presented SSCS in that way.
A promising direction for future research would be to extend our SSCS towards adaptive step sizes and to use techniques to facilitate a higher-order integration, while still leveraging the unique advantages of SSCS.
SSCS Algorithm.
Finally, we summarize SSCS in terms of a concise algorithm:
Input: Score function s θ (¯ u t , T − t ) , CLD parameters Γ , β , M = Γ 2 / 4 , number of sampling steps N , step sizes { δt n ≥ 0 } N − 1 n =0 chosen such that (cid:15) :
= T − (cid:80) N − 1 n =
δt n ≥ 0 (stepsizes can vary, for example in QS).
Output: Synthesized model sample ¯ x (cid:48) N , along with a velocity sample ¯ v (cid:48)
N ¯ x 0 ∼ N (¯ x 0 ; 0 d , I d ) , ¯ v 0 ∼ N (¯ v 0 ; 0 d , M I d ) , ¯ u 0 = (¯ x 0 , ¯ v 0 )
(cid:46)
Draw initial
prior samples from p EQ ( u ) t =(cid:46)
Initialize time for n = 0 to N − 1 do ¯ u n + 12 ∼ N (¯ u n + 12 ; ¯ µ δtn 2 (¯ u n ) , ¯ Σ δtn 2 ) (cid:46)
First half-step: apply exp { δt n 2 ˆ L ∗ A } on ¯ u n ¯ u (cid:48) n
+ 12 ← ¯ u n + 12 + δt n (cid:18) 2 β Γ (cid:2) s (¯ u t , T − t )
+ M − 1 ¯ v t (cid:3)(cid:19) (cid:46)
Full step: apply exp { δt n ˆ L ∗ S } on ¯ u n +¯ u n +1 ∼ N (¯ u n +1 ; ¯ µ δtn 2 (¯ u (cid:48) n + 12 ) , ¯ Σ δtn 2 ) (cid:46)
Second half-step: apply exp { δt n 2 ˆ L ∗ A } on ¯ u (cid:48) n +t ← t + δt n (cid:46) Update time end for ¯ u (cid:48)
N ← ¯ u N − (cid:15) (cid:18)βM −− β − Γ βM −(cid:19) ⊗ I d ¯ u N + (cid:15) (cid:18)
0 2 β Γ s (¯ u t , (cid:15) ) (cid:19) (cid:46)
Denoising (¯ x (cid:48) N , ¯ v (cid:48) N ) =
¯ u (cid:48)
N (cid:46) Extract output data and velocity samples
[Figure]
Note that the algorithm uses the expressions in Eqs.
(127) and (128) for ¯ µ t and ¯ Σ t .
Furthermore, in practice in the denoising step at the end, we usually only update the ¯ x (cid:48) N component of ¯ u (cid:48) N , since we are only interested in the data sample.
This saves us the ﬁnal neural network call during denoising, which only affects the ¯ v (cid:48) N component.
However, we did write the algorithm in the general way, which also allows to correctly generate the velocity sample ¯ v (cid:48) N .
Also note that we could combine the second half-step from one iteration of SSCS with the ﬁrst half-step from the next iteration of SSCS.
This is commonly done in the Leapfrog integrator, which follows a similar structure as our SSCS.
However, it is not important in our case, as the only computational costly operation is in the center full step, which involves the neural network evaluation.
The ﬁrst and last half-step come at virtually no computational cost.
E I MPLEMENTATION AND E XPERIMENT D ETAILS E. S CORE AND J ACOBIAN EXPERIMENT
In this section, we provide details for the experiments presented in Sec. 3.1.
For both experiments, we consider a two-dimensional simple mixture of Normals of the form
[Equation]
(143) where p ( k ) ( x ) =
N ( x ; µ k ; 0 . 04 2 I 2 ) and µ 1 = (cid:18)
[Equation]
(cid:19)
[Equation]
(cid:19)
[Equation]
(cid:18)a
[Equation]
(cid:19)
[Equation]
(cid:18)
[Equation]
(cid:19) , and a = 2 − 12 .
The choice of this data distribution is not arbitrary.
In fact, mixture of Normal distributions are diffused by simply diffusing the components, i.e., setting p 0 ( x 0 ) =
p data ( x ) , we have
[Equation]
where p ( k ) t are the diffused components (analogously for CLD with velocity augmentation).
This means that for both CLD as well as VPSDE Song et al.
(2021c)
we can diffuse p data ( x ) analytically.
This allows us to perform interesting analyses that would be possible when working, for example, with image data.
We visualize the data distribution in Fig.
[Figure]
Score experiment: We empirically verify the reduced complexity of the score of p t ( v t | x t ) , which is learned in CLD, compared to the score of p t ( x t ) , which is learned in VPSDE.
To avoid scaling issues between VPSDE and CLD, we chose M = γ = 1 for CLD in this experiment; this results in an equilibrium distribution of N (0 , 1) (for both data and velocity component, which are independent at equilibrium), which is the same as the equilibrium distribution of VPSDE.
We then measure the difference of the respective scores at time t and the equilibrium (or prior) scores, i.e. (recall that the score of a Normal distribution p ( x ) =
N ( x ; 0 , 1) is simply ∇ x log p ( x ) = − x ),
[Equation] [Equation]
The expectations are approximated using 10 5 samples from p ( x t ) and p ( u t ) for VPSDE and CLD, respectively.
As can be seen in Fig.
8a, ξ CLD ( t ) is smaller than ξ VPSDE ( t ) for all t ∈ [0 , T ] .
The difference is particularly striking for small time values t .
Other previous SDEs, such as the VESDE, sub-VPSDE, etc., are expected to behave similarly.
This result implies that the ground truth scores that need to be learnt in CLD are closer to Normal scores than the ground truth scores in previous
SDEs like the VPSDE.
Since the score of a Normal is very simple—and indeed directly leveraged in our mixed score formulation—we would intuitively expect that the CLD training task is easier.
Complexity experiment: Therefore, to understand the above observations in terms of learning neural networks, we train a small ResNet architecture (less than 100k parameters) for each of the following four setups: both CLD and VPSDE each with and without a mixed score parameterization.
The mixed score of the VPSDE simply assumes a standard normal data distribution (which is also the equilibrium distribution of VPSDE) resulting in adding − x t to the score function.
Formally, − x t is the score of a Normal distribution with unit variance.
We train the models for 1M iterations using fresh data synthesized from p data at a batch size of 512.
The model and data distributions are visualized in Fig.
We measure the complexity of the trained neural networks using the squared Frobenius norm of the networks’ Jacobians.
For CLD, we have
[Equation]
Similarly, for VPSDE, we compute
[Equation]
For both CLD and VPSDE, expectations are again approximated using 10 5 samples.
As can be seen in Fig.
8b the neural network complexity is lower for CLD compared to VPSDE.
A mixed score formulation helps decreasing the neural network complexity for both CLD and VPSDE.
This result implies that the arguably simpler training task in CLD indeed also translates to reduced model complexity in that the neural network is smoother as measured by J F ( t ) .
In large-scale experiments, this would mean that, given similar model capacity, a CLD-based SGM could potentially have a higher expressivity.
Or, on the other hand, similar performance could be achieved with a smoother and potentially smaller model.
Indeed these ﬁndings are in line with our strong results on the CIFAR10 benchmark.
E.
[Equation]
I MAGE M ODELING
E XPERIMENTS
We perform image modeling experiments on CIFAR-10 as well as CelebA-HQ-256.
We report
FID scores on CIFAR-10 for our main model in for a sweep of different solvers; see Tab. 3 and
[Table]
Tab. 2.
We further present generated samples for both models in Sec.
5 using Euler–Maruyama with 2000 quadratic striding steps and Runge–Kutta 4(5) for CIFAR10 and CelebA-HQ-256, respectively.
We present additional samples for variety of solver settings in App.
F. All (average) NFEs for the
Runge–Kutta solver are computed using a batch size of 128.
E.2. T RAINING D ETAILS AND M ODEL A RCHITECTURES
Our models are based on the NCSN++ and the DDPM++ architectures from Song et al.
(2021c).
Importantly, we changed the number of input channels from three to six to facilitate the additional velocity variables.
Note that the number of additional parameters due to this change is negligible.
For fair comparison, we train our models using the same t -sampling cutoff during training as is used for VESDE and VPSDE in Song et al.
(2021c).
Note, however, that this is not strictly necessary for
CLD as we do not have any “blow-up” of the SDE due to unbounded scores as t → 0 .
We summarize our three model architectures as well as our SDE and training setups in Tab. 6.
E.2. CIFAR10 R ESULTS FOR VESDE AND VPSDE
The results reported for VESDE and VPSDE using the GGF sampler are taken from JolicoeurMartineau et al.
(2021a).
All other results for VESDE and VPSDE are generated by using the provided PyTorch code as well as the provided checkpoints from Song et al.
(2021c).
E.2. Q UADRATIC S TRIDING
When we simulate our generative SDE numerically, using for example EM or our SSCS, we need to choose a time discretization.
Given a certain NFE budget N NFE , how do we choose time step sizes?
The standard approach is to use an equidistant discretization, corresponding to a set of evaluation time steps { δt i ≥ 0 } N NFE − 1 i = with δt i = 1 N NFE ∀ i ∈ [0 , N NFE − 1] .
However, prior work (Song et al., 2021a; Kong & Ping, 2021; Watson et al., 2021) has shown that it can be beneﬁcial to focus function evaluation on times t close to the “data”.
This is because the diffusion process distribution is most complex close to the data and almost perfectly Normal close to the prior.
Among other techniques, these works used a useful heuristic, denoted as quadratic striding (QS), which discretizes the integration interval such that the evaluation times follow a quadratic schedule and the individual time steps follow a linear schedule.
We also used this QS approach in our experiments.
We can formally deﬁne it as follows (assuming time interval [0 . 0 , 1 . 0] here for simplicity):
Denote the evaluation times as τ i (including 0 . 0 and 1 . 0 ) and deﬁne:
[Equation]
Hence,
[Equation]
and c τ = 1 N 2 NFE to ensure that τ
NFE
= 1 . 0 .
This describes the time steps as going from t = 0 to t = 1 .
During synthesis, however, we are going backwards.
Hence, we can deﬁne our time steps as
[Equation]
where j now counts time steps in the other direction.
Note that this can be easily adapted to general integration intervals [ (cid:15), T ] .
E.2. D ENOISING
As has been pointed out in Jolicoeur-Martineau et al.
(2021b), samples that are generated with models similar to ours can contain noise that is hard to detect visually but worsens FID scores signiﬁcantly.
Denoising Formulas.
For fair comparison we use the same denoising setup for all experiments we conducted (including VESDE (PC/ODE) and VPSDE (EM/ODE)) except for LSGM 7 .
We simulate the underlying generative ODE/SDE until the time cutoff ε = 1e − 3 and then take a single denoising step of the form
[Equation]
This denoising step can be considered as an Euler–Maruyama step without noise injection.
For
SDEs acting on data directly (VESDE, VPSDE, etc.)
the corresponds denoising formula is
[Equation]
Inﬂuence of Denoising on Results.
For SDEs acting in the data space directly, it has been reported that this denoising step is crucial to obtain good FID numbers
Jolicoeur-Martineau et al.
(2021b);
Song et al.
(2021c).
When we simulate the generative probability ﬂow ODE we found that denoising is important in order for the Runge–Kutta solver not to “blow-up” as t → 0 .
On the other hand, when simulating CLD using our new SSCS solver, we found that denoising only slightly inﬂuences FID (see Tab 7).
We believe that this might be because the neural network does not have any inﬂuence on the denoising step for CLD.
Putting the drift and diffusion coefﬁcients of CLD in the denoising formula in Eq.
(152), we obtain
[Equation]
This means the denoising for CLD results in u 0 being a linear transformation of u ε .
[Table]
E.2. S OLVER T OLERANCES FOR R UNGE –K UTTA 4(5)
In Tab. 2, we report FID numbers for a Runge–Kutta 4(5) solvers (Dormand & Prince, 1980) as well as the “Gotta Go Fast” solver from Jolicoeur-Martineau et al.
(2021a)
(see their Table 1).
For simulating CLD with Runge–Kutta 4(5)
we chose the solver tolerances to hit certain regimes of NFEs to facilitate comparison with VPSDE and VESDE.
We obtain a mean number of function evaluations of 312 and 137 using Runge–Kutta 4(5) solver tolerances of 1e − 5 and 1e − 3 , respectively.
For
VESDE, VPSDE and LSGM we used 1e − 5 as the ODE solver tolerance.
E.
. A BLATIONS E XPERIMENTS
The model architecture used for all ablation experiments can be found in Tab. 6.
As pointed out in Sec.
5 we found that the hyperparameters γ and M only have small effect on CIFAR-10 FID numbers.
On the other hand, we found that the mixed score parameterization helps signiﬁcantly in obtaining competitive FIDs.
E.2. LSGM-100M M ODEL
Our CLD-based SGM has ≈ 108 M parameters, while the original CIFAR-10 Latent SGM from Vahdat et al.
(2021), to which we compare in Tab. 1, uses ≈ 476 M parameters.
To establish a fairer comparison between our CLD-based SGMs and LSGM (Vahdat et al., 2021), we train another smaller
LSGM model with ≈ 109 M parameters.
To do this, we followed the exact setup of the “CIFAR (balanced)” model from LSGM (see Table 7 in Vahdat et al.
(2021)), with a few minor modiﬁcations: We used a VAE backbone model with only 10 groups instead of 20, which corresponds to a reduction in parameters by a factor of 2 in the encoder and decoder networks.
We also reduced the convolutional channels in the latent space SGM from 512 to 256 and reduced the number of the residual cells per scale from 8 to 4.
With these modiﬁcations the resulting “LSGM-100M” uses only ≈ 109 M parameters overall with approximately half of them in the encoder and decoder networks and the other half in the latent SGM.
Other than these architecture modiﬁcations, our model is trained in exactly the same way as the bigger, original models in Vahdat et al.
For evaluation, we follow the recommended setting by Vahdat et al.
and use the same RungeKutta 4(5)
ODE solver with an error tolerance of 1e − 5 to solve the probability ﬂow ODE in LSGM’s latent space.
LSGM-100M achieves an FID of 4.60, an NLL bound of 2.96 bpd, and requires on average 131 NFE for sampling new images.
We report these results in Tabs.
1 and 2 in the main text.
Note that we also tried training a model following the “CIFAR10 (best FID)” setup, but found training to be unstable (however the orignal “CIFAR10 (best FID)” model from Vahdat et al.
(2021) only performs marginally better in FID than their “CIFAR10 (balanced)” model anyway).
Furthermore, we also tried training another small LSGM with a similar number of parameters but with more parameters in the latent SGM and less in the encoder and decoder networks, compared to the reported
LSGM-100M. However, this model performed signiﬁcantly worse.
[Table]
F A DDITIONAL E XPERIMENTS F. T OY E XPERIMENTS F.1. A NALYTICAL S AMPLING
In order to test combinations of diffusions and numerical samplers in isolation, we consider a dataset for which we know the ground truth score function (for all t ) analytically.
In particular, we use the mixture of Normals introduced in App.
E.1; see Fig. 9a for a visualization of the data distribution.
In
Fig.
10, we show samples for VPSDE (Euler–Maruyama (EM) sampler) and CLD (EM and SSCS samplers).
For quantitative comparison, we also compute negative log-likelihoods for the three combinations (which can be done easily due to our access to the ground truth distribution): as can be seen in Tab. 8, for each number of steps n ∈ { 20 , 50 , 100 , 200 } CLD with SCSS outperforms both VPSDE and CLD with EM.
As discussed in Sec. 3.3, we can see in Tab. 8 that EM is not wellsuited for CLD.
This is true, in particular, when using a small number of synthesis steps n (function evaluations).
In Fig.
10, we see that CLD with EM leads to sampling distributions which are too broad.
These results are exactly in line with the “diverging” dynamics that is observed when solving
Hamiltonian dynamics with a non-symplectic integrator, such as the standard Euler method (Neal, 2011).
This problematic behavior of Euler-based techniques is more pronounced when using fewer steps with larger stepsizes, which is also what we observe in our experiments.
These results further motivate the use of our novel SSCS, which addresses these challenges, for sampling from our CLDbased SGMs.
F.1. M AXIMUM L IKELIHOOD T RAINING
For maximum likelihood training, models based on overdamped Langevin dynamics such as VPSDE need to learn an unbounded score for t → 0 .
Our model, on the other hand, only ever needs to learn a bounded score even for t = 0 .
For our image data experiments, we use a reweighted objective function to improve visual quality of samples (as is general practice).
Here, we also study training towards maximum likelihood on toy dataset tasks.
To explore this, we repeat the neural network complexity experiment from App.
E.1 with maximum likelihood training (instead of the reweighted objective).
Furthermore, we also train VPSDE-based and CLD-based
SGMs on a challenging toy dataset and ﬁnd that CLD signiﬁcantly outperforms VPSDE.
We leave the study of CLD with maximum likelihood training for high-dimensional (image) datasets to future work.
Complexity Experiment.
The setup of this experiment is equivalent to the setup in App.
E.1 up to the training objective: in this experiment we do maximum likelihood learning, i.e., we train CLD models with the objective from Eq.
(8) with λ ( t ) =
Γ β .
Furthermore, we test CLD in this setup for three different values of γ .
The results of this experiment can be found in Fig.
For CLD, we ﬁnd that larger values of γ generally lead to less complex networks, in particular for smaller times t .
However, even for γ = 0 . 04 the learned neural network is still signiﬁcantly smoother than the network learned for VPSDE when a mixed score parameterization is used.
[Figure] [Figure]
Challenging Toy Dataset.
Using the same simple ResNet architecture (less than 100k parameters) from the above experiment, we trained a VPSDE-based as well as a CLD-based SGM to maximize the likelihood of a more challenging toy dataset (the dataset is essentially “multi-scale”, as it involves both large scale—the placement of the swiss rolls—and ﬁne scale—the swiss rolls themselves— structure).
Similar to the other toy datasets, the models are trained for 1M iterations using fresh data synthesized from the data distribution in each batch at a batch size of 512.
In Fig.
12, we compare samples of the models to the data distribution.
Even with our simple model architecture, CLD is able to capture the multi-scale structure of the dataset: the ﬁve rolls are adequately resembled and only a few samples are in between modes.
VPSDE, on the other hand, only captures the modes, but not the ﬁne structure.
Furthermore, VPSDE has the undesired behavior of “connecting” the modes.
Overall, we conclude that also in the maximum likelihood training setting CLD is a promising diffusion showing superior behavior compared to the VPSDE in our toy experiments.
[Table]
F. CIFAR-10 - E XTENDED R ESULTS
In this section we provide additional results on CIFAR-10.
For an extended version of Tab.
[Table]
please see Tab. 9.
Note that quadratic striding improves VPSDE and CLD for all settings but VPSDE with n = { 1000 , 2000 } .
For VESDE (using PC sampling), quadratic striding signiﬁcantly worsens FID numbers.
This is potentially due to variance of VESDE already following an exponential schedule (see Figure 5 in Song et al.
(2021c))
[Table]
Furthermore
[Table]
we present additional generated samples from our model: see Fig.
13 and Fig.
14 for samples from EM-QS with 2000 evaluations and SSCS with 150 evaluations, respectively.
F.
C ELEB A-HQ-256 - E XTENDED R ESULTS
In this section we provide additional qualitative results on CelebA-HQ-256.
For high quality samples using our new SSCS solver see Fig. 15.
Samples generated with Runge–Kutta 4(5) at different solver tolerances can be found in Fig 16.
We found that our model still generates very good samples even for solver error tolerance of 1e − 3 using an average of 129 function evaluations.
[Figure]