Elucidating the Design Space of Diffusion-Based Generative Models | AGIDaily
AGI Daily
资讯日报词条论文人物新创
返回论文列表
1 引言2 用同一套框架表达扩散模型3 对确定性采样的改进4 随机采样5 预条件与训练6 结论参考文献清单
返回论文列表
目录

Elucidating the Design Space of Diffusion-Based Generative Models

收录于 NeurIPS 2022 会议论文(Outstanding Paper)被引 4,165 次
打开论文来源

36th Conference on Neural Information Processing Systems (NeurIPS 2022).

Elucidating the Design Space of Diffusion-Based Generative Models

Tero Karras, Miika Aittala, Timo Aila, Samuli Laine

NVIDIA

tkarras@nvidia.com, maittala@nvidia.com, taila@nvidia.com, slaine@nvidia.com

Abstract

摘要

We argue that the theory and practice of diffusion-based generative models are currently unnecessarily convoluted and seek to remedy the situation by presenting a design space that clearly separates the concrete design choices. This lets us identify several changes to both the sampling and training processes, as well as preconditioning of the score networks. Together, our improvements yield new state-of-the-art FID of 1.79 for CIFAR-10 in a class-conditional setting and 1.97 in an unconditional setting, with much faster sampling (35 network evaluations per image) than prior designs. To further demonstrate their modular nature, we show that our design changes dramatically improve both the efficiency and quality obtainable with pre-trained score networks from previous work, including improving the FID of a previously trained ImageNet-64 model from 2.07 to near-SOTA 1.55, and after re-training with our proposed improvements to a new SOTA of 1.36.

我们认为,扩散生成模型的理论与实践目前被不必要地缠在一起,因而提出一套把各项具体设计选择清楚分开的设计空间。这样我们就能分别找出采样、训练以及分数网络预条件上的若干改动。这些改进合在一起,在 CIFAR-10 上把当时最优的 FID 做到类别条件下 1.79、无条件下 1.97,而且采样比以往设计快得多(每张图 35 次网络评估)。为了进一步说明这些选择是模块化的,我们还展示:把这些改动用到以往工作的预训练分数网络上,效率和质量都会大幅提升,包括把一个已训练的 ImageNet-64 模型的 FID 从 2.07 降到接近当时最优的 1.55,再按我们提出的改进重新训练后,达到新的最优 1.36。

1 Introduction

1 引言

Diffusion-based generative models [45] have emerged as a powerful new framework for neural image synthesis, in both unconditional [16, 36, 48] and conditional [17, 35, 36, 38, 39, 41, 42, 48] settings, even surpassing the quality of GANs [13] in certain situations [9]. They are also rapidly finding use in other domains such as audio [27, 37] and video [19] generation, image segmentation [4, 54] and language translation [34]. As such, there is great interest in applying these models and improving them further in terms of image/distribution quality, training cost, and generation speed.

基于扩散的生成模型 [45] 已经成为神经图像合成里一套有力的新框架,既用于无条件生成 [16, 36, 48],也用于条件生成 [17, 35, 36, 38, 39, 41, 42, 48],在某些情形下甚至超过了 GAN [13] 的质量 [9]。它们也迅速被用到音频 [27, 37] 和视频 [19] 生成、图像分割 [4, 54] 以及语言翻译 [34] 等领域。因此,人们很关心如何应用这些模型,并在图像/分布质量、训练成本和生成速度上继续改进。

The literature on these models is dense on theory, and derivations of sampling schedule, training dynamics, noise level parameterization, etc., tend to be based as directly as possible on theoretical frameworks, which ensures that the models are on a solid theoretical footing. However, this approach has a danger of obscuring the available design space — a proposed model may appear as a tightly coupled package where no individual component can be modified without breaking the entire system.

这类模型的文献理论很密,采样日程、训练动态和噪声水平参数化等推导,往往尽可能直接依托某个理论框架,以保证模型有扎实的理论基础。不过,这种做法有可能把可用的设计空间遮住——提出的模型看起来像一个紧耦合的整包,单独改其中一块就会把整套系统弄坏。

As our first contribution, we take a look at the theory behind these models from a practical standpoint, focusing more on the “tangible” objects and algorithms that appear in the training and sampling phases, and less on the statistical processes from which they might be derived. The goal is to obtain better insights into how these components are linked together and what degrees of freedom are available in the design of the overall system. We focus on the broad class of models where a neural network is used to model the score [22] of a noise level dependent marginal distribution of the training data corrupted by Gaussian noise. Thus, our work is in the context of denoising score matching [51].

作为第一项贡献,我们从实践角度审视这些模型背后的理论,更多关注训练和采样阶段里那些“摸得着”的对象和算法,而较少纠缠它们可能由哪些统计过程推导而来。目标是更清楚地看到这些部件如何连在一起,以及整体系统的设计里还有哪些自由度。我们关注的是一大类模型:用神经网络去拟合训练数据被高斯噪声污染后、随噪声水平变化的边际分布的分数(score)[22]。因此,本工作属于去噪分数匹配的语境 [51]。

Figure 1: Denoising score matching on CIFAR-10

Figure 1: Denoising score matching on CIFAR-10. (a) Images from the training set corrupted with varying levels of additive Gaussian noise. High levels of noise lead to oversaturated colors; we normalize the images for cleaner visualization. (b) Optimal denoising result from minimizing Eq. 2 analytically (see Appendix B.3). With increasing noise level, the result approaches dataset mean.

图 1:CIFAR-10 上的去噪分数匹配。(a) 训练集图像被不同程度的加性高斯噪声污染。高噪声会导致颜色过饱和;我们把图像做了归一化,以便更清楚地展示。(b) 解析地最小化式 2 得到的最优去噪结果(见附录 B.3)。随着噪声水平升高,结果会趋向数据集均值。

Our second set of contributions concerns the sampling processes used to synthesize images using diffusion models. We identify the best-performing time discretization for sampling, apply a higher-order Runge–Kutta method for the sampling process, evaluate different sampler schedules, and analyze the usefulness of stochasticity in the sampling process. The result of these improvements is a significant drop in the number of sampling steps required during synthesis, and the improved sampler can be used as a drop-in replacement with several widely used diffusion models [36, 48].

第二组贡献关注用扩散模型合成图像时的采样过程。我们找出表现最好的采样时间离散,把更高阶的 Runge–Kutta 方法用于采样,评估不同的采样器日程,并分析采样过程中随机性是否有用。这些改进的结果是:合成所需的采样步数明显下降,而且改进后的采样器可以即插即用地替换到若干广泛使用的扩散模型中 [36, 48]。

The third set of contributions focuses on the training of the score-modeling neural network. While we continue to rely on the commonly used network architectures (DDPM [16], NCSN [47]), we provide the first principled analysis of the preconditioning of the networks’ inputs, outputs, and loss functions in a diffusion model setting and derive best practices for improving the training dynamics. We also suggest an improved distribution of noise levels during training, and note that non-leaking augmentation [25] — typically used with GANs — is beneficial for diffusion models as well.

第三组贡献聚焦于对分数建模神经网络的训练。我们仍然沿用常用的网络结构(DDPM [16]、NCSN [47]),但第一次在扩散模型设定下,对网络输入、输出和损失函数的预条件做了有原则的分析,并据此给出改善训练动态的实践建议。我们还提出了训练时更好的噪声水平分布,并指出通常用在 GAN 上的非泄漏增广 [25] 对扩散模型同样有益。

Taken together, our contributions enable significant improvements in result quality, e.g., leading to record FIDs of 1.79 for CIFAR-10 [28] and 1.36 for ImageNet [8] in 64×64 resolution. With all key ingredients of the design space explicitly tabulated, we believe that our approach will allow easier innovation on the individual components, and thus enable more extensive and targeted exploration of the design space of diffusion models. Our implementation and pre-trained models are available at https://github.com/NVlabs/edm

把这些贡献合在一起,可以显著提高结果质量,例如把 CIFAR-10 [28] 的 FID 做到当时纪录的 1.79,把 64×64 分辨率的 ImageNet [8] 做到 1.36。设计空间里的关键要素都被明确列成表后,我们相信这种方法会让针对单个部件的改进更容易,从而更充分、更有针对性地探索扩散模型的设计空间。实现和预训练模型见 https://github.com/NVlabs/edm

2 Expressing diffusion models in a common framework

2 用同一套框架表达扩散模型

Let us denote the data distribution by pdata(x)p_{\mathrm{data}}(x)pdata​(x), with standard deviation σdata\sigma_{\mathrm{data}}σdata​, and consider the family of mollified distributions p(x;σ)p(x; \sigma)p(x;σ) obtained by adding i.i.d. Gaussian noise of standard deviation σ\sigmaσ to the data. For σmax⁡≫σdata\sigma_{\max} \gg \sigma_{\mathrm{data}}σmax​≫σdata​, p(x;σmax⁡)p(x; \sigma_{\max})p(x;σmax​) is practically indistinguishable from pure Gaussian noise. The idea of diffusion models is to randomly sample a noise image x0∼N(0,σmax⁡2I)x_0 \sim \mathcal{N}(0, \sigma_{\max}^2 I)x0​∼N(0,σmax2​I), and sequentially denoise it into images xix_ixi​ with noise levels σ0=σmax⁡>σ1>⋯>σN=0\sigma_0 = \sigma_{\max} > \sigma_1 > \cdots > \sigma_N = 0σ0​=σmax​>σ1​>⋯>σN​=0 so that at each noise level xi∼p(xi;σi)x_i \sim p(x_i; \sigma_i)xi​∼p(xi​;σi​). The endpoint xNx_NxN​ of this process is thus distributed according to the data.

把数据分布记为 pdata(x)p_{\mathrm{data}}(x)pdata​(x),标准差为 σdata\sigma_{\mathrm{data}}σdata​,并考虑在数据上加入标准差为 σ\sigmaσ 的独立同分布高斯噪声后得到的一组被磨光的分布 p(x;σ)p(x; \sigma)p(x;σ)。当 σmax⁡≫σdata\sigma_{\max} \gg \sigma_{\mathrm{data}}σmax​≫σdata​ 时,p(x;σmax⁡)p(x; \sigma_{\max})p(x;σmax​) 实际上与纯高斯噪声难以区分。扩散模型的想法是:随机采样一张噪声图像 x0∼N(0,σmax⁡2I)x_0 \sim \mathcal{N}(0, \sigma_{\max}^2 I)x0​∼N(0,σmax2​I),再依次把它去噪成噪声水平为 σ0=σmax⁡>σ1>⋯>σN=0\sigma_0 = \sigma_{\max} > \sigma_1 > \cdots > \sigma_N = 0σ0​=σmax​>σ1​>⋯>σN​=0 的图像 xix_ixi​,并使得在每一噪声水平上 xi∼p(xi;σi)x_i \sim p(x_i; \sigma_i)xi​∼p(xi​;σi​)。该过程的终点 xNx_NxN​ 因此服从数据分布。

Song et al. [48] present a stochastic differential equation (SDE) that maintains the desired distribution ppp as sample xxx evolves over time. This allows the above process to be implemented using a stochastic solver that both removes and adds noise at each iteration. They also give a corresponding “probability flow” ordinary differential equation (ODE) where the only source of randomness is the initial noise image x0x_0x0​. Contrary to the usual order of treatment, we begin by examining the ODE, as it offers a fruitful setting for analyzing sampling trajectories and their discretizations. The insights carry over to stochastic sampling, which we reintroduce as a generalization in Section 4.

Song 等人 [48] 给出一个随机微分方程(SDE),使得样本 xxx 随时间演化时始终保持所要的分布 ppp。这样,上述过程就可以用一个在每一步既去噪又加噪的随机求解器来实现。他们还给出了对应的“概率流”常微分方程(ODE),其中唯一的随机来源是初始噪声图像 x0x_0x0​。与通常的讨论顺序相反,我们先考察 ODE,因为它为分析采样轨迹及其离散化提供了很有收获的设定。这些认识可以带到随机采样上,我们会在第 4 节把随机采样作为推广重新引入。

ODE formulation. A probability flow ODE [48] continuously increases or reduces noise level of the image when moving forward or backward in time, respectively. To specify the ODE, we must first choose a schedule σ(t)\sigma(t)σ(t) that defines the desired noise level at time ttt. For example, setting σ(t)∝t\sigma(t) \propto \sqrt{t}σ(t)∝t​ is mathematically natural, as it corresponds to constant-speed heat diffusion [12]. However, we will show in Section 3 that the choice of schedule has major practical implications and should not be made on the basis of theoretical convenience.

ODE 表述。 概率流 ODE [48] 在时间向前时连续增加图像的噪声水平,向后时则连续降低。要写出这个 ODE,必须先选择一个日程 σ(t)\sigma(t)σ(t),用来规定时刻 ttt 上期望的噪声水平。例如,取 σ(t)∝t\sigma(t) \propto \sqrt{t}σ(t)∝t​ 在数学上很自然,因为它对应匀速热扩散 [12]。不过,我们将在第 3 节说明,日程的选择有重要的实际影响,不应只图理论上方便。

The defining characteristic of the probability flow ODE is that evolving a sample xa∼p(xa;σ(ta))x_a \sim p\big(x_a; \sigma(t_a)\big)xa​∼p(xa​;σ(ta​)) from time tat_ata​ to tbt_btb​ (either forward or backward in time) yields a sample xb∼p(xb;σ(tb))x_b \sim p\big(x_b; \sigma(t_b)\big)xb​∼p(xb​;σ(tb​)). Following previous work [48], this requirement is satisfied (see Appendix B.1 and B.2) by

概率流 ODE 的定义性特征是:把一个样本 xa∼p(xa;σ(ta))x_a \sim p\big(x_a; \sigma(t_a)\big)xa​∼p(xa​;σ(ta​)) 从时刻 tat_ata​ 演化到 tbt_btb​(无论时间向前还是向后),会得到样本 xb∼p(xb;σ(tb))x_b \sim p\big(x_b; \sigma(t_b)\big)xb​∼p(xb​;σ(tb​))。沿用以往工作 [48],这一要求可由下式满足(见附录 B.1 和 B.2)

dx=−σ˙(t) σ(t) ∇xlog⁡p(x;σ(t)) dt,(1)\mathrm{d}x = -\dot{\sigma}(t)\,\sigma(t)\,\nabla_x \log p\big(x;\sigma(t)\big)\,\mathrm{d}t, \tag{1}dx=−σ˙(t)σ(t)∇x​logp(x;σ(t))dt,(1)

where the dot denotes a time derivative. ∇xlog⁡p(x;σ)\nabla_x \log p(x; \sigma)∇x​logp(x;σ) is the score function [22], a vector field that points towards higher density of data at a given noise level.

其中点号表示对时间的导数。∇xlog⁡p(x;σ)\nabla_x \log p(x; \sigma)∇x​logp(x;σ) 是分数函数 [22],也就是在给定噪声水平上指向数据密度更高处的向量场。

Denoising score matching. The score function has the remarkable property that it does not depend on the generally intractable normalization constant of the underlying density function p(x;σ)p(x;\sigma)p(x;σ) [22]. It can thus, in theory, be learned from samples even when p(x;σ)p(x;\sigma)p(x;σ) itself cannot [47, 51]. In practice, most methods [16, 36, 46, 48] approximate the score using a denoiser function D(x;σ)D(x;\sigma)D(x;σ) that minimizes

去噪分数匹配。 分数函数有一个值得注意的性质:它不依赖于底层密度函数 p(x;σ)p(x;\sigma)p(x;σ) 通常难以处理的归一化常数 [22]。因此,即便 p(x;σ)p(x;\sigma)p(x;σ) 本身无法得到,原则上也可以从样本中学习分数 [47, 51]。实践中,多数方法 [16, 36, 46, 48] 用一个去噪器函数 D(x;σ)D(x;\sigma)D(x;σ) 来近似分数,该函数最小化

Ey∼pdataEn∼N(0,σ2I)∥D(y+n;σ)−y∥22,then∇xlog⁡p(x;σ)=(D(x;σ)−x)/σ2,(2, 3)\mathbb{E}_{y\sim p_{\mathrm{data}}}\mathbb{E}_{n\sim\mathcal{N}(0,\sigma^2 I)}\lVert D(y+n;\sigma)-y\rVert_2^2,\qquad\text{then}\quad \nabla_x\log p(x;\sigma)=\bigl(D(x;\sigma)-x\bigr)/\sigma^2, \tag{2, 3}Ey∼pdata​​En∼N(0,σ2I)​∥D(y+n;σ)−y∥22​,then∇x​logp(x;σ)=(D(x;σ)−x)/σ2,(2, 3)

where yyy is a training image and nnn is noise. In this light, the score function isolates the noise component from a noisy image, and can thus be related to the denoiser by the formula ∇xlog⁡p(x;σ)=(D(x;σ)−x)/σ2\nabla_x \log p(x;\sigma) = \bigl(D(x;\sigma)-x\bigr)/\sigma^2∇x​logp(x;σ)=(D(x;σ)−x)/σ2. Substituting Eq. 3 into Eq. 1, the probability flow ODE can equivalently be written in terms of DDD. Figure 1 illustrates this relationship on CIFAR-10.

其中 yyy 是训练图像,nnn 是噪声。从这个角度看,分数函数是从带噪图像里把噪声成分分离出来,因而可以用公式 ∇xlog⁡p(x;σ)=(D(x;σ)−x)/σ2\nabla_x \log p(x;\sigma) = \bigl(D(x;\sigma)-x\bigr)/\sigma^2∇x​logp(x;σ)=(D(x;σ)−x)/σ2 与去噪器联系起来。把式 3 代入式 1,概率流 ODE 也可以等价地写成 DDD 的形式。图 1 在 CIFAR-10 上展示了这一关系。

Time-dependent signal scaling. Some methods (see Appendix C.1) introduce an additional scale schedule s(t)s(t)s(t) and consider x=s(t)x^x = s(t)\hat{x}x=s(t)x^, where x^\hat{x}x^ follows a probability flow ODE as above. We show in Appendix B.2 that this is equivalent to the ODE

随时间变化的信号缩放。 有些方法(见附录 C.1)会再引入一个尺度日程 s(t)s(t)s(t),并考虑 x=s(t)x^x = s(t)\hat{x}x=s(t)x^,其中 x^\hat{x}x^ 仍遵循如上的概率流 ODE。我们在附录 B.2 中说明,这等价于 ODE

dx=[s˙(t)s(t)x−s(t)2σ˙(t)σ(t)∇xlog⁡p(xs(t);σ(t))]dt.(4)\mathrm{d}x = \left[\frac{\dot{s}(t)}{s(t)}x - s(t)^2\dot{\sigma}(t)\sigma(t)\nabla_x\log p\left(\frac{x}{s(t)};\sigma(t)\right)\right]\mathrm{d}t. \tag{4}dx=[s(t)s˙(t)​x−s(t)2σ˙(t)σ(t)∇x​logp(s(t)x​;σ(t))]dt.(4)

Note that we explicitly undo the scaling of xxx when evaluating the score function to keep the definition of p(x;σ)p(x;\sigma)p(x;σ) independent of sss. Appendix B.2 also shows that the denoiser DDD itself is not affected by sss.

注意,我们在计算分数函数时会显式撤销 xxx 的缩放,以使 p(x;σ)p(x;\sigma)p(x;σ) 的定义与 sss 无关。附录 B.2 还说明,去噪器 DDD 本身并不受 sss 影响。

Solution by discretization. The ODE to be solved is obtained by substituting Eq. 3 into Eq. 4 to define the point-wise gradient dx/dt\mathrm{d}x/\mathrm{d}tdx/dt. In practice, we always integrate backward in time. The solution can be found numerically using various ODE solvers, of which many are available as black-box implementations [11]. The simplest is Euler’s method, which we will also refer to as 1st order, where the current gradient is used to take a discrete step over a predefined time interval.

用离散化求解。 要求解的 ODE,是把式 3 代入式 4,从而给出逐点梯度 dx/dt\mathrm{d}x/\mathrm{d}tdx/dt。实践中我们总是沿时间向后积分。可用多种 ODE 求解器做数值求解,其中不少有现成的黑盒实现 [11]。最简单的是欧拉法,我们也称它为 1 阶方法:用当前梯度,在预定的时间间隔上走一步离散步。

Table 1: Specific design choices employed by different model families

Table 1: Specific design choices employed by different model families. NNN is the number of ODE solver iterations that we wish to execute during sampling. The corresponding number of neural function evaluations (NFE) is NNN for Euler and 2N−12N-12N−1 for Heun (see Algorithm 1). MMM is the number of discrete noise levels used in some methods.

表 1:不同模型族采用的具体设计选择。NNN 是我们希望在采样时执行的 ODE 求解迭代次数。相应的神经网络评估次数(NFE)对欧拉法是 NNN,对 Heun 法是 2N−12N-12N−1(见算法 1)。MMM 是某些方法使用的离散噪声水平个数。

Putting it together. Table 1 presents formulas for reproducing deterministic variants of three earlier methods in our framework. These methods were chosen because they are widely used and achieve state-of-the-art performance, but also because they were derived from different theoretical foundations. Some of our formulas appear quite different from the original papers as indirection and recursion have been removed; see Appendix C for details. The main purpose of this reframing is to bring into light all the independent components that often appear tangled together in previous work. In our framework, there are no implicit dependencies between the components — any choices (within reason) for the individual formulas will, in principle, lead to a functioning model. In other words, changing one component does not necessitate changes elsewhere in order to, e.g., maintain the property that the model converges to the data in the limit. In practice, some choices and combinations will of course work better than others.

合在一起。 表 1 给出了在我们的框架里复现三种已有方法之确定性变体的公式。选择这些方法,既因为它们被广泛使用并达到了当时最优水平,也因为它们来自不同的理论基础。我们的一些公式看起来与原文差别很大,因为去掉了间接与递归;细节见附录 C。这样重新表述的主要目的,是把以往工作里常常缠在一起的各个独立部件摊开来。在我们的框架里,部件之间没有隐含依赖——对各公式做任何(合理范围内的)选择,原则上都会得到一个能工作的模型。换言之,改其中一个部件,并不需要为了例如保持模型在极限下收敛到数据而改动别处。当然,实践中有些选择和组合会比另一些更好。

3 Improvements to deterministic sampling

3 对确定性采样的改进

Improving the output quality and/or decreasing the computational cost of sampling are common topics in diffusion model research (e.g., [10, 24, 30, 31, 32, 36, 43, 50, 52, 53, 56]). Our hypothesis is that the choices related to the sampling process are largely independent of the other components, such as network architecture and training details. In other words, the training procedure of DθD_\thetaDθ​ should not dictate σ(t)\sigma(t)σ(t), s(t)s(t)s(t), and {ti}\{t_i\}{ti​}, nor vice versa; from the viewpoint of the sampler, DθD_\thetaDθ​ is simply a black box [52, 53]. We test this by evaluating different samplers on three pre-trained models, each representing a different theoretical framework and model family.

提高输出质量和/或降低采样计算成本,是扩散模型研究里的常见主题(例如 [10, 24, 30, 31, 32, 36, 43, 50, 52, 53, 56])。我们的假设是:与采样过程有关的选择,大体独立于网络结构和训练细节等其他部件。换言之,DθD_\thetaDθ​ 的训练过程不应规定 σ(t)\sigma(t)σ(t)、s(t)s(t)s(t) 和 {ti}\{t_i\}{ti​},反过来也不应如此;从采样器的角度看,DθD_\thetaDθ​ 只是一个黑盒 [52, 53]。我们在三个预训练模型上评估不同采样器来检验这一点,每个模型代表一种不同的理论框架和模型族。

Figure 2: Comparison of deterministic sampling methods

Figure 2: Comparison of deterministic sampling methods using three pre-trained models. For each curve, the dot indicates the lowest NFE where FID is within 3% of the lowest observed FID. The NFE===35, 27, and 79 points mentioned in the text are highlighted with red axis labels.

图 2:在三个预训练模型上比较确定性采样方法。对每条曲线,圆点标出 FID 落在所观测最低 FID 的 3% 以内时的最低 NFE。文中提到的 NFE===35、27 和 79 用红色轴标签标出。

Discretization and higher-order integrators. Solving an ODE numerically is necessarily an approximation of following the true solution trajectory. At each step, the solver introduces truncation error that accumulates over the course of NNN steps. The local error generally scales superlinearly with respect to step size, and thus increasing NNN improves the accuracy of the solution.

离散化与高阶积分器。 数值求解 ODE,必然是对沿真实解轨迹前进的一种近似。求解器在每一步引入截断误差,并在 NNN 步过程中累积。局部误差通常相对步长超线性地缩放,因此增大 NNN 会提高解的精度。

The commonly used Euler’s method is a first order ODE solver with O(h2)O(h^2)O(h2) local error with respect to step size hhh. Higher-order Runge–Kutta methods [49] scale more favorably but require multiple evaluations of DθD_\thetaDθ​ per step. Linear multistep methods have also been recently proposed for sampling diffusion models [30, 56]. Through extensive tests, we have found Heun’s 2nd order method [2] (a.k.a. improved Euler, trapezoidal rule) — previously explored in the context of diffusion models by Jolicoeur-Martineau et al. [24] — to provide an excellent tradeoff between truncation error and NFE. As illustrated in Algorithm 1, it introduces an additional correction step for xi+1x_{i+1}xi+1​ to account for change in dx/dt\mathrm{d}x/\mathrm{d}tdx/dt between tit_iti​ and ti+1t_{i+1}ti+1​. This correction leads to O(h3)O(h^3)O(h3) local error at the cost of one additional evaluation of DθD_\thetaDθ​ per step. Note that stepping to σ=0\sigma=0σ=0 would result in a division by zero, so we revert to Euler’s method in this case. We discuss the general family of 2nd order solvers in Appendix D.2.

常用的欧拉法是一阶 ODE 求解器,相对步长 hhh 的局部误差为 O(h2)O(h^2)O(h2)。更高阶的 Runge–Kutta 方法 [49] 缩放更好,但每一步需要对 DθD_\thetaDθ​ 做多次评估。线性多步法最近也被提出用于扩散模型采样 [30, 56]。经过大量试验,我们发现 Heun 的二阶方法 [2](又称改进欧拉法、梯形法则)——Jolicoeur-Martineau 等人 [24] 曾在扩散模型语境中探索过——在截断误差和 NFE 之间提供了很好的折中。如算法 1 所示,它对 xi+1x_{i+1}xi+1​ 增加一步校正,以考虑 tit_iti​ 到 ti+1t_{i+1}ti+1​ 之间 dx/dt\mathrm{d}x/\mathrm{d}tdx/dt 的变化。这一校正使局部误差达到 O(h3)O(h^3)O(h3),代价是每一步多评估一次 DθD_\thetaDθ​。注意,若一步走到 σ=0\sigma=0σ=0 会发生除以零,因此这时我们退回欧拉法。我们在附录 D.2 中讨论一般的二阶求解器族。

Algorithm 1 Deterministic sampling using Heun’s 2nd order method with arbitrary σ(t)\sigma(t)σ(t) and s(t)s(t)s(t).

  1. procedure HEUNSAMPLER(Dθ(x;σ)D_\theta(x;\sigma)Dθ​(x;σ), σ(t)\sigma(t)σ(t), s(t)s(t)s(t), ti∈{0,…,N}t_{i\in\{0,\ldots,N\}}ti∈{0,…,N}​)
  2. sample x0∼N(0,σ2(t0)s2(t0)I)x_0\sim\mathcal{N}\bigl(0,\sigma^2(t_0)s^2(t_0)I\bigr)x0​∼N(0,σ2(t0​)s2(t0​)I) ▷ Generate initial sample at t0t_0t0​
  3. for i∈{0,…,N−1}i\in\{0,\ldots,N-1\}i∈{0,…,N−1} do ▷ Solve Eq. 4 over NNN time steps
  4. di←(σ˙(ti)/σ(ti)+s˙(ti)/s(ti))xi−σ˙(ti)s(ti)/σ(ti) Dθ(xi/s(ti);σ(ti))d_i\leftarrow\bigl(\dot{\sigma}(t_i)/\sigma(t_i)+\dot{s}(t_i)/s(t_i)\bigr)x_i-\dot{\sigma}(t_i)s(t_i)/\sigma(t_i)\,D_\theta\bigl(x_i/s(t_i);\sigma(t_i)\bigr)di​←(σ˙(ti​)/σ(ti​)+s˙(ti​)/s(ti​))xi​−σ˙(ti​)s(ti​)/σ(ti​)Dθ​(xi​/s(ti​);σ(ti​)) ▷ Evaluate dx/dt\mathrm{d}x/\mathrm{d}tdx/dt at tit_iti​
  5. xi+1←xi+(ti+1−ti)dix_{i+1}\leftarrow x_i+(t_{i+1}-t_i)d_ixi+1​←xi​+(ti+1​−ti​)di​ ▷ Take Euler step from tit_iti​ to ti+1t_{i+1}ti+1​
  6. if σ(ti+1)≠0\sigma(t_{i+1})\neq 0σ(ti+1​)=0 then ▷ Apply 2nd order correction unless σ\sigmaσ goes to zero
  7. di′←(σ˙(ti+1)/σ(ti+1)+s˙(ti+1)/s(ti+1))xi+1−σ˙(ti+1)s(ti+1)/σ(ti+1) Dθ(xi+1/s(ti+1);σ(ti+1))d'_i\leftarrow\bigl(\dot{\sigma}(t_{i+1})/\sigma(t_{i+1})+\dot{s}(t_{i+1})/s(t_{i+1})\bigr)x_{i+1}-\dot{\sigma}(t_{i+1})s(t_{i+1})/\sigma(t_{i+1})\,D_\theta\bigl(x_{i+1}/s(t_{i+1});\sigma(t_{i+1})\bigr)di′​←(σ˙(ti+1​)/σ(ti+1​)+s˙(ti+1​)/s(ti+1​))xi+1​−σ˙(ti+1​)s(ti+1​)/σ(ti+1​)Dθ​(xi+1​/s(ti+1​);σ(ti+1​)) ▷ Eval. dx/dt\mathrm{d}x/\mathrm{d}tdx/dt at ti+1t_{i+1}ti+1​
  8. xi+1←xi+(ti+1−ti)(12di+12di′)x_{i+1}\leftarrow x_i+(t_{i+1}-t_i)\bigl(\tfrac12 d_i+\tfrac12 d'_i\bigr)xi+1​←xi​+(ti+1​−ti​)(21​di​+21​di′​) ▷ Explicit trapezoidal rule at ti+1t_{i+1}ti+1​
  9. return xNx_NxN​ ▷ Return noise-free sample at tNt_NtN​

算法 1 用 Heun 二阶方法、任意 σ(t)\sigma(t)σ(t) 和 s(t)s(t)s(t) 做确定性采样。

  1. procedure HEUNSAMPLER(Dθ(x;σ)D_\theta(x;\sigma)Dθ​(x;σ), σ(t)\sigma(t)σ(t), s(t)s(t)s(t), ti∈{0,…,N}t_{i\in\{0,\ldots,N\}}ti∈{0,…,N}​)
  2. 采样 x0∼N(0,σ2(t0)s2(t0)I)x_0\sim\mathcal{N}\bigl(0,\sigma^2(t_0)s^2(t_0)I\bigr)x0​∼N(0,σ2(t0​)s2(t0​)I) ▷ 在 t0t_0t0​ 生成初始样本
  3. for i∈{0,…,N−1}i\in\{0,\ldots,N-1\}i∈{0,…,N−1} do ▷ 在 NNN 个时间步上求解式 4
  4. di←(σ˙(ti)/σ(ti)+s˙(ti)/s(ti))xi−σ˙(ti)s(ti)/σ(ti) Dθ(xi/s(ti);σ(ti))d_i\leftarrow\bigl(\dot{\sigma}(t_i)/\sigma(t_i)+\dot{s}(t_i)/s(t_i)\bigr)x_i-\dot{\sigma}(t_i)s(t_i)/\sigma(t_i)\,D_\theta\bigl(x_i/s(t_i);\sigma(t_i)\bigr)di​←(σ˙(ti​)/σ(ti​)+s˙(ti​)/s(ti​))xi​−σ˙(ti​)s(ti​)/σ(ti​)Dθ​(xi​/s(ti​);σ(ti​)) ▷ 在 tit_iti​ 计算 dx/dt\mathrm{d}x/\mathrm{d}tdx/dt
  5. xi+1←xi+(ti+1−ti)dix_{i+1}\leftarrow x_i+(t_{i+1}-t_i)d_ixi+1​←xi​+(ti+1​−ti​)di​ ▷ 从 tit_iti​ 到 ti+1t_{i+1}ti+1​ 走欧拉步
  6. if σ(ti+1)≠0\sigma(t_{i+1})\neq 0σ(ti+1​)=0 then ▷ 除非 σ\sigmaσ 变为零,否则做二阶校正
  7. di′←(σ˙(ti+1)/σ(ti+1)+s˙(ti+1)/s(ti+1))xi+1−σ˙(ti+1)s(ti+1)/σ(ti+1) Dθ(xi+1/s(ti+1);σ(ti+1))d'_i\leftarrow\bigl(\dot{\sigma}(t_{i+1})/\sigma(t_{i+1})+\dot{s}(t_{i+1})/s(t_{i+1})\bigr)x_{i+1}-\dot{\sigma}(t_{i+1})s(t_{i+1})/\sigma(t_{i+1})\,D_\theta\bigl(x_{i+1}/s(t_{i+1});\sigma(t_{i+1})\bigr)di′​←(σ˙(ti+1​)/σ(ti+1​)+s˙(ti+1​)/s(ti+1​))xi+1​−σ˙(ti+1​)s(ti+1​)/σ(ti+1​)Dθ​(xi+1​/s(ti+1​);σ(ti+1​)) ▷ 在 ti+1t_{i+1}ti+1​ 计算 dx/dt\mathrm{d}x/\mathrm{d}tdx/dt
  8. xi+1←xi+(ti+1−ti)(12di+12di′)x_{i+1}\leftarrow x_i+(t_{i+1}-t_i)\bigl(\tfrac12 d_i+\tfrac12 d'_i\bigr)xi+1​←xi​+(ti+1​−ti​)(21​di​+21​di′​) ▷ 在 ti+1t_{i+1}ti+1​ 用显式梯形法则
  9. return xNx_NxN​ ▷ 返回 tNt_NtN​ 处的无噪声样本

The time steps {ti}\{t_i\}{ti​} determine how the step sizes and thus truncation errors are distributed between different noise levels. We provide a detailed analysis in Appendix D.1, concluding that the step size should decrease monotonically with decreasing σ\sigmaσ and it does not need to vary on a per-sample basis. We adopt a parameterized scheme where the time steps are defined according to a sequence of noise levels {σi}\{\sigma_i\}{σi​}, i.e., ti=σ−1(σi)t_i=\sigma^{-1}(\sigma_i)ti​=σ−1(σi​). We set σi<N=(Ai+B)ρ\sigma_{i<N}=(Ai+B)^\rhoσi<N​=(Ai+B)ρ and select the constants AAA and BBB so that σ0=σmax⁡\sigma_0=\sigma_{\max}σ0​=σmax​ and σN−1=σmin⁡\sigma_{N-1}=\sigma_{\min}σN−1​=σmin​, which gives

时间步 {ti}\{t_i\}{ti​} 决定步长以及截断误差如何在不同噪声水平之间分配。我们在附录 D.1 中做了详细分析,结论是:步长应随 σ\sigmaσ 减小而单调减小,而且不必按样本单独变化。我们采用参数化方案,按一列噪声水平 {σi}\{\sigma_i\}{σi​} 来定义时间步,即 ti=σ−1(σi)t_i=\sigma^{-1}(\sigma_i)ti​=σ−1(σi​)。我们令 σi<N=(Ai+B)ρ\sigma_{i<N}=(Ai+B)^\rhoσi<N​=(Ai+B)ρ,并选择常数 AAA 和 BBB 使得 σ0=σmax⁡\sigma_0=\sigma_{\max}σ0​=σmax​、σN−1=σmin⁡\sigma_{N-1}=\sigma_{\min}σN−1​=σmin​,于是得到

σi<N=(σmax⁡1/ρ+iN−1(σmin⁡1/ρ−σmax⁡1/ρ))ρandσN=0.(5)\sigma_{i<N}=\left(\sigma_{\max}^{1/\rho}+\frac{i}{N-1}\bigl(\sigma_{\min}^{1/\rho}-\sigma_{\max}^{1/\rho}\bigr)\right)^{\rho}\qquad\text{and}\qquad\sigma_N=0. \tag{5}σi<N​=(σmax1/ρ​+N−1i​(σmin1/ρ​−σmax1/ρ​))ρandσN​=0.(5)

Here ρ\rhoρ controls how much the steps near σmin⁡\sigma_{\min}σmin​ are shortened at the expense of longer steps near σmax⁡\sigma_{\max}σmax​. Our analysis in Appendix D.1 shows that setting ρ=3\rho=3ρ=3 nearly equalizes the truncation error at each step, but that ρ\rhoρ in range of 5 to 10 performs much better for sampling images. This suggests that errors near σmin⁡\sigma_{\min}σmin​ have a large impact. We set ρ=7\rho=7ρ=7 for the remainder of this paper.

这里 ρ\rhoρ 控制靠近 σmin⁡\sigma_{\min}σmin​ 的步被缩短多少,代价是靠近 σmax⁡\sigma_{\max}σmax​ 的步更长。附录 D.1 的分析表明,取 ρ=3\rho=3ρ=3 几乎能让每一步的截断误差相等,但对图像采样而言,ρ\rhoρ 在 5 到 10 之间要好得多。这说明靠近 σmin⁡\sigma_{\min}σmin​ 的误差影响很大。本文后续取 ρ=7\rho=7ρ=7。

Results for Heun’s method and Eq. 5 are shown as the green curves in Figure 2. We observe consistent improvement in all cases: Heun’s method reaches the same FID as Euler’s method with considerably lower NFE.

Heun 方法与式 5 的结果是图 2 中的绿色曲线。我们在所有情形中都看到一致的改进:Heun 方法用明显更少的 NFE 就能达到与欧拉法相同的 FID。

Trajectory curvature and noise schedule. The shape of the ODE solution trajectories is defined by functions σ(t)\sigma(t)σ(t) and s(t)s(t)s(t). The choice of these functions offers a way to reduce the truncation errors discussed above, as their magnitude can be expected to scale proportional to the curvature of dx/dt\mathrm{d}x/\mathrm{d}tdx/dt. We argue that the best choice for these functions is σ(t)=t\sigma(t)=tσ(t)=t and s(t)=1s(t)=1s(t)=1, which is also the choice made in DDIM [46]. With this choice, the ODE of Eq. 4 simplifies to dx/dt=(x−D(x;t))/t\mathrm{d}x/\mathrm{d}t=\bigl(x-D(x;t)\bigr)/tdx/dt=(x−D(x;t))/t and σ\sigmaσ and ttt become interchangeable.

轨迹曲率与噪声日程。 ODE 解轨迹的形状由函数 σ(t)\sigma(t)σ(t) 和 s(t)s(t)s(t) 决定。选择这两个函数,是降低上文所讨论截断误差的一条途径,因为误差幅度可预期与 dx/dt\mathrm{d}x/\mathrm{d}tdx/dt 的曲率成正比。我们认为这两个函数的最佳选择是 σ(t)=t\sigma(t)=tσ(t)=t 和 s(t)=1s(t)=1s(t)=1,这也是 DDIM [46] 的选择。这样选择后,式 4 的 ODE 简化为 dx/dt=(x−D(x;t))/t\mathrm{d}x/\mathrm{d}t=\bigl(x-D(x;t)\bigr)/tdx/dt=(x−D(x;t))/t,并且 σ\sigmaσ 与 ttt 可以互换。

An immediate consequence is that at any xxx and ttt, a single Euler step to t=0t=0t=0 yields the denoised image Dθ(x;t)D_\theta(x;t)Dθ​(x;t). The tangent of the solution trajectory therefore always points towards the denoiser output. This can be expected to change only slowly with the noise level, which corresponds to largely linear solution trajectories. The 1D ODE sketch of Figure 3c supports this intuition; the solution trajectories approach linear at both large and small noise levels, and have substantial curvature in only a small region in between. The same effect can be seen with real data in Figure 1b, where the change between different denoiser targets occurs in a relatively narrow σ\sigmaσ range. With the advocated schedule, this corresponds to high ODE curvature being limited to this same range.

一个直接后果是:在任意 xxx 和 ttt 上,向 t=0t=0t=0 走一步欧拉步,就得到去噪图像 Dθ(x;t)D_\theta(x;t)Dθ​(x;t)。因此,解轨迹的切线总是指向去噪器输出。可以预期这一点随噪声水平只缓慢变化,也就是说解轨迹大体是线性的。图 3c 的一维 ODE 示意支持这一直觉:解轨迹在大噪声和小噪声处都接近直线,只在中间一小段区域有明显曲率。同样的效果也可以在图 1b 的真实数据上看到:不同去噪目标之间的变化发生在相对较窄的 σ\sigmaσ 范围内。按我们主张的日程,这对应着高 ODE 曲率被限制在同一范围内。

Figure 3: A sketch of ODE curvature in 1D

Figure 3: A sketch of ODE curvature in 1D where pdatap_{\mathrm{data}}pdata​ is two Dirac peaks at x=±1x=\pm 1x=±1. Horizontal ttt axis is chosen to show σ∈[0,25]\sigma\in[0,25]σ∈[0,25] in each plot, with insets showing σ∈[0,1]\sigma\in[0,1]σ∈[0,1] near the data. Example local gradients are shown with black arrows. (a) Variance preserving ODE of Song et al. [48] has solution trajectories that flatten out to horizontal lines at large σ\sigmaσ. Local gradients start pointing towards data only at small σ\sigmaσ. (b) Variance exploding variant has extreme curvature near data and the solution trajectories are curved everywhere. (c) With the schedule used by DDIM [46] and us, as σ\sigmaσ increases the solution trajectories approach straight lines that point towards the mean of data. As σ→0\sigma\to 0σ→0, the trajectories become linear and point towards the data manifold.

图 3:一维 ODE 曲率示意,其中 pdatap_{\mathrm{data}}pdata​ 是位于 x=±1x=\pm 1x=±1 的两个 Dirac 峰。横轴 ttt 的选取使每张图展示 σ∈[0,25]\sigma\in[0,25]σ∈[0,25],插图展示数据附近 σ∈[0,1]\sigma\in[0,1]σ∈[0,1]。黑色箭头给出局部梯度示例。(a) Song 等人 [48] 的方差保持 ODE,解轨迹在大 σ\sigmaσ 处被压成水平线。局部梯度只在小 σ\sigmaσ 时才开始指向数据。(b) 方差爆炸变体在数据附近有极端曲率,解轨迹处处弯曲。(c) 采用 DDIM [46] 和我们使用的日程时,随着 σ\sigmaσ 增大,解轨迹趋近指向数据均值的直线。当 σ→0\sigma\to 0σ→0 时,轨迹变为线性并指向数据流形。

The effect of setting σ(t)=t\sigma(t)=tσ(t)=t and s(t)=1s(t)=1s(t)=1 is shown as the red curves in Figure 2. As DDIM already employs these same choices, the red curve is identical to the green one for ImageNet-64. However, VP and VE benefit considerably from switching away from their original schedules.

取 σ(t)=t\sigma(t)=tσ(t)=t 和 s(t)=1s(t)=1s(t)=1 的效果是图 2 中的红色曲线。由于 DDIM 已经采用同样的选择,ImageNet-64 上红线与绿线重合。不过,VP 和 VE 在离开原来的日程后收益相当可观。

Discussion. The choices that we made in this section to improve deterministic sampling are summarized in the Sampling part of Table 1. Together, they reduce the NFE needed to reach high-quality results by a large factor: 7.3×7.3\times7.3× for VP, 300×300\times300× for VE, and 3.2×3.2\times3.2× for DDIM, corresponding to the highlighted NFE values in Figure 2. In practice, we can generate 26.3 high-quality CIFAR-10 images per second on a single NVIDIA V100. The consistency of improvements corroborates our hypothesis that the sampling process is orthogonal to how each model was originally trained. As further validation, we show results for the adaptive RK45 method [11] using our schedule as the dashed black curves in Figure 2; the cost of this sophisticated ODE solver outweighs its benefits.

讨论。 本节为改进确定性采样所做的选择,汇总在表 1 的 Sampling 部分。它们合在一起,把达到高质量结果所需的 NFE 大幅度降低:对 VP 是 7.3×7.3\times7.3×,对 VE 是 300×300\times300×,对 DDIM 是 3.2×3.2\times3.2×,对应于图 2 中标出的 NFE 值。实践中,我们在单块 NVIDIA V100 上每秒可以生成 26.3 张高质量 CIFAR-10 图像。改进的一致性支持了我们的假设:采样过程与各模型最初如何训练是正交的。作为进一步验证,我们在图 2 中用黑色虚线给出采用我们日程的自适应 RK45 方法 [11] 的结果;这种更复杂的 ODE 求解器,其代价超过了它带来的好处。

4 Stochastic sampling

4 随机采样

Deterministic sampling offers many benefits, e.g., the ability to turn real images into their corresponding latent representations by inverting the ODE. However, it tends to lead to worse output quality [46, 48] than stochastic sampling that injects fresh noise into the image in each step. Given that ODEs and SDEs recover the same distributions in theory, what exactly is the role of stochasticity?

确定性采样有不少好处,例如可以通过反解 ODE,把真实图像变成对应的潜表示。不过,它往往比每一步向图像注入新噪声的随机采样带来更差的输出质量 [46, 48]。既然 ODE 和 SDE 在理论上恢复的是同一分布,随机性究竟起什么作用?

Background. The SDEs of Song et al. [48] can be generalized [20, 55] as a sum of the probability flow ODE of Eq. 1 and a time-varying Langevin diffusion SDE [14] (see Appendix B.5):

背景。 Song 等人 [48] 的 SDE 可以推广 [20, 55] 为式 1 的概率流 ODE 与一个随时间变化的 Langevin 扩散 SDE [14] 之和(见附录 B.5):

dx±=−σ˙(t)σ(t)∇xlog⁡p(x;σ(t)) dt  ±  β(t)σ(t)2∇xlog⁡p(x;σ(t)) dt+2β(t) σ(t) dωt,(6)\mathrm{d}x_{\pm}=-\dot{\sigma}(t)\sigma(t)\nabla_x\log p\bigl(x;\sigma(t)\bigr)\,\mathrm{d}t\;\pm\;\beta(t)\sigma(t)^2\nabla_x\log p\bigl(x;\sigma(t)\bigr)\,\mathrm{d}t+\sqrt{2\beta(t)}\,\sigma(t)\,\mathrm{d}\omega_t, \tag{6}dx±​=−σ˙(t)σ(t)∇x​logp(x;σ(t))dt±β(t)σ(t)2∇x​logp(x;σ(t))dt+2β(t)​σ(t)dωt​,(6)

where ωt\omega_tωt​ is the standard Wiener process. dx+\mathrm{d}x_+dx+​ and dx−\mathrm{d}x_-dx−​ are now separate SDEs for moving forward and backward in time, related by the time reversal formula of Anderson [1]. The Langevin term can further be seen as a combination of a deterministic score-based denoising term and a stochastic noise injection term, whose net noise level contributions cancel out. As such, β(t)\beta(t)β(t) effectively expresses the relative rate at which existing noise is replaced with new noise. The SDEs of Song et al. [48] are recovered with the choice β(t)=σ˙(t)/σ(t)\beta(t)=\dot{\sigma}(t)/\sigma(t)β(t)=σ˙(t)/σ(t), whereby the score vanishes from the forward SDE.

其中 ωt\omega_tωt​ 是标准 Wiener 过程。dx+\mathrm{d}x_+dx+​ 和 dx−\mathrm{d}x_-dx−​ 现在分别是时间向前和向后的 SDE,由 Anderson 的时间反转公式 [1] 相联系。Langevin 项还可以看成确定性的基于分数的去噪项与随机的噪声注入项之和,两者对净噪声水平的贡献相互抵消。因此,β(t)\beta(t)β(t) 实际上表达的是用新噪声替换已有噪声的相对速率。取 β(t)=σ˙(t)/σ(t)\beta(t)=\dot{\sigma}(t)/\sigma(t)β(t)=σ˙(t)/σ(t) 即可恢复 Song 等人 [48] 的 SDE,此时分数从正向 SDE 中消失。

This perspective reveals why stochasticity is helpful in practice: The implicit Langevin diffusion drives the sample towards the desired marginal distribution at a given time, actively correcting for any errors made in earlier sampling steps. On the other hand, approximating the Langevin term with discrete SDE solver steps introduces error in itself. Previous results [3, 24, 46, 48] suggest that non-zero β(t)\beta(t)β(t) is helpful, but as far as we can tell, the implicit choice for β(t)\beta(t)β(t) in Song et al. [48] enjoys no special properties. Hence, the optimal amount of stochasticity should be determined empirically.

这一视角说明了随机性在实践中何以有帮助:隐含的 Langevin 扩散会把样本推向给定时刻所期望的边际分布,从而主动校正先前采样步骤中的误差。另一方面,用离散 SDE 求解步去近似 Langevin 项,本身也会引入误差。已有结果 [3, 24, 46, 48] 表明非零的 β(t)\beta(t)β(t) 是有帮助的,但就我们所见,Song 等人 [48] 对 β(t)\beta(t)β(t) 的隐含选择并没有特殊性质。因此,最优的随机性程度应当由经验来确定。

Our stochastic sampler. We propose a stochastic sampler that combines our 2nd order deterministic ODE integrator with explicit Langevin-like “churn” of adding and removing noise. A pseudocode is given in Algorithm 2. At each step iii, given the sample xix_ixi​ at noise level tit_iti​ (=σ(ti)=\sigma(t_i)=σ(ti​)), we perform two sub-steps. First, we add noise to the sample according to a factor γi≥0\gamma_i\ge 0γi​≥0 to reach a higher noise level t^i=ti+γiti\hat{t}_i=t_i+\gamma_i t_it^i​=ti​+γi​ti​. Second, from the increased-noise sample x^i\hat{x}_ix^i​, we solve the ODE backward from t^i\hat{t}_it^i​ to ti+1t_{i+1}ti+1​ with a single step. This yields a sample xi+1x_{i+1}xi+1​ with noise level ti+1t_{i+1}ti+1​, and the iteration continues. We stress that this is not a general-purpose SDE solver, but a sampling procedure tailored for the specific problem.

我们的随机采样器。 我们提出一种随机采样器,把我们的二阶确定性 ODE 积分器,与显式的、类似 Langevin 的“搅动”(先加噪再去噪)结合起来。伪代码见算法 2。在每一步 iii,给定噪声水平 tit_iti​(=σ(ti)=\sigma(t_i)=σ(ti​))上的样本 xix_ixi​,我们做两个子步骤。首先,按因子 γi≥0\gamma_i\ge 0γi​≥0 向样本加噪,到达更高的噪声水平 t^i=ti+γiti\hat{t}_i=t_i+\gamma_i t_it^i​=ti​+γi​ti​。其次,从加噪后的样本 x^i\hat{x}_ix^i​ 出发,用单步把 ODE 从 t^i\hat{t}_it^i​ 向后求解到 ti+1t_{i+1}ti+1​。这样就得到噪声水平为 ti+1t_{i+1}ti+1​ 的样本 xi+1x_{i+1}xi+1​,迭代继续。我们强调,这不是通用的 SDE 求解器,而是针对该问题定制的采样程序。

Algorithm 2 Our stochastic sampler with σ(t)=t\sigma(t)=tσ(t)=t and s(t)=1s(t)=1s(t)=1.

  1. procedure STOCHASTICSAMPLER(Dθ(x;σ)D_\theta(x;\sigma)Dθ​(x;σ), ti∈{0,…,N}t_{i\in\{0,\ldots,N\}}ti∈{0,…,N}​, γi∈{0,…,N−1}\gamma_{i\in\{0,\ldots,N-1\}}γi∈{0,…,N−1}​, SnoiseS_{\mathrm{noise}}Snoise​)
  2. sample x0∼N(0,t02I)x_0\sim\mathcal{N}(0,t_0^2 I)x0​∼N(0,t02​I)
  3. for i∈{0,…,N−1}i\in\{0,\ldots,N-1\}i∈{0,…,N−1} do ▷ γi=min⁡(Schurn/N,2−1)\gamma_i=\min(S_{\mathrm{churn}}/N,\sqrt{2}-1)γi​=min(Schurn​/N,2​−1) if ti∈[Stmin⁡,Stmax⁡]t_i\in[S_{t_{\min}},S_{t_{\max}}]ti​∈[Stmin​​,Stmax​​], else 000
  4. sample ϵi∼N(0,Snoise2I)\epsilon_i\sim\mathcal{N}(0,S_{\mathrm{noise}}^2 I)ϵi​∼N(0,Snoise2​I)
  5. t^i←ti+γiti\hat{t}_i\leftarrow t_i+\gamma_i t_it^i​←ti​+γi​ti​ ▷ Select temporarily increased noise level t^i\hat{t}_it^i​
  6. x^i←xi+t^i2−ti2 ϵi\hat{x}_i\leftarrow x_i+\sqrt{\hat{t}_i^2-t_i^2}\,\epsilon_ix^i​←xi​+t^i2​−ti2​​ϵi​ ▷ Add new noise to move from tit_iti​ to t^i\hat{t}_it^i​
  7. di←(x^i−Dθ(x^i;t^i))/t^id_i\leftarrow\bigl(\hat{x}_i-D_\theta(\hat{x}_i;\hat{t}_i)\bigr)/\hat{t}_idi​←(x^i​−Dθ​(x^i​;t^i​))/t^i​ ▷ Evaluate dx/dt\mathrm{d}x/\mathrm{d}tdx/dt at t^i\hat{t}_it^i​
  8. xi+1←x^i+(ti+1−t^i)dix_{i+1}\leftarrow\hat{x}_i+(t_{i+1}-\hat{t}_i)d_ixi+1​←x^i​+(ti+1​−t^i​)di​ ▷ Take Euler step from t^i\hat{t}_it^i​ to ti+1t_{i+1}ti+1​
  9. if ti+1≠0t_{i+1}\neq 0ti+1​=0 then
  10. di′←(xi+1−Dθ(xi+1;ti+1))/ti+1d'_i\leftarrow\bigl(x_{i+1}-D_\theta(x_{i+1};t_{i+1})\bigr)/t_{i+1}di′​←(xi+1​−Dθ​(xi+1​;ti+1​))/ti+1​ ▷ Apply 2nd order correction
  11. xi+1←x^i+(ti+1−t^i)(12di+12di′)x_{i+1}\leftarrow\hat{x}_i+(t_{i+1}-\hat{t}_i)\bigl(\tfrac12 d_i+\tfrac12 d'_i\bigr)xi+1​←x^i​+(ti+1​−t^i​)(21​di​+21​di′​)
  12. return xNx_NxN​

算法 2 我们在 σ(t)=t\sigma(t)=tσ(t)=t 和 s(t)=1s(t)=1s(t)=1 下的随机采样器。

  1. procedure STOCHASTICSAMPLER(Dθ(x;σ)D_\theta(x;\sigma)Dθ​(x;σ), ti∈{0,…,N}t_{i\in\{0,\ldots,N\}}ti∈{0,…,N}​, γi∈{0,…,N−1}\gamma_{i\in\{0,\ldots,N-1\}}γi∈{0,…,N−1}​, SnoiseS_{\mathrm{noise}}Snoise​)
  2. 采样 x0∼N(0,t02I)x_0\sim\mathcal{N}(0,t_0^2 I)x0​∼N(0,t02​I)
  3. for i∈{0,…,N−1}i\in\{0,\ldots,N-1\}i∈{0,…,N−1} do ▷ 若 ti∈[Stmin⁡,Stmax⁡]t_i\in[S_{t_{\min}},S_{t_{\max}}]ti​∈[Stmin​​,Stmax​​],则 γi=min⁡(Schurn/N,2−1)\gamma_i=\min(S_{\mathrm{churn}}/N,\sqrt{2}-1)γi​=min(Schurn​/N,2​−1),否则为 000
  4. 采样 ϵi∼N(0,Snoise2I)\epsilon_i\sim\mathcal{N}(0,S_{\mathrm{noise}}^2 I)ϵi​∼N(0,Snoise2​I)
  5. t^i←ti+γiti\hat{t}_i\leftarrow t_i+\gamma_i t_it^i​←ti​+γi​ti​ ▷ 选择暂时提高的噪声水平 t^i\hat{t}_it^i​
  6. x^i←xi+t^i2−ti2 ϵi\hat{x}_i\leftarrow x_i+\sqrt{\hat{t}_i^2-t_i^2}\,\epsilon_ix^i​←xi​+t^i2​−ti2​​ϵi​ ▷ 加入新噪声,从 tit_iti​ 走到 t^i\hat{t}_it^i​
  7. di←(x^i−Dθ(x^i;t^i))/t^id_i\leftarrow\bigl(\hat{x}_i-D_\theta(\hat{x}_i;\hat{t}_i)\bigr)/\hat{t}_idi​←(x^i​−Dθ​(x^i​;t^i​))/t^i​ ▷ 在 t^i\hat{t}_it^i​ 计算 dx/dt\mathrm{d}x/\mathrm{d}tdx/dt
  8. xi+1←x^i+(ti+1−t^i)dix_{i+1}\leftarrow\hat{x}_i+(t_{i+1}-\hat{t}_i)d_ixi+1​←x^i​+(ti+1​−t^i​)di​ ▷ 从 t^i\hat{t}_it^i​ 到 ti+1t_{i+1}ti+1​ 走欧拉步
  9. if ti+1≠0t_{i+1}\neq 0ti+1​=0 then
  10. di′←(xi+1−Dθ(xi+1;ti+1))/ti+1d'_i\leftarrow\bigl(x_{i+1}-D_\theta(x_{i+1};t_{i+1})\bigr)/t_{i+1}di′​←(xi+1​−Dθ​(xi+1​;ti+1​))/ti+1​ ▷ 做二阶校正
  11. xi+1←x^i+(ti+1−t^i)(12di+12di′)x_{i+1}\leftarrow\hat{x}_i+(t_{i+1}-\hat{t}_i)\bigl(\tfrac12 d_i+\tfrac12 d'_i\bigr)xi+1​←x^i​+(ti+1​−t^i​)(21​di​+21​di′​)
  12. return xNx_NxN​

Figure 4: Evaluation of our stochastic sampler

Figure 4: Evaluation of our stochastic sampler (Algorithm 2). The purple curve corresponds to optimal choices for {Schurn,Stmin⁡,Stmax⁡,Snoise}\{S_{\mathrm{churn}}, S_{t_{\min}}, S_{t_{\max}}, S_{\mathrm{noise}}\}{Schurn​,Stmin​​,Stmax​​,Snoise​}; orange, blue, and green correspond to disabling the effects of Stmin⁡,tmax⁡S_{t_{\min},t_{\max}}Stmin​,tmax​​ and/or SnoiseS_{\mathrm{noise}}Snoise​. The red curves show reference results for our deterministic sampler (Algorithm 1), equivalent to setting Schurn=0S_{\mathrm{churn}}=0Schurn​=0. The dashed black curves correspond to the original stochastic samplers from previous work: Euler–Maruyama [48] for VP, predictor-corrector [48] for VE, and iDDPM [36] for ImageNet-64. The dots indicate lowest observed FID.

图 4:对我们随机采样器(算法 2)的评估。紫色曲线对应 {Schurn,Stmin⁡,Stmax⁡,Snoise\{S_{\mathrm{churn}}, S_{t_{\min}}, S_{t_{\max}}, S_{\mathrm{noise}}{Schurn​,Stmin​​,Stmax​​,Snoise​ 的最优选择;橙、蓝、绿对应关闭 Stmin⁡,tmax⁡S_{t_{\min},t_{\max}}Stmin​,tmax​​ 和/或 SnoiseS_{\mathrm{noise}}Snoise​ 的效果。红色曲线是我们确定性采样器(算法 1)的对照结果,等价于取 Schurn=0S_{\mathrm{churn}}=0Schurn​=0。黑色虚线对应以往工作中原来的随机采样器:VP 用 Euler–Maruyama [48],VE 用预测–校正 [48],ImageNet-64 用 iDDPM [36]。圆点表示观测到的最低 FID。

Its correctness stems from the alternation of two sub-steps that each maintain the correct distribution (up to truncation error in the ODE step). The predictor-corrector sampler of Song et al. [48] has a conceptually similar structure to ours.

它的正确性来自两个子步骤的交替,每一步都保持正确的分布(除了 ODE 步中的截断误差)。Song 等人 [48] 的预测–校正采样器在概念结构上与我们的方法相似。

To analyze the main difference between our method and Euler–Maruyama, we first note a subtle discrepancy in the latter when discretizing Eq. 6. One can interpret Euler–Maruyama as first adding noise and then performing an ODE step, not from the intermediate state after noise injection, but assuming that xxx and σ\sigmaσ remained at the initial state at the beginning of the iteration step. In our method, the parameters used to evaluate DθD_\thetaDθ​ on line 7 of Algorithm 2 correspond to the state after noise injection, whereas an Euler–Maruyama-like method would use xi;tix_i; t_ixi​;ti​ instead of x^i;t^i\hat{x}_i; \hat{t}_ix^i​;t^i​. In the limit of Δt\Delta tΔt approaching zero there may be no difference between these choices, but the distinction appears to become significant when pursuing low NFE with large steps.

为了分析我们的方法与 Euler–Maruyama 的主要差别,我们先注意到后者在离散化式 6 时有一处细微不一致。可以把 Euler–Maruyama 理解成先加噪,再做 ODE 步,但这一步并不是从加噪后的中间状态出发,而是假定 xxx 和 σ\sigmaσ 仍停留在该迭代步开始时的初始状态。在我们的方法里,算法 2 第 7 行评估 DθD_\thetaDθ​ 所用的参数对应加噪之后的状态;而类似 Euler–Maruyama 的方法会用 xi;tix_i; t_ixi​;ti​ 而不是 x^i;t^i\hat{x}_i; \hat{t}_ix^i​;t^i​。当 Δt\Delta tΔt 趋于零时,这两种选择可能没有差别,但在追求低 NFE、因而步长较大时,这一区别似乎会变得重要。

Practical considerations. Increasing the amount of stochasticity is effective in correcting errors made by earlier sampling steps, but it has its own drawbacks. We have observed (see Appendix E.1) that excessive Langevin-like addition and removal of noise results in gradual loss of detail in the generated images with all datasets and denoiser networks. There is also a drift toward oversaturated colors at very low and high noise levels. We suspect that practical denoisers induce a slightly non-conservative vector field in Eq. 3, violating the premises of Langevin diffusion and causing these detrimental effects. Notably, our experiments with analytical denoisers (such as the one in Figure 1b) have not shown such degradation.

实践上的考虑。 增加随机性有助于校正先前采样步骤造成的误差,但它也有自身的缺点。我们观察到(见附录 E.1),过度地做类似 Langevin 的加噪与去噪,会在所有数据集和去噪网络上导致生成图像逐渐丢失细节。在非常低和非常高的噪声水平上,还会出现颜色过饱和的漂移。我们怀疑,实际去噪器会在式 3 中诱导出一个略微非保守的向量场,从而破坏 Langevin 扩散的前提并造成这些有害效应。值得注意的是,我们用解析去噪器(例如图 1b 中的那个)做的实验并未出现这类退化。

If the degradation is caused by flaws in Dθ(x;σ)D_\theta(x;\sigma)Dθ​(x;σ), they can only be remedied using heuristic means during sampling. We address the drift toward oversaturated colors by only enabling stochasticity within a specific range of noise levels ti∈[Stmin⁡,Stmax⁡]t_i\in[S_{t_{\min}}, S_{t_{\max}}]ti​∈[Stmin​​,Stmax​​]. For these noise levels, we define γi=Schurn/N\gamma_i=S_{\mathrm{churn}}/Nγi​=Schurn​/N, where SchurnS_{\mathrm{churn}}Schurn​ controls the overall amount of stochasticity. We further clamp γi\gamma_iγi​ to never introduce more new noise than what is already present in the image. Finally, we have found that the loss of detail can be partially counteracted by setting SnoiseS_{\mathrm{noise}}Snoise​ slightly above 1 to inflate the standard deviation for the newly added noise. This suggests that a major component of the hypothesized non-conservativity of Dθ(x;σ)D_\theta(x;\sigma)Dθ​(x;σ) is a tendency to remove slightly too much noise — most likely due to regression toward the mean that can be expected to happen with any L2L_2L2​-trained denoiser [29].

如果退化是由 Dθ(x;σ)D_\theta(x;\sigma)Dθ​(x;σ) 的缺陷引起的,采样时就只能用启发式手段来补救。我们通过只在特定噪声水平范围 ti∈[Stmin⁡,Stmax⁡]t_i\in[S_{t_{\min}}, S_{t_{\max}}]ti​∈[Stmin​​,Stmax​​] 内打开随机性,来处理颜色过饱和的漂移。在这些噪声水平上,我们定义 γi=Schurn/N\gamma_i=S_{\mathrm{churn}}/Nγi​=Schurn​/N,其中 SchurnS_{\mathrm{churn}}Schurn​ 控制总体随机性程度。我们还对 γi\gamma_iγi​ 做裁剪,使新引入的噪声不超过图像中已有的噪声。最后,我们发现把 SnoiseS_{\mathrm{noise}}Snoise​ 略设在 1 以上、从而放大新加噪声的标准差,可以部分抵消细节丢失。这说明,所假设的 Dθ(x;σ)D_\theta(x;\sigma)Dθ​(x;σ) 非保守性里,一个主要成分是它往往会去掉略多一点的噪声——这很可能来自任何用 L2L_2L2​ 训练的去噪器都可预期出现的向均值回归 [29]。

Evaluation. Figure 4 shows that our stochastic sampler outperforms previous samplers [24, 36, 48] by a significant margin, especially at low step counts. Jolicoeur-Martineau et al. [24] use a standard higher-order adaptive SDE solver [40] and its performance is a good baseline for such solvers in general. Our sampler has been tailored to the use case by, e.g., performing noise injection and ODE step sequentially, and it is not adaptive. It is an open question if adaptive solvers can be a net win over a well-tuned fixed schedule in sampling diffusion models.

评估。 图 4 表明,我们的随机采样器明显优于以往的采样器 [24, 36, 48],在步数较少时尤其如此。Jolicoeur-Martineau 等人 [24] 使用标准的高阶自适应 SDE 求解器 [40],其表现是这类求解器的一个很好基线。我们的采样器针对这一用途做了定制,例如把噪声注入和 ODE 步按顺序执行,并且不是自适应的。自适应求解器在扩散模型采样中,能否相对调校良好的固定日程取得净收益,仍是一个开放问题。

Through sampler improvements alone, we are able to bring the ImageNet-64 model that originally achieved FID 2.07 [9] to 1.55 that is very close to the state-of-the-art; previously, FID 1.48 has been reported for cascaded diffusion [17], 1.55 for classifier-free guidance [18], and 1.52 for StyleGAN-XL [44]. While our results showcase the potential gains achievable through sampler improvements, they also highlight the main shortcoming of stochasticity: For best results, one must make several heuristic choices — either implicit or explicit — that depend on the specific model. Indeed, we had to find the optimal values of {Schurn,Stmin⁡,Stmax⁡,Snoise}\{S_{\mathrm{churn}}, S_{t_{\min}}, S_{t_{\max}}, S_{\mathrm{noise}}\}{Schurn​,Stmin​​,Stmax​​,Snoise​} on a case-by-case basis using grid search (Appendix E.2). This raises a general concern that using stochastic sampling as the primary means of evaluating model improvements may inadvertently end up influencing the design choices related to model architecture and training.

仅通过改进采样器,我们就能把原先 FID 为 2.07 的 ImageNet-64 模型 [9] 做到 1.55,已经非常接近当时最优;此前,级联扩散报告过 FID 1.48 [17],无分类器引导报告过 1.55 [18],StyleGAN-XL 报告过 1.52 [44]。我们的结果既展示了改进采样器可能带来的收益,也凸显了随机性的主要短板:要得到最好结果,必须做出若干依赖于具体模型的启发式选择——无论是隐含的还是显式的。事实上,我们不得不用网格搜索逐个模型寻找 {Schurn,Stmin⁡,Stmax⁡,Snoise}\{S_{\mathrm{churn}}, S_{t_{\min}}, S_{t_{\max}}, S_{\mathrm{noise}}\}{Schurn​,Stmin​​,Stmax​​,Snoise​} 的最优值(附录 E.2)。这带来一个更一般的担心:如果把随机采样当作评估模型改进的主要手段,可能在不经意间反过来影响与模型结构和训练有关的设计选择。

5 Preconditioning and training

5 预条件与训练

There are various known good practices for training neural networks in a supervised fashion. For example, it is advisable to keep input and output signal magnitudes fixed to, e.g., unit variance, and to avoid large variation in gradient magnitudes on a per-sample basis [5, 21]. Training a neural network to model DDD directly would be far from ideal — for example, as the input x=y+nx=y+nx=y+n is a combination of clean signal yyy and noise n∼N(0,σ2I)n\sim\mathcal{N}(0,\sigma^2 I)n∼N(0,σ2I), its magnitude varies immensely depending on noise level σ\sigmaσ. For this reason, the common practice is to not represent DθD_\thetaDθ​ as a neural network directly, but instead train a different network FθF_\thetaFθ​ from which DθD_\thetaDθ​ is derived.

监督训练神经网络有不少已知的好做法。例如,最好把输入和输出信号的幅度固定在如单位方差上,并避免逐样本梯度幅度变化过大 [5, 21]。直接训练一个网络去拟合 DDD 远非理想——例如,输入 x=y+nx=y+nx=y+n 是干净信号 yyy 与噪声 n∼N(0,σ2I)n\sim\mathcal{N}(0,\sigma^2 I)n∼N(0,σ2I) 的组合,其幅度会随噪声水平 σ\sigmaσ 剧烈变化。因此,常见做法不是直接用神经网络表示 DθD_\thetaDθ​,而是训练另一个网络 FθF_\thetaFθ​,再由它导出 DθD_\thetaDθ​。

Previous methods [36, 46, 48] address the input scaling via a σ\sigmaσ-dependent normalization factor and attempt to precondition the output by training FθF_\thetaFθ​ to predict nnn scaled to unit variance, from which the signal is then reconstructed via Dθ(x;σ)=x−σFθ(⋅)D_\theta(x;\sigma)=x-\sigma F_\theta(\cdot)Dθ​(x;σ)=x−σFθ​(⋅). This has the drawback that at large σ\sigmaσ, the network needs to fine-tune its output carefully to cancel out the existing noise nnn exactly and give the output at the correct scale; note that any errors made by the network are amplified by a factor of σ\sigmaσ. In this situation, it would seem much easier to predict the expected output D(x;σ)D(x;\sigma)D(x;σ) directly. In the same spirit as previous parameterizations that adaptively mix signal and noise (e.g., [10, 43, 50]), we propose to precondition the neural network with a σ\sigmaσ-dependent skip connection that allows it to estimate either yyy or nnn, or something in between. We thus write DθD_\thetaDθ​ in the following form:

以往方法 [36, 46, 48] 用依赖于 σ\sigmaσ 的归一化因子处理输入缩放,并试图通过让 FθF_\thetaFθ​ 预测被缩放到单位方差的 nnn 来预条件输出,再由 Dθ(x;σ)=x−σFθ(⋅)D_\theta(x;\sigma)=x-\sigma F_\theta(\cdot)Dθ​(x;σ)=x−σFθ​(⋅) 重建信号。这样做的缺点是:在大 σ\sigmaσ 时,网络需要非常小心地微调输出,才能恰好抵消已有噪声 nnn 并给出正确尺度的结果;注意,网络犯下的任何误差都会被放大 σ\sigmaσ 倍。在这种情形下,直接预测期望输出 D(x;σ)D(x;\sigma)D(x;σ) 似乎容易得多。与以往自适应混合信号和噪声的参数化(例如 [10, 43, 50])同一思路,我们提出用依赖于 σ\sigmaσ 的跳过连接来预条件神经网络,使它可以估计 yyy 或 nnn,或介于两者之间的某物。于是我们把 DθD_\thetaDθ​ 写成如下形式:

Dθ(x;σ)=cskip(σ) x+cout(σ) Fθ(cin(σ) x; cnoise(σ)),(7)D_\theta(x;\sigma)=c_{\mathrm{skip}}(\sigma)\,x+c_{\mathrm{out}}(\sigma)\,F_\theta\bigl(c_{\mathrm{in}}(\sigma)\,x;\,c_{\mathrm{noise}}(\sigma)\bigr), \tag{7}Dθ​(x;σ)=cskip​(σ)x+cout​(σ)Fθ​(cin​(σ)x;cnoise​(σ)),(7)

where FθF_\thetaFθ​ is the neural network to be trained, cskip(σ)c_{\mathrm{skip}}(\sigma)cskip​(σ) modulates the skip connection, cin(σ)c_{\mathrm{in}}(\sigma)cin​(σ) and cout(σ)c_{\mathrm{out}}(\sigma)cout​(σ) scale the input and output magnitudes, and cnoise(σ)c_{\mathrm{noise}}(\sigma)cnoise​(σ) maps noise level σ\sigmaσ into a conditioning input for FθF_\thetaFθ​. See Table 1 for the specific choices employed by previous methods, as well as the ones that we derive in Appendix B.6.

其中 FθF_\thetaFθ​ 是要训练的神经网络,cskip(σ)c_{\mathrm{skip}}(\sigma)cskip​(σ) 调节跳过连接,cin(σ)c_{\mathrm{in}}(\sigma)cin​(σ) 和 cout(σ)c_{\mathrm{out}}(\sigma)cout​(σ) 缩放输入和输出幅度,cnoise(σ)c_{\mathrm{noise}}(\sigma)cnoise​(σ) 把噪声水平 σ\sigmaσ 映射成 FθF_\thetaFθ​ 的条件输入。以往方法采用的具体选择,以及我们在附录 B.6 中导出的选择,见表 1。

Taking a weighted expectation of Eq. 2 over the noise levels gives the overall training loss Eσ,y,n[λ(σ)∥D(y+n;σ)−y∥22]\mathbb{E}_{\sigma,y,n}\bigl[\lambda(\sigma)\lVert D(y+n;\sigma)-y\rVert_2^2\bigr]Eσ,y,n​[λ(σ)∥D(y+n;σ)−y∥22​], where σ∼ptrain\sigma\sim p_{\mathrm{train}}σ∼ptrain​, y∼pdatay\sim p_{\mathrm{data}}y∼pdata​, and n∼N(0,σ2I)n\sim\mathcal{N}(0,\sigma^2 I)n∼N(0,σ2I). The probability of sampling a given noise level σ\sigmaσ is given by ptrain(σ)p_{\mathrm{train}}(\sigma)ptrain​(σ) and the corresponding weight is given by λ(σ)\lambda(\sigma)λ(σ). We can equivalently express this loss with respect to the raw network output FθF_\thetaFθ​ in Eq. 7:

把式 2 对噪声水平取加权期望,就得到总体训练损失 Eσ,y,n[λ(σ)∥D(y+n;σ)−y∥22]\mathbb{E}_{\sigma,y,n}\bigl[\lambda(\sigma)\lVert D(y+n;\sigma)-y\rVert_2^2\bigr]Eσ,y,n​[λ(σ)∥D(y+n;σ)−y∥22​],其中 σ∼ptrain\sigma\sim p_{\mathrm{train}}σ∼ptrain​,y∼pdatay\sim p_{\mathrm{data}}y∼pdata​,n∼N(0,σ2I)n\sim\mathcal{N}(0,\sigma^2 I)n∼N(0,σ2I)。采样某一噪声水平 σ\sigmaσ 的概率由 ptrain(σ)p_{\mathrm{train}}(\sigma)ptrain​(σ) 给出,相应权重由 λ(σ)\lambda(\sigma)λ(σ) 给出。我们也可以把这一损失等价地写成式 7 中原始网络输出 FθF_\thetaFθ​ 的形式:

Eσ,y,n[λ(σ) cout(σ)2∥Fθ(cin(σ)⋅(y+n);cnoise(σ))−1cout(σ)(y−cskip(σ)⋅(y+n))∥22].(8)\mathbb{E}_{\sigma,y,n}\left[\lambda(\sigma)\,c_{\mathrm{out}}(\sigma)^2\left\lVert F_\theta\bigl(c_{\mathrm{in}}(\sigma)\cdot(y+n);c_{\mathrm{noise}}(\sigma)\bigr)-\frac{1}{c_{\mathrm{out}}(\sigma)}\bigl(y-c_{\mathrm{skip}}(\sigma)\cdot(y+n)\bigr)\right\rVert_2^2\right]. \tag{8}Eσ,y,n​[λ(σ)cout​(σ)2​Fθ​(cin​(σ)⋅(y+n);cnoise​(σ))−cout​(σ)1​(y−cskip​(σ)⋅(y+n))​22​].(8)

This form reveals the effective training target of FθF_\thetaFθ​, allowing us to determine suitable choices for the preconditioning functions from first principles. As detailed in Appendix B.6, we derive our choices shown in Table 1 by requiring network inputs and training targets to have unit variance (cinc_{\mathrm{in}}cin​, coutc_{\mathrm{out}}cout​), and amplifying errors in FθF_\thetaFθ​ as little as possible (cskipc_{\mathrm{skip}}cskip​). The formula for cnoisec_{\mathrm{noise}}cnoise​ is chosen empirically.

这一形式揭示了 FθF_\thetaFθ​ 的有效训练目标,使我们能从第一原理出发确定预条件函数的合适选择。如附录 B.6 所详述,表 1 中我们的选择是这样导出的:要求网络输入和训练目标具有单位方差(cinc_{\mathrm{in}}cin​、coutc_{\mathrm{out}}cout​),并尽可能少地放大 FθF_\thetaFθ​ 中的误差(cskipc_{\mathrm{skip}}cskip​)。cnoisec_{\mathrm{noise}}cnoise​ 的公式则按经验选定。

Table 2: Evaluation of EDM training improvements

Table 2: Evaluation of our training improvements. The starting point (config A) is VP & VE using our deterministic sampler. At the end (configs E, F), VP & VE only differ in the architecture of FθF_\thetaFθ​.

表 2:对我们训练改进的评估。起点(配置 A)是采用我们确定性采样器的 VP 与 VE。到最后(配置 E、F),VP 与 VE 只在 FθF_\thetaFθ​ 的结构上不同。

Table 2 shows FID for a series of training setups, evaluated using our deterministic sampler from Section 3. We start with the baseline training setup of Song et al. [48], which differs considerably between the VP and VE cases; we provide separate results for each (config A). To obtain a more meaningful point of comparison, we re-adjust the basic hyperparameters (config B) and improve the expressive power of the model (config C) by removing the lowest-resolution layers and doubling the capacity of the highest-resolution layers instead; see Appendix F.3 for further details. We then replace the original choices of {cin,cout,cnoise,cskip}\{c_{\mathrm{in}}, c_{\mathrm{out}}, c_{\mathrm{noise}}, c_{\mathrm{skip}}\}{cin​,cout​,cnoise​,cskip​} with our preconditioning (config D), which keeps the results largely unchanged — except for VE that improves considerably at 64×6464\times 6464×64 resolution. Instead of improving FID per se, the main benefit of our preconditioning is that it makes the training more robust, enabling us to turn our focus on redesigning the loss function without adverse effects.

表 2 给出一系列训练设置的 FID,均用第 3 节的确定性采样器评估。我们从 Song 等人 [48] 的基线训练设置出发,该设置在 VP 和 VE 情形下差别相当大;我们对两者分别给出结果(配置 A)。为了得到更有意义的比较起点,我们重新调整基本超参数(配置 B),并通过去掉最低分辨率层、同时把最高分辨率层的容量加倍,来提高模型的表达能力(配置 C);更多细节见附录 F.3。然后,我们把原来的 {cin,cout,cnoise,cskip}\{c_{\mathrm{in}}, c_{\mathrm{out}}, c_{\mathrm{noise}}, c_{\mathrm{skip}}\}{cin​,cout​,cnoise​,cskip​} 换成我们的预条件(配置 D),结果大体不变——只是 VE 在 64×6464\times 6464×64 分辨率上有明显改善。预条件的主要好处并不在于本身把 FID 做低,而在于让训练更稳健,从而使我们可以把注意力转向重新设计损失函数,而不产生副作用。

Loss weighting and sampling. Eq. 8 shows that training FθF_\thetaFθ​ as preconditioned in Eq. 7 incurs an effective per-sample loss weight of λ(σ)cout(σ)2\lambda(\sigma)c_{\mathrm{out}}(\sigma)^2λ(σ)cout​(σ)2. To balance the effective loss weights, we set λ(σ)=1/cout(σ)2\lambda(\sigma)=1/c_{\mathrm{out}}(\sigma)^2λ(σ)=1/cout​(σ)2, which also equalizes the initial training loss over the entire σ\sigmaσ range as shown in Figure 5a (green curve). Finally, we need to select ptrain(σ)p_{\mathrm{train}}(\sigma)ptrain​(σ), i.e., how to choose noise levels during training. Inspecting the per-σ\sigmaσ loss after training (blue and orange curves) reveals that a significant reduction is possible only at intermediate noise levels; at very low levels, it is both difficult and irrelevant to discern the vanishingly small noise component, whereas at high levels the training targets are always dissimilar from the correct answer that approaches dataset average. Therefore, we target the training efforts to the relevant range using a simple log-normal distribution for ptrain(σ)p_{\mathrm{train}}(\sigma)ptrain​(σ) as detailed in Table 1 and illustrated in Figure 5a (red curve).

损失加权与采样。 式 8 表明,按式 7 预条件后训练 FθF_\thetaFθ​,会带来有效的逐样本损失权重 λ(σ)cout(σ)2\lambda(\sigma)c_{\mathrm{out}}(\sigma)^2λ(σ)cout​(σ)2。为了平衡有效损失权重,我们取 λ(σ)=1/cout(σ)2\lambda(\sigma)=1/c_{\mathrm{out}}(\sigma)^2λ(σ)=1/cout​(σ)2,这也会使初始训练损失在整个 σ\sigmaσ 范围上变得均匀,如图 5a 的绿色曲线所示。最后还需要选择 ptrain(σ)p_{\mathrm{train}}(\sigma)ptrain​(σ),也就是训练时如何选取噪声水平。查看训练后按 σ\sigmaσ 划分的损失(蓝色和橙色曲线)可以看到,只有在中间噪声水平上才可能有显著下降;在非常低的水平上,辨认已几乎消失的噪声成分既困难也无关紧要,而在高水平上,训练目标又总是不同于趋近数据集均值的正确答案。因此,我们用一个简单的对数正态分布作为 ptrain(σ)p_{\mathrm{train}}(\sigma)ptrain​(σ),把训练努力集中到相关范围,具体见表 1,并在图 5a 中用红色曲线示意。

Table 2 shows that our proposed ptrainp_{\mathrm{train}}ptrain​ and λ\lambdaλ (config E) lead to a dramatic improvement in FID in all cases when used in conjunction with our preconditioning (config D). In concurrent work, Choi et al. [6] propose a similar scheme to prioritize noise levels that are most relevant w.r.t. forming the perceptually recognizable content of the image. However, they only consider the choice of λ\lambdaλ in isolation, which results in a smaller overall improvement.

表 2 表明,在与我们的预条件(配置 D)一起使用时,所提出的 ptrainp_{\mathrm{train}}ptrain​ 和 λ\lambdaλ(配置 E)在所有情形下都带来了 FID 的大幅改善。在并行工作中,Choi 等人 [6] 提出了类似方案,优先处理对形成图像中可感知内容最相关的噪声水平。不过,他们只孤立地考虑 λ\lambdaλ 的选择,因此总体改进较小。

Augmentation regularization. To prevent potential overfitting that often plagues diffusion models with smaller datasets, we borrow an augmentation pipeline from the GAN literature [25]. The pipeline consists of various geometric transformations (see Appendix F.2) that we apply to a training image prior to adding noise. To prevent the augmentations from leaking to the generated images, we provide the augmentation parameters as a conditioning input to FθF_\thetaFθ​; during inference we set the them to zero to guarantee that only non-augmented images are generated. Table 2 shows that data augmentation provides a consistent improvement (config F) that yields new state-of-the-art FIDs of 1.79 and 1.97 for conditional and unconditional CIFAR-10, beating the previous records of 1.85 [44] and 2.10 [50].

增广正则化。 为了防止较小数据集上常常困扰扩散模型的过拟合,我们从 GAN 文献中借用了一套增广流程 [25]。该流程包含多种几何变换(见附录 F.2),在加噪之前施加到训练图像上。为了防止增广泄漏到生成图像中,我们把增广参数作为 FθF_\thetaFθ​ 的条件输入;推理时把它们设为零,以保证只生成未经增广的图像。表 2 表明,数据增广带来了一致的改进(配置 F),使类别条件和无条件 CIFAR-10 分别达到新的最优 FID 1.79 和 1.97,超过此前 1.85 [44] 和 2.10 [50] 的纪录。

Figure 5: Training loss, noise distribution, and stochasticity

Figure 5: (a) Observed initial (green) and final loss per noise level, representative of the 32×32 (blue) and 64×64 (orange) models considered in this paper. The shaded regions represent the standard deviation over 10k random samples. Our proposed training sample density is shown by the dashed red curve. (b) Effect of SchurnS_{\mathrm{churn}}Schurn​ on unconditional CIFAR-10 with 256 steps (NFE = 511). For the original training setup of Song et al. [48], stochastic sampling is highly beneficial (blue, green), while deterministic sampling (Schurn=0S_{\mathrm{churn}}=0Schurn​=0) leads to relatively poor FID. For our training setup, the situation is reversed (orange, red); stochastic sampling is not only unnecessary but harmful. (c) Effect of SchurnS_{\mathrm{churn}}Schurn​ on class-conditional ImageNet-64 with 256 steps (NFE = 511). In this more challenging scenario, stochastic sampling turns out to be useful again. Our training setup improves the results for both deterministic and stochastic sampling.

图 5:(a) 观测到的按噪声水平划分的初始损失(绿色)和最终损失,分别代表本文考虑的 32×32(蓝色)和 64×64(橙色)模型。阴影区域表示 1 万个随机样本上的标准差。我们提出的训练采样密度用红色虚线表示。(b) SchurnS_{\mathrm{churn}}Schurn​ 对无条件 CIFAR-10、256 步(NFE = 511)的影响。对 Song 等人 [48] 原来的训练设置,随机采样非常有益(蓝、绿),而确定性采样(Schurn=0S_{\mathrm{churn}}=0Schurn​=0)的 FID 相对较差。对我们的训练设置,情况正好相反(橙、红);随机采样不仅没有必要,而且有害。(c) SchurnS_{\mathrm{churn}}Schurn​ 对类别条件 ImageNet-64、256 步(NFE = 511)的影响。在这一更具挑战的场景中,随机采样再次变得有用。我们的训练设置对确定性采样和随机采样的结果都有改进。

Stochastic sampling revisited. Interestingly, the relevance of stochastic sampling appears to diminish as the model itself improves, as shown in Figure 5b,c. When using our training setup in CIFAR-10 (Figure 5b), the best results were obtained with deterministic sampling, and any amount of stochastic sampling was detrimental.

再看随机采样。 有趣的是,随着模型本身变好,随机采样的重要性似乎在下降,如图 5b、c 所示。在 CIFAR-10 上使用我们的训练设置时(图 5b),最好结果来自确定性采样,任何程度的随机采样都有害。

ImageNet-64. As a final experiment, we trained a class-conditional ImageNet-64 model from scratch using our proposed training improvements. This model achieved a new state-of-the-art FID of 1.36 compared to the previous record of 1.48 [17]. We used the ADM architecture [9] with no changes, and trained it using our config E with minimal tuning; see Appendix F.3 for details. We did not find overfitting to be a concern, and thus chose to not employ augmentation regularization. As shown in Figure 5c, the optimal amount of stochastic sampling was much lower than with the pre-trained model, but unlike with CIFAR-10, stochastic sampling was clearly better than deterministic sampling. This suggests that more diverse datasets continue to benefit from stochastic sampling.

ImageNet-64。 作为最后一项实验,我们用提出的训练改进从头训练了一个类别条件的 ImageNet-64 模型。该模型达到了新的最优 FID 1.36,而此前纪录是 1.48 [17]。我们原样使用 ADM 结构 [9],并用配置 E 做了最少调参的训练;细节见附录 F.3。我们没有发现过拟合构成问题,因此选择不用增广正则化。如图 5c 所示,最优的随机性程度远低于预训练模型,但与 CIFAR-10 不同,随机采样明显好于确定性采样。这表明,更多样的数据集仍然能从随机采样中受益。

6 Conclusions

6 结论

Our approach of putting diffusion models to a common framework exposes a modular design. This allows a targeted investigation of individual components, potentially helping to better cover the viable design space. In our tests this let us simply replace the samplers in various earlier models, drastically improving the results. For example, in ImageNet-64 our sampler turned an average model (FID 2.07) to a challenger (1.55) for the previous SOTA model (1.48) [17], and with training improvements achieved SOTA FID of 1.36. We also obtained new state-of-the-art results on CIFAR-10 while using only 35 model evaluations, deterministic sampling, and a small network. The current high-resolution diffusion models rely either on separate super-resolution steps [17, 35, 39], subspace projection [23], very large networks [9, 48], or hybrid approaches [38, 41, 50] — we believe that our contributions are orthogonal to these extensions. That said, many of our parameter values may need to be re-adjusted for higher resolution datasets. Furthermore, we feel that the precise interaction between stochastic sampling and the training objective remains an interesting question for future work.

把扩散模型放到同一套框架里,会露出一种模块化设计。这样就可以有针对性地考察单个部件,从而有可能更好地覆盖可行的设计空间。在我们的试验中,这让我们可以直接替换以往多种模型里的采样器,并大幅改进结果。例如,在 ImageNet-64 上,我们的采样器把一个普通模型(FID 2.07)变成了当时最优模型(1.48)[17] 的有力挑战者(1.55),再加上训练改进后达到最优 FID 1.36。我们还在 CIFAR-10 上取得了新的最优结果,同时只用 35 次模型评估、确定性采样和一个较小的网络。当前的高分辨率扩散模型,要么依赖单独的超分步骤 [17, 35, 39],要么依赖子空间投影 [23]、非常大的网络 [9, 48],或混合方法 [38, 41, 50]——我们认为我们的贡献与这些扩展是正交的。话虽如此,我们的许多参数值对更高分辨率的数据集可能需要重新调整。此外,我们觉得随机采样与训练目标之间更精确的相互作用,仍是值得今后研究的问题。

Societal impact. Our advances in sample quality can potentially amplify negative societal effects when used in a large-scale system like DALL·E 2, including types of disinformation or emphasizing sterotypes and harmful biases [33]. The training and sampling of diffusion models needs a lot of electricity; our project consumed ∼250 MWh on an in-house cluster of NVIDIA V100s.

社会影响。 样本质量上的这些进展,如果用在像 DALL·E 2 这样的大规模系统中,有可能放大负面的社会效应,包括各类虚假信息,或强化刻板印象和有害偏见 [33]。扩散模型的训练和采样需要大量电力;本项目在内部的 NVIDIA V100 集群上大约消耗了 250 MWh。

Acknowledgments. We thank Jaakko Lehtinen, Ming-Yu Liu, Tuomas Kynkäänniemi, Axel Sauer, Arash Vahdat, and Janne Hellsten for discussions and comments, and Tero Kuosmanen, Samuel Klenberg, and Janne Hellsten for maintaining our compute infrastructure.

致谢。 我们感谢 Jaakko Lehtinen、Ming-Yu Liu、Tuomas Kynkäänniemi、Axel Sauer、Arash Vahdat 和 Janne Hellsten 的讨论与意见,并感谢 Tero Kuosmanen、Samuel Klenberg 和 Janne Hellsten 维护计算设施。

References

参考文献

[1] B. D. Anderson. Reverse-time diffusion equation models. Stochastic Processes and their Applications, 12(3):313–326, 1982.

[2] U. M. Ascher and L. R. Petzold. Computer Methods for Ordinary Differential Equations and Differential-Algebraic Equations. Society for Industrial and Applied Mathematics, 1998.

[3] F. Bao, C. Li, J. Zhu, and B. Zhang. Analytic-DPM: an analytic estimate of the optimal reverse variance in diffusion probabilistic models. In Proc. ICLR, 2022.

[4] D. Baranchuk, A. Voynov, I. Rubachev, V. Khrulkov, and A. Babenko. Label-efficient semantic segmentation with diffusion models. In Proc. ICLR, 2022.

[5] C. M. Bishop. Neural networks for pattern recognition. Oxford University Press, USA, 1995.

[6] J. Choi, J. Lee, C. Shin, S. Kim, H. Kim, and S. Yoon. Perception prioritized training of diffusion models. In Proc. CVPR, 2022.

[7] Y. Choi, Y. Uh, J. Yoo, and J.-W. Ha. StarGAN v2: Diverse image synthesis for multiple domains. In Proc. CVPR, 2020.

[8] J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. ImageNet: A large-scale hierarchical image database. In Proc. CVPR, 2009.

[9] P. Dhariwal and A. Q. Nichol. Diffusion models beat GANs on image synthesis. In Proc. NeurIPS, 2021.

[10] T. Dockhorn, A. Vahdat, and K. Kreis. Score-based generative modeling with critically-damped Langevin diffusion. In Proc. ICLR, 2022.

[11] J. R. Dormand and P. J. Prince. A family of embedded Runge-Kutta formulae. Journal of computational and applied mathematics, 6(1):19–26, 1980.

[12] J. B. J. Fourier, G. Darboux, et al. Théorie analytique de la chaleur, volume 504. Didot Paris, 1822.

[13] I. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio. Generative adversarial networks. In Proc. NIPS, 2014.

[14] U. Grenander and M. I. Miller. Representations of knowledge in complex systems. Journal of the Royal Statistical Society: Series B (Methodological), 56(4):549–581, 1994.

[15] M. Heusel, H. Ramsauer, T. Unterthiner, B. Nessler, and S. Hochreiter. GANs trained by a two time-scale update rule converge to a local Nash equilibrium. In Proc. NIPS, 2017.

[16] J. Ho, A. Jain, and P. Abbeel. Denoising diffusion probabilistic models. In Proc. NeurIPS, 2020.

[17] J. Ho, C. Saharia, W. Chan, D. J. Fleet, M. Norouzi, and T. Salimans. Cascaded diffusion models for high fidelity image generation. Journal of Machine Learning Research, 23, 2022.

[18] J. Ho and T. Salimans. Classifier-free diffusion guidance. In NeurIPS 2021 Workshop on Deep Generative Models and Downstream Applications, 2021.

[19] J. Ho, T. Salimans, A. A. Gritsenko, W. Chan, M. Norouzi, and D. J. Fleet. Video diffusion models. In Proc. ICLR Workshop on Deep Generative Models for Highly Structured Data, 2022.

[20] C.-W. Huang, J. H. Lim, and A. C. Courville. A variational perspective on diffusion-based generative models and score matching. In Proc. NeurIPS, 2021.

[21] L. Huang, J. Qin, Y. Zhou, F. Zhu, L. Liu, and L. Shao. Normalization techniques in training DNNs: Methodology, analysis and application. CoRR, abs/2009.12836, 2020.

[22] A. Hyvärinen. Estimation of non-normalized statistical models by score matching. Journal of Machine Learning Research, 6(24):695–709, 2005.

[23] B. Jing, G. Corso, R. Berlinghieri, and T. Jaakkola. Subspace diffusion generative models. In Proc. ECCV, 2022.

[24] A. Jolicoeur-Martineau, K. Li, R. Piché-Taillefer, T. Kachman, and I. Mitliagkas. Gotta go fast when generating data with score-based models. CoRR, abs/2105.14080, 2021.

[25] T. Karras, M. Aittala, J. Hellsten, S. Laine, J. Lehtinen, and T. Aila. Training generative adversarial networks with limited data. In Proc. NeurIPS, 2020.

[26] T. Karras, S. Laine, and T. Aila. A style-based generator architecture for generative adversarial networks. In Proc. CVPR, 2018.

[27] Z. Kong, W. Ping, J. Huang, K. Zhao, and B. Catanzaro. DiffWave: A versatile diffusion model for audio synthesis. In Proc. ICLR, 2021.

[28] A. Krizhevsky. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009.

[29] J. Lehtinen, J. Munkberg, J. Hasselgren, S. Laine, T. Karras, M. Aittala, and T. Aila. Noise2Noise: Learning image restoration without clean data. In Proc. ICML, 2018.

[30] L. Liu, Y. Ren, Z. Lin, and Z. Zhao. Pseudo numerical methods for diffusion models on manifolds. In Proc. ICLR, 2022.

[31] C. Lu, Y. Zhou, F. Bao, J. Chen, C. Li, and J. Zhu. DPM-Solver: A fast ODE solver for diffusion probabilistic model sampling in around 10 steps. In Proc. NeurIPS, 2022.

[32] E. Luhman and T. Luhman. Knowledge distillation in iterative generative models for improved sampling speed. CoRR, abs/2101.02388, 2021.

[33] P. Mishkin, L. Ahmad, M. Brundage, G. Krueger, and G. Sastry. DALL·E 2 preview – risks and limitations. OpenAI, 2022.

[34] E. Nachmani and S. Dovrat. Zero-shot translation using diffusion models. CoRR, abs/2111.01471, 2021.

[35] A. Nichol, P. Dhariwal, A. Ramesh, P. Shyam, P. Mishkin, B. McGrew, I. Sutskever, and M. Chen. GLIDE: Towards photorealistic image generation and editing with text-guided diffusion models. In Proc. ICML, 2022.

[36] A. Q. Nichol and P. Dhariwal. Improved denoising diffusion probabilistic models. In Proc. ICML, volume 139, pages 8162–8171, 2021.

[37] V. Popov, I. Vovk, V. Gogoryan, T. Sadekova, and M. Kudinov. Grad-TTS: A diffusion probabilistic model for text-to-speech. In Proc. ICML, volume 139, pages 8599–8608, 2021.

[38] K. Preechakul, N. Chatthee, S. Wizadwongsa, and S. Suwajanakorn. Diffusion autoencoders: Toward a meaningful and decodable representation. In Proc. CVPR, 2022.

[39] A. Ramesh, P. Dhariwal, A. Nichol, C. Chu, and M. Chen. Hierarchical text-conditional image generation with CLIP latents. Technical report, OpenAI, 2022.

[40] A. J. Roberts. Modify the improved Euler scheme to integrate stochastic differential equations. CoRR, abs/1210.0933, 2012.

[41] R. Rombach, A. Blattmann, D. Lorenz, P. Esser, and B. Ommer. High-resolution image synthesis with latent diffusion models. In Proc. CVPR, 2022.

[42] C. Saharia, W. Chan, H. Chang, C. A. Lee, J. Ho, T. Salimans, D. J. Fleet, and M. Norouzi. Palette: Image-to-image diffusion models. In Proc. SIGGRAPH, 2022.

[43] T. Salimans and J. Ho. Progressive distillation for fast sampling of diffusion models. In Proc. ICLR, 2022.

[44] A. Sauer, K. Schwarz, and A. Geiger. StyleGAN-XL: Scaling StyleGAN to large diverse datasets. In Proc. SIGGRAPH, 2022.

[45] J. Sohl-Dickstein, E. Weiss, N. Maheswaranathan, and S. Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In Proc. ICML, pages 2256–2265, 2015.

[46] J. Song, C. Meng, and S. Ermon. Denoising diffusion implicit models. In Proc. ICLR, 2021.

[47] Y. Song and S. Ermon. Generative modeling by estimating gradients of the data distribution. In Proc. NeurIPS, 2019.

[48] Y. Song, J. Sohl-Dickstein, D. P. Kingma, A. Kumar, S. Ermon, and B. Poole. Score-based generative modeling through stochastic differential equations. In Proc. ICLR, 2021.

[49] E. Süli and D. F. Mayers. An Introduction to Numerical Analysis. Cambridge University Press, 2003.

[50] A. Vahdat, K. Kreis, and J. Kautz. Score-based generative modeling in latent space. In Proc. NeurIPS, 2021.

[51] P. Vincent. A connection between score matching and denoising autoencoders. Neural Computation, 23(7):1661–1674, 2011.

[52] D. Watson, W. Chan, J. Ho, and M. Norouzi. Learning fast samplers for diffusion models by differentiating through sample quality. In Proc. ICLR, 2022.

[53] D. Watson, J. Ho, M. Norouzi, and W. Chan. Learning to efficiently sample from diffusion probabilistic models. CoRR, abs/2106.03802, 2021.

[54] J. Wolleb, R. Sandkühler, F. Bieder, P. Valmaggia, and P. C. Cattin. Diffusion models for implicit image segmentation ensembles. In Medical Imaging with Deep Learning, 2022.

[55] Q. Zhang and Y. Chen. Diffusion normalizing flow. In Proc. NeurIPS, 2021.

[56] Q. Zhang and Y. Chen. Fast sampling of diffusion models with exponential integrator. CoRR, abs/2204.13902, 2022.

Checklist

清单

  1. For all authors...
  1. 对所有作者……

(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]

(a) 摘要和引言中的主要主张是否准确反映了论文的贡献与范围?[Yes]

(b) Did you describe the limitations of your work? [Yes] Section 6. The main limitations of the analysis relate to the set of tested datasets and their limited resolution.

(b) 是否描述了工作的局限性?[Yes] 第 6 节。分析的主要局限在于所测试的数据集集合及其有限的分辨率。

(c) Did you discuss any potential negative societal impacts of your work? [Yes] Section 6.

(c) 是否讨论了本工作可能的负面社会影响?[Yes] 第 6 节。

(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]

(d) 是否已阅读伦理审查指南,并确保论文符合这些指南?[Yes]

  1. If you are including theoretical results...
  1. 如果包含理论结果……

(a) Did you state the full set of assumptions of all theoretical results? [No] We follow common application-specific assumptions about the probability distributions, functions and other components, but do not exhaustively specify them, or consider pathological corner cases.

(a) 是否陈述了所有理论结果的完整假设集合?[No] 我们遵循关于概率分布、函数及其他部件的常见应用假设,但没有穷尽地加以说明,也没有考虑病态的边角情形。

(b) Did you include complete proofs of all theoretical results? [No] Our equations and algorithms build on previously known results, and highlight their practical aspects through mostly readily verifiable algebraic manipulations (Appendix B). We do not explicitly present all details of the derivations, and assume that the previous results are sufficiently rigorously proven in the respective literature.

(b) 是否包含所有理论结果的完整证明?[No] 我们的方程和算法建立在已有结果之上,并通过大多易于核验的代数演算突出其实践方面(附录 B)。我们没有显式给出推导的全部细节,并假定已有结果在相应文献中已得到足够严格的证明。

  1. If you ran experiments...
  1. 如果进行了实验……

(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] Our implementation and pre-trained models are available at https://github.com/NVlabs/edm

(a) 是否提供了复现主要实验结果所需的代码、数据和说明(在补充材料或 URL 中)?[Yes] 实现和预训练模型见 https://github.com/NVlabs/edm

(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] Appendix F.

(b) 是否说明了全部训练细节(例如数据划分、超参数及其选择方式)?[Yes] 附录 F。

(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] Shaded regions in Figures 4 and 5.

(c) 是否报告了误差条(例如多次运行后相对随机种子)?[Yes] 图 4 和图 5 中的阴影区域。

(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] Section 6.

(d) 是否说明了总计算量和所用资源类型(例如 GPU 类型、内部集群或云服务商)?[Yes] 第 6 节。

  1. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
  1. 如果使用已有资产(例如代码、数据、模型)或整理/发布新资产……

(a) If your work uses existing assets, did you cite the creators? [Yes]

(a) 若工作使用了已有资产,是否引用了创建者?[Yes]

(b) Did you mention the license of the assets? [Yes] Appendix F.5.

(b) 是否提及这些资产的许可?[Yes] 附录 F.5。

(c) Did you include any new assets either in the supplemental material or as a URL? [No]

(c) 是否在补充材料或 URL 中包含了任何新资产?[No]

(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]

(d) 是否讨论了所使用/整理数据涉及的个人是否以及如何给予同意?[N/A]

(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]

(e) 是否讨论了所使用/整理的数据是否包含个人可识别信息或冒犯性内容?[N/A]

  1. If you used crowdsourcing or conducted research with human subjects...
  1. 如果使用了众包或进行了涉及人类受试者的研究……

(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]

(a) 是否提供了给参与者的完整说明文本以及屏幕截图(如适用)?[N/A]

(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]

(b) 是否描述了可能的参与风险,并提供机构审查委员会(IRB)批准的链接(如适用)?[N/A]

(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]

(c) 是否说明了支付给参与者的估计时薪,以及参与补偿的总支出?[N/A]