BayesDiff: Estimating Pixel-wise Uncertainty in Diffusion via Bayesian Inference
Authors: Siqi Kou
Lei Gan
Dequan Wang
Chongxuan Li
Zhijie Deng
Venue: ICLR 2024 poster (2024)
Keywords: diffusion model
Bayesian uncertainty
Primary area: generative models

Abstract: Diffusion models have impressive image generation capability, but low-quality generations still exist, and their identification remains challenging due to the lack of a proper sample-wise metric. To address this, we propose BayesDiff, a pixel-wise uncertainty estimator for generations from diffusion models based on Bayesian inference. In particular, we derive a novel uncertainty iteration principle to characterize the uncertainty dynamics in diffusion, and leverage the last-layer Laplace approximation for efficient Bayesian inference. The estimated pixel-wise uncertainty can not only be aggregated into a sample-wise metric to filter out low-fidelity images but also aids in augmenting successful generations and rectifying artifacts in failed generations in text-to-image tasks. Extensive experiments demonstrate the efficacy of BayesDiff and its promise for practical applications.

Published as a conference paper at ICLR 2024
BAYESDIFF: ESTIMATING PIXEL-WISE UNCERTAINTY IN DIFFUSION VIA BAYESIAN INFERENCE
Siqi Kou', Lei Gan', Dequan Wang Chongxuan Li and Zhijie Deng"
Qiing Yuan Research Institute, SEIEE, Shanghai Jiao Tong University
2 Gaoling School of Artificial Intelligence, Renmin University of China
BBeijing Key Laboratory of Big Data Management and Analysis Methods
*School of Computer Science, Fudan University Shanghaii Artificial Intelligence Laboratory kappy-karryssjeee www.euuuuuuuuuuuu.eeu....euuuee. edu. en, 213071302118h fudan. leddanedde edu. cn dequanwanges jte.suu.ctuuddt.. edu.cn, chengxuan1 199 8gmai com, zhi zhijiedE s sdddsjt.u...... jtu.
ABSTRACT
Diffusion models have impressive image generation capability, but low-quality generations still exist, and their identification remains challenging due to the lack of a proper sample-wise metric. To address this, we propose BayesDiff, a pixel-wise uncertainty estimator for generations from diffusion models based on Bayesian inference. In particular, we derive novel uncertainty iteration principle characterize the uncertainty dynamics in diffusion, and leverage the last-layer Laplace approximation for efficient Bayesian inference. The estimated pixel-wise uncertainty can not only be aggregated into sample-wise metric to filter out low-fidelity images but also aids in augmenting successful generations and recti- fying artifacts in failed generations in lext-to-image tasks. Extensive experiments demonstrate the efficacy of BayesDiff and its promise for practical applications. Our code is available at /ttpps:/giitut. com/ ht////aayykk//aaysSi....
INTRODUCTION
The ability of diffusion models to gradually denoise noise vectors into natural images has paved the way for numerous applications, including image synthesis (Dhariwal & Nichol [021] Rombach al., (0022) image inpainting (Lugmayr et al. (0022,, text-to-image generation (Saharia al.] 2022 Gu et al.] 2022 Zhang et al. 2023), etc. However, there are still inevitable low-quality generations causing poor user experience in downstream applications. viable remediation is to filter out low- quality generations, which, yet, cannot be trivially realized due to the lack of proper metric for image quality identification. For example, the traditional metrics such as the Fréchet Inception Distance (FID) (Heusel al. 2017) and Inception Score (IS) (Salimans et al. (016) scores estimate the distributional properties of the generations instead of sample-wise quality.
Bayesian uncertainty has long been used to identify data far from the manifold of training sam- ples (Maddox et al.] 2019 Deng et al. 2021). The notion is intuitive-the Bayesian posterior deliv- low uncertainty for the data witnessed during training while high uncertainty for the others. This fits the requirement that the generations returned to the users should be as realistic as the training im- ages. However, the integration of Bayesian uncertainty and diffusion models is not straightforward. Diffusion models typically involve srage-scale networks, necessitating efficient Bayesian inference strategies. Additionally, the generation of images typically involves an intricate reverse diffusion process, which adds to the challenge of accurately quantifying their uncertainty.
To address these challenges, we propose BayesDiff, framework for estimating the pixel-wise Bayesian uncertainty of the images generated by diffusion models. We develop a novel uncer- tainty iteration principle that applies to various sampling methods characterize the dynamics of pixel-wise uncertainty in the reverse diffusion process, illustrated in Figure [ We leverage the last-layer Laplace approximation (LLLA) (Kristiadi et al. 2020 Daxberger et al. (2021a) for effi- cient Bayesian inference of pre-trained score models. Finally, BayesDiff enables the simultaneous
"Corresponding authors.

---

Published as a conference paper at ICLR 2024
Variance Iteration Principle
Decoder
Var(zz)
LLLA with uncert tintty
Pre trained weights
weights
trained
Var(es) Vanier-:)
Var(ins)
Decoder
.201
Image
Iterate sTeps with BayesDiff
Prompt: photo mathematician Bayes halding rose his
Figure 1: Given initial point øT (O, our BayesDiff framework incorporates uncertainty into the denoising process and generates images with pixel-wise uncertainty estimates.
delivery of image samples and pixel-wise uncertainty estimates. The naive BayesDiff can be slow due to the involved Monte Carlo estimation, so we further develop an accelerated variant of it to enhance efficiency.
We can aggregate the obtained pixel-wise uncertainty into image-wise metrics (e.g., through sum- mation) generation filtering. Through extensive experiments conducted on ADM (Dhariwal & Nichol 2021 U-VIT (Bao et al., 2023). and Stable Diffusion (Rombach al. 2022) using sam- plers including DDIM (Song et al., (020) and DPM-Solver (Lu et al.) (022). we demonstrate the images with cluttered backgrounds. Moreover, in text-to-imaae generation tasks, we surprisingly find that pixel-wise uncertainty can enhance generation diversity by augmenting good generations, and rectify failed generations containing artifacts and mismatch- ing with textual descriptions. Additionally, we perform comprehensive ablation studies to seek thorough and intuitive understanding of the estimated pixel-wise uncertainty.
efficacy of BayesDiff in filtering
BACKGROUND
This section briefly reviews the methodology of diffusion probabilistic models and introduces Laplace approximation (LA), a classic method for approximate Bayesian inference.
2.1 DIFFUSION MODELS
Let æ E Rexxx denote an image. A diffusion model (DM) (Ho et al. 2020)
typically assumes
forward process gradually diffusing data distribution q(x:) towards qi (x,), E [0. T), with (π(ボT)= = (0, x²
trivial Gaussian distribution. The transition distribution obeys a Gaussian formulation, i.e., le (x, x)) = -ax;;; a, o where as, o, E R+ The reverse process is defined with the data score Va, log (wx), which is usually approximated by -ea(x,, l)/o,, with parameterized noise prediction network trained by minimizing:
(0. [w(ot)lco + to,,,t) c||2]
where wt) denotes weighting function.
Kingma et al. (202T) show that the stochastic differential equation (SDE) satisfying the transition distribution specified above takes the form of
dæ: al) + g(L)dwr,
where w, the standard Wiener process, f(t) dloog and g()) do? 2 2dlogar of An SDE
dt
and an ordinary differential equation (ODE) starting from ær capturing the reverse process can be constructed (Song al. 2021):
g(1)
dx, [f(t)=; σt ctltt (t)dd
(3)
2

---

Published as a conference paper at ICLR 2024
dæ;
dt = f(t)at + g(t)
20: ct.
(4)
where W. is the reverse-time Wiener process when time flows backward from T to O, di is an infinitesimal negative timestep and 6, = eg (2 1) denotes the noise estimated by the neural network
(NN) model. We could sample 2o ~ q(x) from ~ 0 (xT) by running backwards in time with
the numerical solvers (Lu al. 2022 Karras et al. 2022 for Equation or Equation (4)
2.2 BAYESIAN INFERENCE IN DEEP MODELS AND LAPLACE APPROXIMATION
Bayesian inference turns a deterministic neural network into a Bayesian neural network (BNN).
Let p(D(0) denote the data likelihood of the NN La for the dataset D = {(x(()) ) As- suming an isotropic Gaussian prior p (O), BNN methods estimate the Bayesian posterior p(0
(x((") p(0)p(D)(0) (O))///O))pp)))))))) where (D = II, ((y(")(at (an())))) ,0) = II, p(y(") (ax()))) and predict for new data x" with p(y/ D) = (p(r
Due to NNs' high nonlinearity, analytically computing P() is often infeasible. Hence, approx- imate inference techniques such as variational inference (VI) (B (Blundell et al. 2015; Hernandez-
Lobato Adams] 2015; Louizos & Welling 2016; /Zhang
al.) 2018 Khan et al. 2018),
Laplace approximation (LA) (Mackay) 1992; Ritter et al., 2018). Markov chain Monte Carlo (MCMC) (Welling& & Teh [01l|Chee et al. 20144] Zhang et al. 2019), and particle-opimizztion
based variational inference (POVI) (Liu & Wang (016) are routinely introduced yield an approx- imation g()) x p)0 Among them, LA has recently gained particular attention because it can apply to pre-trained models effortlessly in post-processing manner and enjoy strong uncertainty quantification (UQ) performance (Foong et al. 2019 Daxberger et al.) 2021abb b).
LA approximates D)) with g() No(; MAP. E), where OMAP denotes the maximum a pos- teriori (MAP) solution OMAP arg max; log (D + log p(0), and Σ b0 (log (D(0) + log (00))]o=0mr= characterizes the Bayesian uncertainty
model parameters. Last-layer Laplace approximation (LLLA) (Kristiadi et al. 2020 Daxberger et al. 2021a) further improves the efficiency of LA by concerning only the parameters of the last layer of the NN. It is particularly suited to the problem of uncertainty quantification for DMs, as DMs are usually large.
METHODOLOGY
We incorporate L.LAA into the noise prediction model in DMs for uncertainty quantification a sin- gle timestep. We then develop a novel algorithm to estimate the dynamics of pixel-wise uncertainty along the reverse diffusion process. We also develop a variant of it for practical acceleration.
3.1 LAPLACE APPROXIMATION ON NOISE PREDICTION MODEL
Usually, the noise prediction model is trained to minimize Equation I under a weight decay regu- larizer, which corresponds the Gaussian prior on the NN parameters. Namely, we can regard the pre-trained parameters as MAP estimation and perform LLLA. Of note, the noise prediction prob- lem corresponds regression under Gaussian likelihood, based on which we estimate the Hessian matrix involved in the approximate posterior (or its variants such as the generalized matrix). The last layer in DMs often linear w.r.t. the parameters, so the Gaussian approximate posterior distribution on the parameters directly leads to a Gaussian posterior predictive:
p( D) NN (æ (), diag("ō ())),
where we abuse 0 denote the parameters of the pre-trained DM. We keep only the diagonal elements in the Gaussian covariance, 73 (xx, t), because they refer to the pixel-wise variance of the predicted noise, i.c., the pixel-wise prediction uncertainty of eg. Implementation details regarding the LLLA are shown in Appendix A.4
3.2 PIXEL-WISE UNCERTAINTY ESTIMATION IN REVERSE DENOISING PROCESS
Next, we elaborate on integrating the uncertainty obtained above into the reverse diffusion process.
3

---

Published as a conference paper at ICLR 2024
Although various sampling methods may correspond various reverse diffusion processes, the paradigm for characterizing the uncertainty dynamics is similar. Take the SDE-form one (Equa- tion B for example, introducing Bayesian uncertainty to the noise prediction model yields:
dæ, [f(t) + g(t)² oz c,ldt + g(t)dw..
(6)
where E, ~ ( t), (iaggnz(()) t))). Assume the following discretization for it:
g(t)² E,) + g()=z,
0c-1 w. (f(1)==
where -N( I). To estimate the pixel-wise uncertainty of æ1-1. apply variance estimation to both sides of the equation, giving rise to
Var(#:-1) = (1- (1-)()))r(a)) - (1 - ((1) g(12 Cov(a,; + g(t) Var(e:) + 1(1)21, (8)
of
where Cov(@ Et) E cxx denotes the pixel-wise covariance between æ, and E,. With this, we can iterate over it to estimate the pixel-wise uncertainty of the final 2o. Recalling that Var(er) = (2,, t), the main challenges then boils down to estimating Cov c.).
The estimation of Cov(æ,, Et). By the law of total expectation E (E(( E(X,, there is
Cov c+) = Ex O 6+) Ex, @ Ee
Ez, (Be, 1m, (z, @ e, x.)) Ex, E., (Ee, (c: (x,))
Ez, (xt c0( t)) Ex, O Ex, (c,(
where @ denotes the element wise multiplication. To estimate this, we need the distribution of æ,,
We notice that it is straightforward to estimate Ex(;)) via similar iteration rule to Equation (
g(t)² g(t) B(G)).
[(x,,1) (1- (()))((,,)
(10)
or
Given these, we can reasonably assume æ; follows (B((x,,,, Var(x:)), and then Cov( 62) can be approximated with Monte Carlo (MC) estimation:
S
s ca (0
1
Cov(xe, E,) ~
Σ
(Ee, @ Cala,,, t)) Ex, 0
(1I)
8
1=1
1=1
where Lt,i ~ (E((x,)) i 1,..)
Applying method to existing samplers. The derivation from Equation to Equation 111 presents our general methodology based on the classical Euler sampler of reverse-time SDE, which can be applied to arbitrary existing sampler of diffusion models in principle. For broader interests and simplicity, we show the explicit rules for DDPM eto al.) 2020) as an instance.
Specifically, the sampling rule of DDPM (Ho et al.
2020 is:
1
X
Xx
Ee) + VB,z
(12)
V1
where af 1= 3r with Br as the given noise schedule for DDPM and a = II o. Using the same techniques as above, we can trivially derive the corresponding iteration rules:
1 of Cov(z,, + (1-a() a,)² Var(x)) - a/
Var(x,-1)
af ([[1-a)) σ/) Var(e:) 3
(13)
alvl 1-6
1- E(e,)
E E(x
B(x+)
(14)
Vo
Val(l - of)
Equation still be leveraged approximate Cov( E2). We iterate these equations to obtain Dy as well as its uncertainty Var(#n). Since the advanced samplers, e.g., Analytic- -iitc-DDMMM (Bao)
et al. 2021 DDIM (Song al. 2020) and DPM-Solver (Lu et al. 2022). more efficient and
4

---

Published as a conference paper at ICLR 2024
Algorithm Pixel-wise uncertainty estimation via Bayesian inference. (BayesDiff)
Input: Starting point æy,, Monte Carlo sample size S. Pre-trained noise prediction model 6g-
Output: Image generation zo and pixel-wise uncertainty Var(xo).
1: Construct the pixel-wise variance prediction function 7/ via LLLA;
2: E(ær)) < 2T. Var(ær) t O, Cov(ar, er) < O:
3: for -
4: Sample ~ (N(ee( I), diag(nă ( (æt, 1));
5: Obtain 2 via Equation (7);
6:
Estimate E((;-1) and (a;-)) via Equation 10 and Equation (
7: sample 2t-1, 1, ~ (((xx)))) Var(#;;11 )
8: Estimate Cov(2; Et-1) via Equation
9:
end for
widely adopted, we also present the explicit formulations corresponding to them in Appendix A. The 2-order DPM-solver is particularly popular in practice, e.g., large-scale text-to-image models, it is non-trivial to apply the above derivations directly to it because there is an extra hidden state introduced between æ; and 2t-1- We propose leverage structures like conditional independence to resolve this. Find more details in Appendix(A..
Continuous-time reverse process. Instead of quantifying the uncertainty captured by the discrete diffusion process as Equation 77) we can also directly quantify that associated with the original continuous-time process, i.e., Equation (6). We have derived approximate expression illustrating the pattern of uncertainty dynamics at arbitrary timestep in [0. However, estimating Var(#o) using it is equally laborious as discrete-time reverse process because discretization is still required to approximate the involved integration. See Appendix A.2 for more discussion.
Algorithm. Algorithm A demonstrates the procedure of applying the developed uncertainty iteration principle to the SDE sampler in Equation 7 After obtaining the pixel-wise uncertainty Var(zu), we can aggregate the elements into an image-wise metric for low-quality image filtering.
3.3 THE PRACTICAL ACCELERATION
Algorithm D computes the uncertainty of the hidden state at each sampling step, abbreviated as BayesDiff. The function 7gl [xe, t) produces outcomes along with eg (z,, raising minimal added cost. Yet, the MC estimation of Cov 6x) in Equation (11 causes S (usually $ > 10) more evaluations of Eg, which can be prohibitive the deployment scenarios.
To address this, we develop faster variant of BiyesDiff by performing uncertainty quantification on only subset the denoising steps rather than all of them, dubbed Bayes pre-define schedule é : (fi,..., [v in advance. For each timestep i, if E i, we sample e from LLLA and estimate corresponding uncertainty Var(x;,1) 1) following the uncertainty iteration principle. Otherwise, adopt the deterministic sampling step where Cov(x, E2) and Var(er) are set to zero. We outline such a procedure in Appendix A.3
Concretely,
Consistency between BayesDifr-Skip and BayesDiff. We check the reliability of BayesDiff-Skip here. Con- cretely, generate 96 images using BayesDiff (skipping interval = 0) under the DDIM sampling rule on ImageNet and mark the top and bottom samples with the high- est and lowest uncertainty according to the summation of pixel-wise uncertainty. We send the same random noises (i.c.. æT) to BayesDiff-Skee (skipping interval > 0) with various skipping intervals (unless specified otherwise, we evenly skip) to obtain generations close to the aforemen- tioned 96 images yet with various uncertainties. We plot the uncertainties of the marked images in Figure 2 It is shown that the marked images that BayesDiff is the most uncertain about remain the same for BayesDiff-SS No- tably, in this experiment, BayesDiff-Skip can achieve a 5x reduction running time.
lop 9 with highes uncertainiy botter with Lowest uncortainty
Interval of skipping
Figure
study on the reliability the BayesDiff Skip algorithm. The top im- ages with the highest uncertainty selected by BayesDiff are still with high uncertainty in BayesDiff-Skin algorithm.

---

Published as a conference paper at ICLR 2024
Ppp
Figure 3: The images with the highest (left) and lowest (right) uncertainty among 5000 unconditional generations U-ViT model trained on ImageNet at 256 x 256 resolution.
photo of eagle.
photo of iguana.
A photo of white shark.
Figure 4: The images with the highest (left) and lowest (right) uncertainty among 80 generations on Stable Diffusion at 512 x 512 resolution.
EXPERIMENTS
In this section, we demonstrate the efficacy of BayesDiff in filtering out low-quality generations. Be- sides, show that pixel-wise uncertainty can aid in generating diverse variations of the successful generation and addressing artifacts and misalignment of failure generations in text-to-image tasks. At last, seek intuitive understanding of the uncertainty estimates obtained by BayesDiff. We sum over the pixel-wise uncertainty to obtain an image-wise metric. Unless specified otherwise, we set the Monte Carlo sample size S 10 and adopt BayesDiff-SSipp with skipping interval of 4, which makes our sampling and uncertainty quantification procedure consume no more than 2x time than the vanilla sampling method.
4.1 EFFECTIVENESS IN LOW-QUALITY IMAGE FILTERING
Comparison between high and low uncertainty images. We first conduct experiments on the
U-ViT (Bao al. 2023) model trained on ImageNet (Deng al. 2009) and Stable Diffusion, performing sampling and uncertainty quantification using BayesDiff-Skip. The sampling algorithm follows the 2-order DPM-Solver with 50 function evaluations (NFE). We display the generations with the highest and lowest uncertainty in Figure 3 and Figure 4
As shown above, our image-win wise uncertainty metric is likely to indicate the level of clutter and the degree of subject prominence in the image. It can be used to detect low-quality images with cluttered backgrounds in downstream applications.
Relationship between our sample-wise uncertainty metric and traditional distributional met- rics. We use DifesSiff-Skip to generate 100,000 images on CELEBA (Liu et al., 2015)) based on
DDPM (Ho al. 2020 model and DDIM sampler, 250,000 256 x 256 ImageNet images based on U-ViT (Bao et al. 2023 and 2-order DPM-Solver, and 250,000 128 x 128 ImageNet images based on ADM (Dhariwal & Nichol, 2021) and DDIM. We separately divide the sets into five groups of the same size with descending uncertainty. We compute the traditional metrics for each group of data, including Precision (Kynkäänniemi al. 2019), which evaluates the fidelity of the genera-

---

Published as a conference paper at ICLR 2024
FID
Precision
Recall
CELEBA 64
CELEBA 64
CELEBA 64
14
TmageNet 128
Inagellet 128
0.75
ImageNet 128
ImageNet 256
6.75
Inagellet 256
0.70
InageNet 256
0.65
0.70
0.60
10
0.35
0.65
0.50
0.45
6
0.60
0.40
Tube
Tube 1
Tube
2
Tube 3
Tube
Tube
Tube 1
Tube 2
Tube 3
Tube
Tube
Tube 1
Tube 2
Tube 3
Tube
Figure 5: FID, Precision and Recall scores of 5 groups of generations with descending uncertainty on CELEBA and ImageNet datasets. Results show there is a strong correlation between our sample- wise uncertainty metric and traditional distributional metrics.
Table I: Comparison on three metrics between randomly selected images and our selected images. We use 50 NFE for both DDIM and DPM-Solver sampler.
FID
Precision
Recall f
Model
Dataset
Sampler
random
ours
random
random
ADM
ImageNet 128
DDIM
8.68 + 0.04
8.48
0.661
0.665
0.655
0.653
ADM
ImageNet et 128
2-order SolvSr
9.77 = 0.03
9.67
0.657
0.659
0.649
0.649
U-VIT
ImageNet 256
2-order DPM-Salver
7.24 0.02
6.81
0.698
0.705
0.658
0.657
U-ViT
ImageNet 512
2-order DPM-Solver
17.72 + 0.03
16.87
0.728
0.732
0.602
0.604
tion, Recall (Kynkäänniemi et al. 2019), which accounts for the diversity, and FID, which conjoins fidelity and diversity. We present the results in Figure
Notably, images with higher uncertainty have higher Recalls in both scenarios, i.e., higher diversity, and images with lower uncertainty have higher Precisions, i.e higher fidelity. This echoes the trade- off between Precision and Recall. Moreover, as Figure cluttered elements, which is consistent with the results of Precision. However, the trend of FID is different among the three datasets. The main reason is that the generations on the simple CELEBA all good enough, so diversity becomes the main factor influencing FID. Conversely, the more complex ImageNet, fidelity the main factor influencing FID.
images with high uncertainty have
Criterion for low-quality image filtering to improve the quality of generated distribution. We generate 50,000 images using 2-order DPM-Solver sampler and BayesDiff-Skip on ImageNet at 256 x 256 reso- lution to explore the distribution of image-wise uncer- tainty. As shown in Figure 6 the empirical distribu- tion of the image-wise uncertainty of the generations is approximately a normal distribution. According to the 3-sigma criterion of normal distribution for climi- nating outliers, we eliminate low-quality images by fil- tering out the images with uncertainty higher than pto, which is equivalent to top 16% images with the high- est uncertainty. To test the effectiveness of this crite- rion, we generate 60,000 images with various models and samplers and select the 50,000 images with lower uncertainty. We compute the Precision, Recall, and FID of these samples in Table [] which also includes the random selection baseline. The results validate that we filter out low-quality images precisely with such an uncertainty-batt based filtering criterion.
Frequency
0.30
Uncertainty
Figure 6: The empirical distribution of the uncertainty estimates yielded by our ap- proach. The dashed line denotes the nor- mal distribution fitted on them. Inspired by this, we propose to filter out the top 16% samples with the highest uncertainty.

---

Published as a conference paper at ICLR 2024
origin
augmented samples
origin
augmented samples
photo of a Shiba Inu dog wearing sunglasses and beach hat.
painting of cheetah drinking on espresso.
Figure 7: Examples the augmentation of good generations with enhanced diversity on Stable
Diffusion with DDIM sampler (50 NFE).
origin
fined
origin
refined
arigin
refined
BaYés
Bayes
BAYES
BAYES
A street sign that reads
'Bayes'
Garfield sunglosses is eating losagna
A teddy bear riding bike
Figure 8: Examples of the rectification of artifacts and misalignment in failure generations on Stable Diffusion with DDIM sampler (50 NFE). The flawed samples identified by humans and the bounding boxes are manually annotated.
4.2 PIXEL-WISE UNCERTAINTY: TOOL FOR DIVERSITY ENHANCEMENT AND ARTIFACT RECTIFICATION
The main issue with Stable Diffusion is that usually, only few generations denoised from 'good' initial noises can align with the input textual description (Wu et al.) 2023). We show that the pixel- wise uncertainty estimated by BayesDiff can be leveraged to alleviate such an issue. Specifically, BayesDiff-Skin allows for introducing a distribution of æ; ~ N (x,,,,,, Var(æ;)) for any time t [0,2], 2J. If the final sample Do appears to be good generation, (EEx)), Var();)) and denoise it to a new one Do.;. which is similar yet different from To. We leverage BayesDiff-Skip with skipping interval of I and DDIM sampler with 50 NFE test this. We use the Gaussian distribution estimated at = 40 for resampling. Figure 7 shows that the resampled æo still conforms the above hypothesis. Moreover, Figure 8 shows that in some cases, the artifacts in original samples can be rectified, and hence the failed samples, which are mismatched with the prompts, are rectified into successful samples. More examples are shown Appendix A.5
can resample æt,i from
4.3 FURTHER UNDERSTANDING OF PIXEL-WISE UNCERTAINTY
Visualization of pixel-wise uncertainty. To gain an intuitive understanding of the obtained uncer- tainty estimates, we visualize them in this section. detail, we launch BayesDiff using DDPM model for generating CELEBA images and Stable Diffusion for generating prompt-conditional im- ages. Nonetheless, the visualization for Stable Diffusion is not straightforward because we actually obtain the variance in the final latent states. To solve this problem, sample variety of latent states and send them to the decoder of Stable Diffusion. We estimate the empirical variance of the out- comes as the final pixel-wise uncertainty. Figure 9 presents the results. As shown, our uncertainty estimates carry semantic information. The eyes, noses, and mouths of human faces demonstrate greater uncertainty CELEBA and the contours of objects in images from Stable Diffusion
8

---

Published as a conference paper at ICLR 2024
Figure 9: Visualization of the pixel-wise uncertainty of generations on CELEBA (top) and from Stable Diffusion with prompt 'A photo of a whitethroat' (bottom). We adopt BayesDiff-Skee and DDIM sampler (50 NFE) in both cases.
Figure 10: Visualization of Ladjacent,D- which denoised from adjacent initial positions corre- sponding to low image-wiss wise uncertainty (left, ranges from 2.5 to 2.8) and high one (right, ranges from 24.5 to 28.1) on CELEBA with DDIM sampler (50 NFE).
hibit higher levels of uncertainty. This further explains the higher image-wise uncertainty for clutter images and the lower one for clean images mentioned in Section
Visualization of generations of adjacent initial positions. In BayesDiff, the estimated uncertainty Var(=1) dependent on the corresponding initial position ær ~ _N(O,)), and higher uncertainty estimates correspond to larger variations in the sampling trajectory. Therefore, adding minor pertur- bation to initial positions corresponding to high uncertainty should produce diverse generations. We conduct experiments CELEBA (Liu al. 2015) with DDIM sampler to validate this conjecture. Specifically, we define the adjacent initial position Fodjacent, == /1 yjr + vTiz, 2 ~ N 7) and visualize Wadjacent,,- which is denoised from Wadjacent, T. Figure shows that images gener- ated from adjacent positions with high uncertainty indeed exhibit greater diversity. This result also echos the higher Recall of the group with higher uncertainty on CELEBA in Section 4.1
RELATED WORK
Several works incorporate Baysian inference into deep generative models and exihibit strong perfor- mance. Variational Autoencoder (VAE) (Kingma & Welling (0114) is a classic generative model that learns the data distribution through Bayesian variational inference. VAEs have been applied in vari- ous domains and demonstrate powerful capabilities of data representation and generation. (Kingmal
& Welling| 2014 Hou et al.) 2017 Bowman al. 2015 Semeniuta et al.) 2017 Wang al. 2019
Ha & Schmidhuber (2018) Variational Diffusion Models (VDMs) (Kingma et al. (021) employ
signal-to-noiss ratio function parameterize the forward noise schedule in diffusion models, en-
abling the direct optimization of the variational lower bound (VLB) and accelerating training lot.
6 CONCLUSION
In this paper, we introduce BayesDiff, framework for pixel-wise uncertainty estimation in Diffu- sion Models via Bayesian inference. We have empirically demonstrated that the estimated pixel-wise uncertainty holds a significant practical value, including being utilized an image-wiss uncertainty metric for filtering low-quality images and tool for diversity enhancement and misalignment rec- tification in text-to-image generations. Apart from image generations, the powerful capability of Diffusion Models to generate realistic samples has been applied in various other domains such as natural language processing (audio synthesis (Huang et al. (022): text-to-speech (Kim et al. (022) ) and AI for science (molecular conformation prediction (Xu et al. 2021); material design (Luo al. ).22 We believe BayesDiff holds great potential for incorporating with these applications to improve the predictive uncertainty and calibrate generations.

---

Published as a conference paper at ICLR 2024
ETHICS STATEMENT
This work is fundamental research in machine learning, the potential negative consequences are apparent. While it is theoretically possible for any technique to be misused, the likelihood of such misuse occurring at the current stage is low.
ACKNOWLEDGMENTS
This work supported by NSF of China (Nos. 62306176, 62076145), Natural Science Foun- dation of Shanghai (No. 237R 4288700), the Key Research and Development Program of Shan- dong Province, China (No. 2023CXGC010112 12), and Beijing Outstanding Young Scientist Program (No. BJJZXYH001209910000000 C. Li was also sponsored by Beijing Nova Program (No. 20220484044).
REFERENCES
Fan Bao, Chongxuan Li, Jun Zhu, and Bo Zhang. Analytic-dpm: an analytic estimate of the opti- mal reverse variance in diffusion probabilistic models. In International Conference on Learning Representations, 2021.
Fan Bao, Shen Nie, Kaiwen Xue, Yue Cao, Chongxuan Li, Hang Su, and Jun Zhu. All are worth words: A vit backbone for diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2222922222222 22679, 2023.
Charles Blundell, Julien Cornebise, Koray Kavukcuoglu, and Daan Wierstra. Weight uncertainty in neural network. In International Conference Machine Learning, pp. 1613-1622, 2015.
Samuel R Bowman, Luke Vilnis, Oriol Vinyals, Andrew M Dai, Rafal Jozefowicz, and Samy Ben- gio. Generating sentences from continuous space. arXiv preprint arXiv:1511.06344 2015.
Tianqi Chen, Emily Fox, and Carlos Guestrin. Stochastic gradient hamiltonian monte carlo. In International Conference Machine Learning, pp. 1683-1691. PMLR, 2014.
Erik Daxberger, Agustinus Kristiadi, Alexander Immer, Runa Eschenhagen, Matthias Bauer, and
Philipp Hennig. Laplace redux-effortless bayesian deep learning. Advances in Neural Information Processing Systems, 34:20089-20103, 2021a.
Erik Daxberger, Eric Nalisnick, James U Allingham, Javier Antorán, and José Miguel Hernández- Lobato. Bayesian deep learning via subnetwork inference. In International Conference on Ma- chine Learning, pp. 2510-2521. PMLR, 2021b.
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hi- erarchical image database. In 2009 IEEE conference computer vision and pattern recognition, pp. 248-255, leee, 2009.
Zhijie Deng, Xiao Yang, Shizhen Xu, Hang Su, and Jun Zhu. Libre: A practical bayesian approach to adversarial detection. In Proceedings of the IEEF/CVE conference on computer vision and pattern recognition, pp. 972-982, 2021.
Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in neural information processing systems, 34:8780-8794 2021.
Andrew YK Foong, Yingzhen Li, José Miguel Hermández-Lobato, and Richard Turner. 'in- between' uncertainty in bayesian neural networks, arXiv preprint arXiv: 1906. 1537, 2019.
Shuyang Gu, Dong Chen, Jianmin Bao, Fang Wen, Bo Zhang, Dongdong Chen, Lu Yuan, and Baining Guo. Vector quantized diffusion model for text-to-imaae synthesis. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10696-10706, 2022.
David Ha and Jürgen Schmidhuter. World models. arXiv preprint arXiv: 1803. 10/22, 2018.
10

---

Published as a conference paper at ICLR 2024
José Miguel Hermández-Lobato and Ryan Adams. Probabilistic backpropagation for scalable learn- ing of Bayesian neural networks. International Conference on Machine Learning, pp. 1861- 1869, 2015.
Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to local nash equilibrium. Advances in neural information processing systems, 30, 2017.
Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 33:6840-6833 2020.
Xianxu Hou, Linlin Shen, Ke Sun, and Guoping Qiu. Deep feature consistent variational autoen- coder. 2017 IEEE winter conference on applications of computer vision (WACV), pp. 1133- 1141. IEEE, 2017.
Rongjie Huang, Zhou Zhao, Huadai Liu, Jinglin Liu, Chenye Cui, and Yi Ren. Prodiff: Progressive fast diffusion model for high-quality text-to-speech. Proceedings the 30th ACM International Conference on Multimedia, pp. 2595-2605, 2022.
Tero Karras, Miika Aittala, Timo Aila, and Samuli Laine. Elucidating the design space of diffusion- based generative models. Advances in Neural Information Processing Systems, 35:26565-265777 2022.
Mohammad Emtiyaz Khan, Didrik Nielsen, Voot Tangkaratt, Wu Lin, Yarin Gal, and Akash Srivas- tava. Fast and scalable Bayesian deep learning by sright-petuuraatio in adam. In International Conference on Machine Learning, pp. 2616-2625, 2018.
Heeseung Kim, Sungwon Kim, and Sungroh Yoon. Guided-tt: A diffusion model for text-to-speech via classifier guidance. In International Conference Machine Learning, pp. 11119-11133. PMLR, 2022.
Diederik Kingma, Tim Salimans, Ben Poole, and Jonathan Ho. Variational diffusion models. Ad- 2021.
vances neural information processing systems,
Diederik Kingma and Max Welling. Auto-encoding variational bayes. stat, 1050:1, 2014.
Agustinus Kristiadi, Matthias Hein, and Philipp Hennig. Being bayesian, even just a bit, fixes overconfidence in relu networks. In International conference machine learning, pp. 5436- 5446. PMLR, 2020.
Tuomas Kynkäänniemi, Tero Karras, Samuli Laine, Jaakko Lehtinen, and Timo Aila. Improved precision and recall metric for assessing generative models. Advances Neural Information Processing Systems, 32, 2019.
Qiang Liu and Dilin Wang. Stein variational gradient descent: A general purpose Bayesian inference algorithm. Advances in Neural Information Processing Systems, pp. 2378-2386, 2016.
Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In Proceedings of International Conference on Computer Vision (ICCV), December 2015.
Christos Louizos and Max Welling. Structured and efficient variational deep learning with matrix gaussian posteriors. In International Conference on Machine Learning, pp. 1708-1716, 2016.
Cheng Lu, Yuhao Zhou, Fan Bao, Jianfei Chen, Chongxuan Li. and Jun Zhu. Dpm-solver: A fast ode solver for diffusion probabilistic model sampling in around 10 steps. Advances in Neural Information Processing Systems, 35:5775-5787, 2022.
Andreas Lugmayr, Martin Danelljan, Andres Romero, Fisher Yu, Radu Timofte, and Luc Van Gool. Repaint: Inpainting using denoising diffusion probabilistic models. In Proceedings of the IEEE/CVF Conference Computer Vision and Pattern Recognition, pp. 11461-11471, 2022.
Shitong Luo, Yufeng Su, Xingang Peng, Sheng Wang, Jian Peng, and Jianzhu Ma. intigen-specing antibody design and optimization with diffusion diffusion-based generative models for protein structures. Advances in Neural Information Processing Systems, 35:9754 2022.

---

Published as a conference paper at ICLR 2024
David John Cameron Mackay. Bayesian methods for adaptive models. PhD thesis, California Institute of Technology, 1992.
Wesley Maddox, Pavel Izmailov, Timur Garipov, Dmitry P Vetrov, and Andrew Gordon Wilson. A simple baseline for bayesian uncertainty in deep learning. Advances in neural information processing systems, 32, 2019.
Hippolyt Ritter, Aleksandar Botev, and David Barber. A scalable laplace approximation for neural networks. In 6th International Conference on Learning Representations, volume 6. International Conference on Representation Learning, 2018.
Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bjöm Ommer. High- resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF confer- on computer vision and pattern recognition, pp.
2022.
Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily Denton, Kamyar Ghasemipour, Raphael Gontijo Lopes, Burcu Karagol Ayan, Tim Salimans, et al. Photorealistic text-to-image diffusion models with deep language understanding. Advances in Neural Informa- 2022.
tion Processing Systems,
Tim Salimans, Ian Goodfellow, Wojeiech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. Advances in neural information processing systems, 29, 2016.
Stanislau Semeniuta, Aliaksei Severyn, and Erhardt Barth. A hybrid convolutional variational toencoder for text generation. arXiv preprint arXiv:1702.02253 2017.
Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. In Interna- fional Conference on Learning Representations, 2020.
Yang Song, Jascha Sohl-Dickstein, Diederík Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In Interna- tional Conference on Learning Representations, 2021.
Wenlin Wang, Zhe Gan, Hongteng Xu, Ruiyi Zhang, Guoyin Wang, Dinghan Shen, Changyou Chen, and Lawrence Carin. Topic-guided variational autoencoders for text generation. NAACL HLT 2019-2019 Conference of the North American Chapter of the Association for Computational Lin- guistics: Human Language
Procedddgg of the Conference, pp. 166-177. Associa- tion for Computational Linguistics (ACI), 2019.
Max Welling and Yee W Teh. Bayesian learning via stochastic gradient langevin dynamics. In International Conference on Machine Learning, pp. 681-688, 2011.
Xiaoshi Wu, Keqiang Sun, Feng Zhu, Rui Zhao, and Hongsheng Li. Better aligning text-to-image models with human preference. arXiv e-prints, pp. arXiv-2303, 2023.
Minkai Xu, Lantao Yu, Yang Song, Chence Shi, Stefano Ermon, and Jian Tang. Geodiff: geo- metric diffusion model for molecular conformation generation. In International Conference on Learning Representations, 2021.
Chenshuang Zhang, Chaoning Zhang, Mengchun Zhang, and In So Kweon. Text-to-image diffusion model in generative ai: A survey. arXiv preprint 230.:22003.0799, 2023.
Guodong Zhang, Shengyang Sun, David Duvenaud, and Roger Grosse. Noisy natural gradient as variational inference. International Conference on Machine Learning, pp. 5847-5856, 2018.
Ruqi Zhang, Chunyuan Li, Jianyi Zhang, Changyou Chen, and Andrew Gordon Wilson. Cyclical stochastic gradient meme for bayesian deep learning. arXiv preprint arXiv:1902.03993 2019.
12

---

Published as a conference paper at ICLR 2024
A APPENDIX
A. ITERATION RULES FOR OTHER SAMPLING METHODS
For Analytic-DPM (Bao et al. 2021). the sampling method is:
1
- a
X,-1
(xi
c1) 0.0
(15)
V
v1 o
1 0/
1
of = X7 + =(V
0/21 27) - (1 (1- -11-a))T+)
(16)
0g
X 1 - 0 (1 a();
Pn
1
Σ
|1 (3
Ft.
iid
qt (xx))
(17)
- d
M
The corresponding iteration rule is:
1 - al
B(xx-1) E(x,)
B(e,)
(18)
Va
Vai(1 -a;)
Var(x;-1) Var(x;) -2 1 a/
Cov(æs, E1) + (1- Var(e:) +
(19)
di dlvl-at
a'(1 ā()
For DDIM (Song et al. 2020). the sampling method is
+ O6-16 Bt OrEi
It-1 a1-1
(20)
at
The corresponding iteration rule is:
E(xx-1) = a1-1 E(xx) + (0t-1
a1-1 (()))(E)))))))
(21)
0t
01 Var(x;) + - (0.-1 0t 0t-l C, + (at-1 0t-1 o, Var(E:
Var(x;-1)
an
(22)
For 2-order DPM-Solver (Lu et al. 2022), applying our method is non trivial because it involves an extra hidden state between 2; and Tt-1:
Da.
Oz (e -1)E:
(23)
at
E1 0t-1 x2 0. 1c-1 - 1)Ese
(24)
where > log a: is the half-log-SNR (Luu et al. a,
2022p. h4 de-1 d 8t denotes the timestep
corresponding to the half-log-SNR of -
Estimating expectation and variance for both sides of Equation 24 yields:
E [((
Ot-1 [(xx)
0 1)E((e..)
(25)
04
Var(#;-1) Var(a:)) -2 Css (e () Es,) + of (c Var(e....
(26)
Unlike first-order sampling methods, we cannot approximate Cov(a,, Es,) with rarely MC samples Tt,i. Nonetheless, observe that injecting the uncertainty e; to Equation (23) yields
Ez, Et NI
O's. at.
Ja. (e 1)ep(x; f), diag(o?, (e 3 (w,, t)))
(27)
Consequently, we can first sample æt,; ~ (((x),,, Var (x)). based on which x., are sampled. Then, approximate Cov (a,, 6x,) with MC estimation similar Equation
13

---

Published as a conference paper at ICLR 2024
A.2 UNCERTAINTY QUANTIFICATION ON CONTINUOUS-TIME REVERSE PROCESS
Firstly, we integrate Equation 66) with time / from to T to obtain the continuous-time solution Zy-
To 2T 1'" [f(t)=,
g(1)²
e, ''" g(t)dw.
(28)
or
Due the independence between the reverse-time Wiener process and Iz, have
Var(xo) = Var(ær) + Varl S. [f(t)x, s(1) e,ldt) + Varl L/" s(t)dwr)
(29)
=1+ + Varl ('d [f(t)x+ g()2 Ezldt) [' g(t)
ot
The second equality is derived using the Ito isometry property Equation 30 of Ito calculus:
E( f 91 (f(t)dss /" g2(()d(r)) = E( B (1(t)g2(t)dh)
(30)
that is,
l' g(t)dwr)) =B(( / )(t)dw,))) - B( L g(t)dw,)) Var 0
B1//
5
(31)
L' g(t)2
-B(() g(t)dw,)) 0
Assuming that the reward process He. E [0, 7] is stochastic process with second order moments and is mean square integrable, we have
Var( f [f(t)=; g()) at
cdldt)
= 1." I' (()))
9(12 -(())(00² Cov(a,, Ex) f(t) 0,
-(())(()) 1()2 Cov(2t, Ex) {()) g(1)²
-f(s)
Cov(es dssdt
(32)
Ti
o, o
I'" T
[ (()))(() 21) f(s) g())
Cov(o,, dsddt
-2 f(s) [(s))({) 0(s)² Cov(x,, e, )s + (' g(s)* σ.
Cov(es, e
o
The second equvalence holds because a. and ex, E, and e, are both independent when # i.c. Cov(#,, Ex) = O, Cov(Es, E,) = 0, Vs + t.
''" J" (()))())Co(ee, (x, dd)ds =2 S" 100% (()),
[ FOOR S. Coo) xs. + f (f(u)zn g(u)²
=2
du
on
+ g(u)d
=2 ['" SOX S. (())ar((z.)ds)d
[" noO L [())oov(2..) J. J.' (f(u)ae. g(w)² Ew dd)dd)d
+2
(33)
14

---

Published as a conference paper at ICLR 2024
Then the question boils down to approximate Cov Sov( (J( g(w)² E.)du)) According to the numerical integration method and Cov(xs, E2) = 0, Vs # t,
Cov(x.: [: ((((()) g(u)² cu)du)= = Cov(xss f(u) + Cov(ae, [ g(u)²
E. E.)du)
Cov(ass [. f(u)xndu)) g(u)² Cov(2e, Eu)
(34)
So when Al - O,
Cov(ass: S: (((w)a g(u)²
E.)du) Cov(ass) J. f(u)ar,du)
(35)
ou
According to sampling method T1-1=11 =x; - (f(t)æz + 200.
or =0=e))))t =)))a) ( - wi).
-wi),
Eo+Al = + (f()x,, + g(s)2
c.) + h(w)
Es+2A: Is+Ar (f(s At) + g + At)?
Es+AI) + h(ww
O2+Ar
=I, (f()((()) )(
O. c)) A1) A(s A1)2
G+A + O(AP) + h(w)
O+A1
(36)
Then using naiive numerical integration method, we have
[" f(u)x,du f(s)x, f(s At) f(s 2 + At)
= At f(s (t)x, f(s
f(t At) 2OAAP) + H(w)
=s. f(u)æxdu + ) + H(w)
(37)
We neglect second-order terms and get the approximation of Cov(#s: S22 f())
Cov( [ (())xadu) se Cov(as,, ' [(u)a,du)= = Var(ar.) S. f(uddu
(38)
In conclusion, derive approximate illustrating the pattern of uncertainty dynamics from ær to Zp.
Var(#)) 1+2 S S()) L ((s)) + S' soof (())aat S."
f(u)du)ds)d
- f/' f(s) gs) Cov(z,,, es + (' g(5)
Varlss)ds + f'' o²
["oltpat g(t)dtt
(39)
Moreover, we can generalize it to arbitrary reverse time interval [i, E [0. Specifically, vO S sisisT,
ff S00) J. f(s)Var(az)ds)dt L. roos. (())ar(a.)). f(u)du)ds)dr
Var(a;) Var(2;))+ +2
2 L f(s) f(s) (()) Cov(a,,,,))d e, + I' g(s)*
Var(e,) + f. g(t) o?
(40)
15

---

end for Published as a conference paper at ICLR 2024
Algorithm 2 A faster variant of BayesDiff. (BayesDift-Skip)
Input: Starting point Monte Carlo sample size S, Pre-trained noise prediction model ca.
Output: Image generation æo and pixel-wise uncertainty Var(#o).
1: Construct the pixel-wise variance prediction function 7Ø via LLLA;
2: B(ær) < 2T. Var(ær) + 0, Cov(ar, ET) < 0:
3:
4: t
5: Sample 6 ~ (a 1), diag(1h t)));
6: else
7:
E; t t), Cov ex) t O, Var(er)
8:
end if
9:
Obtain # via Equation
10:
Estimate E(x;-1) and Var x1-1) via Equation 10 and Equation {
11:
- i then
Sample 1;-1,1 (E) Var(#;-1 Estimate Cov( Ct-1) via Equation
,,... S;
13:
end
15:
A.3 BAYESDIT-SKIPP ALOGORITHM
In this section, we present our BayesDiff-Skie algorithm. To be specific, if sampling with uncer- tainty used from H, #;-1, then E, is considered posterior predictive distribution, where Cov(æ,, 6x) and Var(e,) are non-zero. Conversely, if origi- nal deterministic sampling used from 2; to øt-1, E is treated constant and Cov Ge) and Var(e;) are zero. We conclude it to this algorithm in Algorithm 2
random variable sampled from the normal
A.4 IMPLEMENTATION DETAILS OF LAST LAYER LAPLACE APPROXIMATION
We adopt the most lightweight diagonal factorization and ignore off- off-diagonal elements for Hessian approximation in LLLA (Daxberger et al. 2021a). To avoid storing large Jacobian matrix, adopt the Monte Carlo method to approximate the accurate variance outputs diag(ng t)) directly by the variance of samples fo, (ar, t) Og p)) (0;; AMPP, E). This results in faster computation speed, while still maintaining reasonable level of accuracy. The number of samples is chosen as 100 in practice.
A.S ADDITIONAL EXAMPLES RESAMPLING METHOD WITH BAYESDIFF
To provide more intuitive demonstration of the significance of our resampling method, we include additional prompts and corresponding images containing artifacts annotated by humans, presenting 8 resampled images using BayesDiff in Figure [I and Figure 12 We find that the success rate of resampling flawed samples into desirable samples is approximately at least 60%.
16

---

Published as a conference paper at ICLR 2024
OFTCE
OFICE
POCE
POCE
OFICE
POCE
OFFIEE
OFFICE
OFFIC
hamster working police office, professional photography, photo realistic
medium format film portrait close up of a female astronaut sitting on a bench the park on rainy day, hasselblad film bokeh, unsplash, soft light photogrophed colour expired film
Figure 11: 8 potential rectified samples resampled by BayesDiff (right) of flawed images (left) annotated by humans.
17

---

Published as a conference paper at ICLR 2024
cat standing on castle surrounded by fire, digital art, realistic, large depth field, vignette effect, trending arstation
Figure 12: 8 potential rectified samples resampled by BayesDiff (right) of flawed images (left) annotated by humans.
18


Reviews:
[{"review_id": "cJkqOqH5pf", "reviewer": "Reviewer_B5Gy", "summary": "Authors propose to obtain a Laplace approximation to the last layer of a diffusion model to filter out low-fidelity images.", "questions": "See weaknesses.", "limitations": "", "rating": 6, "confidence": 3, "soundness": 2, "presentation": 3, "contribution": 2, "strengths": "**Originality.** The idea of obtaining Laplace approximations to the weights of neural networks is not new, neither is the idea of filtering out low-fidelity images.\n\n**Quality and clarity.** The paper is easy to follow.\n\n**Significance.** I do not find the proposed approach a theoretically sound approach, hence not significant.", "weaknesses": "* Why not use the model likelihood to rule out low-fidelity images? The likelihood of diffusion models is tractable as done in [Song et al.](https://openreview.net/pdf/ef0eadbe07115b0853e964f17aa09d811cd490f1.pdf)\n\n* Despite authors' justification, I am not convinced that the posterior distribution over the weights of the last layer can be accurately approximated with a Gaussian distribution. This statement is as accurate as the statement that a Gaussian prior is a good prior for the weights of a neural network. Is that true? I suggest plotting per-weight histograms of the last layer of a trained diffusion model to see if they are Gaussian.\n\n* The whole notion of removing low-fidelity images and promoting generative models to create \"good looking\" images has been recently highly criticized due to this process biasing generative models. See [this paper](https://arxiv.org/pdf/2106.10270.pdf) and [this paper](https://arxiv.org/abs/2306.06130) and similar papers (in reference and citations).", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "wegjXrexYR", "reviewer": "Reviewer_NYDr", "summary": "Diffusion models are powerful generative models but it is not easy to output standard bayesian uncertainty statistics from them such as posterior predictive probability, or pixel-wise uncertainty etc. Knowing if there are some pixels in an image, or an entire image, can be very helpful in ensuring high quality in downstream tasks.\n\nThis work uses the well known method of Laplacian approximation to estimate parameter uncertainty in the score network of an image diffusion model. For computational efficiency, and tractability in converting parameter uncertainty into sample uncertainty the authors use the well known approximation to only estimate the variance in the last linear layer of the neural network. Once the uncertainty update from a single application of the score network can be computed then the final uncertainty can be easily computed by deriving the update equation for different first-order and second order discrete time samplers.\n\n==== After rebuttal ======\nThanks for the updates. No changes to rating. Best wishes.", "questions": "1. Section 4.2 shows that pixel wise uncertainty can be used to correct bad portions / artefacts in the original images. Many questions come to mind about this experiment. Were the bounding boxes for the artefacts determined automatically based on pixel uncertainty ? Even if they were identified manually ? How  often are the refined samples sampled using rejection sampling on pixel uncertainty score better than the original ? In other words are the examples in figure 8 cherry picked or representative of the pixel-wise uncertainty rejection sampling method ? \n\n2. Figure 2 tries to demonstrate that despite skipping the \"pixel-variance sum\" statistic is able to separate out high uncertainty images from low uncertainty images. However at skipping=3 and skipping=4 the two clusters seem to be mixed quite a lot. Also it's not clear why the mean of the scores decreases for skipping=5 and skipping=6 when it was increasing monotonically from skipping=1 to 4.", "limitations": "", "rating": 6, "confidence": 4, "soundness": 3, "presentation": 2, "contribution": 2, "strengths": "The paper is reasonably novel and presents a methodology that practitioners may find useful. Specially the use of pixel-uncertainty in fixing the sample may be useful.", "weaknesses": "While the overall method is quite simple and the experiments show some potential for the method but the actual experiments are not clear/substantive enough. See questions section for more details.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "XwOiSxMHmQ", "reviewer": "Reviewer_CcvE", "summary": "This paper proposes to use a last-layer Laplace approximation in diffusion models and derives how to propagate variance iteratively through the diffusion dynamics to obtain per-pixel uncertainty estimates. The experiments leverage these for filtering out low-fidelity samples, rectifying visual artifacts and visualization.\n\nOverall the method seems sensible, although I am unfortunately not too familiar with diffusion models, so may not be the best person to judge this. The evaluation seems to largely rely on subjective, qualitative analysis, and where it is quantitative the differences are mostly small and error bars missing. So all in all I would slightly lean towards rejection, but I am not strongly opinionated either way due to a lack of confidence.\n\nEDIT: In light of the rebuttal, I now lean towards acceptance.", "questions": "* I would like to see error bars for (some of) the quantitative results.\n* Is there a strict need to use a Laplace approximation for inference? The likelihood is a Gaussian, so if you are only estimating uncertainty over the final layer weights, shouldn't the posterior be Gaussian as well? Or is this not the case due to the iterative sampling process?\n* Could the sampling variances be used to create a baseline with a deterministic diffusion model?\n\nMinor:\n* I think it would be helpful to complement Figure 2 with a plot of skipping intervals vs Spearman correlation with the no-skipping ranking.\n* For Figure 5, I would suggest using a different color palette (with different colors rather than differing shades) and distinct markers. It is unnecessarily difficult to match the lines and legends as is.", "limitations": "", "rating": 6, "confidence": 2, "soundness": 3, "presentation": 3, "contribution": 2, "strengths": "* Overall the methodology seems sensible, utilizing the fact that diffusion models are probabilisitic to perform inference is quite a natural approach.\n* The paper is well structured and clear on what prior work it builds on.", "weaknesses": "* I find it hard to tell whether the proposed method does anything meaningful. Most of the comparisons are rather qualitative, and where they are quantitative they are hard to interpret, e.g. it is quite difficult to decide what to make of Table 1. Many of the differences are quite small and without error bars it seems impossible to know whether those correspond to meaningful performance gains.\n* There are no baselines. I appreciate that there may not have been any prior work in this direction (although I would imagine that there would be some non-probabilistic filtering techniques. Perhaps from the literature on GANs?), however given that the iterative sampling process involves a Gaussian at every step, if I am understanding things correctly I would think that a deterministic diffusion model would also give us pixelwise variances that could be used as a baseline.\n* Alternatively, it might have been interesting to experiment with different covariance structures for the Laplace approximation to see if those make a difference.\n* I did not find the background section on diffusion models (2.1) particularly helpful as it relies on a lot of terminology on SDEs. The opening paragraph is good, perhaps something similar that briefly summarizes things from an algorithmic perspective (what kind of network are we typically training to predict what and w.r.t. what objective, what is being sampled, ...).", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "n4jKHwAhVr", "reviewer": "Reviewer_AU5E", "summary": "This paper proposes to leverage epistemic uncertainty in the (reverse) sampling process of diffusion models. This is done by applying the last-layer Laplace approximation to the image-to-image neural network that approximates the score function. Using some approximations, this uncertainty gives rise to uncertainty in the image sample at each time step of the backward diffusion process. Applications like filtering low-quality samples and sample diversity enhancement are discussed.", "questions": "The last-layer Laplace approximation can still be very expensive for networks with high output dimensionality, e.g. in text or image generation. For example, if the image is $d \\times d$, then the network has an output dim of $d^2$. Assuming the last-layer feature dim of $h$, this means the last-layer weight matrix is $d^2 \\times h$ and so the Hessian is $hd^2 \\times hd^2$. Then, to get the variance over outputs $\\gamma^2(x, t)$, you need to multiply the Hessian with the last-layer Jacobian, which itself is large---$d^2 \\times hd^2$. Can the authors elaborate on how BayesDiff overcomes this issue in practice?", "limitations": "", "rating": 8, "confidence": 3, "soundness": 3, "presentation": 2, "contribution": 3, "strengths": "I find the paper is well-written and easy to follow even for me, who is not very familiar with diffusion models. In any case, the proposed method is sound and most importantly, very practical---the authors noted that the overhead of their method is no more than 1x of the standard diffusion sampling. \n\nI especially find the applications presented to be very interesting, illuminating, and again: practical. I emphasize the practicality of this paper since Bayesian neural networks are often quite impractical for large-scale problems like diffusion models.", "weaknesses": "1. Some details that might be useful for potential readers are glossed over. E.g. how is $\\mathrm{diag}(\\gamma_\\theta^2(x_t, t))$ computed? What approximation of the Hessian is used? etc.\n2. Sec. 4.2 and 4.3 are a bit handwavy---it would be much better if the authors could make them more quantitative, like Sec. 4.1. Handpicked examples are not useful to instill confidence about the benefits of BayesDiff.\n3. Some figures are quite hard to follow:\n    1. Fig. 2 is quite hard to understand. The caption is not descriptive at all and the colors are hard to see in print.\n    2. Fig. 3 & 4: need more spacing between \"left\" and \"right\" groups. I was really confused at first trying to parse what is \"left\" and what is \"right\".\n    3. Fig. 5: The colors are horrible (esp. in print), they're indistinguishable. It's better to use different markers or different linestyle instead.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}]

Author rebuttal:

Decision: Accept (poster)