Diffusion Models are Certifiably Robust Classifiers

Authors: huanran  chen
yinpeng  dong
shitong  shao
zhongkai  hao
xiao  yang
hang  su
jun  zhu
Venue: NeurIPS_cc_2024_Conference
Published: 2024-04-26 10:28:47

Abstract: Generative learning, recognized for its effective modeling of data distributions, offers inherent advantages in handling out-of-distribution instances, especially for enhancing robustness to adversarial attacks. Among these, diffusion classifiers, utilizing powerful diffusion models, have demonstrated superior empirical robustness. However, a comprehensive theoretical understanding of their robustness is still lacking, raising concerns about their vulnerability to stronger future attacks. In this study, we prove that diffusion classifiers possess $O(1)$ Lipschitzness, and establish their certified robustness, demonstrating their inherent resilience. To achieve non-constant Lipschitzness, thereby obtaining much tighter certified robustness, we generalize diffusion classifiers to classify Gaussian-corrupted data. This involves deriving the evidence lower bounds (ELBOs) for these distributions, approximating the likelihood using the ELBO, and calculating classification probabilities via Bayes' theorem. Experimental results show the superior certified robustness of these Noised Diffusion Classifiers (NDCs). Notably, we achieve over 80\% and 70\% certified robustness on CIFAR-10 under adversarial perturbations with \(\ell_2\) norms less than 0.25 and 0.5, respectively, using a single off-the-shelf diffusion model without any additional data.

Main paper: 
 introduction: 
 Despite the unprecedented success of discriminative learning [32, 22] , they are vulnerable to adversarial examples, which are generated by imposing human-imperceptible perturbations on natural examples but can mislead target models into making erroneous predictions [44, 8] . To improve the robustness of discriminative learning, numerous defense techniques have been developed [29, 51, 35, 27, 34] . However, since discriminative models are directly trained for specific tasks, they often find shortcuts in the objective function, exhibiting non-robust nature [7, 36] . For example, adversarial training exhibits poor generalization against unseen threat models [45, 34] , and purification-based methods typically cannot completely remove adversarial perturbations, leaving subsequent discriminative classifiers still affected by these perturbations [1, 25, 3, 15] .On the contrary, generative learning is tasked with modeling the entire data distribution, which offers a degree of inherent robustness without any adversarial training [53, 9] . As the current stateof-the-art generative approach, diffusion models provide a more accurate estimation of the score function across the entire data space. Thus, they have been effectively utilized as generative classifiers for robust classification, known as diffusion classifiers [26, 3, 5] . Specifically, they calculate the classification probability p(y|x) ∝ p(x|y)p(y) through Bayes' theorem and approximate the log likelihood log p(x|y) via the evidence lower bound (ELBO). This method establishes a connection between robust classification and the fast-growing field of pre-trained generative models. Although promising, there is still a lack of rigorous theoretical analysis, raising questions about whether their robustness is overestimated and whether they will be vulnerable to (potentially) stronger future adaptive attacks. In this work, we use theoretical tools to derive the certified robustness of diffusion classifiers, fundamentally address these concerns, and gain a deeper understanding of their robustness.We begin by analyzing the smoothness of diffusion classifiers through the derivation of their Lipschitzness. We prove that diffusion classifiers possess an O(1) Lipschitz constant, demonstrating their inherent robustness. This allows us to certify the robust radius of diffusion classifiers by dividing the gap between predictions on the correct class and the incorrect class by their Lipschitz constant. Although we obtain a non-trivial certified radius, it could be much tighter if we could derive non-constant Lipschitzness (i.e., the Lipschitzness at each point). Randomized smoothing [6, 38] , a well-researched technique, allows us to obtain tighter Lipschitzness based on the output at each point. However, randomized smoothing requires the base classifier (e.g., diffusion classifiers) to process Gaussian-corrupted data x τ , where τ is the noise level. To address this, we generalize diffusion classifiers to calculate p(y|x τ ) by estimating log p(x τ |y) using its ELBO and then calculating p(y|x τ ) using Bayes' theorem. We named these generalized diffusion classifiers as Noised Diffusion Classifiers. Hence, the core problem becomes deriving the ELBO for noisy data.Naturally, we conceive to generalize the ELBO in Sohl-Dickstein et al. [41] and Kingma et al. [17] to τ ̸ = 0, naming the corresponding diffusion classifier the Exact Posterior Noised Diffusion Classifier (EPNDC). EPNDC achieves state-of-the-art certified robustness among methods that do not use extra data. Surprisingly, we discover that one can calculate the expectation or ensemble of this ELBO without any additional computational overhead. This finding allows us to design a new diffusion classifier that functions as an ensemble of EPNDC but does not require extra computational cost. We refer to this enhanced diffusion classifier as the Approximated Posterior Noised Diffusion Classifier (APNDC). Towards the end of this paper, we reduce the time complexity of diffusion classifiers by significantly decreasing variance through the use of the same noisy samples for all classes and by proposing a search algorithm to narrow down the candidate classes for the diffusion classifier.Experimental results substantiate the superior performance of our methods. Notably, we achieve 82.2%, 70.7%, and 54.5% at ℓ 2 radii of 0.25, 0.5, and 0.75, respectively, on the CIFAR-10 dataset. These results surpass the previous state-of-the-art [47] by absolute margins of 5.6%, 6.1%, and 4.1% in the corresponding categories. Additionally, our approach registers a clean accuracy of 91.2%, outperforming Xiao et al. [47] by 3.6%. Moreover, our time complexity reduction techniques decrease the computational burden by a factor of 10 on CIFAR-10 and by a factor of 1000 on ImageNet, without compromising certified robustness. Furthermore, our comparative analysis with heuristic methods not only highlights the tangible benefits of our theoretical advancements but also provides valuable insights into several evidence lower bounds and the inherent robustness of diffusion classifiers.The contributions of this paper are summarized as follows:• We derive the Lipschitz constant and certified lower bound for diffusion classifiers, demonstrating their inherent provable robustness. • We generalize diffusion classifiers to classify noisy data, enabling us to derive non-constant Lipschitzness and state-of-the-art certified robustness. • We propose a variance reduction technique that greatly reduces time complexity without compromising certified robustness.2 Background 
diffusion models: 
 For simplicity in derivation, we introduce a general formulation that covers various diffusion models. In Appendix A.8, we show that common models, such as Ho et al. [11] , Song et al. [42] , Kingma et al. [17] and Karras et al. [16] , can be transformed to align with our definition.Given x := x 0 ∈ [0, 1] D with a data distribution q(x 0 ), the forward diffusion process incrementally introduces Gaussian noise to the data distribution, resulting in a continuous sequence of distributions {q(x t ) := q t (x t )} T t=1 by: q(x t ) = q(x 0 )q(x t |x 0 )dx 0 ,Logit AveragingBayes' TheoremBayes' TheoremFigure 1 : Illustration of our theoretical contributions. We derive the Lipschitz constant and the corresponding certified radius for diffusion classifiers [3] . Additionally, we introduce two novel evidence lower bounds, which are used to approximate the log likelihood. These lower bounds are then employed to construct classifiers based on Bayes' theorem. By applying randomized smoothing to these classifiers, we derive their certified robust radii.where q(x t |x 0 ) = N (x t ; x 0 , σ 2 t I), i.e., x t = x 0 + σ t ϵ, ϵ ∼ N (0, I). Typically, σ t monotonically increases with t, establishing one-to-one mappings t(σ) from σ to t and σ(t) from t to σ. Additionally, σ T is large enough that q(x T ) is approximately an isotropic Gaussian distribution. Given p := p θ as the parameterized reverse distribution with prior p(x T ) = N (x T ; 0, σ 2 T I), the diffusion process used to synthesize real data is defined as a Markov chain with learned Gaussian distributions [11, 42] :EQUATIONIn this work, we parameterize the reverse Gaussian distribution p(x t-1 |x t ) using a neural network h θ (x t , t) asEQUATIONThe parameter θ is usually trained by optimizing the evidence lower bound (ELBO) on the log likelihood [41, 11, 17] :EQUATIONwherew t = σt+1-σ t σ 3 t+1is the weight of the loss at time step t and C 1 is a constant. Similarly, the conditional diffusion model p(x t-1 |x t , y) is parameterized by h θ (x t , σ t , y). A similar lower bound on conditional log likelihood isEQUATIONwhere C is another constant.Diffusion classifier [3, 5, 26 ] DC(•) : [0, 1] D → R K is a generative classifier that uses a single off-the-shelf diffusion model for robust classification. It first approximates the conditional likelihood log p(y|x 0 ) via conditional ELBO (i.e., using ELBO as logit), and then calculates the class probability p(y|x 0 ) ∝ p(x 0 |y) through Bayes' theorem, with the assumption that p(y) is a uniform prior:EQUATIONIn other words, it utilizes the ELBO of each conditional likelihood log p(y|x 0 ) as the logit of each class. This classifier achieves state-of-the-art empirical robustness across several types of threat models and can generalize to unseen attacks as it does not require training on adversarial examples [3] . However, there is still lacking a rigorous theoretical analysis, leaving questions about whether they will be vulnerable to (potentially) future stronger adaptive attacks.Randomized smoothing [23, 6, 48, 20] is a model-agnostic technique designed to establish a lower bound of robustness against adversarial examples. It is scalable to large networks and datasets and achieves state-of-the-art performance in certified robustness [48] . This approach constructs a smoothed classifier by averaging the output of a base classifier over Gaussian noise. Owing to the Lipschitz continuity of this classifier, it remains stable within a certain perturbation range, thereby ensuring certified robustness.Formally, given a classifier f : [0, 1] D → R K that takes a D-dimensional input x 0 and predicts class probabilities over K classes, the y-th output of the smoothed classifier g is:EQUATIONwhere ϵ ∼ N (0, I) is a Gaussian noise and σ τ is the noise level. Let Φ -1 denote the inverse function of the standard Gaussian CDF. Salman et al. [38] prove that Φ -1 (g(x 0 ) y ) is 1 στ -Lipschitz. However, the exact computation of g(x 0 ) is infeasible due to the challenge of calculating the expectation in a high-dimensional space. Practically, one usually estimates a lower bound p A of g(x 0 ) y and an upper bound p B of max ŷ̸ =y g(x 0 ) ŷ using the Clopper-Pearson lemma, and then calculates the lower bound of the certified robust radius R for class y asEQUATIONTypically, the existing classifiers are trained to classify images in clean distribution q(x 0 ). However, the input distribution in Eq. ( 7) is q(x τ ) = q(x 0 )q(x τ |x 0 )dx 0 . Due to the distribution discrepancy, g(x 0 ) constructed by classifiers trained on clean distribution q(x 0 ) exhibits low accuracy on q(x τ ).Due to this issue, we cannot directly incorporate the diffusion classifier [3] with randomized smoothing. In this paper, we propose a new category of diffusion classifiers, that can directly calculate p(y|x τ ) via an off-the-shelf diffusion model.To handle Gaussian-corrupted data, early work [6, 38] trains new classifiers on q(x τ ) but is not applicable to pre-trained models. Orthogonal to our work, there is also some recent work on using denoiser for certified robustness [39, 46] , and some of them choose diffusion model as denoiser [2, 47, 52] . They first denoise x τ ∼ q(x τ ), followed by an off-the-shelf discriminative classifier for classifying the denoised image. However, the efficacy of such an algorithm is largely constrained by the performance of the discriminative classifier. 
methodology: 
 In this section, we first derive an upper bound of the Lipschitz constant in Sec. We observe that the logits -1 DT T t=1 w t E ϵ ∥h θ (x t , σ t ) -x 0 ∥ 2 2 of diffusion classifier in Eq. ( 6) can be decomposed asEQUATIONAlgorithm 1 EPNDC (σ 2 t+1 -σ 2 t )xτ +(σ 2 t -σ 2 τ )x t+1 σ 2 t+1 -σ 2 τ 5:Calculate the analytical form of E p(x t |x t+1 ,y) [xt] by:(σ 2 t+1 -σ 2 t )h(x t+1 ,σ t+1 ,y)+σ 2 t x t+1 σ 2 t+1 6:end for 7:Calculate the lower bound log p(xτ |y) of log p(xτ |y) using w Given that E ϵ ∥h θ (x t , σ t )∥ 2 2 and E ϵ [h θ (x t , σ t )] are smoothed by Gaussian noise and lie within the range [0, 1] D , they satisfy the Lipschitz condition [38] . Consequently, the logits of diffusion classifiers should satisfy a Lipschitz condition. Thus, it can be inferred that the entire diffusion classifier is robust and possesses a certain robust radius.(τ ) t = σ 2 t+1 -σ 2 τ 2(σ 2 t -σ 2 τ )(σ 2 t+1 -σ 2 t ) by: T t=τ +1 w (τ ) t E q(x t+1 |xτ ) ∥E q(x t |x t+1 ,xτ ,y) [xt] -E p(x t |x t+1 ,We derive an upper bound for the Lipchitz constant of diffusion classifiers in the following theorem: Theorem 3.1. The upper bound of Lipschitz constant of diffusion classifier is given by:EQUATION)If one can get a lower bound p A for DC(x 0 ) y and a upper bound p B for max ŷ̸ =y DC(x 0 ) ŷ (e.g., probabilistic bound by Bernstein inequality [30] ), the lower bound of certified radius for diffusion classifier can be obtained:EQUATION)Proof. (Sketch; details in Appendix A.2). Employing a similar methodology to that used by Salman et al. [38] , we derive the gradient of the diffusion classifier. Since the gradient norm of a neural network is unbounded, we transfer the target of the gradient operator from the neural network to the Gaussian density function, so that we can bound the gradient norm and the Lipschitz constant.As demonstrated in Theorem 3.1, the Lipschitz constant of diffusion classifiers is nearly identical to that in the "weak law" of randomized smoothing (See Appendix A.3, or Lemma 1 in Salman et al. [38] ). This constant is small and independent of the dimension D, indicating the inherent robustness of diffusion classifiers. However, similar to the weak law of randomized smoothing, such certified robustness has limitations because it assumes the maximum Lipschitz condition is satisfied throughout the entire perturbation path, i.e., it assumes the equality always holds in |f (x adv ) y -f (x) y | ≤ L∥x -x adv ∥ 2 when f has Lipschitz constant L. As a result, the equality also holds in f(x adv ) y ≥ f (x) y -L∥x -x adv ∥ 2 and f (x adv ) ŷ ≤ f (x) ŷ + L∥x -x adv ∥ 2 for max ŷ̸ =y f (x) ŷ .To guarantee the prediction is unchanged (i.e., f (x adv ) y ≥ f (x adv ) ŷ ), its requires the perturbation ∥x -x adv ∥ 2 must be less than 1 2L . To be specific, under the weak law of randomized smoothing, it is impossible to achieve a certified radius greater than 1.253. According to Eq. ( 11), a certified radius greater than 0.39 is unattainable, and empirically, the average certified radius achieved is only 0.156 (refer to Appendix C.3). This is significantly lower than the empirical robustness upper bound obtained through adaptive attacks as reported in Chen et al. [3] .On the other hand, the "strong law" of randomized smoothing (See Eq. ( 8) or Lemma 2 in Salman et al. [38] ) can yield a non-constant Lipschitzness, leading to a more precise robust radius, with the upper bound of the certified radius potentially being infinite. Therefore, in the subsequent sections, we aim to combine diffusion classifier with randomized smoothing to achieve a tighter certified radius, thus thoroughly explore its robustness. As explained in Sec. 2.3, randomized smoothing constructs a smoothed classifier g from a given base classifier f by aggregating votes over Gaussian-corrupted data. This process necessitates that the base classifier can classify data from the noisy distribution q(x τ ). However, the diffusion classifier in Chen et al. [3] is limited to classifying data solely from q(x 0 ). Therefore, in this section, we generalize the diffusion classifier to enable the classification of images from q(x τ ) for any given τ . Similar to Chen et al. [3] , our fundamental idea involves deriving the ELBO for log p(x τ |y) and subsequently calculating p(y|x τ ) using the estimated log p(x τ |y) via Bayes' theorem. Drawing inspiration from Ho et al. [11] , we derive a similar ELBO for log p(x τ ), as elaborated in the following theorem (the conditional ELBO is similar to unconditional one, see Appendix A.4 for details): Theorem 3.2. (Proof in Appendices A.4 and A.5). The ELBO of log p(x τ ) is given by:EQUATIONwhereEQUATION)Remark 3.3. Notice that the summation of KL divergence in the ELBO of log p(x τ ) starts from τ + 1 and ends at T , while that of log p(x 0 ) starts from 1. Besides, the posterior is q(x t |x t+1 , x τ ) instead of q(x t |x t+1 , x 0 ). Remark 3.4. When τ = 0, this result degrades to the diffusion training loss σt+1-σt σ 3 t+1 ∥x 0h(x t+1 , σ t+1 )∥ 2 , consistent with Kingma et al. [17] and Karras et al. [16] . Due to the page width limit, we only present the unconditional ELBO in the main text. We can get the conditional ELBO by adding y to the condition. Using the conditional ELBOs as approximation for log likelihood (i.e., using ELBOs as logits), one can calculate p(y|x τ ) = e log p θ (xτ |y) ŷ e log p θ (xτ | ŷ) for classification. We name this algorithm as Exact Posterior Noised Diffusion Classifier (EPNDC), as demonstrated in Algorithm 1.Although this classifier achieves non-trivial certified robustness, it still has limitations. For instance, we cannot theoretically determine the optimal weight w (τ ) t (see Appendix C.2 for details). Additionally, the time complexity is high. In the next section, we propose a new diffusion classifier called the Approximated Posterior Noised Diffusion Classifier (APNDC), which addresses these problems and acts like an ensemble of EPNDC so that greatly enhanced certified robustness without any computational overhead.Greatly inspired by Song et al. [42] and Meng et al. [31] , we propose to approximate the posterior in a similar manner: ✗ ✗ (75.0) 61.0 (75.0) 43.0 (65.0) 32.0 (65.0) 23.0 SmoothAdv [38] ✗ ✗ (82.0) 68.0 (76.0) 54.0 (68.0) 41.0 (64.0) 32.0 Consistency [13] ✗ ✗ (77.8) 68.8 (75.8) 58.1 (72.9) 48.5 (52.3) 37.8 MACER [50] ✗ ✗ (81.0) 71.0 (81.0) 59.0 (66.0) 46.0 (66.0) 38.0 Boosting [12] ✗ ✗ (83.4) 70.6 (76.8) 60.4 (71.6) 52.4 (73.0) 38.8 SmoothMix [14] ✓ ✗ (77.1) 67.9 (77.1) 57.9 (74.2) 47.7 (61.8) 37.2 Denoised [39] ✓ ✗ (72.0) 56.0 (62.0) 41.0 (62.0) 28.0 (44.0) 19.0 Lee [24] ✓ ✗ (-) 60.0 (-) 42.0 (-) 28.0 As a result, the KL divergence can be simplified using this approximation:EQUATIONEQUATIONIntriguingly, Eq. ( 15) is the ELBO of E q(xτ |x0=h θ (xτ ,στ )) [log p τ (x τ )], i.e.,EQUATIONTherefore, one can use the ELBO in Eq. ( 16) as a approximation for log p(x τ ) (i.e., employing the EL-BOs of this expected log likelihood as the logits), and calculate the class probabilities through Bayes' theorem. We name this method as Approximated Posterior Noised Diffusion Classifier (APNDC), as shown in Algorithm 2.APNDC is functionally equivalent to an ensemble of EPNDC, as it calculates the ELBO ofE q(xτ |x0=h θ (xτ ,στ )) [log p τ (x τ )],which corresponds to the expected log p(x τ |y). This nearly-free ensemble can be executed with only one more forward pass of UNet to compute h θ (x τ , τ ). For detailed explanations, please refer to Appendix A.7. Remark 3.5. From a heuristic standpoint, one might consider first employing a diffusion model for denoising (named DiffPure by Nie et al. [34] ), followed by using a diffusion classifier for classification. This approach differs from our method, where we calculate the diffusion loss only from τ + 1 to T , and the noisy samples x t are obtained by adding noise to x τ instead of x 0 . In Table 1 , we demonstrate that our APNDC method significantly outperforms this heuristic approach (DiffPure+DC).Variance reduction. The main computational effort in our approach is dedicated to calculating the evidence lower bound for each class. This involves computing the sum of reconstruction losses. For instance, in DC, the reconstruction loss is∥x 0 -h θ (x t , σ t+1 )∥ 2 2 . In EPNDC, it is ∥E q(xt|xt+1,xτ ) [x t ] -E p(xt|xt+1) [x t ]∥ 2 2, and in APNDC, the loss is ∥h θ (x τ , σ τ ) -h θ (x t+1 , σ t+1 )∥ 2 2 , with the summation carried out over t. Chen et al. [3] attempt to reduce the time complexity by only calculating the reconstruction loss at certain timesteps. However, this approach proves ineffective. We identify that the primary reason for this failure is the large variance in the reconstruction Table 2 : Certified accuracy at ImageNet-64x64. The clean accuracy is in the parentheses.Off-the-shelf Extra data Certified Accuracy at R (%) 0.25 0.5 0.75 1.0 RS [6] ✗ ✗ (45.5) 37.3 (45.5) 26.6 (37.0) 20.9 (37.0) 15.1 SmoothAdv [38] ✗ ✗ (44.4) 37.4 (44.4) 27.9 (34.7) 21.1 (34.7) 17.0 Consistency [13] ✗ ✗ (43.6) 36.9 (43.6) 31.5 (43.6) 26.0 (31.4) 16.6 MACER [50] ✗ ✗ (46.3) 35.7 (46.3) 27.1 (46.3) 15.6 (38.7) 11.3 Carlini [2] ✓ ✗ (41.1) 37.5 (39.4) 30.7 (39.4) 24.6 (39.4) 21.7 DensePure [47] ✓ ✗ (37.7) 35.4 (37.7) 29.3 (37.7) 26.0 (37.7) 18.6 APNDC (Sift-and-Refine, ours) ✓ ✗ (54.4) 46.3 (54.4) 38.3 (43.5) 35.2 (43.5) 32.8loss, necessitating sufficient calculations for convergence. To address this, we propose an effective variance reduction technique that uses identical input samples across all categories at each timestep.In other words, we use the same x t for different classes. This approach significantly reduces the difference in prediction difficulty among various classes, allowing for a more equitable calculation of the reconstruction loss for each class. As shown in Figure 2 (a), we can utilize a much smaller number of timesteps, such as 8, without sacrificing accuracy, thereby substantially reducing time complexity.Sift-and-refine algorithm. The time complexity of these diffusion classifiers is proportional to the number of classes, presenting a significant obstacle for their application in datasets with numerous classes. Chen et al. [3] suggest the use of multi-head diffusion to address this issue. However, this approach requires training an additional diffusion model, leading to extra computational overhead.In our work, we focus solely on employing a single off-the-shelf diffusion model to construct a certifiably robust classifier. To tackle the aforementioned challenge, we propose a Sift-and-refine algorithm. The core idea is to swiftly reduce the number of classes, thereby limiting our focus to a manageable subset of classes. We provide more detailed analysis in Algorithm 5. 
experiment: 
 Following previous studies [2, 47, 52] , we evaluate the certified robustness of our method on two standard datasets, CIFAR-10 [19] and ImageNet [37] , selecting a subset of 512 images from each. We adhere to the certified robustness pipeline established by Cohen et al. [6] , although our method potentially offers a tighter certified bound, as demonstrated in Appendix A.3. To make a fair comparison with previous studies, we also select σ τ ∈ {0.25, 0.5, 1.0} for certification (thus τ is determined) and use EDM [16] as our diffusion models. For a re-clarification on the hyper-parameters and additional experiments (including ablation studies on diffusion checkpoints and time complexity comparison), please refer to Appendix B.Experimental settings. Due to computational constraints, we employ a sample size of N = 10, 000 to estimate p A . The number of function evaluations (NFEs) for each image in our method is O(N • T ′ • K), amounting to 10 8 for T ′ = 100 and 10 9 for T ′ = 1000 since K = 10 in this dataset.In contrast, the NFEs for the previous state-of-the-art method [47] are 4 • 10 8 , which is four times higher than our method when T ′ is 100. It is important to highlight that our sample size N is 10 times smaller than those baselines in (Table 1 ), potentially placing our method at a significant disadvantage, especially for large σ τ .Experimental results. As shown in Table 1 , our method, utilizing an off-the-shelf model without the need for extra data, significantly outperforms all previous methods at smaller values of ϵ = {0.25, 0.5}. Notably, it surpasses all previous methods on clean accuracy, and exceeds the previous state-of-the-art method [47] by 5.6% at ϵ = 0.25 and 6.1% at ϵ = 0.5. Even with larger values of ϵ, our method attains performance levels comparable to existing approaches. This is particularly noteworthy considering our constrained setting of N = 10, 000, substantially smaller than the N = 100, 000 used in prior works. Considering that the community of randomized smoothing employs hypothesis tests to establish a probabilistic upper bound of the smoothed function, with consistent type-one error rates, our method encounters significant disadvantages. This is particularly the case since, with equivalent accuracy on noisy data, certified robustness is a monotonically increasing function with respect to sample size N . However, we still achieve competitive performance despite its inherent sample size disadvantage.EQUATIONExperimental settings. We conduct experiments on ImageNet64x64 due to the absence of conditional diffusion models for 256x256 resolution. Due to computational constraints, we employ a sample size of N = 1000, 10 times smaller than all other works in Table 2 . We use the Sift-and-Refine algorithm to improve the efficiency.Experimental results. As demonstrated in Table 2 and Figure Comparison with heuristic methods. From a heuristic standpoint, one might consider initially using a diffusion model for denoising, followed by a diffusion classifier for classification. As shown in Table 1 , this heuristic approach outperforms nearly all prior off-the-shelf and no-extra-data baselines. However, the methods derived through our theoretical analysis significantly surpass this heuristic strategy. This outcome underscores the practical impact of our theoretical contributions.Trivial performance of EPNDC. Although EPNDC exhibits non-trivial improvements compared to previous methods, it still lags significantly behind APNDC. There are two main reasons for this gap. First, as extensively discussed in Appendix C.2, the weight in EPNDC is not optimal, and we cannot theoretically determine the optimal weight. Additionally, APNDC is equivalent to an ensemble of EPNDC, which may contribute to its superior performance compared to EPNDC.Explanation of Eq. (11) . Eq. ( 11) is extremely similar to the weak law of randomized smoothing. When σ t is larger, it could potentially have a larger certified radius, but the input images will be more noisy and hard to classify. This trade-off is quite similar to the role of σ τ in randomized smoothing. However, there are two key differences. First, the inputs to the network contain different levels of noisy images, which means the network could see clean images, less noisy images, and very noisy images, hence could make more accurate predictions. Besides, the trade-off parameter is wt σt , allowing users some freedom to select different noise levels and balance them by w t . We observe that this is the common feature of such denoising and reconstructing classifiers. We anticipate this observation will aid the community in developing more robust and certifiable defenses. 
conclusion: 
 In this work, we conduct a comprehensive analysis of the robustness of diffusion classifiers. We establish their non-trivial Lipschitzness, a key factor underlying their remarkable empirical robustness. Furthermore, we extend the capabilities of diffusion classifiers to classify noisy data at any noise level by deriving the evidence lower bounds for noisy data distributions. This advancement enable us to combine the diffusion classifiers with randomized smoothing, leading to a tighter certified radius. Experimental results demonstrate substantial improvements in certified robustness and time complexity. We hope that our findings contribute to a deeper understanding of diffusion classifiers in the context of adversarial robustness and help alleviate concerns regarding their robustness.|| ∂ ∂x softmax(x/β) y || 2 ≤ 1 2 √ 2β . Proof. max || ∂ ∂x softmax(x/β) y || 2 = max ||(e y -softmax(x/β)) softmax(x/β) y β || 2 = max 1 β • softmax(x/β) 2 y [(1 -softmax(x/β) y ) 2 + i̸ =y softmax(x/β) 2 i ] ≤ max √ 2 β • softmax(x/β) 2 y (1 -softmax(x/β) y ) 2 ≤ 1 2 √ 2β . 
experiment statistical significance: 
 Question: Does the paper report error bars suitably and correctly defined or other appropriate information about the statistical significance of the experiments? Answer: [Yes] Justification: Following previous work in the community of certified robustness, we use the same type I error, 0.001. Guidelines:• The answer NA means that the paper does not include experiments.• The authors should answer "Yes" if the results are accompanied by error bars, confidence intervals, or statistical significance tests, at least for the experiments that support the main claims of the paper. • The factors of variability that the error bars are capturing should be clearly stated (for example, train/test split, initialization, random drawing of some parameter, or overall run with given experimental conditions). • The method for calculating the error bars should be explained (closed form formula, call to a library function, bootstrap, etc.) • The assumptions made should be given (e.g., Normally distributed errors).• It should be clear whether the error bar is the standard deviation or the standard error of the mean. • It is OK to report 1-sigma error bars, but one should state it. The authors should preferably report a 2-sigma error bar than state that they have a 96% CI, if the hypothesis of Normality of errors is not verified. • For asymmetric distributions, the authors should be careful not to show in tables or figures symmetric error bars that would yield results that are out of range (e.g. negative error rates). • If error bars are reported in tables or plots, The authors should explain in the text how they were calculated and reference the corresponding figures or tables in the text. 
experiments compute resources: 
 Question: For each experiment, does the paper provide sufficient information on the computer resources (type of compute workers, memory, time of execution) needed to reproduce the experiments?Answer: [Yes] Justification: These are extensive discussed in Appendix B.4.Guidelines:• The answer NA means that the paper does not include experiments.• The paper should indicate the type of compute workers CPU or GPU, internal cluster, or cloud provider, including relevant memory and storage. • The paper should provide the amount of compute required for each of the individual experimental runs as well as estimate the total compute. • The paper should disclose whether the full research project required more compute than the experiments reported in the paper (e.g., preliminary or failed experiments that didn't make it into the paper). 
code of ethics: 
 Question: Does the research conducted in the paper conform, in every respect, with the NeurIPS Code of Ethics https://neurips.cc/public/EthicsGuidelines? 
broader impacts: 
 Question: Does the paper discuss both potential positive societal impacts and negative societal impacts of the work performed?Answer: [Yes] Justification: See page 30.Guidelines:• The answer NA means that there is no societal impact of the work performed.• If the authors answer NA or No, they should explain why their work has no societal impact or why the paper does not address societal impact. • Examples of negative societal impacts include potential malicious or unintended uses (e.g., disinformation, generating fake profiles, surveillance), fairness considerations (e.g., deployment of technologies that could make decisions that unfairly impact specific groups), privacy considerations, and security considerations.• The conference expects that many papers will be foundational research and not tied to particular applications, let alone deployments. However, if there is a direct path to any negative applications, the authors should point it out. For example, it is legitimate to point out that an improvement in the quality of generative models could be used to generate deepfakes for disinformation. On the other hand, it is not needed to point out that a generic algorithm for optimizing neural networks could enable people to train models that generate Deepfakes faster. • The authors should consider possible harms that could arise when the technology is being used as intended and functioning correctly, harms that could arise when the technology is being used as intended but gives incorrect results, and harms following from (intentional or unintentional) misuse of the technology. • If there are negative societal impacts, the authors could also discuss possible mitigation strategies (e.g., gated release of models, providing defenses in addition to attacks, mechanisms for monitoring misuse, mechanisms to monitor how a system learns from feedback over time, improving the efficiency and accessibility of ML). 
safeguards: 
 Question: Does the paper describe safeguards that have been put in place for responsible release of data or models that have a high risk for misuse (e.g., pretrained language models, image generators, or scraped datasets)?Answer: [NA]Justification: We just do classification task.Guidelines:• The answer NA means that the paper poses no such risks.• Released models that have a high risk for misuse or dual-use should be released with necessary safeguards to allow for controlled use of the model, for example by requiring that users adhere to usage guidelines or restrictions to access the model or implementing safety filters. • Datasets that have been scraped from the Internet could pose safety risks. The authors should describe how they avoided releasing unsafe images. • We recognize that providing effective safeguards is challenging, and many papers do not require this, but we encourage authors to take this into account and make a best faith effort.12. Licenses for existing assets Question: Are the creators or original owners of assets (e.g., code, data, models), used in the paper, properly credited and are the license and terms of use explicitly mentioned and properly respected?Answer: [Yes] Justification: We cite the CIFAR-10 and ImageNet.Guidelines:• The answer NA means that the paper does not use existing assets.• The authors should cite the original paper that produced the code package or dataset.• The authors should state which version of the asset is used and, if possible, include a URL. • The name of the license (e.g., CC-BY 4.0) should be included for each asset.• For scraped data from a particular source (e.g., website), the copyright and terms of service of that source should be provided. • If assets are released, the license, copyright information, and terms of use in the package should be provided. For popular datasets, paperswithcode.com/datasets has curated licenses for some datasets. Their licensing guide can help determine the license of a dataset. • For existing datasets that are re-packaged, both the original license and the license of the derived asset (if it has changed) should be provided. 
 
 Appendix: Lemma A.3. (Adapted from Chen et al. [3] .) The gradient of the diffusion classifier is given byd dx E ϵ [∥h θ (x t , σ t , y) -x∥ 2 2 ] = E ϵ [ ∂ log p(x t |x) ∂x ∥h θ (x t , σ t , y) -x∥ 2 2 ] + E ϵ [(h θ (x t , σ t , y) -x) 2 σ t ],where∂ log p(x t |x) ∂x = ∂ ∂x log exp (- ∥x t -x∥ 2 2 2σ 2 t ) = - x -x t σ 2 t = σ t ϵ σ 2 t = ϵ σ t .Lemma A.3 already derive the gradient of the diffusion classifier, and transfer the target of nabla operator to distribution function. Hence, we only need to bound the ℓ 2 norm of both term in Lemma A.3.For the first term:∥E ϵ [ ∂ log p(x t |x) ∂x ∥h θ (x t , σ t , y) -x∥ 2 2 ]∥ 2 =∥ p(ϵ)[ ϵ σ t ∥h θ (x t , σ t , y) -x∥ 2 2 ]dϵ∥ 2 ≤ 1 σ t max ∥u∥2=1 u ⊤ p(ϵ)ϵ∥h θ (x t , σ t , y) -x∥ 2 2 dϵ = D σ t max ∥u∥2=1 u ⊤ p(ϵ)ϵ ∥h θ (x t , σ t , y) -x∥ 2 2The term in Salman et al. [38] ≤ D σ t 2 π .The last inequality holds since∥h θ (xt,σt,y)-x∥ 2 2 Dis a function in [0, 1] D , thus it satisfies the condition of Lemma 1 in Salman et al. [38] . For the second term, since x ∈ [0, 1] D and h θ (x t , σ t , y)∈ [0, 1] D , hence h θ (x t , σ t , y) -x ∈ [0, 1] D , consequently, ∥E ϵ [(h θ (x t , σ t , y) -x) 2 σ t ]∥ 2 = ∥E ϵ [(h θ (x t , σ t , y) -x)]∥ 2 2 σ t ≤ √ D • 2 σ t .Therefore,EQUATIONBoth Chen et al. [3] , Li et al. [26] , Clark and Jaini [5] formulate the logit of the diffusion classifier asT t=1 E ϵ [∥h θ (x t , σ t , y) -x∥ 2 2 ]. However, in practice, both Chen et al. [3] and Li et al. [26] use MSE loss rather than L2 loss in the diffusion classifier. In other words, they multiply the logit by 1 DT . Therefore, in this paper, we directly formulate the diffusion classifier using the MSE loss, as demonstrated in Eq. ( 6). Consequently, the maximum gradient norm of the logits in the diffusion classifier is:EQUATION)Remark A.4. There may be concerns regarding how the selection of temperature (whether multiplying logits by 1 DT ) can significantly influence certified robustness. However, this is not the case. The temperature simultaneously affects both the scale of output from the diffusion classifier and the Lipschitz scale, with these scales changing proportionately. This is analogous to multiplying a function by a constant k: the Lipschitz constant will increase by a factor of k, but the gap between the outputs will also increase by the same factor, thus leaving the certified robustness unchanged.Eq. ( 18) provides the maximum gradient norm (Lipschitz constant) in the logit space. One can already use Eq. ( 18) to perform certified robustness in the logit space, which is precisely what we did in our experiments. However, since our diffusion classifier is defined by the class probabilities rather than the logits, to ensure consistency with our main text, we will derive the Lipschitz constant of the diffusion classifier in the class probabilities space in the following.Let's define one-hot vector e i in R n to be the vector where the i-th element is 1 and all other elements are 0. Hinton et al. [10] proves that ∂ ∂x log softmax(x/β) y = 1 β (e y -softmax(x/β)), where β is the softmax temperature. Consequently,∂ ∂x softmax(x/β) y = ∂ ∂x log softmax(x/β) y softmax(x/β) y = (e y -softmax(x/β)) softmax(x/β) y β .We can derive the maximum ℓ 2 norm of the gradient as∥ ∂ ∂x 0 p(y|x 0 )∥ 2 =∥ ∂ ∂x 0 softmax(f (x)) y ∥ 2 =∥ K y=1 ∂softmax(f (x)) y ∂(-1 DT T t=1 E ϵ [w t ∥h θ (x t , t, y) -x 0 ∥ 2 2 ]) ∂(-1 DT T t=1 E ϵ w t ∥h θ (x t , t, y) -x 0 ∥ 2 2 ) ∂x 0 ∥ 2 ≤ K y=1 ∥ ∂softmax(f (x)) y ∂(-1 DT T t=1 E ϵ [w t ∥h θ (x t , t, y) -x 0 ∥ 2 2 ]) ∥ 2 ∥ ∂(-1 DT T t=1 E ϵ w t ∥h θ (x t , t, y) -x 0 ∥ 2 2 ) ∂x 0 ∥ 2 ≤ 1 2 √ 2 T i=1 w i σ i T ( 2 π + 2 √ D ).The last step is get by using Lemma A.2 for the first term and Eq. ( 18) for the second term. Denote u as a unit vector, the Lipschitz constant of the diffusion classifier p(y|x) isEQUATIONIt is important to note that this represents the upper bound of the Lipschitz constant for the diffusion classifier. In practical scenarios, the actual Lipschitz constant is much smaller, due to the conservative nature of the inequalities used in the derivation. To gain an intuitive understanding of the practical Lipschitz constant for diffusion classifiers, we measure the gradient norm of the classifier on clean and noisy data. Furthermore, employing the algorithm from Chen et al. [4] , we empirically determine the maximum gradient norm. Our results on the CIFAR-10 test set indicate that the gradient norm is less than 0.02, suggesting that the Lipschitz constant for our diffusion classifier is smaller than 0.02 on this dataset.In this section, we will show that if f has a smaller Lipschitz constant, it will induce a more smoothed function g, thus has a higher certified robustness. Here we discuss a simple case: the weak law of randomized smoothing proposed in Salman et al. [38] with σ = 1. We complement the derivation of this law with much more details, and we hope our detailed explanation could assist newcomers in the field in quickly grasping the key concepts in randomized smoothing.To derive the Lipschitz constant of the smoothed function g, we only need to derive the maximum dot product between the gradient of g and a unit vector u for the worst f .max f u ⊤ ∇ x g(x) = max f u ⊤ ∇ x E ϵ [f (x + ϵ)] = max f u ⊤ ∇ x p(ϵ)f (x + ϵ)dϵ = max f u ⊤ ∇ x 1 (2π) n/2 exp (- ∥ϵ∥ 2 2 2 )f (x + ϵ)dϵ = max f u ⊤ ∇ x 1 (2π) n/2 exp (- ∥t -x∥ 2 2 2 )f (t)dt = max f u ⊤ 1 (2π) n/2 exp (- ∥t -x∥ 2 2 2 )(t -x)f (t)dt = max f u ⊤ 1 (2π) n/2 exp (- ∥t -x∥ 2 2 2 )(t -x)f (t -x)dt = max f 1 (2π) n/2 exp (- ∥t -x∥ 2 2 2 )[u ⊤ (t -x)]f (t -x)dtIn the next step, we transition to another orthogonal coordinate system, denoted as u, u 2 ,• • • , u D .This change is made with the assurance that the determinant of the Jacobian matrix, representing the transformation from the old coordinates to the new ones, equals 1. We then decompose the vector tx in the new coordinate system as follows:t -x = a 1 u + a 2 u 2 + a 3 u 3 + • • • + a D u D .Therefore,EQUATION2 )sds.We could get easily the result by change of variable:EQUATION))| +∞ 0 = 1 √ 2π .The classifier will robustly classify the input data as long as the probability of classify the noisy data as the correct class is greater than the probability of classifying the noisy data as the wrong class. If one estimate a lower bound p A of the accuracy of the correct class over noisy sample and a upper bound p B of the probability of classify the noisy input as wrong class using the Clopper-Pearson interval, we could get the robust radius byR = π 2 (p A -p B ),which will ensure that for any ∥δ∥ 2 ≤ R and any wrong class ŷ ̸ = y:g(x + δ) y = P (f (x + δ + ϵ) = y) > g(x + δ) ŷ = P (f (x + δ + ϵ) = ŷ).Hence, g(x) will robustly classify the input data.When f satisfies the Lipschitz condition with Lipschitz constant L, since it is impossible to be one when x > 0 and zero when x ≤ 0, the inequality here can be tighter, so we can get a smaller Lipschitz constant. In fact, in this case, the maximum Lipschitz constant of g is:max f 1 √ 2π +∞ -∞ exp(-s 2 /2)sf (s)ds s.t., 0 ≤ f (s) ≤ 1, f (s) is L-lipschitzHowever, obtaining an analytical solution for the certified radius when f adheres to Lipschitz continuity appears infeasible. To understand why, consider the following: firstly, f should approach zero as x tends toward negative infinity and one as x tends toward positive infinity. Secondly, f must be an increasing function, with only one interval of increase. Additionally, within this interval, f is either zero or one outside the bounds of increase, and it must take a linear form within, with a slope of 1 L . We define the left endpoint of this increasing interval as a, which necessarily lies in the range [-1 L , 0]. Also notice that both a = -1 L and a = 0 yield the same certified radius. However, when a ∈ (-1 L , 0), the certified radius must be smaller. To see why, let's considerf a (s) =            0, s ≤ a L(s -a), a ≤ s ≤ a + 1 L 1, s ≥ a + 1 L , with special case f 0 (s) =            0, s ≤ 0 Ls, 0 ≤ s ≤ 1 L 1, s ≥ 1 L . Denote fa (x) = 1 √ 2π exp(-x 2 /2)xf a (x). The difference of Lipschitz constant between two ran- domized function is +∞ -∞ [ f0 (s) -fa (s)]ds = 0 a [ f0 (s) -fa (s)] + -a 0 [ f0 (s) -fa (s)] + 1/L -a [ f0 (s) -fa (s)] = -a 0 [-aL -fa (s)] + 1/L -a [ f0 (s) -fa (s)] ≤ 0Consequently, the corner case for a must lie within the open interval (-1/L, 0). However, the corresponding integral lacks an analytical solution, and taking the derivative of it results in a function whose zero points are indeterminable. Therefore, obtaining an analytical solution for the improvement in certified robustness when a function exhibits Lipschitz continuity is challenging. Nevertheless, we can approximate the result with numerical algorithms, and it is evident that this Lipschitzness leads to a non-trivial enhancement in certified robustness of randomized smoothing.Similar to Ho et al. [11] , we derive the ELBO aslog p(x τ ) = log p(x τ :T )q(x τ +1:T |x τ ) q(x τ +1:T |x τ ) dx τ +1:T = log E q(x τ +1:T |xτ ) [ p(x τ :T ) q(x τ +1:T |x τ ) ] = log E q(x τ +1:T |xτ ) [ p(x T )p(x τ :T -1 |x T ) q(x τ +1:T |x τ ) ] ≥ E q(x τ +1:T |xτ ) [log p(x T )p(x τ :T -1 |x T ) q(x τ +1:T |x τ ) ] = E q(x τ +1:T |xτ ) [log p(x T ) T -1 t=τ p(x t |x t+1 ) T -1 t=τ q(x t+1 |x t , x τ ) ] = E q(x τ +1:T |xτ ) [log p(x T ) T -1 t=τ p(x t |x t+1 ) T -1 t=τ q(xt+1|xτ )q(xt|xt+1,xτ ) q(xt|xτ ) ] = E q(x τ +1:T |xτ ) [log p(x T ) T -1 t=τ p(x t |x t+1 ) T -1 t=τ q(x t |x t+1 , x τ ) -log T -1 t=τ q(x t+1 |x τ ) q(x t |x τ ) ] = E q(x τ +1:T |xτ ) [log p(x T ) T -1 t=τ p(x t |x t+1 ) T -1 t=τ q(x t |x t+1 , x τ ) -log q(x T |x τ ) q(x τ |x τ ) ] = E q(x τ +1:T |xτ ) [log T -1 t=τ p(x t |x t+1 ) T -1 t=τ q(x t |x t+1 , x τ ) -log q(x T |x τ ) p(x T ) ] = E q(x τ +1:T |xτ ) [log T -1 t=τ p(x t |x t+1 ) T -1 t=τ q(x t |x t+1 , x τ ) ] -E q(x T |xτ ) [D KL (q(x T |x τ )||p(x T ))] = T -1 t=τ E q(xt,xt+1|xτ ) [log p(x t |x t+1 ) q(x t |x t+1 , x τ ) ] -E q(x T |xτ ) [D KL (q(x T |x τ )||p(x T ))] = T -1 t=τ E q(xt+1|xτ ),q(xt|xt+1,xτ ) [log p(x t |x t+1 ) q(x t |x t+1 , x τ ) ] -E q(x T |xτ ) [D KL (q(x T |x τ )||p(x T ))] = log p(x τ |x τ +1 ) - T -1 t=τ +1 E q(xt+1|xτ ) [D KL (q(x t |x t+1 , x τ )||p(x t |x t+1 ))] -E q(x T |xτ ) [D KL (q(x T |x τ )||p(x T ))] = - T -1 t=τ +1 E q(xt+1|xτ ) [D KL (q(x t |x t+1 , x τ )||p(x t |x t+1 ))] + CThis could be understood as a generalization of the ELBO in Ho et al. [11] , which is a special case when τ = 0. Notice that the summation of KL divergence in ELBO of log p(x τ ) start from τ + 1 and end at T , while that of log p(x 0 ) start from 1. Besides, the posterior is q(x t |x t+1 , x τ ) instead of q(x t |x t+1 , x 0 ).Similarly, the conditional ELBO is give by: log p(x τ |y) ≥ log p(x τ |x τ +1 , y)-E q(x T |xτ ) [D KL (q(x T |x τ )||p(x T ))] - T -1 t=τ +1 E q(xt+1|xτ ) [D KL (q(x t |x t+1 , x τ , y)||p(x t |x t+1 , y))] = - T -1 t=τ +1 E q(xt+1|xτ ) [D KL (q(x t |x t+1 , x τ , y)||p(x t |x t+1 , y))] + C 5 .This is equivalent to adding the condition y to all posterior distributions in the unconditional ELBO.The KL divergence in Theorem 3.2 is the expectation of the log ratio between posterior and predicted reverse distribution, which requires integrating over the entire space. To compute this KL divergence more efficiently, we derives its analytical form:q(x t |x t+1 , x τ ) = q(x t |x τ )q(x t+1 |x t ) q(x t+1 |x τ ) = N (x t |x τ , (σ 2 t -σ 2 τ )I)N (x t+1 |x t , (σ 2 t+1 -σ 2 t )I) N (x t+1 |x τ , (σ 2 t+1 -σ 2 τ )I) = 1 (2π(σ 2 t -σ 2 τ )) n/2 exp( ∥xt-xτ ∥ 2 -2(σ 2 t -σ 2 τ ) ) 1 (2π(σ 2 t+1 -σ 2 t )) n/2 exp( ∥xt+1-xt∥ 2 -2(σ 2 t+1 -σ 2 t ) ) 1 (2π(σ 2 t+1 -σ 2 τ )) n/2 exp( ∥xt+1-xτ ∥ 2 -2(σ 2 t+1 -σ 2 τ ) ).Since the likelihood distribution q(x t+1 |x t ) and the prior distribution q(x t |x τ ) are both Gaussian distribution, the posterior q(x t |x t+1 , x τ ) is also a Gaussian distribution. Therefore, we only need to derive the expectation and the covariance matrix. In the following, instead of derive the q(x t |x t+1 , x τ ) using equations, we use some trick to simplify the derivation:EQUATIONEQUATION∥x t ∥ 2 (σ 2 t -σ 2 τ ) - 2x T t x τ (σ 2 t -σ 2 τ ) + ∥x t ∥ 2 (σ 2 t+1 -σ 2 t ) - 2x T t+1 x t (σ 2 t+1 -σ 2 t ) + C(x t+1 , x τ ) ) = exp(- 1 2 ( 1 (σ 2 t -σ 2 τ ) + 1 (σ 2 t+1 -σ 2 t ) )∥x t ∥ 2 -2( x T τ (σ 2 t -σ 2 τ ) + x T t+1 (σ 2 t+1 -σ 2 t ) )x t + C(x t+1 , x τ ) ) = exp(- 1 2 (σ 2 t -σ 2 τ ) + (σ 2 t+1 -σ 2 t ) (σ 2 t -σ 2 τ )(σ 2 t+1 -σ 2 t ) ∥x t ∥ 2 -2( x T τ (σ 2 t -σ 2 τ ) + x T t+1 (σ 2 t+1 -σ 2 t ) )x t + C(x t+1 , x τ ) ) = exp(- 1 2 σ 2 t+1 -σ 2 τ (σ 2 t -σ 2 τ )(σ 2 t+1 -σ 2 t ) ∥x t ∥ 2 -2( x T τ (σ 2 t -σ 2 τ ) + x T t+1 (σ 2 t+1 -σ 2 t ) )x t + C(x t+1 , x τ ) ) = exp(- 1 2    σ 2 t+1 -σ 2 τ (σ 2 t -σ 2 τ )(σ 2 t+1 -σ 2 t )   ∥xt∥ 2 -2 x T τ (σ 2 t -σ 2 τ ) + x T t+1 (σ 2 t+1 -σ 2 t ) σ 2 t+1 -σ 2 τ (σ 2 t -σ 2 τ )(σ 2 t+1 -σ 2 t ) x t    + C(x t+1 , x τ )   ) = exp(- 1 2 σ 2 t+1 -σ 2 τ (σ 2 t -σ 2 τ )(σ 2 t+1 -σ 2 t ) ∥x t ∥ 2 -2 (σ 2 t+1 -σ 2 t )x T τ + (σ 2 t -σ 2 τ )x T t+1 σ 2 t+1 -σ 2 τ x t + C(x t+1 , x τ ) ) = exp(- 1 2 (σ 2 t -σ 2 τ )(σ 2 t+1 -σ 2 t ) σ 2 t+1 -σ 2 τ x t - (σ 2 t+1 -σ 2 t )x τ + (σ 2 t -σ 2 τ )x t+1 σ 2 t+1 -σ 2 τ 2 + C(x t+1 , x τ ) ) ∝ N (x t ; (σ 2 t+1 -σ 2 t )x τ + (σ 2 t -σ 2 τ )x t+1 σ 2 t+1 -σ 2 τ , (σ 2 t -σ 2 τ )(σ 2 t+1 -σ 2 t ) σ 2 t+1 -σ 2 τ I).The KL divergence between the posterior and predicted reverse distribution isD KL (q(x t |x t+1 , x τ )∥p θ (x t |x t+1 )) =D KL (N (x t ; (σ 2 t+1 -σ 2 t )x τ + (σ 2 t -σ 2 τ )x t+1 σ 2 t+1 -σ 2 τ , (σ 2 t -σ 2 τ )(σ 2 t+1 -σ 2 t ) σ 2 t+1 -σ 2 τ I)∥ N (x t ; (σ 2 t+1 -σ 2 t )h(x t+1 , σ t+1 ) + σ 2 t x t+1 σ 2 t+1 , σ2 t I)) = 1 2 (σ 2 t -σ 2 τ )(σ 2 t+1 -σ 2 t ) σ 2 t+1 -σ 2 τ ∥E q(xt|xt+1,xτ ) [x t ] -E p(xt|xt+1) [x t ]∥ 2 + C 2 = σ 2 t+1 -σ 2 τ 2(σ 2 t -σ 2 τ )(σ 2 t+1 -σ 2 t ) ∥E q(xt|xt+1,xτ ) [x t ] -E p(xt|xt+1) [x t ]∥ 2 + C 2 .When τ = 0, the result degrade to:q(x t |x t+1 , x 0 ) = N (x t ; (σ 2 t+1 -σ 2 t )x 0 + σ 2 t x t+1 σ 2 t+1 , σ 2 t (σ 2 t+1 -σ 2 t ) σ 2 t+1 I).When dσ t := σ t+1 -σ t → 0, the KL divergence between posterior and model prediction is simplified by:lim dσt→0 D KL (q(x t |x t+1 , x 0 )∥p θ (x t |x t+1 )) = lim dσt→0 D KL (N (x t ; (σ 2 t+1 -σ 2 t )x 0 + σ 2 t x t+1 σ 2 t+1 , σ 2 t (σ 2 t+1 -σ 2 t ) σ 2 t+1 I)∥ N (x t ; (σ 2 t+1 -σ 2 t )h(x t+1 , σ t+1 ) + σ 2 t x t+1 σ 2 t+1 , σt )) = lim dσt→0 1 2 σ 2 t (σ 2 t+1 -σ 2 t ) σ 2 t+1 ∥ (σ 2 t+1 -σ 2 t )x 0 σ 2 t+1 - (σ 2 t+1 -σ 2 t )h(x t+1 , σ t+1 ) σ 2 t+1 ∥ 2 = lim dσt→0 (σ 2 t+1 -σ 2 t ) 2 2 σ 2 t (σ 2 t+1 -σ 2 t ) σ 2 t+1 σ 4 t+1 ∥x 0 -h(x t+1 , σ t+1 )∥ 2 = lim dσt→0 (σ 2 t+1 -σ 2 t ) 2 σ 2 t σ 2 t+1 σ 4 t+1 ∥x 0 -h(x t+1 , σ t+1 )∥ 2 = lim dσt→0 (σ 2 t+1 -σ 2 t ) 2σ 4 t+1 ∥x 0 -h(x t+1 , σ t+1 )∥ 2 = dσ t σ 3 t+1 ∥x 0 -h(x t+1 , σ t+1 )∥ 2 =w(i)∥x 0 -h(x t+1 , σ t+1 )∥ 2 ,which is consistent to the results in Kingma et al. [17] and Karras et al. [16] .If we interpret the shift in weight from σt+1-σt σt+1 toσ 2 t +σ 2 d σ 2 t σ 2 d 1 √ 2πkσ exp(- ∥ log σt-kµ∥ 2 2k 2 σ) as a reweighting of D KL (q(x t |x t+1 , x 0 )∥p θ (x t |x t+1 )) by ŵt wt , a similar methodology can be applied to derive the weight for D KL (q(x t |x t+1 , x τ )∥p θ (x t |x t+1 )):lim dσt→0 ŵt w t D KL (q(x t |x t+1 , x τ )∥p θ (x t |x t+1 )) = lim dσt→0 ŵt w t 1 2 (σ 2 t -σ 2 τ )(σ 2 t+1 -σ 2 t ) σ 2 t+1 -σ 2 τ ∥E q(xt|xt+1,xτ ) [x t ] -E p(xt|xt+1) [x t ]∥ 2 2 = lim dσt→0 ŵt dσt σ 3 t+1 1 2 (σ 2 t -σ 2 τ )(2σtdσt) σ 2 t+1 -σ 2 τ ∥E q(xt|xt+1,xτ ) [x t ] -E p(xt|xt+1) [x t ]∥ 2 2 = lim dσt→0 ŵt (dσt) 2 σ 2 t+1 1 4 (σ 2 t -σ 2 τ ) σ 2 t+1 -σ 2 τ ∥E q(xt|xt+1,xτ ) [x t ] -E p(xt|xt+1) [x t ]∥ 2 2 = lim dσt→0 ŵt σ 2 t+1 (σ 2 t+1 -σ 2 τ ) 4(σ 2 t -σ 2 τ )(dσ t ) 2 ∥E q(xt|xt+1,xτ ) [x t ] -E p(xt|xt+1) [x t ]∥ 2 2 = lim dσt→0 σ 2 t + σ 2 d σ 2 t σ 2 d 1 √ 2πk σ exp(- ∥ log σ t -k µ ∥ 2 2k 2 σ ) σ 2 t+1 (σ 2 t+1 -σ 2 τ ) 4(σ 2 t -σ 2 τ )(dσ t ) 2 • ∥E q(xt|xt+1,xτ ) [x t ] -E p(xt|xt+1) [x t ]∥ 2 2 = lim dσt→0 σ 2 t + σ 2 d σ 2 d 1 √ 2πk σ exp(- ∥ log σ t -k µ ∥ 2 2k 2 σ ) σ 2 t+1 -σ 2 τ 4(σ 2 t -σ 2 τ )(σ t+1 -σ t ) 2 • ∥E q(xt|xt+1,xτ ) [x t ] -E p(xt|xt+1) [x t ]∥ 2 2We compare different weights in EPNDC. As demonstrated in Table 3 , these weights are not as effective as the derived weight. Interestingly, simply setting the weight to zero when the standard deviation falls below a certain threshold significantly boosts the performance of the derived weight. This suggests that the latter part of the derived weight might be close to the optimal weight. We observe a similar phenomenon with the final weight we use, suggesting that the current weight might not be optimal. We defer the investigation into how to find the optimal weight, what constitutes this optimal weight, and why it is considered optimal to future work. We also attempt to learn an optimal weight for our EPNDC. However, the learning process is difficult due to the high variance of ∥E q(xt|xt+1,xτ) [x t ] -E p(xt|xt+1) [x t ]∥ 2 2 .Attempts to simplify the learning process through cubic spline interpolation for reducing the number of learned parameters are also time-consuming. Our work primarily focuses on robust classification of input data using a single off-the-shelf diffusion model. Therefore, we leave the exploration of this aspect for future research.In this section, we show that APNDC is actually use the expectation of the ELBOs calculated from samples that are first denoised from the input and then have noise added back. In other word, APNDC approximate log p(x τ ) by the lower bound of E p(x0|xτ) E q(xτ |x0) [log p τ (x τ )].We first derive the lower bound for E q(xt|x0) [log p τ (x τ )]. The derivation of this lower bound is just the discrete case of the proof in Kingma and Gao [18] . We include it here only for completeness.E q(xτ |x0) [log p τ (x τ )] = q(x τ |x 0 ) log q(x τ |x 0 ) log p τ (x τ ) log q(x τ |x 0 ) =E q(xτ |x0) [log q(x τ |x 0 )] -D KL (q(x τ |x 0 )∥p τ (x τ )) ≥E q(xτ |x0) [log q(x τ |x 0 )] -D KL (q(x τ :T |x 0 )∥p(x τ :T )) =E q(xτ |x0) [log q(x τ |x 0 )] - T -1 t=τ [D KL (q(x t:T |x 0 )∥p(x t:T )) -D KL (q(x t+1:T |x 0 )∥p(x t+1:T ))] + D KL (q(x T |x 0 )∥p(x T )) =C 4 - T -1 t=τ [D KL (q(x t:T |x 0 )∥p(x t:T )) -D KL (q(x t+1:T |x 0 )∥p(x t+1:T ))] =C 4 - T -1 t=τ D KL (q(x t |x t+1 , x 0 )∥p(x t |x t+1 )) =C 4 - T -1 t=τ +1 w τ E xt∼q(xt|x0) [∥h θ (x t , σ t ) -x∥ 2 2 ].Given a input image x τ , we use the ELBOs of E q(xτ |x0=h θ (xτ ,στ )) [log p τ (x τ )], rather than its own ELBO, to approximate its log likelihood:log p(x τ ) ≈ E q(xτ |x0=h θ (xτ ,στ )) [log p τ (x τ )] ≥ C 4 - T -1 t=τ +1 w t E xt∼q(xt|x0) [∥h θ (x t , σ t ) -x∥ 2 2 ].Hence, APNDC is actually use the expectation of the ELBOs calculated from samples that are first denoised from the input and then have noise added back.Algorithm 3 Linear to EDM Predict ϵ = ϵ(α t x t , t)5: Calculate x 0 = x t -σ • ϵ 6: end if 7: if performing x 0 -prediction then 8:Predict x 0 = ϵ(α t x t , t) 9: end if 10: Return: x 0 .In this paper, we introduce a new definition for diffusion models, specifically as the discrete version of Karras et al. [16] . This definition encompasses various diffusions, including VE-SDE, VP-SDE, and methods like x-prediction, v-prediction, and epsilon-prediction, transforming their differences into the difference of parametrization in h θ (•, •), makes theoretical analysis extremely convenient. This operation also decouple the training of diffusion models and the sampling of diffusion models, i.e., any diffusion model could use any sampling algorithm. To better demonstrate this transformation, we present the pseudocodes.Linearly adding noise diffusion models. These kind of diffusion models define the forward process as a linear interpolation between the clean image and Gaussian noise, i.e., x t = α t x 0 + σ t ϵ. It could be transformed as:xt in EDM x t α t = x 0 + σt in EDM σ t α t ϵ.Hence, we could directly pass xt αt and σt αt to an EDM model to get the predicted x 0 , as shown in Algorithm 4.t } T t=0 and x t = t i=0 (1 -β i )x 0 + 1 - t i=0(1 -β i )ϵ, which could be seen as a special case of Linear diffusion models.dX t = - 1 2 β(t)X t dt + β(t)dW t , t ∈ [0, 1],where β(t) = β t•T • T . Consequently, we could also use an EDM model to solve the reverse VP-SDE by predictingx 0 = h θ ( xt √ exp (-t 0 β(s)ds) , 1-exp (-t 0 β(s)ds) exp (-t 0 β(s)ds) ).dX t = dσ(t) 2 dt dW t .EDM is a special case of VE-SDE, where σ(t) = t. For a x t in VE-SDE, the variance of the noise is σ(t). Hence, we could directly use h θ (x t , σ(t)) to get the predicted x 0 .We adhere to the certified robustness pipeline established by Cohen et al. [6] , yet our method potentially offers a tighter certified bound, as demonstrated in Appendix A.3. To prevent confusion regarding our hyper-parameters and those in Cohen et al. [6] , we clarify these hyper-parameters as follows: ϵ = maximum allowed ℓ 2 perturbation of the input N = number of samples used in binomial test to estimate the lower bound p A σ = std. of Gaussian noise data augmentation during training and certification T = number of diffusion timesteps T ′ = number of diffusion timesteps we selected to calculate/(estimate) evidence lower bounds α = Type one error for estimating the lower bound p A .To ensure a fair comparison, we follow previous work and do not estimate p B , instead directly setting p B = 1 -p A . This approach results in a considerably lower certified robustness, especially for ImageNet. Therefore, it is possible that the actual certified robustness of diffusion classifiers might be significantly higher than the results we present.There are multiple ways to reduce the number of timesteps selected to estimate the evidence lower bounds (e.g., uniformly, selecting the first T ′ timesteps). Chen et al. [3] demonstrate that these strategies achieve similar results. In this work, we just adopt the simplest strategy, i.e., uniformly select T ′ timesteps.We compare our methods with training-based methods as outlined in Cohen et al. [6] , Salman et al. [38] , Jeong and Shin [13] , Zhai et al. [50] , and with diffusion-based purification methods in Carlini et al. [2] , Xiao et al. [47] . Since none of these studies provide code for ImageNet64x64, we retrain ResNet-50 using these methods and certify it via randomized smoothing. For training-based methods, we utilize the implementation by Jeong and Shin [13] 2 with their default hyper-parameters for ImageNet. For diffusion-based purification methods, we first resize the input images to 64x64, then resize them back to 256x256, and feed them into the subsequent classifiers. This process ensures a fair comparison with our method.In the ImageNet dataset, we employ the same diffusion models as our baseline studies, Carlini et al.[2] and Xiao et al. [47] . For the CIFAR-10 dataset, however, we opt for a 55M diffusion model from Karras et al. [16] , as its parameterization aligns more closely with our definition of diffusion models. In contrast, Carlini et al. [2] utilizes a 50M diffusion model from Nichol and Dhariwal [33] . When we replicate the study by Carlini et al. [2] using the model from Karras et al. [16] and a WRN-70-2 [49] , we achieve certified robustness of 76.56%, 59.76%, and 41.01% for radii 0.25, 0.5, and 0.75, respectively, which is nearly identical to their results shown in Table 1 . This finding suggests that the choice of diffusion models does not significantly impact certified robustness.We choose the discrete version of the diffusion model from Karras et al. [16] as our definition because it is the simplest version for deriving the ELBOs in this paper. For more details, please see Appendix A.8.Name PropertiesDC ELBO: log p(x0|y) ≥ -T t=1 E wt∥h θ (xt, σt, y) -x0∥ 2 2 + C Diffusion Classifier: DC(x)y = exp(-T t=1 E[w t ∥h θ (x t ,σ t ,y)-x 0 ∥ 2 2 ]) ŷ exp (-T t=1 E[w t ∥h θ (x t ,σ t ,ŷ)-x 0 ∥ 2 2 ]) Smoothed Classifier: gDC(x) = DC(x) Certified Robustness: R = √ 2T (p A -p B ) (2/ √ D+ √ 2/π) T i=1 w i /σ i EPNDC ELBO: log p(xt|y) ≥ -T i=t wiE[∥E[q(xi|xi+1, xt)] -E[p(xi|xi+1, y)]∥ 2 ] + C2 Diffusion Classifier: EPNDC(xt)y = exp(-T i=t w i E[∥E[q(x i |x i+1 ,x t )]-E[p(x i |x i+1 ,y)]∥ 2 ]) ŷ exp (-T i=t w i E[∥E[q(x i |x i+1 ,x t )]-E[p(x i |x i+1 ,ŷ)]∥ 2 ])Smoothed Classifier: gEPNDC(x)y = P ϵ∼N (0,I) (arg max ŷ EPNDC(x0+ σ • ϵ) ŷ = y) Certified Robustness: R = σ 2 Φ -1 (pA) -Φ -1 (pB) APNDC ELBO: E q(x t |x 0 ),x 0 =h(x t ,σ t ) [log p(xt|y)] ≥ -T i=t E wi∥h θ (xi, σi, y) -x0∥ 2 2 + C3 Diffusion Classifier: APNDC(xt)y = exp(-T i=t E[w i ∥h θ (x i ,σ i ,y)-h θ (x t ,σ t )∥ 2 2 ]) ŷ exp (-T i=t E[w i ∥h θ (x i ,σ i ,ŷ)-h θ (x t ,σ t )∥ 2 2 ])Smoothed Classifier: gAPNDC(x)y = P ϵ∼N (0,I) (arg max ŷ APNDC(x0+ σ • ϵ) ŷ = y) Certified Robustness: R = σ 2 Φ -1 (pA) -Φ -1 (pB)Table 4 : An illustration of the relationship between different ELBOs, likelihood, classifiers, and certified robustness.Variance reduction proves beneficial. As illustrated in Figure 2 (a), our variance reduction technique enables a significant reduction in time complexity while maintaining high clean accuracy. Regarding certified robustness, Table 1 shows that a tenfold reduction in time complexity results in only a minor, approximately 3%, decrease in certified robustness across all radii. Notably, with T ′ = 100, our method still attains state-of-the-art clean accuracy and certified robustness for ϵ = 0.25, 0.5, 0.75 while only cost one-fourth of the NFEs in Xiao et al. [47] . This underscores the effectiveness of our variance reduction approach.Sift-and-refine proves beneficial. Our method's requirement for function evaluations (NFEs) is proportional to the number of classes, which limits its scalability in datasets with a large number of candidate classes. For instance, in the ImageNet dataset, without the Sift-and-refine algorithm, our method necessitates approximately 10 8 NFEs per image (i.e., 100 • 1000 • 1000), translating to about 3 × 10 6 seconds for certifying each image on a single 3090 GPU. In contrast, Xiao et al. [47] 's method requires about 4 × 10 6 NFEs (i.e., 40 • 10 • 10000), or roughly 3 × 10 5 seconds. Our proposed Sift-and-refine technique, however, can swiftly identify the most likely candidates, thereby reducing the time complexity. It adjusts the processing time based on the difficulty of the input samples. With this technique, our method requires only about 1 × 10 5 seconds per image, making it more efficient compared to Xiao et al. [47] .As demonstrated in Figure 1 and Table 4 , the basic idea of all these diffusion classifiers is to approximate the log likelihood by ELBO and calculate the classification probability via Bayes' theorem. All these classifiers possess non-trivial robustness, but certified lower bounds vary in tightness.Table 5 : The accuracy of diffusion classifier [3] using the EDM checkpoint [16] on CIFAR-10 test set with various weight. Result are tested on the same subset with 512 images as in Chen et al. [3] .Weight Name ŵt Accuracy (%) EDMσ 2 t +σ 2 d σ 2 t σ 2 d 1 √ 2πkσ exp(- ∥ log σ t -kµ∥ 2 2k 2 σ ) 94.92 Uniform 1 85.76 DDPM 1 σ t 90.23 EDM-W σ 2 t +σ 2 d σ 2 t σ 2 d 88.67 EDM-p(t) 1 √ 2πkσ exp(- ∥ log σ t -kµ∥ 2 2k 2 σ ) 93.75 ELBO σ t+1 -σ t σ 3 t 44.53The diffusion classifier is intuitively considered the most robust, as it can process not only clean images but also those corrupted by Gaussian noise. This means it can achieve high clean accuracy by leveraging less noisy samples, while also enhancing robustness through more noisy samples where adversarial perturbations are significantly masked by Gaussian noise. However, its certified robustness is not as tight as desired. As explained in Appendix A.2, this is because we assume that the maximum Lipschitz condition holds across the entire space, which is a relatively broad assumption, resulting in a less stringent certified robustness.EPNDC and APNDC utilize the Evidence Lower Bound (ELBO) of corrupted data log p(x τ ). This implies that the least noisy examples they can process are at the noise level corresponding to τ . As τ increases, the upper bound of certified robustness also rises, but this simultaneously diminishes the classifiers' ability to accurately categorize clean data. As highlighted in Chen et al. [3] , this mechanism proves less effective, particularly in datasets with a large number of classes but low resolution. In such cases, the addition of even a small variance of Gaussian noise can render the entire image unclassifiable.Generally, the Diffusion Classifier is intuitively more robust than both EPNDC and APNDC. However, obtaining a tight theoretical certified lower bound for the Diffusion Classifier proves more challenging compared to EPNDC and APNDC. Therefore, we contend that in practical applications, the Diffusion Classifier is preferable to both EPNDC and APNDC. Looking forward, we aim to derive a tighter certified lower bound for the Diffusion Classifier in future research.Typically, when training diffusion models by Eq. ( 5), most researchers opt to use a re-designed weight ŵt (e.g., ŵt = 1 in Ho et al. [11] ), rather than the derived weight w t . When constructing diffusion classifier from an off-the-shelf diffusion model, we find that maintaining consistency between the loss weight in diffusion classifier and the training weight is crucial. As shown in Table 5 , any inconsistency in loss weight leads to a decrease in performance. Conversely, performance enhances when the diffusion classifier's weight closely aligns with the training weight. Surprisingly, the derived weight (ELBO) yields the worst performance. Therefore, when τ = 0, we use the training weight ŵt rather than the derived weight w t .Similarly, when τ ̸ = 0, the derived weight w (τ ) t also results in the worst performance among different weight configurations, as detailed in Appendix C.2. However, determining the optimal weight in this general case is a complex challenge. Directly replacing w (τ ) t with the training weight ŵt is not appropriate, as w (τ ) t ̸ = w t . To address this issue, we propose an alternative: multiplying the weight by ŵt wt (i.e., using ŵtw (τ ) t wt as the weight for EPNDC). This method effectively acts as a substitution of w t with ŵt when τ = 0. However, it is important to note that this approach is not optimal, and deriving an optimal weight appears to be infeasible.To enhance generative performance, most researchers opt not to use the derived weight w t for the training loss ∥E[q(x t |x t+1 , x 0 )] -E[p(x t |x t+1 )]∥ 2 . Instead, they employ a redesigned weight ŵt . For example, Ho et al. [11] define ŵt = 1 σt . Another approach involves sampling i from a specifically designed distribution p(t), rather than a uniform distribution. This approach can be interpreted as adjusting the loss weight to ŵt = p(t), without altering the distribution of i:E x,t∼p(t) E xt [∥h(x t , σ t ) -x∥ 2 2 ] =E x T t=0 p(t)E xt [∥h(x t , σ t ) -x∥ 2 2 ] =E x,t E xt [p(t)∥h(x τ , σ t ) -x∥ 2 2 ].For example, Karras et al. [16] employσ 2 t +σ 2 d σ 2 t σ 2 das the loss weight but modify p(t) to1 √ 2πkσ exp (- ∥ log σt-kµ∥ 2 2k 2 σ), where σ d , k σ , k µ are hyper-parameters. Thus, it is equivalent to setting ŵt =σ 2 t +σ 2 d σ 2 t σ 2 d 1 √ 2πkσ exp (- ∥ log σt-kµ∥ 2 2k 2 σ).We discover that maintaining consistency in the loss weight used in diffusion classifiers and during training is crucial. Take EDM as an example. As demonstrated in Table 5 , if we fail to maintain the consistency of the loss weight between training and testing, a significant performance drop occurs.The closer the weight during testing is to the weight used during training, the better the performance.Surprisingly, the derived weight (ELBO) yields the poorest performance, as indicated in Table 5 . This issue also occurs when calculating D KL (q(x t |x t+1 , x t )||p(x t |x t+1 )). The performance of our derived weight is significantly inferior to both the uniform weight and the DDPM weight. For D KL (q(x t |x t+1 , x 0 )||p(x t |x t+1 )), substituting the derived weight σt+1-σt σ 3 t with the training weightσ 2 t +σ 2 d σ 2 t σ 2 d 1 √ 2πkσ exp(- ∥ log σt-kµ∥ 2 2k 2 σ) is feasible. However, this substitution becomes problematic for D KL (q(x t |x t+1 , x τ )||p(x t |x t+1 )), as there is no σt+1-σt σ 3 t term, as outlined in Eq. ( 13). We propose two alternative strategies: one interprets the shift from w t to ŵt as reweighting the KL divergence by ŵt wt , requiring only the multiplication of ŵt wt to our derived weight. The other strategy involves using the equation ŵt = w t to reduce the number of parameters. While these two interpretations yield identical results for D KL (q(x t |x t+1 , x 0 )||p(x t |x t+1 )), they differ for D KL (q(x t |x t+1 , x τ )||p(x t |x t+1 )). Therefore, directly deriving an optimal weight appears infeasible. For detailed information, see Appendix A.6.Algorithm 5 Sift-and-refine Sharing Noise Across Different Timesteps. In Sec. 3.4, we demonstrate that by using the same x i for all classes, we significantly reduce the variance of predictions. This allows us to use a fewer number of timesteps, thereby greatly reducing time complexity. From another perspective, using the same x i for all classes is equivalent to applying the same noise to samples at the same timestep. This raises the question: "If we share the noise across all samples, could we further reduce time complexity?" However, this approach proves ineffective. Analyzing the difference between the logits of two classes reveals that sharing noise does not reduce the variance of this difference. Consequently, we opt not to share noise across different timesteps but only within the same timestep for different classes.Discrete progressive class selection algorithm. We design a normalized discrete critical class selection algorithm for accelerating diffusion classifiers. Typically, the time complexity of the vanilla diffusion classifier can be defined as O(KT ), where K denotes the count of classes and T denotes the number of timesteps. Sharpening T is tractable, but overdoing that practice can have an extremely negative impact on final performance. Another way to speed up the computation is to actively discard some unimportant classes when estimating the conditional likelihood via conditional ELBO. Indeed, these two sub-approaches can be merged in parallel in a single algorithm (i.e., our proposed class selection algorithm). Additionally, to achieve an in-depth analysis of acceleration in diffusion classifiers, the time complexity of our proposed discrete acceleration algorithm can be determined by a predefined manual class candidate trajectory C cand as well as a predefined manual timestep candidate trajectory T cand .The procedure of the discrete progressive class selection algorithm can be described in Algorithm 6. The specific mechanism of Algorithm 6 can be described from a simple example: the predefined trajectory C cand is set as [400, 80, 40, 1] and the predefined trajectory T cand is set as [2, 5, 25, 50] simultaneously. Assume we conduct this accelerated diffusion classifier with K =1000 in the specific ImageNet [47] . First, we estimate the diffusion loss, which is equivalent to conditional likelihood, for 1000 classes by 2 time points and then sort the losses of the different classes to obtain the smallest 400 classes. Subsequently, we estimate the diffusion loss for 400 classes by 3 (w.r.t. 5-2) time points and then sort the losses for different classes to obtain the smallest 80 classes. Ultimately, the procedure concludes with the selection of 40 out of 80 classes with 20 time points (w.r.t. 25-5), followed by choosing 1 class from 40 classes with 25 (w.r.t. 50-25) time points.The ablation outcomes presented in Table 6 illustrate that suitable design of predefined manual timestep candidate trajectories C cand and T cand are crucial in the final performance of diffusion classifiers. A salient observation in the initial definition of C cand and T cand is that T cand can initially be small, whereas C cand must start significantly larger to achieve high accuracy while ensuring low time complexity. Thus, the timestep trajectory [2, 5, 15, 50] and the classes trajectory [400, 80, 40, 1] are in accordance with the above conditions and achieve the best performance in various predefined trajectories.Accelerated Diffusion Models. We observe that consistency models [43] and CUD [40] determine the class of the generated object at large timesteps, while they primarily refine the images at lower timesteps. In other words, at smaller timesteps, the similarity between predictions of different classes is so high that classification becomes challenging. Conversely, at larger timesteps, the images become excessively noisy, leading to less accurate predictions. Consequently, constructing generative classifiers from consistency models and CUD appears to be a difficult task.Despite the significant improvements in certified robustness, this work still presents limitations. Firstly, the time complexity of the diffusion classifier restricts its applicability in real-world scenarios, providing primarily theoretical benefits. Additionally, the certified bounds for diffusion classifiers are not straightforward enough. Future efforts could emulate the strong law of randomized smoothing to establish a more direct certified lower bound for Chen et al. [3] . Guidelines:• The answer NA means that the paper has no limitation while the answer No means that the paper has limitations, but those are not discussed in the paper. • The authors are encouraged to create a separate "Limitations" section in their paper.• The paper should point out any strong assumptions and how robust the results are to violations of these assumptions (e.g., independence assumptions, noiseless settings, model well-specification, asymptotic approximations only holding locally). The authors should reflect on how these assumptions might be violated in practice and what the implications would be. • The authors should reflect on the scope of the claims made, e.g., if the approach was only tested on a few datasets or with a few runs. In general, empirical results often depend on implicit assumptions, which should be articulated. • The authors should reflect on the factors that influence the performance of the approach.For example, a facial recognition algorithm may perform poorly when image resolution is low or images are taken in low lighting. Or a speech-to-text system might not be used reliably to provide closed captions for online lectures because it fails to handle technical jargon. • The authors should discuss the computational efficiency of the proposed algorithms and how they scale with dataset size. • If applicable, the authors should discuss possible limitations of their approach to address problems of privacy and fairness. • While the authors might fear that complete honesty about limitations might be used by reviewers as grounds for rejection, a worse outcome might be that reviewers discover limitations that aren't acknowledged in the paper. The authors should use their best judgment and recognize that individual actions in favor of transparency play an important role in developing norms that preserve the integrity of the community. Reviewers will be specifically instructed to not penalize honesty concerning limitations. • The experimental setting should be presented in the core of the paper to a level of detail that is necessary to appreciate the results and make sense of them. • The full details can be provided either with the code, in appendix, or as supplemental material.Justification: See page 30.Guidelines:• The answer NA means that the authors have not reviewed the NeurIPS Code of Ethics.• If the authors answer No, they should explain the special circumstances that require a deviation from the Code of Ethics. • The authors should make sure to preserve anonymity (e.g., if there is a special consideration due to laws or regulations in their jurisdiction).∀0 ≤ t ≤ T, q t (x) ∈ C 2 , h(x, σ t ) ∈ C 1 and E qt(x) [∥x∥ 2 2 ] ≤ ∞.For any classifier f mentioned in this paper, f (x) ∈ C 1 , and ∃C ≥ 0, ∀x : ∥f (x)∥ 2 ≤ C.The output of the diffusion U-Net is bounded: h(x, σ t ) ∈ [0, 1] D for all x and t. This property can be ensured by using the CLIP operator to clip the output of the U-Net. Lemma A.2. The second norm of the gradient of softmax function || ∂ ∂x softmax(x/β) y || 2 is less than or equal to 1 2 √ 2β . In other words,https://github.com/jh-jeong/smoothing-consistency 


Decision: This work investigates the robustness of diffusion classifiers. It is shown that diffusion classifiers are inherently robust since they possess O(1) Lipschitzness and their certified robustness is also established. Furthermore, the authors achieve tighter bounds for diffusion classifiers that classify Gaussian-corrupted data (called Noised Diffusion Classifiers; NDCs), using evidence lower bounds (ELBOs) for the appropriate distributrions and Bayes' theorem. Empirical evaluation of NDCs using CIFAR-10 shows that NDCs are certifiably robust up to 80% and 70% under $\ell_2$ perturbations that have magnitude less than 0.25 and 0.5 respectively.

Reviews: review: paper_summary: paper_summary: This paper presents a theoretical analysis of the enhanced robustness in diffusion-based classifiers and introduces a generalized Noised Diffusion Classifier, EPNDC. The authors utilize the Evidence Lower Bound (ELBO) of each conditional log-likelihood $\log p(x_\tau | y) $and Bayes' theorem as the logits for each class. They identified that EPNDC is time-consuming due to the iterative computation of two conditional ELBOs. To address this, they leverage the ELBO of an ensemble of EPNDC to approximate the expected likelihood as logits without additional computational cost. Additionally, they developed variance reduction and sift-and-refine techniques to reduce time complexity. Experimental results demonstrate that APNDC achieves significantly better robustness without requiring extra training data, fewer diffusion steps, and a reduced number of samples needed to estimate the Lipschitz bound.
strength_weakness: strength_weakness: 1. Some causal relationships are unclear or lack citations, requiring further explanation from the authors. For instance, in Line 156: What does the "nabla operator" refer to? It is neither explained nor cited. In Lines 161-164: "However, similar to the weak law of randomized smoothing, such certified robustness has limitations because it assumes the maximum Lipschitz condition is satisfied throughout the entire perturbation path. As a result, the robust radius is less than half of the reciprocal of the maximum Lipschitz constant." The causal relationship here is unclear and needs further clarification.

2. Although the diffusion classifier is highly scalable and robust, its clean accuracy on ImageNet is still far behind the current state-of-the-art (90%+). More details can be found at [https://paperswithcode.com/sota/image-classification-on-imagenet](https://paperswithcode.com/sota/image-classification-on-imagenet).
questions: questions: 1. Refer to weaknesses. 

2. Eq (15) uses the diffusion model $h_\theta$ one more time than Eq (12). Why does APNDC not increase the computational overhead compared to EPNDC (Line201)? Please explain further.
limitations: limitations: The authors didn't address the limitations of APNDC, but Diffusion Classifiers are still far behind the current SOTA in classification accuracy. These are some potential limitations.
paper_summary: paper_summary: This work proves that diffusion classifiers possess inherent robustness to adversarial attacks by demonstrating their O(1) Lipschitzness and establishing their certified resilience. By generalizing these classifiers to handle Gaussian-corrupted data and using evidence lower bounds for likelihood approximation, the research demonstrates the superior certified robustness of Noised Diffusion Classifiers (NDCs).
strength_weakness: strength_weakness: 1. The proposed method combines two existing techniques, diffusion classifiers and randomized smoothing, which is not sufficiently novel. The paper needs to better highlight what sets this approach apart from existing methods and how it fundamentally advances the field. Although the authors attempt to establish a theoretical framework, the derivation of the Lipschitz constant and its implications are not sufficiently detailed, leaving unanswered questions about the robustness guarantees.

2. The experimental evaluation relies heavily on the small CIFAR-10 and ImageNet 64x64 datasets. Expanding the experiments to include larger datasets, such as ImageNet-1K, would provide a more comprehensive assessment.

3. The paper discusses techniques to reduce time complexity but does not convincingly demonstrate the practicality of the proposed methods with experimental results, such as throughput or inference latency. A more detailed analysis and comparisons of computational efficiency, especially in relation to existing methods, are needed.
questions: questions: Please address the weaknesses mentioned above.
limitations: limitations: No potential negative societal impact.
paper_summary: paper_summary: The authors investigate the certified robustness of diffusion classifiers. For this purpose, they first show that these classifiers have O(1) Lipschitzness and subsequently achieve tighter robustness bounds through Bayes' theorem and the ELBO.
strength_weakness: strength_weakness: W1: References could be ordered by appearance (minor)

W2: The nature of diffusion classifiers induces a considerable computational overhead compared to standard classifiers. However, the authors try to address this issue through their sift-and-refine algorithm. Still a comparison between different methods w.r.t. inference time would have been informative. (could also include standard classifiers). Note that I would not consider large computational cost as a negative point concerning paper acceptance I just believe that a comparison would be helpful for the reader. Still the appendix provides some information w.r.t. time complexity so I view this as a minor issue. 

W3: Appendix D is very short and could be incorporated into the paper (at least in the camera-ready version)
questions: questions: Q1: Could the authors provide a computational cost comparison between different methods?
limitations: limitations: Limitations are included in the appendix.
paper_summary: paper_summary: This paper derives an upper bound of the Lipschitz constant for diffusion classifiers. Then, it proposes Exact Posterior Noised Diffusion Classifier (EPNDC) and Approximated Posterior Noised Diffusion Classifier (APNDC) by deriving ELBO upper bounds on $\log p (x_\tau)$ and thereby enabling classifying noisy images. The APNDC achieves state-of-the-art certified robustness.
strength_weakness: strength_weakness: In my opinion, some of the contents are not explained very clearly. Please see below and the contents of the "Questions" section.

- Table 4 is nice. However, I wish it was in the main text instead of the appendix, because the current main text misses the discussion on how to calculate the certified robustness for the proposed models.
- Figure 2 doesn't present the certified radius with a conventional diffusion classifier, as derived in Eq. (11). Since (11) is an important contribution of this work, I believe it should be included.
- I would like to see an ablation study on $\sigma_\tau$, but could not find this result.

Overall, this is still a nice paper.
questions: questions: - Line 145: Why are the mentioned quantities bounded in the range $[0, 1]^D$? Do you clip $h_\theta (x_t, \sigma_t)$ to $[0, 1]^D$? How about $\|\| h_\theta (x_t, \sigma_t) \|\|_2^2$?
- Eq (12): The notation $q$ was introduced in Eq (1) to represent probabilities in the forward diffusion process. So, how to compute $q (x_t | x_{t+1})$? It would also be nice to add subscripts to each of the nested expectations, so that it's clear what variables the expectations are taken over. 
- Also Eq (12): does the method become computationally cheaper when $\tau$ increases? Is it correct that different values of $\tau$ can reuse some computation, so if you set $\tau$ to 0, you simultaneously get the ELBO bound for $\tau = 0, 1, \ldots, T$?
- Remark 3.4: when would it make sense to use $\tau = 0$? When $\tau$ is $0$, is $\sigma_\tau$ also 0? Does this mean randomized smoothing is not used?
- Line 224: the APNDC reconstruction loss $\|\| h_\theta (x_\tau, \sigma_\tau) \|\|_2^2$ sees great resemblance to the training objective of consistency models. Does this intuitively imply that consistency models are more suitable or less suitable for APNDC? I see a short discussion about consistency models in the appendix, but it does not fully address my curiosity.
- Line 247 mentions that $\sigma_\tau \in \\{ 0.25, 0.5, 1.0 \\}$. What are the corresponding $\tau$ values? Which setting is used for which results? Are the different radii in Table 1, Table 2, and Figure 2 evaluated with the same $\sigma_\tau$ or different ones?
limitations: limitations: As is the case for numerous diffusion classifier paper, the computation complexity, while improved in this paper, is far from ideal. This paper evaluates the method on a small subset of CIFAR-10 and ImageNet, probably due to this reason.

Comments: title: Concerns addressed
comment: Thank you for your thoughtful review and for recognizing the value of our contributions. We are glad that you found our theoretical approach to addressing these gaps meaningful. We are also grateful for your decision to raise the score.
Although diffusion classifiers and randomized smoothing are two established techniques, there are indeed some gaps when applying randomized smoothing to diffusion classifiers, as mentioned in the rebuttal. Despite the lack of novelty in combining these two existing components, addressing the gaps that hinder such a combination is also a valid contribution, especially when the mitigation method is supported by a theoretical foundation.
Thank you for your kind words and for taking the time to review our paper. We're glad that our revisions were helpful and that you enjoyed the paper.
Thanks for editing the article and solving my confusion. Overall, it's a great paper!
Thank you for your thoughtful review and for raising your score. We are delighted to hear that you found reading our paper enjoyable and that our responses addressed your concerns. Your feedback is invaluable to us, and we appreciate your support.
I thank the authors for their response. My concerns are appropriately addressed and I am happy to raise my score. 
I found reading the paper quite enjoyable.