Year: 2021

Abstract:
Score-based (denoising diffusion) generative models have recently gained a lot of success in generating realistic and diverse data. These approaches define a forward diffusion process for transforming data to noise and generate data by reversing it (thereby going from noise to data). Unfortunately, current score-based models generate data very slowly due to the sheer number of score network evaluations required by numerical SDE solvers. In this work, we aim to accelerate this process by devising a more efficient SDE solver. Existing approaches rely on the Euler-Maruyama (EM) solver, which uses a fixed step size. We found that naively replacing it with other SDE solvers fares poorly they either result in low-quality samples or become slower than EM. To get around this issue, we carefully devise an SDE solver with adaptive step sizes tailored to score-based generative models piece by piece. Our solver requires only two score function evaluations per step, rarely rejects samples, and leads to high-quality samples. Our approach generates data 2 to 10 times faster than EM while achieving better or equal sample quality. For high-resolution images, our method leads to significantly higher quality samples than all other methods tested. Our SDE solver has the benefit of requiring no step size tuning.

text: Score-based (denoising diffusion) generative models have recently gained a lot of success in generating realistic and diverse data. These approaches define a forward diffusion process for transforming data to noise and generate data by reversing it (thereby going from noise to data). Unfortunately, current score-based models generate data very slowly due to the sheer number of score network evaluations required by numerical SDE solvers.
In this work, we aim to accelerate this process by devising a more efficient SDE solver. Existing approaches rely on the Euler-Maruyama (EM) solver, which uses a fixed step size. We found that naively replacing it with other SDE solvers fares poorly - they either result in low-quality samples or become slower than EM. To get around this issue, we carefully devise an SDE solver with adaptive step sizes tailored to score-based generative models piece by piece. Our solver requires only two score function evaluations per step, rarely rejects samples, and leads to high-quality samples. Our approach generates data 2 to 10 times faster than EM while achieving better or equal sample quality. For high-resolution images, our method leads to significantly higher quality samples than all other methods tested. Our SDE solver has the benefit of requiring no step size tuning.

heading: 1 INTRODUCTION
text: Score-based generative models (Song and Ermon, 2019; 2020; Ho et al., 2020; Jolicoeur-Martineau et al., 2020; Song et al., 2020a; Piché-Taillefer, 2021) have been very successful at generating data from various modalities, such as images (Ho et al., 2020; Song et al., 2020a), audio (Chen et al., 2020; Kong et al., 2020; Mittal et al., 2021; Kameoka et al., 2020), and graphs (Niu et al., 2020). They have further been used effectively for super-resolution (Saharia et al., 2021; Kadkhodaie and Simoncelli, 2020), inpainting (Kadkhodaie and Simoncelli, 2020), source separation (Jayaram and Thickstun, 2020), and image-to-image translation (Sasaki et al., 2021). In most of these applications, scorebased models achieved superior performances in terms of quality and diversity than the historically dominant Generative Adversarial Networks (GANs) (Goodfellow et al., 2014).
Score-based models can be understood in two main classes: those based on a Variance Exploding (VE) diffusion process (Song and Ermon, 2019) and those based on a Variance Preserving (VP) one (Ho et al., 2020). Both diffusion processes progressively transform real data into Gaussian noise; N (0, σ2maxI) for VE where σ2max is very large, and N (0, I) for VP. The diffusion process (VE, VP, etc.) is then reversed in order to generate real data from Gaussian noise. Reversing the process requires the score function, which is estimated with a neural network (known as a score network). Although very powerful, score-based models generate data through an undesirably long iterative process; meanwhile, other state-of-the-art methods such as GANs generate data from a single forward pass of a neural network. Increasing the speed of the generative process is thus an active area of research.
Chen et al. (2020) and San-Roman et al. (2021) proposed faster step size schedules for VP diffusions that still yield relatively good quality/diversity metrics. Although fast, these schedules are arbitrary, require careful tuning, and the optimal schedules will vary from one model to another.
Block et al. (2020) proposed generating data progressively from low to high-resolution images and show that the scheme improves speed. Similarly, Nichol and Dhariwal (2021) proposed generating low-resolution images and then upscale them since generating low-resolution images is quicker. They further suggested to accelerate VP-based models by learning dimension-specific noise rather than assuming equal noise everywhere. Note that these methods do not affect the data generation algorithm and would thus be complementary to our methods.
Song et al. (2020a) and Song et al. (2020b) proposed removing the noise from the data generation algorithm and solve an Ordinary Differential Equation (ODE) rather than a Stochastic Differential Equation (SDE); they report being able to converge much faster when there is no noise. Although it improves the generation speed, Song et al. (2020a) report obtaining lower-quality images when using the ODE formulation for the VE process (Song et al., 2020a). We will later show that our SDE solver generally leads to better results than ODE solvers at similar speeds.
Thus, existing methods for acceleration often require considerable step size/schedule tuning (this is also true for the baseline approach) and do not always work for both VE and VP processes. To improve speed and remove the need for step size/schedule tuning, we propose to solve the reverse diffusion process using SDE solvers with adaptive step sizes.
It turns out that off-the-shelf SDE solvers are ill-suited for generative modeling and exhibit either (1) divergence, (2) slower data generation than the baseline, or (3) significantly worse quality than the baseline (see Appendix A). This can be attributed to distinct features of the SDEs that arise in score-based generative models that set them apart from the SDEs traditionally considered in the numerical SDE solver literature, namely: (1) the codomain of the unknown function is extremely high-dimensional, especially in the case of image generation; (2) evaluating the score function is computationally expensive, requiring a forward pass of a large mini-batch through a large neural network; (3) the required precision of the solution is smaller than usual because we are satisfied as long as the error is not perceptible (e.g., one RGB increment on an image).
We devise our own SDE solver with these features in mind, resulting in an algorithm that can get around the problems encountered by off-the-shelf solvers. To address high dimensionality, we use the `2 norm rather than the `∞ norm to measure the error across different dimensions to prevent a single pixel from slowing down the solver. To address the cost of score function evaluations while still obtaining high precision, we (1) take the minimum number of score function evaluations needed for adaptive step sizes (two evaluations), and (2) use extrapolation to get high precision at no extra cost. To take advantage of the reduced requirement for precision, we set the absolute tolerance for the error according to the range of RGB values.
Our main contribution is a new SDE solver tailored to score-based generative models with the following benefits:
• Our solver is much faster than the baseline methods, i.e. reverse-diffusion method with Langevin dynamics and Euler-Maruyama (EM);
• It yields higher quality/diversity samples than EM when using the same computing budget;
• It does not require any step size or schedule tuning;
• It can be used to quickly solve any type of diffusion process (e.g., VE, VP)

heading: 2 BACKGROUND

heading: 2.1 SCORE-BASED MODELING WITH SDES
text: Let x(0) ∈ Rd be a sample from the data distribution pdata. The sample is gradually corrupted over time through a Forward Diffusion Process (FDP), a common type of Stochastic Differential Equation (SDE):
dx = f(x, t)dt+ g(t)dw, (1)
where f(x, t) : Rd × R→ Rd is the drift, g(t) : R→ R is the diffusion coefficient and w(t) is the Wiener process indexed by t ∈ [0, 1]. Data points and their probability distribution evolve along the trajectories {x(t)}1t=0 and {pt(x)}1t=0 respectively, with p0 ≡ pdata. The functions f and g are chosen such that x(1) be approximately Gaussian and independent from x(0). Inference is achieved by reversing this diffusion, drawing x(1) from its Gaussian distribution and solving the Reverse Diffusion Process (RDP) equal to:
dx = [ f(x, t)− g(t)2∇x log pt(x) ] dt+ g(t)dw̄, (2)
where∇x log pt(x) is referred to as the score of the distribution at time t (Hyvärinen, 2005) and w̄(t) is the Wiener process in which time flows backward (Anderson, 1982).
One can observe from Equation 2 that the RDP requires knowledge of the score (or pt), which we do not have access to. Fortunately, it can be estimated by a neural network (referred to as the score network) by optimizing the following objective:
L(θ) = Ex(t)∼p(x(t)|x(0)),x(0)∼pdata [ λ(t)
2 ∥∥sθ(x(t), t)−∇x(t) log pt(x(t)|x(0))∥∥22] , (3) where λ(t) : R→ R is a weighting function generally chosen to be inversely proportional to:
E [∥∥∇x(t) log pt(x(t)|x(0))∥∥22] .
One can demonstrate that the minimizer of that objective θ∗ will be such that sθ∗(x, t) = ∇x log pt(x) (Vincent, 2011), allowing us to approximate the reverse diffusion process. As can be seen, evaluating the objective requires the ability to generate samples from the FDP at arbitrary times t. Thankfully, as long as the drift is affine (i.e., f(x, t) = Ax + B), the transition kernel p(x(t)|x(0)) will always be normally distributed (Särkkä and Solin, 2019), which means that we can solve the forward diffusion in a single step. Furthermore, the score of the Gaussian transition kernel is trivial to compute, making the loss an inexpensive training objective.
There are two primary choices for the FDP in the literature, which we discuss below.

heading: 2.2 VARIANCE EXPLODING (VE) PROCESS
text: The Variance Exploding (VE) process consists in the following FDP:
dx =
√ d [σ2(t)]
dt dw.
Its associated transition kernel is:
x(t)|x(0) ∼ N (x(0), [σ2(t)− σ2(0)]I) ≈ N (x(0), σ2(t)I).
In practice, we let σ(t) = σmin ( σmax σmin )t , where σmin = 0.01 and σmax ≈ maxi ∑N j=1 ||x(i) − x(j)|| is the maximum Euclidean distance between two samples from the dataset {x(i)}Ni=1 (Song and Ermon, 2020). Using the maximum Euclidean distance ensures that x(1) does not depend on x(0); thus, x(1) is approximately distributed as N (0, σ2(1)I).

heading: 2.3 VARIANCE PRESERVING (VP) PROCESS
text: The Variance Preserving (VP) process consists in the following FDP:
dx = −1 2 β(t)xdt+
√ β(t)dw.
Its associated transition kernel is:
x(t)|x(0) ∼ N (x(0) e− 12 ∫ t 0 β(s)ds, (1− e− ∫ t 0 β(s)ds) I).
In practice, we let β(t) = βmin + t (βmax − βmin), where βmin = 0.1 and βmax = 20. Thus, x(1) is approximately distributed as N (0, I) and does not depend on x(0).

heading: 2.4 SOLVING THE REVERSE DIFFUSION PROCESS (RDP)
text: There are many ways to solve the RDP; the most basic one being Euler-Maruyama (Kloeden and Platen, 1992), the SDE analog to Euler’s method for solving ODEs. Song et al. (2020a) also proposed Reverse-Diffusion, which consists in ancestral sampling (Ho et al., 2020) with the same discretization used in the FDP. With the Reverse-Diffusion, (Song et al., 2020a) obtained poor results unless applying an additional Langevin dynamics step after each Reversion-Diffusion step. They named this approach Predictor-Corrector (PC) sampling, with the predictor corresponding to Reverse-Diffusion and the corrector to Langevin dynamics. Although using a corrector step leads to better samples, PC sampling is only heuristically motivated and the theoretical underpinnings are not yet understood. Nevertheless, (Song et al., 2020a) report their best results (in terms of lowest Fréchet Inception Distance (Heusel et al., 2017)) using the Reverse-Diffusion with Langevin dynamics for VE models. For VP models, they obtain their best results using Euler-Maruyama.

heading: 3 EFFICIENT METHOD FOR SOLVING REVERSE DIFFUSION PROCESSES

heading: 3.1 SETTING UP THE ALGORITHM
text: We start with a general algorithm for solving an SDE (similar to most ODE/SDE solvers). We choose the various options/hyper-parameters based on a mixture of theory and experiments; an ablation study of the different hyper-parameters can also be found in Appendix B.

heading: 3.1.1 INTEGRATION METHOD
text: Solving the RDP to generate data can take an undesirably long time. One would assume that solving SDEs with high-order methods would improve speed over Euler-Maruyama, just like high-order ODE solvers improve speed over Euler’s method when solving ODEs. However, this is not always the case: while higher-order solvers may achieve lower discretization errors, they require more function
evaluations, and the improved precision might not be worth the increased computation cost (Lehn et al., 2002; Lamba, 2003).
Our preliminary attempts at using SDE solvers with the DifferentialEquations.jl Julia package (Rackauckas and Nie, 2017a) confirmed that higher-order methods were significantly slower (6 to 8 times slower; see Appendix A). Lamba’s algorithm (Lamba, 2003), a low-order adaptive method, yielded the fastest results, thus motivating us to restrict our search to the space of low-order methods. Still, the resulting images were of lower quality.
Using a fixed step-size while solving an ODE/SDE requires some tuning and one should be able to advance faster (from t = 1 to t = 0) in regions of low noise. To gain more speed, one can dynamically adjust the step size over time; this is a common approach used in most fast ODE/SDE solvers. Such technique generally use two integration methods: a lower-order (x′) method and a higher-order (x′′) method. The local error E(x′,x′′) = x′ − x′′ is used to determine how stable the lower-order method is at the current step size; the closer to zero, the more appropriate the step size is. From this information, we can dynamically adjust the step size and decide whether or not to accept the proposed sample of the lower-order method. Alternatively, one can select x′′ as the proposal, which we will refer to as extrapolating.
Rather than using the Improved Euler ODE solver (Süli and Mayers, 2003) as in Lamba (2003) or a high-order stochastic Runge-Kutta method (Rößler, 2010) as in Rackauckas and Nie (2017b) (which did not work well in our preliminary attempts with the Julia package) we instead rely on the more recent Improved Euler SDE solver (Roberts, 2012) as our higher order method. This method is very similar to the classical Improved Euler ODE solver, but it is made to work with SDEs instead of ODEs. Importantly, this method only requires two score function evaluations and re-uses the same score function evaluation used for EM, meaning that it is only twice as expensive as EM. Similarly to Lamba’s algorithm, this method, albeit quick, leads to images of poor quality. However, by using extrapolation (taking x′′ instead of x′ as our proposal), we were able to match and improve over the baseline approach (EM). Thus, using the stochastic Improved Euler was the key to taking bigger steps without sacrificing precision. Note that Lamba’s algorithm cannot use extrapolation due to its use of a non-stochastic ODE solver (Improved Euler).
An algorithm has strong-order p when the local error from t to t+ h is O(hp+1)). Euler-Maruyama has strong-order 0.5 while Improved Euler has strong-order 1 (Roberts, 2012). The highest strongorder found in the DifferentialEquations.jl Julia package (Rackauckas and Nie, 2017a) are order 1.5. Thus, our method obtains a balance between methods that are 1) low precision, but fast and 2) high precision, but slow.

heading: 3.1.2 TOLERANCE
text: In ODE/SDE solvers, the local error is divided by a tolerance term. Traditionally, the mixed tolerance δ(x′) : Rd → Rd is calculated as the maximum between the absolute and relative tolerance:
δ(x′) = max( abs, rel|x′|), (4)
where the absolute value | · | is applied element-wise. The DifferentialEquations.jl Julia package instead calculates the mixed tolerance through the maximum of the current and previous sample:
δ(x′,x′prev) = max( abs, relmax(|x′|, |x′prev|)). (5)
Having no trivial prior for which approach to use, we tried both and found the latter approach (Equation 5) to converge much faster for VE models (see Appendix B).
Given our focus on image generation, we can set abs a priori. During training and at the end of the data generation, images are represented as floating-point tensors with range [ymin, ymax]. When evaluated, they must be transformed into 8-bit color images; this means that images are scaled to the range [0, 255] and converted to the nearest integer (to represent one of the 256 values per color channel). Given the 8-bit color encoding, an absolute tolerance abs = ymax−ymin256 corresponds to tolerating local errors of at most one color (e.g., x′ij with Red=5 and x ′′ ij with Red=6 is accepted, but x′ij with Red=5 and x ′′ ij with Red=7 is not) channel-wise. One-color differences are not perceptible and should not influence the metrics used for evaluating the generated images. For VP models, which
have range [−1, 1], this corresponds to abs = 0.0078 while for VE models, which have range [0, 1], this corresponds to abs = 0.0039.
To control speed/quality, we vary rel, where large values lead to more speed but less precision, while small values lead to the converse.

heading: 3.1.3 NORM OF THE SCALED ERROR
text: The scaled error (the error scaled by the mixed tolerance) is calculated as
Eq = ∥∥∥∥ x′ − x′′δ(x′,x′prev) ∥∥∥∥ q .
Many algorithms use q = ∞ (Lamba, 2003; Rackauckas and Nie, 2017b), where ||x||∞ = max(x1, ...,xk) over all k elements of x. Although this can work with low-dimensional SDEs, this is highly problematic for high-dimensional SDEs such as those in image-space. The reason is that a single channel of a single pixel (out of 65536 pixels for a 256 × 256 color image) with a large local error will cause the step size to be reduced for all pixels and possibly lead to a step size rejection. Indeed, our experiments confirmed that using q =∞ slows down generation considerably (see Appendix B). To that effect, we instead use a scaled `2 norm:
||x||2 = √√√√ 1 n k∑ i=1 ( x′ − x′′ δ(x′,x′prev) ) k .

heading: 3.1.4 HYPERPARAMETERS OF THE DYNAMIC STEP SIZE ALGORITHM
text: Upon calculating the scaled error, we accept the proposal x′′ if Eq ≤ 1 and increment the time by h Whether or not it is accepted, we update the next step size h in the usual way:
h← min(hmax, θhE−rq ), (6)
where hmax is the maximum step size, θ is the safety parameter which determines how strongly we adapt the step size (0 being very safe; 1 being fast, but high rejections rate), and r is an exponentscaling term.
Although ODE theory tells us that we should let r = 1p+1 with p being the order of the lowerorder integration method, there is no such theory for SDEs (Rackauckas and Nie, 2017b). Thus, as Rackauckas and Nie (2017b) suggest, we resorted to empirically testing values and found that any r ∈ [0.5, 1] works well on both VE and VP processes, but that r ∈ [0.8, 0.9] is slightly faster (see Appendix B). We arbitrarily chose r = 0.9 as the default setting.
Finally, we defaulted to setting θ = 0.9 for the safety parameter as is common in the literature, and choose hmax to be equal to the largest step size possible, namely the remaining time t.

heading: 3.1.5 HANDLING THE MINI-BATCH
text: Using the same step size for every sample of a mini-batch means that every images would be slowed down by the other images. Since every image’s RDP is independent from one another, we apply a different step size to each data sample; some images may converge faster than others, but we wait for all images to have converged.

heading: 3.2 ALGORITHM
text: In Section 3.1, We defined every aspect of the algorithm needed to numerically solve Equation 2 for image generation. The algorithm thus consists in using adaptive step sizes through Equation 6 with the hyperparameters defined in the previous subsection (q =∞, θ = 0.9, r = 0.9, abs = ymax−ymin256 ) with Euler-Maruyama as the low-order method and Improved Euler as the high-order method. The resulting algorithm is described in Algorithm 1. This algorithm is straightforward to parallelize across the batch dimension.
Note that this algorithm is only for solving an RDP; a more general version for solving an arbitrary forward-time diffusion process can be found in Appendix C. Additionally, we present a demonstration in Appendix F showing that the extrapolation step conserves the stability and convergence of the EM step.
Algorithm 1 Dynamic step size extrapolation for solving Reverse Diffusion Processes
Require: sθ, rel, abs, hinit = 0.01, r = 0.9, θ = 0.9 . for images: abs = ymax−ymin256 t← 1 h← hinit Initialize x x′prev ← x while t > 0 do
Draw z ∼ N (0, I) x′ ← x− hf(x, t) + hg(t)2sθ(x, t) + √ hg(t)z . Euler-Maruyama
x̃← x− hf(x′, t− h) + hg(t− h)2sθ(x′, t− h) + √ hg(t− h)z x′′ ← 12 (x ′ + x̃) . Improved Euler (SDE version) δ ← max( abs, relmax(|x′|, |x′prev|)) . Element-wise operations E2 ← 1√n ‖(x
′ − x′′) /δ‖2 if E2 ≤ 1 then . Accept
x← x′′ . Extrapolation t← t− h x′prev ← x′
h← min(t, θhE−r2 ) . Dynamic step size updatereturn x

heading: 4 EXPERIMENTS
text: To test Algorithm 1 on RDPs, we apply it to various pre-trained models from Song et al. (2020a). To start, we generate low-resolution images (32x32) by testing the VP, VE, VP-deep, and VEdeep models on CIFAR-10 (Krizhevsky et al., 2009). Then, we generate higher-resolutions images (256x256) by testing the VE models on LSUN-Church (Yu et al., 2015), and Flickr-Faces-HQ (FFHQ) (Karras et al., 2019). See implementation details in Appendix D. We used four or less V100 GPUs to run the experiments.
To measure the performance of the image generation, we calculate the Fréchet Inception Distance (FID) (Heusel et al., 2017) and the Inception Score (IS) (Salimans et al., 2016), where low FID and high IS correspond to higher quality/diversity. We compare our method to the three base solvers used in Song et al. (2020a): Reverse-Diffusion with Langevin dynamics, Euler-Maruyama (EM), and Probability Flow, where the latter solves an ODE instead of an SDE using Runge-Kutta 45 (Dormand and Prince, 1980). We also compare against the fast solver by (Song et al., 2020b) called denoising diffusion implicit models (DDIM), which is only defined for VP models. We define the baseline approach as the solver used by Song et al. (2020a) which leads to the lowest FID (EM for VP models and Reverse-Diffusion with Langevin for VE models). For our algorithm, the only free hyperparameter is the relative tolerance which we set to rel ∈ {0.01, 0.02, 0.05, 0.1, 0.5}. The FID and the Number of score Function Evaluations (NFE) are described in Table 1 for lowresolution images and Table 2 for high-resolution images. The Inception Score (IS) is described for CIFAR-10 in Appendix E.

heading: 4.1 PERFORMANCE
text: Compared to EM, we observe that our method is immediately advantageous in terms of quality/diversity for high-resolution images, along with 2 to 3× speedups ( rel = 0.02). While this advantage becomes less obvious in terms of the FID on CIFAR-10, our method still offers > 5× computational speedups at no apparent disadvantage ( rel ∈ {0.02, 0.05}).
Reverse-Diffusion with Langevin achieves the lowest FID for VE models on CIFAR-10, though at the cost of a 4× computational overhead over our method. Furthermore, their advantage vanishes for VP models and when generating high-resolution images.
We further compare our SDE solver to EM given the same computational budget and observe that our method is always immensely preferable in high-resolutions and for VP models. For VE models on CIFAR-10, we observe that our algorithm leads to a better FID as long as the NFE is sufficiently large (270). Note that since our algorithm takes two score function evaluations per step, EM has the advantage of doing twice as many steps given the same NFE, which appears to be a factor more important than the order of the method at low budget in low-resolution VE. Nevertheless, comparing for equal number of iterative step, the results still point to our method being always preferable. For high-resolution images, we see that EM cannot converge on moderate to small NFEs due to the high-dimensionality, making of our SDE solver the way to go.
Generally, we observe that the VE process cannot be solved as fast as the VP process; this is due to the enormous Gaussian noise in the VE process causing larger local errors. This reflects the issue mentioned in Section 3.1.1 regarding high-order SDE solvers not always being beneficial in terms of speed for SDEs with heavy Gaussian noise. In practice, for VE, the algorithm uses a small step size in the beginning to ensure high accuracy and eventually increases the step size as the noise becomes less considerable.

heading: 4.2 SOLVING AN ODE INSTEAD OF AN SDE
text: We see that our SDE solver generally does better than Probability Flow, especially in high-resolution, where we obtain greatly lower FIDs with a similar budget. Our algorithm attains the same NFE as Probability Flow when rel = 0.10 for low-resolution images and when 0.05 < rel < 0.10 for high-resolution images. For the same budget, Probability Flow has higher FID than our approach on all but low-resolution VE models. However, in that case, our algorithm achieves a much lower FID when rel ≤ 0.05, albeit slower. In high-resolution, Probability Flow leads to very poor FIDs, suggesting no convergence.

heading: 4.3 DDIM
text: Contrary to Song et al. (2020b),the FID of DDIM worsens significantly when the NFE decreases. This could be due to differences between Song et al. (2020a) continuous-time score-matching and the DDIM training procedure and architecture. Nevertheless, the FID increase engendered by a reduced budget is much less dramatic than for EM. As of note, DDIM succeeds in maintaining a lower FID than our solver at extremely small NFEs (< 50), albeit with extremely poor FID.

heading: 5 LIMITATIONS
text: Although we tested our approach on a wide range of settings, we nevertheless only tested on continuous-time image generation models. We did so because solving the SDE requires continuoustime and the only such pre-trained models at time of publishing are the one by Song et al. (2020a).
Although our approach removes step size and schedule tuning, we still need to choose a value of the relative tolerance, which indirectly affects the number of steps taken; one could theoretically tune this hyper-parameter to optimize a certain metric, going against the point of removing tuning. Still, letting rel = 0.01 for precise results and rel = 0.05 for fast results are reasonable choices, as all evidence points to the FID being stable w.r.t. rel.

heading: 6 CONCLUSION
text: We built an SDE solver that allows for generating images of comparable (or better) quality to Euler-Maruyama at a much faster speed. Our approach makes image generation with score-based models more accessible by shrinking the required computational budgets by a factor of 2 to 5×, and presenting a sensible way of compromising quality for additional speed.

heading: A DIFFERENTIALEQUATIONS.JL
text: Here, we report the preliminary experiments we ran with the DifferentialEquations.jl Julia package (Rackauckas and Nie, 2017a) before devising our own SDE solver. As can be seen, most methods either did not converge (with warnings of "instability detected") or converged, but were much slower than Euler-Maruyama. The only promising method was Lamba’s method (Lamba, 2003). Note that an algorithm has strong-order p when the local error from t to t+ h is O(hp+1)).

heading: B EFFECTS OF MODIFYING ALGORITHM 1
text: As can be seen, most chosen settings lead to better results. However, r seems to have little impact on the FID. Still, using r ∈ [0.8, 0.9] lead to a little bit less score function evaluations and sometimes lead to lower FID.
We notice that using q =∞ and δ(x′) lead to higher NFE as we expect. However, they also generally lead to higher FID, thus lower quality/diversity, which is not expected! We hypothesized that this might be due to the large number of steps taken when using q = ∞ and δ(x′). To test this, we trained the VE and VP models with Euler-Maruyama with 10k steps instead of 1k steps and we indeed obtained higher FIDs. This means that taking too many steps leads to worse performance in score-based models.
Worse quality from taking more steps should typically not happen as more steps should mean a more precise trajectory. We hypothesize this to be caused by the difference between using the actual score function instead of using the pre-trained score-network; given the errors in the score network, it may be that taking too many steps leads to some deviations from the right solution. Alternatively, this could also be due to the metric, as no existing quality/diversity metrics for generative models is truly perfect; but we believe that this hypothesis is less plausible than the increasing errors from using the score-network.

heading: C DYNAMIC STEP SIZE ALGORITHM FOR SOLVING ANY TYPE OF SDE (RATHER THAN JUST REVERSE DIFFUSION PROCESSES)
text: Assume, we have a Diffusion Process of the form:
dx = f(x, t)dt+ g(x, t)dw. (7)
The algorithm to solve it is represented in Algorithm 2. The differences are:
• it is in forward-time • the range of time must be given • The diffusion can depend on x, which leads to a slightly more complicated formulation that
depends on some random number s = ±1 (Roberts, 2012). • we retain the full trajectory instead of only the ending • we retain the noise after a rejection to ensure that there is no bias in the rejections
Algorithm 2 Dynamic step size extrapolation for solving arbitrary (forward-time) Diffusion Processes Require: sθ, tbegin, tend, rel, abs, hinit = 0.01, r = 0.9, θ = 0.9 t← tbegin h← hinit Initialize x(t) x′prev ← x Draw z ∼ N (0, I) while t < tend do
if Stratonovich SDE or g(x, t) = g(x) then s← 0 else . Itō diffusion Draw s ∼ Uniform({−1, 1}) x′ ← x(t) + hf(x(t), t) + √ hg(x(t), t)(z− s) . Euler-Maruyama x̃← x(t) + hf(x′, t+ h) + √ hg(x′, t+ h)(z + s) x′′ ← 12 (x ′ + x̃) . Improved Euler (SDE version) δ ← max( abs, relmax(|x′|, |x′prev|)) . Element-wise operations E2 ← 1√n ‖(x
′ − x′′) /δ‖2 if E2 ≤ 1 then . Accept
t← t+ h x(t)← x′′ . Extrapolation x′prev ← x′ Draw z ∼ N (0, I)
h← min(t, θhE−r2 ) . Dynamic step size updatereturn x
D IMPLEMENTATION DETAILS
We started from the original code by Song et al. (2020a) but changed a few settings concerning the SDE solving. This creates some very minor difference between their reported results and ours. For the VP and VP-deep models, we obtained 2.55 and 2.49 instead of the original 2.55 and 2.41 for the baseline method (EM). For the VE and VE-deep models, we obtained 2.40 and 2.21 instead of the original 2.38 and 2.20 for the baseline method (Reverse-Diffusion with Langevin).
As done in Song et al. (2020a), we used the optimal signal-to-noise ratio of 0.01 for the Langevin corrector.
When solving the SDE, time followed the sequence t0 = 1, ti = ti−1 − 1− N , where N = 1000 for CIFAR-10, N = 2000 for LSUN, = 1e− 3 for VP models, and = 1e− 5 for VE models. Meanwhile, the actual step size h used in the code for Euler-Maruyama (EM) was equal to 1N . Thus, there was a negligible difference between the step size used in the algorithm (h = 1N ) and the actual step size implied by t (h = 1− N ). Note that this has little to no impact.
The bigger issue is at the last predictor step was going from t = to t = − 1N < 0. Thus, t was made negative. Furthermore the sample was denoised at t < 0 while assuming t = . There are two ways to fix this issue: 1) take only a step from t = to t = 0 and do not denoise (since you cannot denoise with the incorrect t or with t = 0), or 2) stop at t = and then denoise. Since denoising is very helpful, we took approach 2; however, both approaches are sensible.
Finally, denoising was not implemented correctly before. Denoising was implemented as one predictor step (Reverse-Diffusion or EM) without adding noise. This corresponds to:
x← x− h [ f(x, t)− g(t)2∇x log pt(x) ] .
At the last iteration, this incorrect denoising would be:
x← x + d[σ 2(t)]
dt
1
N ∇x log pt(x)
= x + σmin N
√ 2 log ( σmax σmin ) ∇x log pt(x)
≈ x for VE and
x← x + √ βmin N ∇x log pt(x)
≈ x for VP.
Meanwhile, the correct way to denoise based on Tweedie formula (Efron, 2011) is:
x← x + Var[x(t)|x(0)]∇x log pt(x), where Var[x(t)|x(0)] is the variance of the transition kernel: Var[x(t)|x(0)] = σmin = 0.01 for VE and Var[x(t)|x(0)] = 1. This means that the correct Tweedie formula corresponds to
x← x + 0.012∇x log pt(x) ≈ x
for VE and x← x +∇x log pt(x)
for VP.
As can be seen, denoising has a very small impact on VE so the difference between the correct and incorrect denoising is minor. Meanwhile, for VP the incorrect denoising lead to a tiny change, while the correct denoising lead to a large change. In practice, we observe that changing the denoising method to the correct one does not significantly affect the FID with VE, but lowers down the FID significantly with VP.
E INCEPTION SCORE ON CIFAR-10

heading: F STABILITY AND BIAS OF THE NUMERICAL SCHEME
text: The following constructions rely on the underlying assumption of the stochastic dynamics being driven by a wiener process. More so, we also assume that the Brownian motion is time symmetrical. Both assumptions are consistent and widely used in the literature; for example, see (Gardiner, 2009) (Arnold, 1974).
The method described in Algorithm 1 gives us a significant speedup in terms of computing time and actions. Albeit the speed up comes from a piece-wise step in the algorithm combining the traditional Euler Maruyama (EM) with a form of adaptive step size predictor-corrector. Here we show that both the stability and the convergence of the EM scheme are conserved by introducing the extra adaptive stepsize of our new scheme. As a first step, we define the stability and bias in a Stochastic Differential Equation (SDE) numerical solution.
We denote <(λ) as the real value of a complex-valued λ. The linear test SDE is defined in the following way:
dxt = λxtdt+ σdwt (8)
with its numerical counterpart yn+1 = < (hλ)yn + zn,
where the zn are random variables that do not depend on y0,y1......yn or λ and the EM scheme is
yn+1 = (1 + hλ)yn + zn.
A numerical scheme is asymptotically unbiased with step size h > 0 if, for a given linear SDE (8) driven by a two-sided Wiener process, the distribution of the numerical solution yn converges as n→∞ to the normal distribution with zero mean and variance σ 2
2|λ| (Artemiev and Averina, 2011). This stems from the fact that a solution of a linear SDE (8) is a Gaussian process whenever the initial condition is Gaussian (or deterministic); thus, there are only two moments that control the bias in the algorithm:
lim n→∞ E [yn] = 0, lim n→∞
E [ y2n ] = − σ 2
2 |λ| .
A numerical scheme with step size h is numerically stable in mean if the numerical solution y(h)n applied to a linear SDE satisfies
lim n→∞ E [yn] = 0,
and is stable in mean square (Saito and Mitsui, 1996) if we have that
lim h→0 ( lim n→∞ E [ |yn| 2 ]) = σ2 2<(λ) .
In what follows, we will trace the criteria for bias through our algorithm and show that it remains unbiased. By construction, the first EM step remains unbiased, while for the RDP, we write down the time reverse Wiener process as
ỹn+1 = (1 + λh) ỹn + z̃n
in the reverse time steps h i.e., t− nh, t− 2nh, E [ ỹn+1 ] = (1 + λ (t− h))E [ỹn] = (1 + λ (t− h))E [ (1 + λ (t− h)) ỹn−1
] ...
= (1 + λ (t− h))n+1 E [ỹ0] = (1 + λ (t− h))n+1 E [y0] .
Thus, if |1 + λ (t− h)| < 1,
then lim n→∞ E [ y(h)n ] = 0.
In Algorithm 1, we are performing consecutive steps forward and backwards in time so t = 2h such that |1 + λh| < 1. Thus, the scheme is both numerically stable and unbiased with respect to the mean.
Next, we focus on the numerical solution in mean square: E [∣∣ỹn+1∣∣2] = |1 + λ (t− h)|2 E [|ỹn|2]+ σ2h
= |1 + λ (t− h)|2 { |1 + λ (t− h)|2 E [∣∣ỹn−1∣∣2]+ σ2h}+ σ2h ...
= |1 + λ (t− h)|2(n+1) E [|y0|] + |1 + λ (t− h)|2(n+1) − 1
2<λ+ |λ|2 (t− h) σ2.
Under the same assumption of consecutive steps, we have that
E [∣∣ỹn+1∣∣2] = |1 + λh|2(n+1) E [|y0|] + |1 + λh|2(n+1) − 1
2<(λ) + |λ|2 h σ2,
lim n→∞
E [∣∣ỹn+1∣∣2] = − σ2
2<(λ) + |λ|2 h ,
lim h→0 ( lim n→∞ E [∣∣ỹn+1∣∣2]) = − σ22<(λ) .
Assuming the imaginary part of λ is null, we have that
lim h→0 ( lim n→∞ E [∣∣ỹn+1∣∣2]) = − σ22 |λ| .
Thus, the numerical scheme is stable and unbiased in the mean square.
Following the two steps for computation of x′ and x̃, the step size decreases and does not change size; thus, all the above statements hold, and the entire algorithm is stable and unbiased with respect to both the mean and square mean.

heading: G SAMPLES

Review summaries:
The paper presents a new SDE solver for the reverse process in score-based models. The algorithm is fast and offers high quality, and avoids some hyperparameter tuning. There is theoretical analysis on the stability and bias of the algorithm. The paper also has experiments comparing the proposed algorithm to several baseline methods. 

Score-based/diffusion-based generative models can achieve high sample quality. However, their sampling speed is slow due to the large number of evaluations required by numerical SDE solvers. This works aims to accelerate the sampling process by using a more efficient SDE solver. The proposed approach generates data 2 to 10 times faster than the baselines while achieving reasonably well sample qualities.