Title: DiffAttack: Evasion Attacks Against Diffusion-Based Adversarial Purification
Venue: NeurIPS 2023
Accepted: yes
Keywords: adversarial attack

adversarial purification

adversarial robustness

diffusion model
Abstract: Diffusion-based purification defenses leverage diffusion models to remove crafted perturbations of adversarial examples and achieve state-of-the-art robustness. Recent studies show that even advanced attacks cannot break such defenses effectively, since the purification process induces an extremely deep computational graph which poses the potential problem of gradient obfuscation, high memory cost, and unbounded randomness. In this paper, we propose a unified framework DiffAttack to perform effective and efficient attacks against diffusion-based purification defenses, including both DDPM and score-based approaches. In particular, we propose a deviated-reconstruction loss at intermediate diffusion steps to induce inaccurate density gradient estimation to tackle the problem of vanishing/exploding gradients. We also provide a segment-wise forwarding-backwarding algorithm, which leads to memory-efficient gradient backpropagation. We validate the attack effectiveness of DiffAttack compared with existing adaptive attacks on CIFAR-10 and ImageNet. We show that DiffAttack decreases the robust accuracy of models compared with SOTA attacks by over 20\% on CIFAR-10 under $\ell_\infty$ attack $(\epsilon=8/255)$, and over 10\% on ImageNet under $\ell_\infty$ attack $(\epsilon=4/255)$. We conduct a series of ablations studies, and we find 1) DiffAttack with the deviated-reconstruction loss added over uniformly sampled time steps is more effective than that added over only initial/final steps, and 2) diffusion-based purification with a moderate diffusion length is more robust under DiffAttack.

DiffAttack: Evasion Attacks Against Diffusion-Based Adversarial Purification

Abstract

Diffusion-based purification defenses leverage diffusion models to remove crafted perturbations of adversarial examples and achieve state-of-the-art robustness. Recent studies show that even advanced attacks cannot break such defenses effectively, since the purification process induces an extremely deep computational graph which poses the potential problem of vanishing/exploding gradient, high memory cost, and unbounded randomness. In this paper, we propose an attack technique DiffAttack to perform effective and efficient attacks against diffusion-based purification defenses, including both DDPM and score-based approaches. In particular, we propose a deviated-reconstruction loss at intermediate diffusion steps to induce inaccurate density gradient estimation to tackle the problem of vanishing/exploding gradients. We also provide a segment-wise forwarding-backwarding algorithm, which leads to memory-efficient gradient backpropagation. We validate the attack effectiveness of DiffAttack compared with existing adaptive attacks on CIFAR-10 and ImageNet. We show that DiffAttack decreases the robust accuracy of models compared with SOTA attacks by over 20% on CIFAR-10 under ℓ ∞ attack ( ϵ = 8 / 255) , and over 10% on ImageNet under ℓ ∞ attack ( ϵ = 4 / 255) . We conduct a series of ablations studies, and we find 1) DiffAttack with the deviated-reconstruction loss added over uniformly sampled time steps is more effective than that added over only initial/final steps, and 2) diffusion-based purification with a moderate diffusion length is more robust under DiffAttack.

1 Introduction

Since deep neural networks (DNNs) are found vulnerable to adversarial perturbations [52, 20], improving the robustness of neural networks against such crafted perturbations has become important, especially in safety-critical applications [18, 5, 54]. In recent years, many defenses have been proposed, but they are attacked again by more advanced adaptive attacks [7, 30, 11, 12]. One recent line of defense ( diffusion-based purification ) leverages diffusion models to purify the input images and achieves the state-of-the-art robustness. Based on the type of diffusion models the defense utilizes, diffusion-based purification can be categorized into score-based purification [34] which uses the score-based diffusion model [49] and DDPM-based purification [4, 62, 57, 51, 55, 56] which uses the denoising diffusion probabilistic model (DDPM) [25]. Recent studies show that even the most advanced attacks [12, 34] cannot break these defenses due to the challenges of vanishing/exploding gradient, high memory cost, and large randomness. In this paper, we aim to explore the vulnerabilities of such diffusion-based purification defenses, and design a more effective and efficient adaptive attack against diffusion-based purification , which will help to better understand the properties of diffusion process and motivate future defenses.

In particular, the diffusion-based purification defenses utilize diffusion models to first diffuse the adversarial examples with Gaussian noises and then perform sampling to remove the noises. In this way, the hope is that the crafted adversarial perturbations can also be removed since the training

distribution of diffusion models is clean [49, 25]. The diffusion length (i.e., the total diffusion time steps) is usually large, and at each time step, the deep neural network is used to estimate the gradient of the data distribution. This results in an extremely deep computational graph that poses great challenges of attacking it: vanishing/exploding gradients , unavailable memory cost , and large randomness . To tackle these challenges, we propose a deviated-reconstruction loss and a segment-wise forwarding-backwarding algorithm and integrate them as an effective and efficient attack technique DiffAttack .

Essentially, our deviated-reconstruction loss pushes the reconstructed samples away from the diffused samples at corresponding time steps. It is added at multiple intermediate time steps to relieve the problem of vanishing/exploding gradients. We also theoretically analyze the connection between it and the score-matching loss [26], and we prove that maximizing the deviated-reconstruction loss induces inaccurate estimation of the density gradient of the data distribution, leading to a higher chance of attacks. To overcome the problem of large memory cost, we propose a segment-wise forwarding-backwarding algorithm to backpropagate the gradients through a long path. Concretely, we first do a forward pass and store intermediate samples, and then iteratively simulate the forward pass of a segment and backward the gradient following the chain rule. Ignoring the memory cost induced by storing samples (small compared with the computational graph), our approach achieves O (1) memory cost.

Finally, we integrate the deviated-reconstruction loss and segment-wise forwarding-backwarding algorithm into DiffAttack, and empirically validate its effectiveness on CIFAR-10 and ImageNet. We find that (1) DiffAttack outperforms existing attack methods [34, 60, 53, 1, 2] by a large margin for both the score-based purification and DDPM-based purification defenses, especially under large perturbation radii; (2) the memory cost of our efficient segment-wise forwarding-backwarding algorithm does not scale up with the diffusion length and saves more than 10x memory cost compared with the baseline [4]; (3) a moderate diffusion length benefits the robustness of the diffusion-based purification since longer length will hurt the benign accuracy while shorter length makes it easier to be attacked; (4) attacks with the deviated-reconstruction loss added over uniformly sampled time steps outperform that added over only initial/final time steps. The effectiveness of DiffAttack and interesting findings will motivate us to better understand and rethink the robustness of diffusion-based purification defenses.

We summarize the main technical contributions as follows:

We propose DiffAttack, a strong evasion attack against the diffusion-based adversarial purification defenses, including score-based and DDPM-based purification.

We propose a deviated-reconstruction loss to tackle the problem of vanishing/exploding gradient, and theoretically analyze its connection with data density estimation.

We propose a segment-wise forwarding-backwarding algorithm to tackle the high memory cost challenge, and we are the first to adaptively attack the DDPM-based purification defense, which is hard to attack due to the high memory cost.

We empirically demonstrate that DiffAttack outperforms existing attacks by a large margin on CIFAR-10 and ImageNet. Particularly, DiffAttack decreases the model robust accuracy by over 20% for ℓ ∞ attack ( ϵ = 8 / 255) on CIFAR-10, and over 10% on ImageNet under ℓ ∞ attack ( ϵ = 4 / 255) .

We conduct a series of ablation studies and show that (1) a moderate diffusion length benefits the model robustness, and (2) attacks with the deviated-reconstruction loss added over uniformly sampled time steps outperform that added over only initial/final time steps.

2 Preliminary

There are two types of diffusion-based purification defenses, DDPM-based purification , and scorebased purification , which leverage DDPM [46, 25] and score-based diffusion model [49] to purify the adversarial examples, respectively. Next, we will introduce the basic concepts of DDPM and score-based diffusion models.

Denote the diffusion process indexed by time step t with the diffusion length T by { x t } T t =0 . DDPM constructs a discrete Markov chain { x t } T t =0 with discrete time variables t following p ( x t | x t -1 ) = N ( x t ; √ 1 -β t x t -1 , β t I ) where β t is a sequence of positive noise scales (e.g., linear scheduling, cosine scheduling [33]). Considering α t := 1 -β t , ¯ α t := Π t s =1 α s , and

σ t = √ β t (1 -¯ α t -1 ) / (1 -¯ α t ) , the reverse process (i.e., sampling process) can be formulated as:

where z is drawn from N ( 0 , I ) . ϵ θ parameterized with θ is the model to approximate the perturbation ϵ in the diffusion process and is trained via the density gradient loss L d :

where ϵ is drawn from N ( 0 , I ) and t is uniformly sampled from [ T ] := { 1 , 2 , ..., T } .

Score-based diffusion model formulates diffusion models with stochastic differential equations (SDE). The diffusion process { x t } T t =0 is indexed by a continuous time variable t ∈ [0 , 1] . The diffusion process can be formulated as:

where f ( x , t ) : R n ↦→ R n is the drift coefficient characterizing the shift of the distribution, g ( t ) is the diffusion coefficient controlling the noise scales, and w is the standard Wiener process. The reverse process is characterized via the reverse time SDE of Equation (3):

where ∇ x log p t ( x ) is the time-dependent score function that can be approximated with neural networks s θ parameterized with θ , which is trained via the score matching loss L s [26, 47]:

where λ : [0 , 1] → R is a weighting function and t is uniformly sampled over [0 , 1] .

3 DiffAttack

3.1 Evasion attacks against diffusion-based purification

A class of defenses leverages generative models for adversarial purification [43, 48, 45, 60]. The adversarial images are transformed into latent representations, and then the purified images are sampled starting from the latent space using the generative models. The process is expected to remove the crafted perturbations since the training distribution of generative models is assumed to be clean. With diffusion models showing the power of image generation recently [15, 39], diffusion-based adversarial purification has achieved SOTA defense performance [34, 4].

We first formulate the problem of evasion attacks against diffusion-based purification defenses. Suppose that the process of diffusion-based purification, including the diffusion and reverse process, is denoted by P : R n ↦→ R n where n is the dimension of the input x 0 , and the classifier is denoted by F : R n ↦→ [ K ] where K is the number of classes. Given an input pair ( x 0 , y ) , the adversarial example ˜ x 0 satisfies:

̸

where F i ( · ) is the i -th element of the output, d : R n × R n ↦→ R is the distance function in the input space, and δ max is the perturbation budget.

Since directly searching for the adversarial instance ˜ x 0 based on Equation (6) is challenging, we often use a surrogate loss L to solve an optimization problem:

where P ( · ) is the purification process with DDPM (Equation (1)) or score-based diffusion (Equations (3) and (4)), and the surrogate loss L is often selected as the classification-guided loss, such as CW loss [7], Cross-Entropy loss and difference of logits ratio (DLR) loss [12]. Existing adaptive attack methods such as PGD [30] and APGD attack [12] approximately solve the optimization problem in Equation (7) via computing the gradients of loss L with respect to the decision variable ˜ x 0 and iteratively updating ˜ x 0 with the gradients.

Diffusion process

Reverse process

Segment-wise forwarding-backwarding (Sec.3.3)

t=0

t=T/3

t=2T/3

t=T

Deviated-reconstruction loss (Sec.3.2)

Classifier

''Dog''(GT)

''Fish''

(Adv. Target)

Adv. Attacks

DiffAttack

L

dev

dev

L

dev

L

dev

L

However, we observe that the gradient computation for the diffusion-based purification process is challenging for three reasons: 1) the long sampling process of the diffusion model induces an extremely deep computational graph which poses the problem of vanishing/exploding gradient [2], 2) the deep computational graph impedes gradient backpropagation, which requires high memory cost [60, 4], and 3) the diffusion and sampling process introduces large randomness which makes the calculated gradients unstable and noisy.

To address these challenges, we propose a deviated-reconstruction loss (in Section 3.2) and a segmentwise forwarding-backwarding algorithm (in Section 3.3) and design an effective algorithm DiffAttack by integrating them into the attack technique (in Section 3.4).

3.2 Deviated-reconstruction loss

In general, the surrogate loss L in Equation (7) is selected as the classification-guided loss, such as CW loss, Cross-Entropy loss, or DLR loss. However, these losses can only be imposed at the classification layer, and induce the problem of vanishing/exploding gradients [2] due to the long diffusion length. Specifically, the diffusion purification process induces an extremely deep graph. For example, DiffPure applies hundreds of iterations of sampling and uses deep UNet with tens of layers as score estimators. Thus, the computational graph consists of thousands of layers, which could cause the problem of gradient vanishing/exploding. Similar gradient problems are also mentioned with generic score-based generative purification (Section 4, 5.1 in [60]). Backward path differentiable approximation (BPDA) attack [2] is usually adopted to overcome such problems, but the surrogate model of the complicated sampling process is hard to find, and a simple identity mapping function is demonstrated to be ineffective in the case [34, 4, 60].

To overcome the problem of exploding/vanishing gradients, we attempt to impose intermediate guidance during the attack. It is possible to build a set of classifiers on the intermediate samples in the reverse process and use the weighted average of the classification-guided loss at multiple layers as the surrogate loss L . However, we observe that the intermediate samples are noisy, and thus using classifier F that is trained on clean data cannot provide effective gradients. One solution is to train a set of classifiers with different noise scales and apply them to intermediate samples to impose classification-guided loss, but the training is too expensive considering the large diffusion length and variant noise scales at different time steps. Thus, we propose a deviated-reconstruction loss to address the challenge via imposing discrepancy for samples between the diffusion and reverse processes adversarially to provide effective loss at intermediate time steps.

Concretely, since a sequence of samples is generated in the diffusion and reverse processes, effective loss imposed on them would relieve the problem of vanishing/exploding gradient and benefit the optimization. More formally, let x t , x ′ t be the samples at time step t in the diffusion process and the reverse process, respectively. Formally, we maximize the deviated-reconstruction loss L dev

formulated as follows:

where α ( · ) is time-dependent weight coefficients and d ( x t , x ′ t ) is the distance between noisy image x t in the diffusion process and corresponding sampled image x ′ t in the reverse process. The expectation over t is approximated by taking the average of results at uniformly sampled time steps in [0 , T ] , and the loss at shallow layers in the computational graph (i.e., large time step t ) helps relieve the problem of vanishing/exploding gradient. The conditional expectation over x t , x ′ t given x 0 is approximated by purifying x 0 multiple times and taking the average of the loss.

Intuitively, the deviated-reconstruction loss in Equation (8) pushes the reconstructed sample x ′ t in the reverse process away from the sample x t at the corresponding time step in the diffusion process, and finally induces an inaccurate reconstruction of the clean image. Letting q t ( x ) and q ′ t ( x ) be the distribution of x t and x ′ t , we can theoretically prove that the distribution distance between q t ( x ) and q ′ t ( x ) positively correlates with the score-matching loss of the score-based diffusion or the density gradient loss of the DDPM. In other words, maximizing the deviated-reconstruction loss in Equation (8) induces inaccurate data density estimation, which results in the discrepancy between the sampled distribution and the clean training distribution.

Theorem 1. Consider adversarial sample ˜ x 0 := x 0 + δ , where x 0 is the clean example and δ is the perturbation. p t ( x ) , p ′ t ( x ) , q t ( x ) , q ′ t ( x ) are the distribution of x t , x ′ t , ˜ x t , ˜ x ′ t where x ′ t represents the reconstruction of x t in the reverse process. D TV ( · , · ) measures the total variation distance. Given a VP-SDE parameterized by β ( · ) and the score-based model s θ with mild assumptions that ∥∇ x log p t ( x ) -s θ ( x , t ) ∥ 2 2 ≤ L u , D TV ( p t , p ′ t ) ≤ ϵ re , and a bounded score function by M (specified in Appendix C.1), we have:

Proof sketch. We first use the triangular inequality to upper bound D TV ( q t , q ′ t ) with D TV ( q t , p t ) + D TV ( p t , p ′ t ) + D TV ( p ′ t , q ′ t ) . D TV ( q t , p t ) can be upper bounded by a function of the Hellinger distance H ( q t , p t ) , which can be calculated explicitly. D TV ( p t , p ′ t ) can be upper bounded by the reconstruction error ϵ re by assumption. To upper bound D TV ( p ′ t , q ′ t ) , we can leverage Pinker's inequality to alternatively upper bound the KL-divergence between p ′ t and q ′ t which can be derived by using the Fokker-Planck equation [44] in the reverse SDE.

Remark. Alarge deviated-reconstruction loss can indicate a large total variation distance D TV ( q t , q ′ t ) , which is the lower bound of a function with respect to the score-matching loss E t, x ∥ s θ ( x , t ) -∇ x log q ′ t ( x ) ∥ 2 2 (in RHS of Equation (9)). Therefore, we show that maximizing the deviatedreconstruction loss implicitly maximizes the score-matching loss, and thus induces inaccurate data density estimation to perform an effective attack. The connection of deviated-reconstruction loss and the density gradient loss for DDPM is provided in Thm. 3 in Appendix C.2.

3.3 Segment-wise forwarding-backwarding algorithm

Adaptive attacks against diffusion-based purification require gradient backpropagation through the forwarding path. For diffusion-based purification, the memory cost scales linearly with the diffusion length T and is not feasible in a realistic application. Therefore, existing defenses either use a surrogate model for gradient approximation [55, 56, 60, 45] or consider adaptive attacks only for a small diffusion length [4], but the approximation can induce error and downgrade the attack performance a lot. Recently, DiffPure [34] leverages the adjoint method [28] to backpropagate the gradient of SDE within reasonable memory cost and enables adaptive attacks against score-based purification. However, it cannot be applied to a discrete process, and the memory-efficient gradient backpropagation algorithm is unexplored for DDPM. Another line of research [9, 8, 19] proposes the technique of gradient checkpointing to perform gradient backpropagation with memory efficiency. Fewer activations are stored during forwarding passes, and the local computation graph is constructed via recomputation. However, we are the first to apply the memory-efficient backpropagation technique to attack diffusion purification defenses and resolve the problem of memory cost during attacks, which is realized as a challenging problem by prior attacks against purification defenses [34, 60]. Concretely, we propose a segment-wise forwarding-backwarding algorithm, which leads to memory-efficient gradient computation of the attack loss with respect to the adversarial examples.

Wefirst feed the input x 0 to the diffusion-based purification process and store the intermediate samples x 1 , x 2 , ..., x T in the diffusion process and x ′ T , x ′ T -1 , ..., x ′ 0 in the reverse process sequentially. For ease of notation, we have x t +1 = f d ( x t ) and x ′ t = f r ( x ′ t +1 ) for t ∈ [0 , T -1] . Then we can backpropagate the gradient iteratively following:

At each time step t in the reverse process, we only need to store the gradient ∂ L /∂ x ′ t , the intermediate sample x ′ t +1 and the model f r to construct the computational graph. When we backpropagate the gradients at the next time step t +1 , the computational graph at time step t will no longer be reused, and thus, we can release the memory of the graph at time step t . Therefore, we only have one segment of the computational graph used for gradient backpropagation in the memory at each time step. We can similarly backpropagate the gradients in the diffusion process. Ignoring the memory cost of storing intermediate samples (usually small compared to the memory cost of computational graphs), the memory cost of our segment-wise forwarding-backwarding algorithm is O (1) (validated in Figure 3).

We summarize the detailed procedures in Algorithm 1 in Appendix B. It can be applied to gradient backpropagation through any discrete Markov process with a long path. Basically, we 1) perform the forward pass and store the intermediate samples, 2) allocate the memory of one segment of the computational graph in the memory and simulate the forwarding pass of the segment with intermediate samples, 3) backpropagate the gradients through the segment and release the memory of the segment, and 4) go to step 2 and consider the next segment until termination .

3.4 DiffAttack Technique

Currently, AutoAttack [12] holds the state-of-the-art attack algorithm, but it fails to attack the diffusion-based purification defenses due to the challenge of vanishing/exploding gradient , memory cost and large randomness . To specifically tackle the challenges, we integrate the deviatedreconstruction loss (in Section 3.2) and the segment-wise forwarding-backwarding algorithm (in Section 3.3) as an attack technique DiffAttack against diffusion-based purification, including the scorebased and DDPM-based purification defenses. The pictorial illustration of DiffAttack is provided in Figure 1.

Concretely, we maximize the surrogate loss L as the optimization objective in Equation (7):

where L cls is the CE loss or DLR loss, L dev is the deviated-reconstruction loss formulated in Equation (8), and λ is the weight coefficient. During the optimization, we use the segment-wise forwarding-backwarding algorithm for memory-efficient gradient backpropagation. Note that L dev suffers less from the gradient problem compared with L cls , and thus the objective of L dev can be optimized more precisely and stably, but it does not resolve the gradient problem of L cls . On the other hand, the optimization of L dev benefits the optimization of L cls in the sense that L dev can induce a deviated reconstruction of the image with a larger probability of misclassification. λ controls the balance of the two objectives. A small λ can weaken the deviated-reconstruction object and make the attack suffer more from the vanishing/exploded gradient problem, while a large λ can downplay the guidance of the classification loss and confuse the direction towards the decision boundary of the classifier.

Attack against randomized diffusion-based purification. DiffAttack tackles the randomness problem from two perspectives: 1) sampling the diffused and reconstructed samples across different time steps multiple times as in Equation (8) (similar to EOT [3]), and 2) optimizing perturbations for all samples including misclassified ones in all steps. Perspective 1) provides a more accurate estimation of gradients against sample variance of the diffusion process. Perspective 2) ensures a more effective and stable attack optimization since the correctness of classification is of high variance over different steps in the diffusion purification setting. Formally, the classification result of a sample can be viewed as a Bernoulli distribution (i.e., correct or false). We should reduce the success rate of the Bernoulli distribution of sample classification by optimizing them with a larger attack loss, which would lead to lower robust accuracy. In other words, one observation of failure in classification does not indicate that the sample has a low success rate statistically, and thus, perspective 2) helps

to continue optimizing the perturbations towards a lower success rate (i.e., away from the decision boundary). We provide the pseudo-codes of DiffAttack in Algorithm 2 in Appendix D.1.

4 Experimental Results

In this section, we evaluate DiffAttack from various perspectives empirically. As a summary, we find that 1) DiffAttack significantly outperforms other SOTA attack methods against diffusion-based defenses on both the score-based purification and DDPM-based purification models, especially under large perturbation radii (Section 4.2 and Section 4.3); 2) DiffAttack outperforms other strong attack methods such as the black-box attack and adaptive attacks against other adversarial purification defenses (Section 4.4); 3) a moderate diffusion length T benefits the model robustness, since too long/short diffusion length would hurt the robustness (Section 4.5); 4) our proposed segment-wise forwarding-backwarding algorithm achieves O (1) -memory cost and outperforms other baselines by a large margin (Section 4.6); and 5) attacks with the deviated-reconstruction loss added over uniformly sampled time steps outperform that added over only initial/final time steps (Section 4.7).

4.1 Experiment Setting

Dataset & model. We validate DiffAttack on CIFAR-10 [27] and ImageNet [13]. We consider different network architectures for classification. Particularly, WideResNet-28-10 and WideResNet70-16 [61] are used on CIFAR-10, and ResNet-50 [23], WideResNet-50-2 (WRN-50-2), and ViT (DeiT-S) [16] are used on ImageNet. We use a pretrained score-based diffusion model [49] and DDPM [25] to purify images following [34, 4].

Evaluation metric. The performance of attacks is evaluated using the robust accuracy (Rob-Acc), which measures the ratio of correctly classified instances over the total number of test data under certain perturbation constraints. Following the literature [12], we consider both ℓ ∞ and ℓ 2 attacks under multiple perturbation constraints ϵ . We also report the clean accuracy (Cl-Acc) for different approaches.

Baselines. To demonstrate the effectiveness of DiffAttack, we compare it with 1) SOTA attacks against score-based diffusion adjoint attack (AdjAttack) [34], 2) SOTA attack against DDPM-based diffusion Diff-BPDA attack [4], 3) SOTA black-box attack SPSA [53] and square attack [1], and 4) specific attack against EBM-based purification joint attack [60]. We defer more explanations of baselines and experiment details to Appendix D.2. The codes are publicly available at https: //github.com/kangmintong/DiffAttack .

4.2 Attack against score-based purification

DiffPure [34] presents the state-of-theart adversarial purification performance using the score-based diffusion models [49]. It proposes a strong adaptive attack (AdjAttack) which uses the adjoint method [28] to efficiently backpropagate the gradients through reverse SDE. Therefore, we select AdjAttack as the strong baseline and compare DiffAttack with it. The results on CIFAR-10 in Table 1 show that DiffAttack achieves much lower robust accuracy compared with AdjAttack under different types of attacks ( ℓ ∞ and ℓ 2 attack) with multiple perturbation constraints ϵ . Concretely, DiffAttack decreases the robust accuracy

of models by over 20% under ℓ ∞ attack with ϵ = 8 / 255 ( 70 . 64% → 46 . 88% on WideResNet-28-10 and 71 . 29% → 45 . 31% on WideResNet-70-16). The effectiveness of DiffAttack also generalizes well to large-scale datasets ImageNet as shown in Table 2. Note that the robust accuracy of the state-of-the-art non-diffusion-based purification defenses [38, 21] achieve about 65% robust accuracy on CIFAR-10 with WideResNet-28-10 under ℓ ∞ = 8 / 255 attack ( ϵ = 8 / 255 ), while the performance of score-based purification under AdjAttack in the same setting is 70.64%. However, given the strong DiffAttack, the robust accuracy of score-based purification drops to 46 . 88% . It motivates us to think of more effective techniques to further improve the robustness of diffusion-based purification in future work.

4.3 Attack against DDPM-based purification

Another line of diffusion-based purification defenses [4, 55, 56] leverages DDPM [46] to purify the images with intentionally crafted perturbations. Since backpropagating the gradients along the diffusion and sampling process with a relatively large diffusion length is unrealistic due to the large memory cost, BPDA attack [2] is adopted as the strong attack against the DDPM-based purification. However, with our proposed segment-wise forwarding-backwarding algorithm, we can compute the gradients within a small budget of memory cost, and to our best knowledge, this is the first work to achieve adaptive gradient-based adversarial attacks against DDPM-based purification. We compare DiffAttack with Diff-BPDA attack [4] on CIFAR-10, and the results in Table 3 demonstrate that DiffAttack outperforms the baseline by a large margin under both ℓ ∞ and ℓ 2 attacks.

4.4 Comparison with other adaptive attack methods

Besides the AdjAttack and Diff-BPDA attacks against existing diffusion-based purification defenses, we also compare DiffAttack with other general types of adaptive attacks: 1) black-box attack SPSA [53] and 2) square attack [1], as well as 3) adaptive attack against score-based generative models joint attack (Score / Full) [60]. SPSA attack approximates the gradients by randomly sampling from a pre-defined distribution and using the finite-difference method. Square attack heuristically searches for adversarial examples in a

low-dimensional space with the constraints of perturbation patterns. Joint attack (score) updates the input by the average of the classifier gradient and the output of the score estimation network, while joint attack (full) leverages the classifier gradients and the difference between the input and the purified samples. The results in Table 4 show that DiffAttack outperforms SPSA, square attack, and joint attack by a large margin on score-based and DDPM-based purification defenses . Note that joint attack (score) cannot be applied to the DDPM-based pipeline due to the lack of a score estimator. AdjAttack fails on the DDPM-based pipeline since it can only calculate gradients through SDE.

4.5 Robustness with different diffusion lengths

We observe that the diffusion length plays an extremely important role in the effectiveness of adversarial purification. Existing DDPM-based purification works [56, 55] prefer a small diffusion length, but we find it vulnerable under our DiffAttack. The influence of the diffusion length T on the performance (clean/robust accuracy) of the purification defense methods is illustrated in Figure 2. We observe that 1) the clean accuracy of the purification

0

20

40

60

80

100

0.02 0.06 0.10 0.14 0.18 0.22 0.26 0.30

Clean Acc

Robust Acc

Accuracy (%)

Diffusion length T

0

20

40

60

80

100

20

60

100 140 180 220 260 300

Clean Acc

Robust Acc

Accuracy (%)

Diffusion length T

defenses negatively correlates with the diffusion lengths since the longer diffusion process adds more noise to the input and induces inaccurate reconstruction of the input sample; and 2) a moderate diffusion length benefits the robust accuracy since diffusion-based purification with a small length makes it easier to compute the gradients for attacks, while models with a large diffusion length have poor clean accuracy that deteriorates the robust accuracy. We also validate the conclusion on ImageNet in Appendix D.3.

4.6 Comparison of memory cost

Recent work [4] computes the gradients of the diffusion and sampling process to perform the gradient-based attack, but it only considers a small diffusion length (e.g., 14 on CIFAR-10). They construct the computational graph once and for all, which is extremely expensive for memory cost with a large diffusion length. We use a segment-wise forwarding-backwarding algorithm in Section 3.3 to avoid allocating the memory for the whole computational graph. In this part, we validate the memory efficiency of our approach compared to [4]. The results

0

5,000

10,000

15,000

20,000

25,000

30,000

35,000

40,000

45,000

DiffAttack

Memory Cost (MB)

T=3

T=5

T=10

T=15

T=30

Diffusion length T

in Figure 3 demonstrate that 1) the gradient backpropagation of [4] has the memory cost linearly correlated to the diffusion length and does not scale up to the diffusion length of 30 , while 2) DiffAttack has almost constant memory cost and is able to scale up to extremely large diffusion length ( T = 1000 ). The evaluation is done on an RTX A6000 GPU. In Appendix D.3, we provide comparisons of runtime between DiffAttack and [4] and demonstrate that DiffAttack reduces the memory cost with comparable runtime.

4.7 Influence of applying the deviated-reconstruction loss at different time steps

We also show that the time steps at which we apply the deviated-reconstruction loss also influence the effectiveness of DiffAttack. Intuitively, the loss added at small time steps does not suffer from vanishing/exploding gradients but lacks supervision at consequent time steps, while the loss added at large time steps gains strong supervision but suffers from the gradient problem. The results in Figure 4 show that adding deviated-reconstruction loss to uniformly sampled time steps (Uni(0,T)) achieves the best attack performance and tradeoff compared with that of adding loss to the same number of partial time steps only at the initial stage ( (0 , T/ 3) ) or the final stage ( (2 T/ 3 , T ) ). For fair comparisons, we uniformly sample T/ 3 time steps (identical to partial stage guidance (0 , T/ 3) , (2 T/ 3 , T ) ) to impose L dev .

5 Related Work

Adversarial purification methods purify the adversarial input before classification with generative models. Defense-gan [43] trains a GAN to restore the clean samples. Pixeldefend [48] utilizes an autoregressive model to purify adversarial examples. Another line of research [50, 22, 17, 24, 60] leverages energy-based model (EBM) and Markov chain Monte Carlo (MCMC) to perform the purification. More recently, diffusion models have seen wide success in image generation [15, 40, 41, 42, 31, 39]. They are also used to adversarial purification [34, 4, 62, 57, 51, 55, 56] and demonstrated to achieve the state-of-the-art robustness. In this work, we propose DiffAttack specifically against diffusion-based purification and show the effectiveness in different settings, which motivates future work to improve the robustness of the pipeline.

Adversarial attacks search for visually imperceptible signals which can significantly perturb the prediction of models [52, 20]. Different kinds of defense methods are progressively broken by advanced attack techniques, including white-box attack [6, 2, 32] and black-box attack [1, 53, 35]. [11, 12, 37, 59, 29] propose a systematic and automatic framework to attack existing defense methods. Despite attacking most defense methods, these approaches are shown to be ineffective against the diffusion-based purification pipeline due to the problem of vanishing/exploding gradient, memory cost, and randomness. Therefore, we propose DiffAttack to specifically tackle the challenges and successfully attack the diffusion-based purification defenses.

6 Conclusion

In this paper, we propose DiffAttack, including the deviated-reconstruction loss added on intermediate samples and a segment-wise forwarding-backwarding algorithm. We empirically demonstrate that DiffAttack outperforms existing adaptive attacks against diffusion-based purification by a large margin. We conduct a series of ablation studies and show that a moderate diffusion length benefits the model robustness, and attacks with the deviated-reconstruction loss added over uniformly sampled time steps outperform that added over only initial/final time steps, which will help to better understand the properties of diffusion process and motivate future defenses.

Acknolwdgement. This work is partially supported by the National Science Foundation under grant No. 1910100, No. 2046726, No. 2229876, DARPA GARD, the National Aeronautics and Space Administration (NASA) under grant no. 80NSSC20M0229, the Alfred P. Sloan Fellowship, and the Amazon research award.

0

5

10

15

20

25

score-based

DDPM-based

(0, 𝑇/3)

(2𝑇/3, 𝑇)

References

Maksym Andriushchenko, Francesco Croce, Nicolas Flammarion, and Matthias Hein. Square attack: a query-efficient black-box adversarial attack via random search. In European Conference on Computer Vision , pages 484-501. Springer, 2020.

Anish Athalye, Nicholas Carlini, and David Wagner. Obfuscated gradients give a false sense of security: Circumventing defenses to adversarial examples. In International conference on machine learning , pages 274-283. PMLR, 2018.

Anish Athalye, Logan Engstrom, Andrew Ilyas, and Kevin Kwok. Synthesizing robust adversarial examples. In International conference on machine learning , pages 284-293. PMLR, 2018.

Tsachi Blau, Roy Ganz, Bahjat Kawar, Alex Bronstein, and Michael Elad. Threat modelagnostic adversarial defense using diffusion models. arXiv preprint arXiv:2207.08089 , 2022.

Yulong Cao, Ningfei Wang, Chaowei Xiao, Dawei Yang, Jin Fang, Ruigang Yang, Qi Alfred Chen, Mingyan Liu, and Bo Li. Invisible for both camera and lidar: Security of multi-sensor fusion based perception in autonomous driving under physical-world attacks. In 2021 IEEE Symposium on Security and Privacy (SP) , pages 176-194. IEEE, 2021.

Nicholas Carlini and David Wagner. Adversarial examples are not easily detected: Bypassing ten detection methods. In Proceedings of the 10th ACM workshop on artificial intelligence and security , pages 3-14, 2017.

Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In 2017 ieee symposium on security and privacy (sp) , pages 39-57. Ieee, 2017.

Bo Chang, Lili Meng, Eldad Haber, Lars Ruthotto, David Begert, and Elliot Holtham. Reversible architectures for arbitrarily deep residual neural networks. In Proceedings of the AAAI conference on artificial intelligence , volume 32, 2018.

Tianqi Chen, Bing Xu, Chiyuan Zhang, and Carlos Guestrin. Training deep nets with sublinear memory cost. arXiv preprint arXiv:1604.06174 , 2016.

Zhaoyu Chen, Bo Li, Shuang Wu, Kaixun Jiang, Shouhong Ding, and Wenqiang Zhang. Content-based unrestricted adversarial attack. arXiv preprint arXiv:2305.10665 , 2023.

Francesco Croce, Maksym Andriushchenko, Vikash Sehwag, Edoardo Debenedetti, Nicolas Flammarion, Mung Chiang, Prateek Mittal, and Matthias Hein. Robustbench: a standardized adversarial robustness benchmark. arXiv preprint arXiv:2010.09670 , 2020.

Francesco Croce and Matthias Hein. Reliable evaluation of adversarial robustness with an ensemble of diverse parameter-free attacks. In International conference on machine learning , pages 2206-2216. PMLR, 2020.

Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A largescale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition , pages 248-255. Ieee, 2009.

Luc Devroye, Abbas Mehrabian, and Tommy Reddad. The total variation distance between high-dimensional gaussians. arXiv preprint arXiv:1810.08693 , 2018.

Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in Neural Information Processing Systems , 34:8780-8794, 2021.

Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929 , 2020.

Yilun Du and Igor Mordatch. Implicit generation and modeling with energy based models. Advances in Neural Information Processing Systems , 32, 2019.

Kevin Eykholt, Ivan Evtimov, Earlence Fernandes, Bo Li, Amir Rahmati, Chaowei Xiao, Atul Prakash, Tadayoshi Kohno, and Dawn Song. Robust physical-world attacks on deep learning visual classification. In Proceedings of the IEEE conference on computer vision and pattern recognition , pages 1625-1634, 2018.

Aidan N Gomez, Mengye Ren, Raquel Urtasun, and Roger B Grosse. The reversible residual network: Backpropagation without storing activations. Advances in neural information processing systems , 30, 2017.

Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. arXiv preprint arXiv:1412.6572 , 2014.

Sven Gowal, Sylvestre-Alvise Rebuffi, Olivia Wiles, Florian Stimberg, Dan Andrei Calian, and Timothy A Mann. Improving robustness using generated data. Advances in Neural Information Processing Systems , 34:4218-4233, 2021.

Will Grathwohl, Kuan-Chieh Wang, Jörn-Henrik Jacobsen, David Duvenaud, Mohammad Norouzi, and Kevin Swersky. Your classifier is secretly an energy based model and you should treat it like one. arXiv preprint arXiv:1912.03263 , 2019.

Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition , pages 770-778, 2016.

Mitch Hill, Jonathan Mitchell, and Song-Chun Zhu. Stochastic security: Adversarial defense using long-run dynamics of energy-based models. arXiv preprint arXiv:2005.13525 , 2020.

Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems , 33:6840-6851, 2020.

Aapo Hyvärinen and Peter Dayan. Estimation of non-normalized statistical models by score matching. Journal of Machine Learning Research , 6(4), 2005.

Alex Krizhevsky. Learning multiple layers of features from tiny images. 2009.

Xuechen Li, Ting-Kam Leonard Wong, Ricky TQ Chen, and David Duvenaud. Scalable gradients for stochastic differential equations. In International Conference on Artificial Intelligence and Statistics , pages 3870-3882. PMLR, 2020.

Xiang Ling, Shouling Ji, Jiaxu Zou, Jiannan Wang, Chunming Wu, Bo Li, and Ting Wang. Deepsec: A uniform platform for security analysis of deep learning model. In 2019 IEEE Symposium on Security and Privacy (SP) , pages 673-690. IEEE, 2019.

Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. In International Conference on Learning Representations , 2018.

Chenlin Meng, Yang Song, Jiaming Song, Jiajun Wu, Jun-Yan Zhu, and Stefano Ermon. Sdedit: Image synthesis and editing with stochastic differential equations. arXiv preprint arXiv:2108.01073 , 2021.

Marius Mosbach, Maksym Andriushchenko, Thomas Trost, Matthias Hein, and Dietrich Klakow. Logit pairing methods can fool gradient-based attacks. arXiv preprint arXiv:1810.12042 , 2018.

Alexander Quinn Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. In International Conference on Machine Learning , pages 8162-8171. PMLR, 2021.

Weili Nie, Brandon Guo, Yujia Huang, Chaowei Xiao, Arash Vahdat, and Anima Anandkumar. Diffusion models for adversarial purification. In International Conference on Machine Learning (ICML) , 2022.

Nicolas Papernot, Patrick McDaniel, Ian Goodfellow, Somesh Jha, Z Berkay Celik, and Ananthram Swami. Practical black-box attacks against machine learning. In Proceedings of the 2017 ACM on Asia conference on computer and communications security , pages 506-519, 2017.

Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems , 32, 2019.

Maura Pintor, Luca Demetrio, Angelo Sotgiu, Ambra Demontis, Nicholas Carlini, Battista Biggio, and Fabio Roli. Indicators of attack failure: Debugging and improving optimization of adversarial examples. arXiv preprint arXiv:2106.09947 , 2021.

Sylvestre-Alvise Rebuffi, Sven Gowal, Dan A Calian, Florian Stimberg, Olivia Wiles, and Timothy Mann. Fixing data augmentation to improve adversarial robustness. arXiv preprint arXiv:2103.01946 , 2021.

Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. Highresolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition , pages 10684-10695, 2022.

Chitwan Saharia, William Chan, Huiwen Chang, Chris Lee, Jonathan Ho, Tim Salimans, David Fleet, and Mohammad Norouzi. Palette: Image-to-image diffusion models. In ACMSIGGRAPH 2022 Conference Proceedings , pages 1-10, 2022.

Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily Denton, Seyed Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, S Sara Mahdavi, Rapha Gontijo Lopes, et al. Photorealistic text-to-image diffusion models with deep language understanding. arXiv preprint arXiv:2205.11487 , 2022.

Chitwan Saharia, Jonathan Ho, William Chan, Tim Salimans, David J Fleet, and Mohammad Norouzi. Image super-resolution via iterative refinement. IEEE Transactions on Pattern Analysis and Machine Intelligence , 2022.

Pouya Samangouei, Maya Kabkab, and Rama Chellappa. Defense-gan: Protecting classifiers against adversarial attacks using generative models. arXiv preprint arXiv:1805.06605 , 2018.

Simo Särkkä and Arno Solin. Applied stochastic differential equations , volume 10. Cambridge University Press, 2019.

Changhao Shi, Chester Holtz, and Gal Mishne. Online adversarial purification based on self-supervision. arXiv preprint arXiv:2101.09387 , 2021.

Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In International Conference on Machine Learning , pages 2256-2265. PMLR, 2015.

Yang Song, Sahaj Garg, Jiaxin Shi, and Stefano Ermon. Sliced score matching: A scalable approach to density and score estimation. In Uncertainty in Artificial Intelligence , pages 574-584. PMLR, 2020.

Yang Song, Taesup Kim, Sebastian Nowozin, Stefano Ermon, and Nate Kushman. Pixeldefend: Leveraging generative models to understand and defend against adversarial examples. arXiv preprint arXiv:1710.10766 , 2017.

Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In International Conference on Learning Representations , 2021.

Vignesh Srinivasan, Csaba Rohrer, Arturo Marban, Klaus-Robert Müller, Wojciech Samek, and Shinichi Nakajima. Robustifying models against adversarial attacks by langevin dynamics. Neural Networks , 137:1-17, 2021.

Jiachen Sun, Weili Nie, Zhiding Yu, Z Morley Mao, and Chaowei Xiao. Pointdp: Diffusiondriven purification against adversarial attacks on 3d point cloud recognition. arXiv preprint arXiv:2208.09801 , 2022.

Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199 , 2013.

Jonathan Uesato, Brendan O'Donoghue, Pushmeet Kohli, and Aäron van den Oord. Adversarial risk and the dangers of evaluating against weak attacks. In icml2018 , 2018.

Boxin Wang, Weixin Chen, Hengzhi Pei, Chulin Xie, Mintong Kang, Chenhui Zhang, Chejian Xu, Zidi Xiong, Ritik Dutta, Rylan Schaeffer, et al. Decodingtrust: A comprehensive assessment of trustworthiness in gpt models. arXiv preprint arXiv:2306.11698 , 2023.

Jinyi Wang, Zhaoyang Lyu, Dahua Lin, Bo Dai, and Hongfei Fu. Guided diffusion model for adversarial purification. arXiv preprint arXiv:2205.14969 , 2022.

Quanlin Wu, Hang Ye, and Yuntian Gu. Guided diffusion model for adversarial purification from random noise. arXiv preprint arXiv:2206.10875 , 2022.

Chaowei Xiao, Zhongzhu Chen, Kun Jin, Jiongxiao Wang, Weili Nie, Mingyan Liu, Anima Anandkumar, Bo Li, and Dawn Song. Densepure: Understanding diffusion models towards adversarial robustness. arXiv preprint arXiv:2211.00322 , 2022.

Haotian Xue, Alexandre Araujo, Bin Hu, and Yongxin Chen. Diffusion-based adversarial sample generation for improved stealthiness and controllability. arXiv preprint arXiv:2305.16494 , 2023.

Chengyuan Yao, Pavol Bielik, Petar Tsankov, and Martin Vechev. Automated discovery of adaptive attacks on adversarial defenses. Advances in Neural Information Processing Systems , 34:26858-26870, 2021.

Jongmin Yoon, Sung Ju Hwang, and Juho Lee. Adversarial purification with score-based generative models. In International Conference on Machine Learning , pages 12062-12072. PMLR, 2021.

Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146 , 2016.

Kui Zhang, Hang Zhou, Jie Zhang, Qidong Huang, Weiming Zhang, and Nenghai Yu. Ada3diff: Defending against 3d adversarial point clouds via adaptive diffusion. arXiv preprint arXiv:2211.16247 , 2022.

A Broader Impact and Limitations

Broader impact . As an effective and popular way to explore the vulnerabilities of ML models, adversarial attacks have been widely studied. However, recent diffusion-based purification is shown hard to attack based on different trials, which raises an interesting question of whether it can be attacked. Our paper provides the first effective attack against such defenses to identify the vulnerability of diffusion-based purification for the community and inspire more effective defense approaches. In particular, we propose an effective evasion attack against diffusion-based purification defenses which consists of a deviated-reconstruction loss at intermediate diffusion steps to induce inaccurate density gradient estimation and a segment-wise forwarding-backwarding algorithm to achieve memoryefficient gradient backpropagation. The effectiveness of the deviated-reconstruction loss helps us to better understand the properties of diffusion purification. Concretely, there exist adversarial regions in the intermediate sample space where the score approximation model outputs inaccurate density gradients and finally misleads the prediction. The observation motivates us to design a more robust sampling process in the future, and one potential way is to train a more robust score-based model. Furthermore, the segment-wise forwarding-backwarding algorithm tackles the memory issue of gradient propagation through a long path. It can be applied to the gradient calculation of any discrete Markov process almost within a constant memory cost. To conclude, our attack motivates us to rethink the robustness of a line of SOTA diffusion-based purification defenses and inspire more effective defenses.

Limitations . In this paper, we propose an effective attack algorithm DiffAttack against diffusionbased purification defenses. A possible negative societal impact may be the usage of DiffAttack in safety-critical scenarios such as autonomous driving and medical imaging analysis to mislead the prediction of machine learning models. However, the foundation of DiffAttack and important findings about the diffusion process properties can benefit our understanding of the vulnerabilities of diffusionbased purification defenses and therefore motivate more effective defenses in the future. Concretely, the effectiveness of DiffAttack indicates that there exist adversarial regions in the intermediate sample space where the score approximation model outputs inaccurate density gradients and finally misleads the prediction. The observation motivates us to design a more robust sampling process in the future, and one potential way is to train a more robust score-based model. Furthermore, to control a robust sampling process, it is better to provide guidance across uniformly sampled time steps rather than only at the final stage according to our findings.

Algorithm 1 Segment-wise forwarding-backwarding algorithm (PyTorch-like pseudo-codes)

B Efficient Gradient Backpropagation

In this section, we provide the PyTorch-like pseudo-codes of the segment-wise forwardingbackwarding algorithm. At each time step t in the reverse process, we only need to store the gradient ∂ L /∂ x ′ t , the intermediate sample x ′ t +1 and the model f r to construct the computational graph. When we backpropagate the gradients at the next time step t +1 , the computational graph at

time step t will no longer be reused, and thus, we can release the memory of the graph at time step t . Therefore, we only have one segment of the computational graph used for gradient backpropagation in the memory at each time step. We can similarly backpropagate the gradients in the diffusion process.

C Proofs

C.1 Proof of Thm. 1

Assumption C.1. Consider adversarial sample ˜ x 0 := x 0 + δ , where x 0 is the clean example and δ is the perturbation. p t ( x ) , p ′ t ( x ) , q t ( x ) , q ′ t ( x ) are the distribution of x t , x ′ t , ˜ x t , ˜ x ′ t where x ′ t represents the reconstruction of x t at time step t in the reverse process. We consider a score-based diffusion model with a well-trained score-based model s θ parameterized by θ with the clean training distribution. Therefore, we assume that s θ can achieve a low score-matching loss given a clean sample and reconstruct it in the reverse process:

where D TV ( · , · ) is the total variation distance. L u and ϵ re are two small constants that characterize the score-matching loss and the reconstruction error.

Assumption C.2. We assume the score function of data distribution is bounded by M :

Lemma C.1. Consider adversarial sample ˜ x 0 := x 0 + δ , where x 0 is the clean example and δ is the perturbation. p t ( x ) , p ′ t ( x ) , q t ( x ) , q ′ t ( x ) are the distribution of x t , x ′ t , ˜ x t , ˜ x ′ t where x ′ t represents the reconstruction of x t in the reverse process. Given a VP-SDE parameterized by β ( · ) and the score-based model s θ with Assumption C.2, we have:

Proof. The reverse process of VP-SDE can be formulated as follows:

Using the Fokker-Planck equation [44] in Equation (16), we have:

Similarly, applying the Fokker-Planck equation on the reverse SDE for q ′ t ( x ) , we can get:

We use the notation h p ( x ) = 1 2 g 2 rev ( t ) ∇ x log p ′ t ( x ) -f rev ( x , t, p t ) and h q ( x ) = 1 2 g 2 rev ( t ) ∇ x log q ′ t ( x ) -f rev ( x , t, q t ) . Then according to [34](Theorem A.1), under the assumption that p ′ t ( x ) and q ′ t ( x ) are smooth and fast decaying (i.e., lim x i →∞ [ p ′ t ( x ) ∂ log p ′ ( x ) /∂ x i ] = 0 , lim x i →∞ [ q ′ t ( x ) ∂ log q ′ ( x ) /∂ x i ] = 0 ), we have:

Plugging in Equations (18) and (19), we have:

Finally, we can derive as follows:

Theorem 2 (Thm. 1 in the main text) . Consider adversarial sample ˜ x 0 := x 0 + δ , where x 0 is the clean example and δ is the perturbation. p t ( x ) , p ′ t ( x ) , q t ( x ) , q ′ t ( x ) are the distribution of x t , x ′ t , ˜ x t , ˜ x ′ t where x ′ t represents the reconstruction of x t in the reverse process. D TV ( · , · ) measures the total variation distance. Given a VP-SDE parameterized by β ( · ) and the score-based model s θ with mild assumptions that ∥∇ x log p t ( x ) -s θ ( x , t ) ∥ 2 2 ≤ L u , D TV ( p t , p ′ t ) ≤ ϵ re , and a bounded score function by M (specified with details in Appendix C.1), we have:

-s =1 -

Proof. Since we consider VP-SDE here, we have:

Using the triangular inequality, the total variation distance between q t and q ′ t can be decomposed as:

According to Assumption C.1, we have D TV ( p t , p ′ t ) ≤ ϵ re and thus, we only need to upper bound D TV ( q t , p t ) and D TV ( q ′ t , p ′ t ) ,respectively.

Using the notation α := 1 β ( t ) and ¯ α := Π t α

Therefore, we can upper bound the total variation distance between q t and p t as follows:

where we leverage the inequality between the Hellinger distance H ( · , · ) and total variation distance in Equation (31)(a) and we plug in the closed form of Hellinger distance between two Gaussian distribution [14] parameterized by µ 1 , Σ 1 , µ 2 , Σ 2 in Equation (32)(b):

Then, we will upper bound D TV ( p ′ t , q ′ t ) . We first leverage Pinker's inequality to upper bound the total variation distance with the KL-divergence:

Then we plug in the results in Lemma C.1 to upper bound KL ( p ′ t , q ′ t ) and it follows that:

where in Equation (40)(a), we leverage the fact that β ( · ) is bounded in [0 , 1] .

Combining Equations (29), (33) and (40), we can finally get:

C.2 Connection between the deviated-reconstruction loss and the density gradient loss for DDPM

Theorem 3. Consider adversarial sample ˜ x 0 := x 0 + δ , where x 0 is the clean example and δ is the perturbation. p t ( x ) , p ′ t ( x ) , q t ( x ) , q ′ t ( x ) are the distribution of x t , x ′ t , ˜ x t , ˜ x ′ t where x ′ t represents the reconstruction of x t in the reverse process. Given a DDPM parameterized by β ( · ) and the function approximator s θ with the mild assumptions that ∥ s θ ( x , t ) -ϵ ( x t , t ) ∥ 2 2 ≤ L u , D TV ( p t , p ′ t ) ≤ ϵ re , and a bounded score function by M (i.e., ∥ ϵ ( x , t ) ∥ 2 ≤ M ) where ϵ ( · , · ) represents the mapping function of the true perturbation, we have:

Proof. For ease of notation, we use the notation: α t := 1 -β t and ¯ α t := Π t s =1 α s . From the DDPM sampling process [25], we know that:

where σ 2 t = 1 -¯ α t -1 1 -¯ α t β t .

µ t,q and µ t,p represent the mean of the distribution q ′ t and p ′ t , respectively. Then from Equations (43) and (44), we have:

Applying Equation (45) iteratively, we get:

On the other hand, µ T,q -µ T,p can be formulated explicitly considering the Gaussian distribution at time step T in the diffusion process:

Combining Equations (46) and (47), we can derive that:

We then leverage the closed form formulation of the Hellinger distance between two Gaussian distributions [14] parameterized by µ 1 , Σ 1 , µ 2 , Σ 2 :

Applying it to distribution p ′ t and q ′ t , we have:

D Experiment

D.1 Pseudo-code of DiffAttack

Given an input pair ( x , y ) and the perturbation budget, we notate L := L cls + λ L dev (Equation (8)) the surrogate loss, Π the projection operator given the perturbation budget and distance metric, η the step size, α the momentum coefficient, N iter the number of iterations, and W the set of checkpoint iterations. Concretely, we select L cls as the cross-entropy loss in the first round and DLR loss in the second round following [34]. The gradient of the surrogate loss with respect to the samples is computed by forwarding the samples and backwarding the gradients for multiple times and taking the average to tackle the problem of randomness. We also optimize all the samples, including the misclassified ones, to push them away from the decision boundary. The gradient can be computed with our segment-wise forwarding-backwarding algorithm in Section 3.3, which enables DiffAttack to be the first fully adaptive attack against the DDPM-based purification defense. The complete procedure is provided in Algorithm 2.

D.2 Experiment details

We use pretrained score-based diffusion models [49] on CIFAR-10, guided diffusion models [15] on ImageNet, and DDPM [25] on CIFAR-10 to purify the images following the literature [34, 4, 55, 56]. Due to the high computational cost, we follow [34] to randomly select a fixed subset of 512 images sampled from the test set to evaluate the robust accuracy for fair comparisons. We implement DiffAttack in the framework of AutoAttack [12], and we use the same hyperparameters. Specifically, the number of iterations of attacks ( N iter ) is 100 , and the number of iterations to approximate the gradients (EOT) is 20 . The momentum coefficient α is 0 . 75 , and the step size η is initialized with 2 ϵ where ϵ is the maximum ℓ p -norm of the perturbations. The balance factor λ between the classificationguided loss and the deviated-reconstruction loss in Equation (8) is fixed as 1 . 0 and α ( · ) is set the reciprocal of the size of sampled time steps in the evaluation. We consider ϵ = 8 / 255 and ϵ = 4 / 255 for ℓ ∞ attack and ϵ = 0 . 5 for ℓ 2 attack following the literature [11, 12].

We use randomly selected 3 seeds and report the averaged results for evaluations. CIFAR-10 is under the MIT license and ImageNet is under the BSD 3-clause license.

More details of baselines. In this part, we illustrate more details of the baselines 1) SOTA attacks against score-based diffusion adjoint attack (AdjAttack) [34], 2) SOTA attack against DDPM-based

Algorithm 2 DiffAttack

diffusion Diff-BPDA attack [4], 3) SOTA black-box attack SPSA [53] and square attack [1], and 4) specific attack against EBM-based purification joint attack (score/full) [60]. AdjAttack selects the surrogate loss L as the cross-entropy loss and DLR loss and leverages the adjoint method [28] to efficiently backpropagate the gradients through SDE. The basic idea is to obtain the gradients via solving an augmented SDE. For the SDE in Equation (4), the augmented SDE that computes the gradients ∂ L /∂ x ′ T of back=propagating through it is given by:

where ∂ L ∂ x ′ 0 is the gradient of the objective L w.r.t. the x ′ 0 , and

with 1 d and 0 d representing the d -dimensional vectors of all ones and all zeros, respectively and f rev ( x , t ) := -1 2 β ( t ) x -β ( t ) ∇ x log p t ( x ) , g rev ( t ) := √ β ( t ) .

SPSA attack approximates the gradients by randomly sampling from a pre-defined distribution and using the finite-difference method. Square attack heuristically searches for adversarial examples in a low-dimensional space with the constraints of the perturbation pattern (i.e., constraining the square shape of the perturbation). Joint attack (score) updates the input by the weighted average of the classifier gradient and the output of the score estimation network (i.e., the gradient of log-likelihood with respect to the input), while joint attack (full) leverages the classifier gradients and the difference between the input and the purified samples. The update of the joint attack (score) is formulated as follows:

The update of the joint attack (full) is formulated as follows:

where η is the step size and λ ′ the balance factor fixed as 0 . 5 in the evaluation.

D.3 Additional Experiment Results

Efficiency evaluation . We evaluate the wall clock time per gradient backpropagation of the segmentwise forwarding-backwarding algorithm for different diffusion lengths and compare the time efficiency as well as the memory costs with the standard gradient backpropagation in previous attacks [4]. The results in Table 5 indicate that the segment-wise forwarding-backwarding algorithm consumes comparable wall clock time per gradient backpropagation compared with [4] and achieves a much better tradeoff between time efficiency and memory efficiency. The evaluation is done on an RTX A6000 GPU with 49,140 MB memory. In the segment-wise forwarding-backwarding algorithm, we require one forward pass and one backpropagation pass in total for the gradient computation, while the standard gradient backpropagation in [4] requires one backpropagation pass. However, since the backpropagation pass is much more expensive than the forward pass [36], our segmentwise forwarding-backwarding algorithm can achieve comparable time efficiency while significantly reducing memory costs.

More ablation studies on ImageNet . We conduct more evaluations on ImageNet to consolidate the findings in CIFAR-10. We evaluate the clean/robust accuracy (%) of diffusion-based purification with different diffusion lengths T under DiffAttack. The results in Table 6 indicate that 1) the clean accuracy of the purification defenses negatively correlates with the diffusion lengths, and 2) a moderate diffusion length benefits the robust accuracy under DiffAttack.

Tansferability of DiffAttack . ACA [10] and Diff-PGD attack [58] explore the transferability of unrestricted adversarial attack, which generates realistic adversarial examples to fool the classifier and maintain the photorealism. They demonstrate that this kind of semantic attack transfers well to other models. To explore the transferability of adversarial examples by ℓ p -norm-based DiffAttack, we evaluate the adversarial examples generated on score-based purification withResNet-50 on defenses with pretrained WRN-50-2 and DeiT-S. The results in Table 7 indicate that DiffAttack also transfers better than AdjAttack and achieves much lower robust accuracy on other models.

Ablation study of balance factor λ . As shown in Equation (11), λ controls the balance of the two objectives. A small λ can weaken the deviated-reconstruction object and make the attack suffer more from the vanishing/exploded gradient problem, while a large λ can downplay the guidance of the classification loss and confuse the direction towards the decision boundary of the classifier. The results in Table 8 show that selecting λ as 1 . 0 achieves better tradeoffs empirically, so we fix it as 1 . 0 for experiments.

D.4 Visualization

In this section, we provide the visualization of adversarial examples generated by DiffAttack. Based on the visualization on CIFAR-10 and ImageNet with different network architectures, we conclude that the perturbation generated by DiffAttack is stealthy and imperceptible to human eyes and hard to be utilized by defenses.

Clean

Adversarial

Ground truth label

Prediction

airplane

ship

automobile

frog

truck

automobile

frog

automobile

deer

truck

ship

bird

ship

truck

dog

truck

Clean

Adversarial

Ground truth label

Prediction

deer

deer

airplane

bird

dog

truck

truck

deer

horse

dog

automobile

frog

cat

automobile

horse

automobile

Y

Clean

Adversarial

Ground truth label

Prediction

urchin

dock

Irish terrier

cabbage butterfly

coral reef

ship

ringlet

福

福

Clean

Adversarial

Ground truth label

Prediction

mushroom

safe

stove

corn

mailbox

moving van

oven

Clean

Adversarial

Ground truth label

Prediction

screen

home theater

candle

coffee

computer

desk

book case

red wine

STEPHEN

STEPHENKNO

Peer reviews:
{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThis paper aims to generate adv-samples that can effectively attack diffusion-based purification. Two key strategies are proposed: (a) deviated reconstruction loss which is used as a surrogate loss to relieve gradient obfuscation existing in the long computational graph; (b) segment-wise forward-backward strategy is applied to relieve the high memory cost to calculate accurate $L_{cls}$. The experiments show that the method proposed is effective.\n\nSTRENGTHS:\nOverall, the paper is well-written and easy to read, the clarification is clear and \n\n- The problem is important since diffusion-based purification is proven to be effective and model-agnostic.\n- The proposed deviated reconstruction is proven to be effective.\n- The segment-wise forward-backward is effective and well-design\n- The experiments results are extensive.\n\nWEAKNESSES:\nI mainly have some questions here:\n\n- Will the segment-wise forward-backward affect the speed compared with the original forward-backward?\n- Intuitively, the adv-samples generated by DiffAttack are (1) hard to be purified by one specific DM, (2) hard to denoise at each stage in a given DM. When the budget $\\epsilon$ is larger, e.g. 8, 16 for imagenet, what will the adv-samples be like? \n- The code is not provided in the supp materials, it will be better to show some demo code\n- Do well need to carefully design the $\\lambda$ weights for the two losses?\n- (Some related paper) Can DiffAttack also transfer better to other networks? This topic is quite related to some recent papers, which prove that only attacking the diffusion model can be transferred well. [1, 2]\n\nI am willing to raise my score if most of the questions are solved.\n\n\n\n[1] Chen, Z., Li, B., Wu, S., Jiang, K., Ding, S., & Zhang, W. (2023). Content-based Unrestricted Adversarial Attack. arXiv preprint arXiv:2305.10665.\n\n[2] Xue, H., Araujo, A., Hu, B. and Chen, Y., (2023). Diffusion-Based Adversarial Sample Generation for Improved Stealthiness and Controllability. arXiv preprint arXiv:2305.16494.\n\nQUESTIONS:\nrefer to `Weaknesses`\n\nLIMITATIONS:\nNULL", "TITLE": "Official Review", "RECOMMENDATION": 5, "REVIEWER_CONFIDENCE": 2, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2023-06-28"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThis paper proposes a new adaptive attack to unify the robustness evaluation of diffusion-based purification defenses, including both score-based and DDPM-based diffusion models. The new attack mainly includes two novel techniques to overcome the challenges of evaluating diffusion-based purification defenses. The first technique is a regularizer that encourages a large distance between the forward images and their counterparts in the reverse process, which is proposed to tackle the vanishing or exploding gradients problem. The second technique is a forward-backward algorithm that allows for gradient back-propagation segment by segment, which is proposed to reduce the high memory cost. Evaluations on CIFAR-10 and ImageNet show that the proposed adaptive attack can lower the robust accuracy by a large margin while maintaining low memory costs.\n\nSTRENGTHS:\n### Originality\n\n* **Novel attack techniques.** The overall attack is novel. The proposed regularizer is not surprising but requires some insight to apply properly. The segment-wise forward-backward algorithm is also novel to my knowledge.\n\n### Quality\n\n* **Comprehensive evaluations.** The evaluation includes two models on CIFAR-10 and three models on ImageNet, with two purification defenses and several baseline adaptive attacks.\n* **Good ablation studies.** Other studies of the diffusion lengths, memory cost, and the proposed loss term are relatively sufficient.\n* **The theorem unifies attacks against score-based and DDPM-based purification defenses.** The presented two theorems show that increasing the new loss term can increase the data estimation loss of both DDPM-based and score-based purification defenses, although these theorems are not sufficiently discussed or motivated.\n\n### Clarity\n\nN/A\n\n### Significance\n\n* **Timely topic.** Diffusion-based purification is a fast-developing direction in adversarial example defenses. Given the well-known challenges and the lacked systemized evaluation of these defenses, this paper tackles an important problem in adversarial example defenses.\n* **Strong results.** It is good to see that the proposed attack can lower the robust accuracy by around 10% to 20%. The memory cost is also very low compared with previous approaches.\n\nWEAKNESSES:\n### Originality\n\n**1. [Moderate] Missing related work for memory-efficient gradient back-propagation.**\n\nOne major contribution of this paper is the memory-efficient gradient back-propagation algorithm. However, this paper did not discuss this literature and potential previous approaches for improving memory efficiency, either for the general optimization problem or for the diffusion model specifically. It is also claimed that this algorithm *\"can be used for any discrete Markov process.\"* This is a strong claim and seems to contribute to a broader area. Yet, without a solid discussion of related work, it is unclear how to position this algorithm in the literature. For example, is there any existing memory-efficient algorithm that is also able to tackle the memory overheads when evaluating diffusion-based purification defense? If so, a further ablation study may be necessary to show why the algorithm in this paper is still needed. If not, it is recommended to highlight this contribution more.\n\n**2. [Minor] Attack framework vs. attack techniques.**\n\nThe proposed methods are more like novel attack techniques rather than an attack framework. As far as I can tell from Algorithm 2, the attack generally follows the existing PGD or APGD attack framework (gradient update + projection). It is suggested to tune down this claim if the authors could not differentiate the proposed attack's framework from existing ones.\n\n### Quality\n\n**3. [Major] Did not address the motivated challenge of unbounded randomness.**\n\nThe authors called out the *\"unbounded randomness\"* problem in many places throughout the paper (e.g., lines 6, 32, 43, 133, 226, 391). However, the paper did not explain how this problem was resolved by the two proposed techniques. The missing explanation is confirmed by the summarized technical contributions in L69-83, where the two proposed techniques both tackle one of the remaining two challenges. There are two places discussing the randomness problem but likely for some other contexts: the expectation in Equation (8) and the optimization decision in L234-240. However, neither of these discussions could explain the \"unbounded randomness\" challenge in the original evaluation.\n\nPlease clarify if the proposed attack could tackle the randomness problem. If not, it is suggested to discuss why the proposed attack does not need to tackle the randomness problem to obtain strong results. If that is indeed the case, I am curious if the results in this paper would connect to the recent studies showing that randomness might be unhelpful in defenses [A, B]. Otherwise, is it possible to lower the robust accuracy even more if the randomness problem is explicitly tackled? Combined together they could strengthen this paper by showing some insights into the most challenging problem in evaluating purification defenses (gradient, memory, or randomn[[2023-06-28]]ess).\n\n[A] On the Limitations of Stochastic Pre-processing Defenses. NeurIPS 2022.\n[B] Randomness in ML Defenses Helps Persistent Attackers and Hinders Evaluators. arXiv 2023.\n\n**4. [Major] It is unclear how the gradient issue was resolved.**\n\nThe authors claimed that the proposed deviated-reconstruction loss in Equation (8) could resolve the gradient problems, including both gradient obfuscation (L48, L72, etc.) and gradient vanishing/exploding (L10, L141, etc.). However, it is unclear how these problems are resolved by the proposed loss term.\n\nThis issue has three folds.\n\n1. **[Minor] It is unclear what exact problem is being resolved** when the authors mixed the concepts of \"gradient obfuscation\" and \"vanishing/exploding gradients.\" Specifically, \"gradient obfuscation\" is a general concept that also includes non-differentiable defense components, where the gradient is undefined and hence zero, yet \"vanishing/exploding gradients\" specifically refers to the defined but overly small or large gradients in differentiable defense components. While these are minor conceptual confusion, it is suggested to be consistent in the wording and clarify if it is the \"non-differentiable\" or \"differentiable but vanishing/exploding\" problem that the technique aims to solve, as their solutions typically require different strategies.\n2. **[Moderate] It is unclear if the gradient issue indeed exists in previous evaluations.** While it is true that deep networks could have the problem of vanishing or exploding gradients, they have not been explicitly observed by previous evaluations of purification-based defenses, such as DiffPure [29]. Given this, it is hard to justify if the proposed techniques could obtain stronger results because they have indeed resolved the gradient issues or some other undiscovered reasons.\n3. **[Major] It is unclear why adding a loss term B would resolve the gradient problem of the existing loss term A.** Specifically, if there were a gradient problem in the original robustness evaluation (with only $\\mathcal{L}\\_{cls}$), it means that the loss term $\\mathcal{L}\\_{cls}$ has already exhibited some form of gradient obfuscation (be it non-differentiable or vanishing gradients). In this case, why would adding a new loss term $\\mathcal{L}\\_{dev}$ would be able to resolve the gradient problem in $\\mathcal{L}\\_{cls}$? For example, if the total loss shows non-vanishing gradients, it is very likely that the gradient of $\\mathcal{L}\\_{cls}$ is still vanishing, and the observed gradient solely comes from the added $\\mathcal{L}\\_{dev}$. While it is explained how $\\mathcal{L}\\_{dev}$ can relieve the gradient problem (L153), it only explains how $\\mathcal{L}\\_{dev}$ relieve the gradient problem of itself but not $\\mathcal{L}\\_{cls}$.\n\n**5. [Major] Unclear effectiveness of the proposed regularizer.**\n\nGiven that it is unclear how the gradient issue was resolved, I feel the effectiveness of $\\mathcal{L}\\_{dev}$ should require more exploration from two perspectives.\n1. If it indeed solves the gradient problem of $\\mathcal{L}\\_{cls}$, the authors should provide evidence showing that the problem (1) exists before adding $\\mathcal{L}\\_{dev}$, and (2) disappears after adding $\\mathcal{L}\\_{dev}$.\n2. If it cannot solve the gradient problem of $\\mathcal{L}\\_{cls}$ but mostly optimizes the gradient problem of itself, then it seems to me that making forward-backward samples deviated is more effective than increasing the classification loss, which is an interesting insight. In this case, I would recommend the authors explore the rationale behind this observation, and highlight the efforts of resolving gradient problems in $\\mathcal{L}\\_{dev}$ rather than $\\mathcal{L}\\_{cls}$. Additionally, an ablation study of the loss weight $\\lambda$ should be included.\n\n**6. [Moderate] Unclear discussion about randomized purification.**\n\nThe discussion at L234 is unclear (even with L674-676).\n* First of all, if a single prediction has a high variance, the ultimate prediction should be an ensemble of multiple predictions, e.g., through majority vote. After that, it seems reasonable for attacks not to evaluate misclassified samples. From my understanding, this choice is not to reduce the computational cost, but a fact that you do not need to attack it -- you already find an adversarial example with distance zero.\n* I did not see the logical connection between L234-L237 and L237-L240, mostly because it is unclear if the first part refers to the fixed clean image or the sampled images during the attack.\n* Also, the effectiveness of this choice was not evaluated. Is this choice a must-have for the final results?\n\n**7. [Minor] Visualization of purified noise.**\n\nSince this paper was able to circumvent purification defenses, it is suggested to also visualize the adversarial noise before and after the purification defense. Right now only the pre-purification adversarial examples are provided.\n\n### Clarity\n\n**8. [Major] The presentation is confusing and contrived.**\n\n* Be consistent when describing the gradient problem (detailed in Quality-4.1). The current presentation uses \"gradient obfuscation\" and \"vanishing/exploding gradients\" interchangeably, but the previous term is a general concept that also includes non-differentiable problems. In Section 3.2, jumping between these two terms and the proposed technique is very distracting. It is suggested to use only one of them and be clear about what specific problem you are trying to solve.\n* The intuition behind Equation (8) is not clear until paragraph L166. It is suggested to explain the intuition (deviation, not the gradient problem) first.\n* The paragraph L157 comes out of the blue and is very dense, it might fit more at the end of Section 3.2.\n* Theorem 1 also comes out of the blue. The use of this theorem is unclear until L189. It is suggested to explain the remark (L187) or at least its high-level idea before introducing the theorem.\n* The use of Theorem 3 was presented without any discussion.\n* It is a bit hard to determine what exact defense was evaluated, it would be good to specify the defense name rather than citations.\n\n**9. [Minor] Typos and notations.**\n\n* Undefined terms\n\t* L151, $d()$\n\t* L172, \"data density estimation\"\n\t* L177, VP-SDSE\n\t* L206, $f\\_d$ and $f\\_r$\n * Typos\n\t* L142, Path -> Pass\n\t* L152, sampled -> reconstructed.\n\n### Significance\n\nN/A\n\nQUESTIONS:\nI am willing to raise my score if the following questions are adequately answered or clarified, ordered by importance.\n\n1. Quality 4, 5\n2. Quality 3\n3. Quality 6 (merge to Quality 3 if they are relevant)\n4. Originality 1\n5. Quality 7\n6. Fix Clarity 8\n\nLIMITATIONS:\nN/A", "TITLE": "Official Review", "RECOMMENDATION": 6, "REVIEWER_CONFIDENCE": 4, "SOUNDNESS_CORRECTNESS": 2, "DATE": "2023-06-30"}

comments: SUMMARY:
This paper proposes a framework, DiffAttack, to attack against diffusion-based adversarial purification defenses. To address the issue of gradient vanishing/exploding, the paper introduces the concept of deviated-reconstruction loss and theoretically analyzes its relationship with density gradient estimation. To overcome the challenge of high memory cost, the paper presents a segment-wise forwarding-backwarding algorithm. Empirical experiments demonstrate the effectiveness of the proposed method and provide observations that contribute to a better understanding of the properties of the diffusion process.

STRENGTHS:
1. The content is rich.
2. The theoretical analysis is solid.
3. The experimental results show improvements compared to the competing algorithm.

WEAKNESSES:
1. Section 3.2 discusses that maximizing the deviated-reconstruction loss in Equation (8) can lead to inaccurate data density estimation, which results in a sampling distribution that is inconsistent with the clean training distribution. However, it does not provide a detailed explanation of how this helps alleviate gradient vanishing/exploding.
2. Additional experiments should be conducted to investigate the transferability of DiffAttack.

QUESTIONS:
1. Line 151 does not provide a specific equation for α(·).
2. The paragraph from lines 157-165 should be placed before the paragraph from lines 147-156.

LIMITATIONS:
NA
TITLE: Official Review
SOUNDNESS_CORRECTNESS: 4
DATE: 2023-07-05

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThe paper introduces an adversarial attack focused on diffusion-based purification techniques. In diffusion-based purification, a (malicious) input is first noised and then denoised by a diffusion model before being fed through the classifier. The paper aims at solving the issues that arise when using backpropagation-based PGD attacks due to the size of the denoising diffusion graph. The two main contributions are:\n\n - A per-timestep deviated reconstruction loss that maximizes the distance between the noisy version of the original image at a certain timestep and the denoising reconstruction. \n - Segment-wise forwarding-backwarding which is essentially gradient checkpointing for diffusion graphs\n\nIn the evaluation. they test their method against a variety of SOTA baselines on CIFAR10 and ImageNet and are able to beat previously best achieved robust accuracies by a margin.\n\nSTRENGTHS:\n- The evaluation protocol seems reasonable to me and the results are good across the board compared to the given baselines.\n - Overall the presentation is clear\n - Both gradient checkpointing and the deviated reconstruction loss are quite simple ideas that seem to work well at solving the problem at hand.\n\nWEAKNESSES:\n- I think the formulation of the segment-wise forwarding-backwarding algorithm makes it seem more novel than it truly is. Gradient checkpointing has been used to compute gradients in deep computational graphs by trading memory for compute in a lot of papers. I agree that diffusion graphs are well suited for this approach as the diffusion latents that are stored are very compact in size compared to the activations inside the score-net, but I still believe that it would be clearer to the reader to just refer to it as gradient-checkpointing. \n - I personally find some arrows in Figure 1 to be a bit confusing. I do not really understand the red arrows DiffAttack in the top part of the graph at t=0 and it's not super clear how they interact with the grey arrows for segment-wise forwarding-backwarding. I understand how the method works from the description in the text and I think it's a good idea to have a figure illustrating gradient flow in the paper but I believe clarity could be improved here. \n - In my opinion, Section 3 should contain a brief description of diffusion-based purification defenses in mathematical notation as the paper is explicitly aimed at attacking them. \n - I think it should be clearly stated at (11) that the goal is to maximize the objective similar to (6)/(7). Maybe it would even improve clarity to add a max close to (8) as minimization is more common in deep learning literature\n - I like Section 4.7 but I think it could be improved by showing results without the added deviated-reconstruction loss at all.\n - I believe the theoretical connection between Theorem 1 and the rest of the paper is rather weak. The Theorem only connects total variation to a mismatch between the ground-truth score function and the network estimate of the score. I think this would be a lot more useful if the paper would actually maximize the total-variation distance or if the Theorem could be stated in terms of the quantity being maximized.\n\nQUESTIONS:\n- Especially in classifier guidance, it is common to denoise the current latent x_t to get a coarse estimate of x_0 and then calculate the gradient through this single-step approximation (For example \"UPainting: Unified Text-to-Image Diffusion Generation with Cross-modal Guidance\" Li et Al 2022 ). You mention several strategies in 3.2 to prevent gradient obfuscation by introducing additional losses at intermediate steps. Would it be possible to apply such an approach to your problem and do you expect it to work better/worse than your deviated-reconstruction loss?\n\nLIMITATIONS:\n- I think the paper is very applicable to diffusion-based purifications and the authors do not mention strong limitations either.", "TITLE": "Official Review", "RECOMMENDATION": 5, "REVIEWER_CONFIDENCE": 4, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2023-07-11"}