R OBUST L EARNING M EETS G ENERATIVE M ODELS : C AN P ROXY D ISTRIBUTIONS I MPROVE A DVERSARIAL R OBUSTNESS ?
Anonymous authors
Paper under double-blind review
A BSTRACT
While additional training data improves the robustness of deep neural networks against adversarial examples, it presents the challenge of curating a large number of speciﬁc real-world samples.
We circumvent this challenge by using additional data from proxy distributions learned by advanced generative models.
We ﬁrst seek to formally understand the transfer of robustness from classiﬁers trained on proxy distributions to the real data distribution.
We prove that the difference between the robustness of a classiﬁer on the two distributions is upper bounded by the conditional Wasserstein distance between them.
Next we use proxy distributions to signiﬁcantly improve the performance of adversarial training on ﬁve different datasets.
For example, we improve robust accuracy by up to 7 .
5 % and 6 .
7 % in (cid:96) ∞ and (cid:96) 2 threat model over baselines that are not using proxy distributions on the CIFAR-10 dataset.
We also improve certiﬁed robust accuracy by 7 . 6 % on the CIFAR-10 dataset.
We further demonstrate that different generative models bring a disparate improvement in the performance in robust training.
We propose a robust discrimination approach to characterize the impact of individual generative models and further provide a deeper understanding of why current state-of-the-art in diffusion-based generative models are a better choice for proxy distribution than generative adversarial networks.
I NTRODUCTION
Deep neural networks are powerful tools but their success depends strongly on the amount of training data (Sun et al., 2017; Mahajan et al., 2018).
Recent works show that for improving robust training against adversarial examples (Biggio et al., 2013; Szegedy et al., 2014; Biggio & Roli, 2018), additional training data is helpful (Carmon et al., 2019; Schmidt et al., 2018a;
Uesato et al., 2019; Deng et al., 2021).
However, curating more real-world data from the actual data distribution is usually challenging and costly (Recht et al., 2019).
To circumvent this challenge, we ask: can robust training be enhanced using a proxy distribution, i.e., an approximation of the real data distribution?
In particular, can additional samples from a proxy distribution, that is perhaps cheaper to sample from, improve robustness.
If so, can generative models that are trained on limited training images in small scale datasets (LeCun & Cortes, 2010; Krizhevsky et al., 2014), act as such a proxy distribution?
When training on synthetic samples from generative models, a natural question is whether robustness on synthetic data will also transfer to real world data.
Even if it does, can we determine the features of synthetic data that enable this synthetic-to-real robustness transfer and optimize our selection of generative models based on these features?
Finally, can we also optimize the selection of individual synthetic samples to maximize the robustness transfer?
Q.1 When does robustness transfer from proxy distribution to real data distribution?
This question is fundamental to develop a better understanding of whether a proxy distribution will help.
For a classiﬁer trained on only synthetic samples, we argue that in addition to empirical and generalization error, distribution shift penalty also determines its robustness on the real data distribution.
We prove that this penalty is upper bounded by the conditional Wasserstein distance between the proxy distribution and real data distribution.
Thus robustness will transfer from proxy distributions that are in close proximity to real data distribution with respect to conditional Wasserstein distance.
Q.2 How effective are proxy distributions in boosting adversarial robustness on real-world dataset?
Our experimental results on ﬁve datasets demonstrate that the use of samples from PrOxy distributions in Robust Training (PORT) can signiﬁcantly improve robustness.
In particular, PORT achieves up to to 7 .
5 % improvement in adversarial robustness over existing state-of-the-art (Croce et al., 2020).
Its improvement is consistent across different threat models ( (cid:96) ∞ or (cid:96) 2 ), network architectures, datasets, and robustness criteria (empirical or certiﬁed robustness).
We also uncover that synthetic images from diffusion-based generative models are most helpful in improving robustness on real datasets.
We further investigate the use of proxy distributions in robust training.
In particular, we investigate why current state-of-the-art in diffusion-based models are signiﬁcantly more helpful than their counterparts, such as generative adversarial networks (GANs).
Q.3 Can we develop a metric to characterize which proxy distribution will be most helpful in robust training?
Our theory motivates the design of a measure of proximity between two distributions that incorporates the geometry of the distributions and can empirically predict the transfer of robustness.
We propose a robust learning based approach where we use the success of a discriminator in distinguishing adversarially perturbed samples of synthetic and real data as a measure of proximity.
Discriminating between synthetic and real data is a common practice (Goodfellow et al., 2014; Gui et al., 2020), however, we ﬁnd that considering adversarial perturbations on synthetic and real data samples is the key to making the discriminator an effective measure for this task.
We demonstrate that the rate of decrease in discriminator success with an increasing size of perturbations can effectively measure proximity and it accurately predicts the relative transfer of robustness from different generative models.
We also leverage our robust discriminators to identify most helpful synthetic samples.
We use the proximity of each synthetic sample to real data distribution, referred to as synthetic score, as a metric to judge their importance.
This score can be computed using output probability from a discriminator that is robustly trained to distinguish between adversarially perturbed samples from proxy and real data distribution.
We demonstrate that selecting synthetic images based on their synthetic scores can further improve performance.
Contributions.
We make the following key contributions
• We provide an analytical bound on the transfer of robustness from proxy distributions to real data distribution using the notion of conditional Wasserstein distance and further validate it experimentally.
• Overall, using additional synthetic images, we improve both clean and robust accuracy on ﬁve different datasets.
In particular, we improve robust accuracy by up to 7 . 5 % and 6 .
7 % in (cid:96) ∞ and (cid:96) 2 threat models, respectively, and certiﬁed robust accuracy ( (cid:96) 2 ) by 7 . 6 % on the CIFARdataset.
• When selecting a proxy distribution, we show that existing metrics, such as FID, fail to determine the synthetic-to-real transfer of robustness.
We propose a new metric ( ARC ) based on the distinguishability of adversarially perturbed synthetic and real data, that accurately determines the performance transfer.
• We also develop a metric, named synthetic score, to determine the importance of each synthetic sample in synthetic-to-real robustness transfer.
We demonstrate that choosing samples with lower synthetic scores provide better results than randomly selected samples.
I NTEGRATING PROXY DISTRIBUTIONS IN ROBUST TRAINING
In this section we propose to use samples from proxy distributions to improve robustness.
We ﬁrst provide analytical bounds on the transfer of adversarial robustness from proxy to real data distribution.
Next, using robust discriminators we provide a metric based on our analytical bound, which can accurately determine the relative ranking of different proxy distributions in terms of robustness transfer.
Our metric can be calculated empirically (using samples from both distributions) and does not require the knowledge of the proxy or real data distribution.
Finally, we present our robust training formulation (PORT) which uses synthetic samples generated by the generative model, together with real samples.
Notation.
We represent the input space by X and corresponding label space as Y .
Data is sampled from a joint distribution D that is supported on X × Y .
For a label y , we use D | y to denote the conditional distribution of class y .
We denote the proxy distribution as ˜ D .
We denote the neural network for classiﬁcation by f : X → Z , parameterized by θ , which maps input images to output probability vectors ( z ).
We use h to refer to the classiﬁcation functions that output labels.
For a set
S sampled from a distribution D , we use ˆ S to denote the empirical distribution with respect to set
S .
We use S ∼ D to denote the sampling of a dataset from a distribution D .
We use ( x, y ) ← D to denote the sampling of a single point from D .
2. U NDERSTANDING TRANSFER OF ADVERSARIAL ROBUSTNESS BETWEEN DATA DISTRIBUTIONS
Since our goal is to use samples from proxy distribution to improve robustness on real data distribution, we ﬁrst study the transfer of adversarial robustness between two data distributions.
Deﬁnition 1 (Average Robustness) .
We deﬁne average robustness for a classiﬁer h on a distribution
D according to a distance metric d as follows:
Rob d ( h, D )
=
E ( x,y ) ← D [inf h ( x (cid:48) )
(cid:54) =
y d ( x (cid:48) , x )] .
where classiﬁer h : X → Y predicts class label of an input sample 2 .
This deﬁnition refers to the expected distance to the closest adversarial example for each sample.
Formalizing transfer of robustness from proxy to real data distribution.
In robust learning from a proxy distribution, we are interested in bounding the average robustness of the classiﬁer obtained by a learning algorithm ( L ), on distribution D , when the training set is a set S of n labeled examples sampled from a proxy distribution ˜ D .
In particular we want to provide a lower bound on the transferred average robustness i.e, E
[Equation]
In order to understand this quantity better
[Equation]
suppose h is a classiﬁer trained on a set S that is sampled from ˜ D , using algorithm L .
We decompose Rob d ( h, D ) to three quantities as follows:
[Equation]
Using this decomposition, by linearity of expectation and triangle inequality we can bound transferred average robustness from below by
[Equation]
As the above decomposition suggests, in order to bound the average robustness
[Equation]
we need to bound both the generalization penalty and the distribution shift penalty.
The generalization penalty has been rigorously studied before in multiple works (Cullina et al., 2018;
Montasser et al., 2019; Schmidt et al., 2018b).
Hence, we focus on bounding the distribution shift penalty.
Our goal is to provide a bound on the distribution-shift penalty that is independent of the classiﬁer in hand and is only related to the properties of the distributions.
With this goal, we deﬁne a notion of distance between two distributions.
Deﬁnition 2 (Conditional Wasserstein distance) .
For two labeled distributions D and ˜ D supported on X × Y , we deﬁne cwd according to a distance metric d as follows:
[Equation]
where J ( D, ˜ D ) is the set of joint distributions whose marginals are identical to D and ˜ D .
It is simply the expectation of Wasserstein distance between conditional distributions for each class.
Now, we are ready to state our main theorem that bounds the distribution shift penalty for any learning algorithm based only on the Wasserstein distance of the two distributions.
Theorem 1 (Bounding distribution-shift penalty) .
Let D and ˜ D be two labeled distributions supported on X × Y with identical label distributions,
i.e., ∀ y ∗ ∈ Y , Pr ( x,y ) ← D
[ y = y ∗ ] =
Pr ( x,y ) ← ˜ D
[ y = y ∗ ] .
Then for any classiﬁer h : X → Y
[Equation]
Theorem 1 shows how one can bound the distribution-shift penalty by minimizing the conditional
Wasserstein distance between the two distributions.
We provide its proof and empirical validation in Appendix A.
Even if we successfully reduce the generalization penalty, the distribution-shift penalty may remain the dominant factor in transferred robustness.
This theorem enables us to switch our attention from robust generalization to creating generative models for which the underlying distribution is close to the original distribution.
In Appendix A, we also provide two other theorems about the tightness of Theorem 1 and the effect of combining clean and proxy data together.
2. W HICH PROXY DISTRIBUTION TO CHOOSE ? - A PPROXIMATING CONDITIONAL W ASSERSTEIN DISTANCE USING ROBUST DISCRIMINATORS
Our analytical results suggest that a proxy distribution that has small conditional Wasserstein distance to the real data can improve robustness.
This means that optimizing for conditional Wasserstein distance in a proxy distribution (e.g., a generative model) can potentially lead to improvements in adversarial robustness.
Unfortunately, it is generally a hard task to empirically calculate the conditional Wasserstein distance using only samples from the distributions (Mahloujifar et al., 2019b;
Bhagoji et al., 2019).
In this section, we introduce a metric named ARC as a surrogate for conditional
Wasserstein distance that can be calculated when we only have sample access to the data distributions.
Before deﬁning our metric, we need to deﬁne the notion of robust discrimination between two distributions.
[Figure]
Without adversarial perturbations, a non-robust discriminator can perfectly distinguish both proxy distributions from the real distribution.
) Under adversarial perturbations, classiﬁcation between real and proxy-1 is much harder compared to real and proxy-2 distribution.
The success of a robust discriminator is dependent on the proximity of real and proxy distributions.
Robust discrimination.
Our metric works based on how well a discriminator can robustly distinguish between samples from the real and proxy distributions.
Compared to a typical discriminator, the robust discriminator should be accurate even when there is an adversary who can perturb the sampled instance by a perturbation of size (cid:15) .
Intuitively, if there exists a successful and robust discriminator for two distributions D and ˜ D , then it means that no adversary can make instances of D to look like instances of ˜ D even by making perturbations of size (cid:15) .
This means that D and ˜ D are far away from each other (Figure 1b).
On the other hand, if no robust discriminator exists, then it means that the adversary can ”align“ most of the mass of proxy distribution with that of real distribution by making perturbations of size at most (cid:15) .
This notion is closely related to the optimal transport between the proxy and real distribution.
In particular, the optimal adversary here corresponds to a transport J ∈ J ( D, ˜ D ) that minimizes
Pr ( x,x (cid:48) )
← J ( D, ˜ D ) [ d ( x, x (cid:48) ) ≤ (cid:15) ]
(Compare with Deﬁnition 2).
To be more speciﬁc, the goal of a robust discriminator σ is to maximize its robust accuracy 3 :
[Equation]
We use Racc ∗ (cid:15)
( D, ˜ D ) to denote the accuracy of best existing robust discriminator, namely,
Racc ∗ (cid:15) ( D, ˜ D ) =
min σ Racc (cid:15) ( σ, D, ˜ D ) .
Note that as (cid:15) grows from 0 to ∞ , the robust accuracy of any discriminator will decrease to at most 50% .
If two distributions D and ˜ D are close to each other, this drop in accuracy happens much faster since the adversary can make images from two distributions to look alike by adding smaller perturbations.
We use this intuition and deﬁne our metric
ARC as follows:
[Equation]
In other words, the ARC metric is equal to the area under the robust discrimination accuracy v.s. perturbation curve (See Figure 3 for a sample of this curve.)
In Section 3.2, we discuss how this metric can be calculated with only samples from the real data and proxy distributions.
When selecting a proxy distribution, we choose the one with the smallest ARC value, since it is expected to be closest to real data distribution.
We also demonstrate that ARC metric is directly related to conditional Wasserstein distance.
In particular, we have the following Theorem:
Theorem 2.
For any two distributions ˜ D and D with equal class probabilities we have cwd ( D, ˜ D ) ≥ 4 · ARC ( D, ˜ D ) .
Moreover, if for all labels y , ( D | y ) and ( ˜ D | y ) are two concentric uniform spheres, then we have cwd ( D, ˜ D )
= 4 · ARC ( D, ˜ D ) .
Why non-robust discrimination is not an effective metric.
Deep neural networks are commonly used as a discriminator between synthetic and real images (Goodfellow et al., 2014; Gui et al., 2020).
In our experiments, we ﬁnd that even a four-layer convolutional network can achieve near 100% classiﬁcation accuracy on all selected proxy distributions (Appendix C.1).
This result shows that non-robust discrimination is not an effective measure of proximity (as highlighted in Figure 1a).
2. B RINGING IT ALL TOGETHER : I MPROVING ADVERSARIAL ROBUSTNESS USING PROXY DISTRIBUTIONS
Overview of robust training.
The key objective in robust training is to solve min
[Equation]
∼ D L adv ( θ, x, y, Ω) , where L adv is determined by the training objective and Ω is the threat model.
In adversarial training (Madry et al., 2018; Zhang et al., 2019; Carmon et al., 2019; Pang et al., 2021), we train against projected gradient descent based (PGD) adversarial examples by selecting L adv ( . )
= (cid:96) ( θ, PGD ( x, Ω) , y ) .
In randomized smoothing (Cohen et al., 2019; Salman et al., 2019; Sehwag et al., 2020; Carmon et al., 2019), where the objective is to achieve certiﬁed robustness (Wong & Kolter, 2018), we aim to achieve invariance to random Gaussian Noise by selecting
L adv ( . )
= (cid:96) ( θ, x, y )
+
βD kl ( f θ ( x ) , f θ ( x + δ )) , where δ ∼ N(0 , σ 2 I ) , and D kl ( ., . ) is the KLdivergence.
This loss function (Zheng et al., 2016), referred to as robust stability training (RST), performs better than using (cid:96) ( θ, x + δ, y )
(Carmon et al., 2019).
We refer the L adv in adversarial training and randomized smoothing as L pgd and L smooth , respectively.
We represent the cross-entropy loss function, which is used to train the classiﬁer, as (cid:96) ( . ) , where (cid:96) ( θ, x, y ) =
(cid:104)− log ( f θ ( x )) , y (cid:105) and y is the one-hot vector encoding of y .
Our objective is to integrate synthetic samples from Proxy distributions in Robust Training (PORT).
In particular, we use the following robust training formulation that combines samples from a real training dataset with synthetic samples.
[Equation]
where γ ∈ [0 , 1] and L agg is the aggregated adversarial loss over both D and ˜ D .
Depending on training objective, we select either L pgd or L smooth as L adv .
We approximate the aggregated loss using available training samples from the real data distribution ( D ) and a set of synthetic images sampled from the proxy distribution ( ˜ D ).
We select γ through a hyperparameter search.
Which synthetic samples to choose?
In particular, which set ( S ) of N synthetic samples from the proxy distribution ( ˜ D ) leads to maximum transferred robustness on real data, i.e.,
E f ← ˆ L ( S )
[ Rob d ( f, D )] , where ˆ L is a robust learning algorithm.
While it can be solved in many different ways, we follow a rejection sampling based approach.
In particular, we measure proximity of each synthetic sample to real data distribution and use it as a metric to accept or reject a sample.
We use output probability score from our trained robust discriminators as a measure of proximity.
In particular we deﬁne synthetic-score ( x ) =
min x i ∈ Ball (cid:15) ( x ) σ ( x i ) as the ﬁnal score for each synthetic sample, where samples with lowest score are prioritized in the selection.
E XPERIMENTAL RESULTS
First, we show that our proposed approach of using proxy distributions brings signiﬁcant improvements in the performance of both adversarial training and randomized smoothing across both (cid:96) ∞ and (cid:96) 2 threat models (Section 3.1).
We also uncover that diffusion-based generative models are more effective proxy distributions than generative adversarial networks (GANs) on multiple datasets.
Next we delve deeper into why diffusion-based generative models are highly effective proxy distributions (Section 3.2).
We ﬁnd that the key reason behind the success of diffusion based models is the that there is no robust discriminator that can robustly distinguish between the samples from diffusion based models and real data distribution.
We demonstrate that our proposed metric ( ARC ) provides a better characterization of the effectiveness of diffusion-based models than other widely used metrics.
Finally, we investigate the effectiveness of adaptively selecting synthetic images in our framework.
3. I MPROVING ROBUSTNESS USING SYNTHETIC IMAGES FROM PROXY DISTRIBUTIONS Setup.
We consider ﬁve datasets, namely CIFAR-10 (Krizhevsky et al., 2014), CIFAR100 (Krizhevsky et al., 2014), CelebA (Liu et al., 2015), AFHQ (Choi et al., 2020), and ImageNet (Deng et al., 2009).
We also work with commonly used l ∞ and l 2 threat models for adversarial attacks and use AutoAttack (Croce & Hein, 2020) to measure robustness.
We provide extensive details on the setup in Appendix B.
Evaluation metrics for robust training.
We use two key metrics to evaluate performance of trained models: clean accuracy and robust accuracy .
While the former refers to the accuracy on unmodiﬁed test set images, the latter refers to the accuracy on adversarial examples generated from test set images.
We refer to the robust accuracy of any discriminator trained to distinguish between synthetic and real data as robust discrimination accuracy.
We also use randomized smoothing to measure certiﬁed robust accuracy, i.e., robust accuracy under strongest possible adversary in the threat model.
Synthetic data.
We sample synthetic images from a generative models, in particular from denoising diffusion-based probabilistic models (DDPM)
(Ho et al., 2020; Nichol & Dhariwal, 2021).
We provide extensive details on the number of images sampled and the sampling procedure in Appendix B.
We use γ = 0 .
4 as it achieves best results (Appendix D).
We combine real and synthetic images in a 1 : 1 ratio in each batch, thus irrespective of the number of synthetic images, our training time is only twice of the baseline methods. / Auto refers to
[Table]
3.1. I MPROVING PERFORMANCE OF ADVERSARIAL TRAINING
State-of-the-art robust accuracy synthetic images (Table 1, 2).
Using synthetic images from diffusion-based generative models (DDPM), our approach achieves state-of-the-art robust accuracy in the category of not using any extra real world data (Croce et al., 2020).
We improve robust accuracy by up to 7 . 5 % and 6 .
7 % over previous works in (cid:96) ∞ and (cid:96) 2 threat model, respectively.
Notably, the gain in performance is highest for the CIFAR-10 and Celeb-A datasets.
Note that by using only synthetic images, our work also achieves competitive performance with previous works that use extra real-world images.
For example, using additional real-data Carmon et al.
(2019) achieve 59 .
53 % robust accuracy on CIFAR-10 ( (cid:96) ∞ ) while we achieve 60 .
6 % robust accuracy by using only synthetic data.
[Table]
[Table]
Proxy distribution offsets increase in network parameters.
We ﬁnd that gains from using synthetic samples are equivalent to ones obtained by scaling network size by an order of magnitude (Table 1).
For example, a ResNetnetwork with synthetic data achieves higher robust accuracy ( (cid:96) ∞ ) than a W RN -34-20 trained without it, while having 16 × fewer parameters than the latter.
Similar trend holds for W RN -34-10 networks, when compared with a much larger W RN -70-16 network.
This trend also holds for both (cid:96) ∞ and (cid:96) 2 threat models.
Simultaneous improvement in clean accuracy.
Due to the accuracy vs robustness trade-off in adversarial training, improvement in robust accuracy often comes at the cost of clean accuracy.
However synthetic samples provide a boost in both clean and robust accuracy, simultaneously.
Using adaptively sampled synthetic images, we observe improvement in clean accuracy by up to 2 .
6 % and 2 .
3 % across (cid:96) ∞ and (cid:96) 2 threat models, respectively.
Comparison across generative models.
We ﬁnd that synthetic samples from diffusion-based generative models (Ho et al., 2020; Nichol & Dhariwal, 2021) provides signiﬁcantly higher improvement in performance than generative adversarial networks (GANs) (Table 4).
We further investigate this phenomenon in the next section.
We further analyze sample complexity of adversarial training using synthetic data in Appendix D.1.
We also provide visual examples of real and synthetic images for each dataset at the end of the paper.
When choosing proxy distribution in PORT ( (cid:96) ∞ ), DDPM model outperforms the leading generative adversarial network (GAN) on each dataset.
[Table]
[Figure] [Figure]
3.1. I MPROVING CERTIFIED ROBUSTNESS WITH RANDOMIZED SMOOTHING
We provide results on certiﬁed adversarial robustness in Table 5.
We ﬁrst compare the performance of our proposed approach with the baseline technique, i.e., RST (Carmon et al., 2019).
We achieve signiﬁcantly higher certiﬁed robust accuracy than the baseline approach at all (cid:96) 2 perturbations budgets for both ResNet-18 and W RN -28-10 network architectures.
Additionally, the robustness of our approach decays at a smaller rate than the baseline.
At (cid:96) ∞ perturbation of 2 / 255 , equivalent to (cid:96)perturbation of 111 / 255 , our approach achieves 7 .
6 % higher certiﬁed robust accuracy than RST.
We also signiﬁcantly outperform other certiﬁed robustness techniques which aren’t based on randomized smoothing (Zhang et al., 2020; Wong et al., 2018; Balunovic & Vechev, 2019).
Along with better certiﬁed robust accuracy, our approach also achieves better clean accuracy than most previous approaches, simultaneously.
Synthetic images vs real-world images.
Using only synthetic samples ( 10 M), we also outperform
RST where it uses an additional curated set of 500 K real-world images (RST 500 K ).
While the latter achieves 63 .
8 % certiﬁed robust accuracy, we improve it to 66 .
3. D ELVING DEEPER INTO USE OF PROXY DISTRIBUTIONS IN ROBUST TRAINING
Earlier in Section 3.1 we showed that diffusion-based generative models are an excellent choice for a proxy distribution for many datasets.
Now we characterize the beneﬁt of individual proxy distributions in our robust training framework.
We consider seven different generative models, which are well-representative of the state-of-the-art on the CIFAR-10 dataset.
Using synthetic-to-real transfer of robustness as ground truth.
From each generative model we sample one million synthetic images.
We adversarially train a ResNet-18 (He et al., 2016) network on these images and rank generative models in order of robust accuracy achieved on the CIFARtest set.
We provide further experimental setup details in Appendix C.
Calculating ARC.
At each perturbation budget ( (cid:15) ), we adversarially train a ResNet-18 classiﬁer to distinguish between synthetic and real images.
We measure robust discrimination accuracy of trained classiﬁer on a balanced held-out validation set.
We calculate ARC by measuring the area under the robust discrimination accuracy and perturbation budget curve 4 (Figure 3).
We provide a detailed comparison of it with other metrics in Table 6.
4 ( l ) 0.
R o b u s t
d i s c
r
i m i n a t i o n a cc u r a c y ddpmstyleCwgan [Figure] ndadiffBigan
For every generative model and perturbation budget ( (cid:15) ), we ﬁrst adversarially train a binary classiﬁer on adversarial perturbed synthetic and CIFAR-10 images.
Next we measure its robust discrimination accuracy on the validation set at the (cid:15) value used in training.
ARC is the area under the robust discrimination accuracy vs (cid:15) curve. [Figure] [Table] [Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table] [Figure] [Table] ARC is highly effective at determining synthetic to real transfer of robustness (Table 6).
Each of the baseline metrics, including FID which is widely used, fail in accurately predicting the transfer of robustness from synthetic to real distributions.
Even more, they also fail to identify DDPM
(Ho et al., 2020) as the most successful proxy distribution.
Our proposed metric ( ARC ), which measures the distinguishability of perturbed synthetic and real images
[Table]
exactly predicts the ranking of different generative models in terms of the transfer of robustness.
It also provides deeper insight into why synthetic samples from DDPM models are highly effective compared to other models.
As shown in Figure 3, discrimination between DDPM samples and real images becomes almost impossible even at very small perturbations budgets.
A more detailed comparison is provided in Appendix C.2.
Adaptive sampling of synthetic data based on ARC (Appendix C.3).
We compare the beneﬁt of adaptive sampling with random sampling on CIFAR-10 dataset (for both (cid:96) 2 and (cid:96) ∞ threat models).
Our adaptive sampling achieves an average of 0 .
5% and 0 .
2% improvement in robust accuracy over random sampling in the (cid:96) ∞ and (cid:96) ∞ threat models, respectively.
R ELATED WORK
Transfer of adversarial robustness.
This line of work focuses on the transfer of adversarial robustness, i.e., correct classiﬁcation even under adversarial perturbations, when testing the model on different data distributions (Shafahi et al., 2020; Sehwag et al., 2019).
Note that this is different from just achieving correct classiﬁcation on unmodiﬁed images across different distributions (Taori et al., 2020; Hendrycks & Dietterich, 2019).
Here we provide a theoretical analysis of the transfer of adversarial robustness between data distributions.
Using extra curated real-world data in robust training.
Prior works (Zhai et al., 2019; Carmon et al., 2019; Uesato et al., 2019; Najaﬁ et al., 2019; Deng et al., 2021) have argued for using more training data in adversarial training and often resort to curating additional real-world samples.
In contrast, we model the proxy distribution from the limited training images available and sample additional synthetic images from this distribution.
Generative models for proxy distributions.
State-of-the-art generative models are capable of modeling the distribution of current large-scale image datasets.
In particular, generative adversarial networks (GANs) have excelled at this task (Goodfellow et al., 2014; Karras et al., 2020; Gui et al., 2020).
Though GANs generate images with high ﬁdelity, they often lack high diversity (Ravuri &
Vinyals, 2019).
However, samples from recently proposed diffusion process based models achieve both high diversity and ﬁdelity (Ho et al., 2020; Nichol & Dhariwal, 2021).
Fr ´ echet Inception Distance (FID) (Heusel et al., 2017) and Inception Score (IS) (Heusel et al., 2017) are two common metrics to evaluate the quality of samples from generative models.
Using generative models to improve adversarial robustness.
Earlier works have used generative models to learn training data manifold and the use it to map input samples to data manifold (Samangouei et al., 2018; Jalal et al., 2017; Xu et al., 2018).
However, most of these techniques are broken against adaptive attacks (Athalye et al., 2018; Tram ` er et al., 2020).
We use generative models to sample additional training samples which further improve the adversarial robustness.
Comparison with Rebufﬁ et al. (2021).
A concurrent work by Rebufﬁ et al.
(2021) also uses randomly sampled synthetic images to improve adversarial robustness.
In comparison, we provide a theoretical analysis of when synthetic data helps along with metrics to optimize the selection of both generative models and individual samples.
We also demonstrate an improvement in certiﬁed robust accuracy using synthetic samples.
Despite these differences, similar beneﬁts of using proxy distributions in two independent and concurrent works further ascertain the importance of this research direction.
D ISCUSSION AND B ROADER O UTLOOK
Using synthetic data has been a compelling solution in many applications, such as healthcare (Jordon et al., 2018) and autonomous driving (Mayer et al., 2016) since it makes collecting a large amount of data feasible.
In a similar spirit, we use synthetic data to make deep neural networks more robust against adversarial attacks.
We investigate foundational questions such as determining the transfer of robustness from synthetic to real data and determining selection criteria for how to choose generative models or individual samples.
Finally, we note that while it is crucial to improve robustness against the threat of adversarial examples, it also has an unwanted side-effect in domains where adversarial examples are used for good.
Recent works use them to provide privacy on the web (Shan et al., 2020) or to evade website ﬁngerprinting methods (Rahman et al., 2020).
Improving defenses against adversarial examples will negatively hurt these applications.
R EPRODUCIBILITY
We provide proof of each of our theorems in Appendix A. Similarly, we provide extensive details on our experimental setup in Appendix B. Our work is also featured on RobustBench (Croce et al., 2020), an external benchmark for standardized evaluation of adversarial robustness.
Our robustly trained models are also available through the RobustBench API.
For further reproducibility, we have also submitted our code with the supplementary material.
A T HEORETICAL RESULTS
In this Section, we ﬁrst provide the proofs of Theorem 1 and 2.
Then we provide some additional results showing the tightness of our Theorem 1 and also the effect of combining real and proxy data on our Theorem.
Finally, we provide some experimental result that validate our theory.
A. P ROOF OF T HEOREM
Theorem 1: Let D and ˜ D be two labeled distributions supported on X × Y with identical label distributions, i.e., ∀ y ∗ ∈ Y , Pr ( x,y ) ← D
[ y = y ∗ ] =
Pr ( x,y ) ← ˜ D
[ y = y ∗ ] .
Then for any classiﬁer
[Equation]
Sketch of the proof.
We ﬁrst provide an informal sketch of the proof and then formalize the steps after that.
Consider D (cid:48) to be the distribution that is the outcome of the following process: First sample ( x, y ) from D , then ﬁnd the closest x (cid:48) such that h ( x (cid:48) )
(cid:54) =
y and output ( x (cid:48) , y ) 5 .
Also consider a similar distribution ˜ D (cid:48) corresponding to ˜ D .
We now prove a Lemma that shows the conditional
Wasserestein distance between D and D (cid:48) is equal to Rob d ( h, D ) . Lemma 3. We have Rob d ( h, D )
=
cwd ( D, D (cid:48) ) and Rob d ( h, ˜ D ) =
cwd ( ˜ D, ˜ D (cid:48) ) .
Proof.
Let J y be the optimal transport between D | y and D (cid:48) | y . Also let J (cid:48) y be the joint distribution ( x, x (cid:48) )
that is obtained by ﬁrst sampling x from D | y and then setting x (cid:48) =
arg min
h ( x (cid:48) )
(cid:54) =
y d ( x, x (cid:48) ) .
The marginals of J (cid:48)
y are equal to D | y and D (cid:48)
| y .
Hence, J (cid:48)
y is a valid transport between D | y and D (cid:48)
| y .
Also, deﬁne a potentially randomized perturbation algorithm
A J y that given an input x samples ( x, x (cid:48) )
← J y | x , conditioned on x and outputs x (cid:48) .
We have
[Equation]
On the other hand, because for all x we have h ( A J y ( x )) (cid:54) =
y then d ( x, A J y ( x )) ≥ inf y (cid:54) = h ( x (cid:48) ) d ( x, x (cid:48) ) . Therefore we have
Rob
[Equation]
Therefore we have
[Equation]
On the other hand, because J y is the optimal transport, we have
[Equation]
Now combining Equations 1 and 2, we conclude that
[Equation] Similarly, we can also prove that cwd d ( ˜ D, ˜ D (cid:48) ) = Rob d ( h, ˜ D ) . By the way the distributions D (cid:48) and ˜ D (cid:48) are deﬁned we have
[Equation]
5 Here, we assume that the closest point x (cid:48) exists.
Otherwise, We can set x (cid:48) so that the distance is arbitrarily close to the inﬁmum and the proof follows.
Roughly, the reason behind this is that all examples ( x (cid:48) , y ) sampled from ˜ D (cid:48) could be seen as an adversarial example for all elements of D with the label y .
And we know that D (cid:48) consists of optimal adversarial examples for D , therefore, the optimal transport between D and D (cid:48) should be smaller than the optimal transport between D and ˜ D (cid:48) .
Also, by triangle inequality for Wasserestein distance we have, [Equation] Now using Lemma 3 and Equations 4 and 3 we have
[Equation]
With a similar argument, because of symmetry of D and ˜ D , we can also prove
[Equation]
Combining inequalities 5 and 7 we get
[Equation]
which ﬁnishes the proof. Full proof.
The following is a succinct formalization of the proof steps mentioned above, let J ∗ y =
inf J ∈J
( D | y, ˜ D | y ) be the optimal transport between the conditional distributions D | y and ˜ D | y .
We have
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
[Table]
[Equation]
With a similar argument we get Rob d ( h, ˜ D )
≤ Rob d
( h, D )
+ cwd d ( D, ˜ D ) and the proof is complete.
A. P ROOF OF T HEOREM
Theorem 2.
For any two distributions ˜ D and D with equal class probabilities we have cwd ( D, ˜ D ) ≥ 4 ARC ( D, ˜ D ) .
Moreover, if for all labels y , ( D | y ) and ( ˜ D | y ) are two concentric uniform l p spheres, then we have cwd ( D, ˜ D )
= 4 ARC ( D, ˜ D ) .
Proof.
We start by proving a lemma.
Lemma 4.
Let J ∈ J
( D, ˜ D ) be an arbitrary transport between D and ˜ D .
Then, for any discriminator σ we have,
[Equation]
Proof.
Consider an adversary A (cid:15)J that on input x sampled from D , samples a pair ( x, x (cid:48) )
← J |
J [1] = x from the transport and return a center point x (cid:48)(cid:48) between x and x (cid:48) such that d ( x, x (cid:48)(cid:48) )
=
d ( x (cid:48) , x (cid:48)(cid:48) ) =
d ( x, x (cid:48) ) / 2 if d ( x, x (cid:48) ) ≤ (cid:15) .
Otherwise, it returns x .
Also, on a in input x (cid:48) sampled from ˜ D it samples a pair ( x, x (cid:48) )
← J | J [2] =
x (cid:48) from the transport and return a center point x (cid:48)(cid:48) between x and x (cid:48) such that d ( x, x (cid:48)(cid:48) )
=
d ( x (cid:48) , x (cid:48)(cid:48) ) =
d ( x, x (cid:48) ) / 2 if d ( x, x (cid:48) ) ≤ (cid:15) .
Otherwise, it returns x (cid:48) .
Denote D
A ≡ A (cid:15)J # D to be the push-forward of D under A J .
And also denote ˜ D
A ≡ A (cid:15)J # ˜ D .
Now we have, δ ( D A , ˜ D A )
≤ Pr ( x,x (cid:48) )
← J [ d ( x, x (cid:48) ) > (cid:15) ] where δ is the total variational distance.
Therefore, no discriminator σ can distinguish D (cid:48) from ˜ D with accuracy more than 1+Pr ( x,x (cid:48) ) ← J [ d ( x,
[Equation]
(cid:48) )
>(cid:15) ].
Now, let J ∗ =
(cid:80) ly
=1 α y J ∗
y be a transport between D and ˜ D where J ∗ y is the optimal transport between ˜ D | y and D | y and α y is the probability of class y for D and ˜ D .
using Lemma 4 we have
[Equation]
Therefore we have
[Equation]
∞
[Equation]
Now, by integration by parts we have (cid:90) ∞
[Equation]
Therefore, we have
[Equation]
Now to prove the second part of theorem about the case of concentric spheres we start by following lemma.
Lemma 5.
Let D y
= D | y and ˜
D y =
˜ D | y .
Assume ˜
D y and D y are two concentric spheres according to the some l p norm.
Also let J ∗ ∈ J
( D y , ˜ D
y ) be the optimal transport between D y and ˜ D
y with respect to the same norm.
Then we have,
[Equation]
Proof.
let D be the uniform sphere centered at point c and with radius r and let ˜ D be the uniform sphere centered at point c and with radios ˜ r > r .
Observe that the optimal robust distinguisher for any (cid:15) <
r +˜ r 2 is the one that assigns 0 to x if d ( c, x ) <
˜ r − r 2 and assigns 1 otherwise and for any (cid:15) <
˜ r − r 2 we have
[Equation]
On the other hand, for any (cid:15) ≥ ˜ r − r 2 we have
[Equation]
Now consider optimal transport J ∗ between D and ˜ D .
Observe that this transport is equivalent to the following distribution:
[Equation]
Therefore, we have Pr ( x,x (cid:48) )
← J ∗ [ d ( x, x (cid:48) )
=
˜ r − r ] = 1 Which implies for any (cid:15) <
˜ r − r we have
Pr
[Equation]
x,
[Equation]
) ←
[Equation]
x
[Equation] > [Equation] 11) and for any (cid:15) ≥ ˜ r − r
[Equation]
( x,x (cid:48) ) ← J ∗ [ d ( x, x (cid:48) ) > (cid:15) ] =
[Equation] Putting Equations equation 9, equation 10, equation 11, and equation 12 together, we ﬁnish the proof of Lemma.
Having Lemma 5, we can follow the same steps as before except that instead of Inequality equationwe have an equality of the following form.
[Equation]
A. E FFECT OF C OMBINING P ROXY AND R EAL D ATA ON T HEOREM
A natural question is what happens when we combine the original distribution with the proxy distribution.
For example, one might have access to a generative model but they want to combine the samples from the generative model with some samples from the original distribution and train a robust classiﬁer on the aggregated dataset.
The following corollary answers this question.
Theorem 6.
Let D and ˜ D be two labeled distributions supported on X × Y with identical label distributions and let ¯ D = p · D
+ (1 − p ) ·
˜ D be the weighted mixture of D and ˜ D .
Then for any classiﬁer h : X → Y
[Equation]
Note that the value of p is usually very small as the number of data from proxy distribution is usually much higher than the original distribution.
This shows that including (or not including) the data from original distribution should not have a large effect on the obtained bound on distribution-shift penalty.
Proof of Theorem 6.
We just need to show that cwd
d ( D, ¯ D ) ≤ (1 − p ) · cwd d ( D, ˜ D )) .
Note that since the label distributions are equal, we have
[Equation]
Now let J y be the optimal transport between D | y and ˜ D | y .
Now construct a joint distribution
J (cid:48)
y ≡ (1 − p ) ·
J + p · ( x, x ) x ← D | y .
Notice that J (cid:48)
y is a joint distribution with marginals equal to D and ¯ D .
Therefor J (cid:48)
y is a transport between D and ¯ D and we can calculate its cost.
We have
[Equation]
Therefore, we have
[Equation]
[Figure]
A. T IGHTNESS OF T HEOREM
Here, we show a theorem that shows our bound on distribution-shift penalty is tight.
The following theorem shows that one cannot obtain a bound on the distribution-shift penalty for a speciﬁc classiﬁer that is always better than our bound.
Theorem 7 (Tightness of Theorem 1) .
For any distribution D supported on X × Y , any classiﬁer h , any homogeneous distance d and any (cid:15) ≤ Rob d
( h, D ) , there is a labeled distribution ˜ D such that
[Equation]
Proof.
for α ∈ [0 , 1] let ˜ D
α be the distribution of the following process: First sample ( x, y ) from
D , then ﬁnd the closest x (cid:48) such that h ( x (cid:48) ) (cid:54) =
y and output ( x + α ( x (cid:48) − x ) , y ) .
By deﬁnition, the conditional Wasserestein distance between D and ˜ D 1 is equal to Rob d ( h, D ) .
We also have cwd ( D, ˜ D α )
=
α · cwd ( D, ˜ D 1 ) .
Observe that for any classiﬁer we have Rob d ( h, ˜ D α ) ≤ (1 − α )
Rob d ( h, D ) because if ( x (cid:48) , y ) is an adversarial example for ( x, y ) , then x (cid:48) is also an adversarial example for ( x + α ( x (cid:48) − x ) , y ) with distance (1 − α )
d ( x, x (cid:48) ) .
On the other hand we have Rob d ( h, ˜ D α ) ≥ (1 − α )
Rob d ( h, D ) because any adversarial example for ( x + α ( x (cid:48) − x ) , y ) with distance r is also an adversarial example for x with distance at most r + αd ( x (cid:48) − x ) and since x (cid:48) is the optimal adversarial example for x then r must be at least α ( x (cid:48) − x ) .
Therefore, we have Rob d ( h, ˜ D α ) =
(1 − α )
Rob d ( h, D ) .
Putting everything together and setting α = (cid:15)/ Rob d ( h, D ) we have
[Equation]
Note that Theorem 7 only shows the tightness of Theorem 1 for a speciﬁc classiﬁer.
But there might exist a learning algorithm L that incurs a much better bound in the expectation.
Namely, there might exist L such that for any two distributions D and ˜ D we have
[Equation]
We leave ﬁnding such an algorithm as an open question.
A. E XPERIMENTAL VALIDATION OF MAIN THEOREM
In theorem 1 we prove that transfer of adversarial robustness between two distributions is upper bounded by their conditional Wasserstein distance.
Now we provide empirical validation of this result.
We consider a 10 -class classiﬁcation problem where each class is modeled using a 128dimensional multivariate normal distribution.
In contrast to real-world datasets, where the underlying distribution of the data is unknown, we can efﬁciently and exactly calculate Wasserstein distance on this synthetic dataset.
We robustly train a four-layer convolutional network on it.
To construct a proxy distribution, we perturb both mean and covariance parameters across each class.
On each proxy distribution, we measure the average robustness of the pre-trained model and its conditional
Wasserstein distance from the original distribution.
We use Wasserstein-2 distance 7 , which has a closed-form expression for normal distributions (Givens et al., 1984).
As shown in Figure 4, the difference in average robustness is upped bounded by the conditional Wasserstein distance.
B A DDITIONAL DETAILS ON EXPERIMENTAL SETUP
We describe experimental details common across most experiments in this section.
We discuss design choices pertaining to individual experiments in their respective sections.
Training setup.
We use network architectures from the ResNet family, namely ResNet-18 (He et al., 2016) and variants of WideResNet (Zagoruyko & Komodakis, 2016).
We train each network using stochastic gradient descent and 0 .
1 learning rate with cosine learning rate decay, weight decay of 5 × 10 − 4 , batch size 128 , and 200 epochs.
We work with ﬁve datasets, namely CIFAR-10, CIFAR100, ImageNet ( 64 × 64 size images), CelebA ( 64 × 64 ), and AFHQ ( 224 × 224 ).
For CelebA (Liu et al., 2015) dataset, we consider a four-class classiﬁcation problem based on the attribute smile and male, i.e., smile/male, smile/not-male, not-smile/male, not-smile/not-male (total 200 K images).
Animal Faces-High-Quality (AFHQ) dataset comprises 15 K images for three classes: cat, dog, and wild animals.
Thus we consider the task of three-class classiﬁcation on this dataset.
To reduce the computational cost on ImageNet dataset, we use the free adversarial training (Shafahi et al., 2019) procedure.
We use the ResNet-18 model for CIFAR-10, ImageNet, CelebA, and AFHQ dataset.
However, for CIFAR-10 and CIFAR-100 dataset, we also use much larger W RN -34-10 network.
Robust training parameters.
We consider both l ∞ and l 2 threat models.
For CIFAR-10 and
CIFAR-100 dataset, we use the commonly used perturbation budget ( (cid:15) ) of 8 / 255 and 127 / 255 for l ∞ and l 2 threat model, respectively.
For other three dataset too, we choose commonly used perturbation budgets.
We perform adversarial training using a 10-step projected gradient descent attack (PGD-10) and benchmark test set robustness with the much stronger AutoAttack 8 (Croce & Hein, 2020).
We use β = 6 , σ = 0 .
25 , 100 samples for selection, and 10 , 000 samples for estimation in randomized smoothing, as described in Cohen et al.
Generative models.
We consider seven different generative models for the CIFAR-10 and two different networks for the CelebA and ImageNet dataset.
In Table 7.
We provide the number of synthetic images generated from each model and whether the generated images are labelled or unlabeled.
If the model is unconditional, i.e., only generates unlabeled images, we label the images using an additional classiﬁer.
We use state-of-the-art LaNet (Wang et al., 2019) network to label images for the CIFAR-10 dataset.
LaNet network is trained only on the training images of the CIFAR-10 dataset and achieves 99.0% accuracy on its test set.
For CelebA dataset, we train a ResNet50 model to label synthetic images.
For adaptive sampling of synthetic images for CIFAR10 dataset, we ﬁrst sample of set of 15 M 9 synthetic images from the DDPM model.
Next we select 10 M synthetic images with the lowest synthetic score from this set.
Evaluation metrics for generative models.
We use following existing baseline metrics to evaluate the quality of synthetic samples.
1) Fr´echet Inception Distance (FID) :
It measures the Fr´echet distance (Dowson & Landau, 1982) between features of synthetic and real images extracted from an Inception-V3 network.
Inception score (IS) : Unlike FID, Inception score only uses synthetic data with the goal to account for both ﬁdelity and diversity of synthetic data.
Nearest neighbour distance (1-NN): It computes the average distance of a synthetic image to the nearest real image in the pixel space. 4) ARC :
This is the metric we propose and it measures distance between synthetic loose We use the 6 M randomly sampled images made available by Nakkiran et al (2021) along with 9 M more sampled by us using improved sampling techniques (Nichol & Dhariwal, 2021) from the DDPM model. [Table]
[Table]
and real data based on the success of a robust discriminator.
We compare performance of all three baselines with our proposed metric [Table]
Computational cost.
In addition to robust training, sampling from generative models is another key contributor to the computational cost in our approach.
We sample images from the DDPM model using 250 steps for both CIFAR-10 and ImageNet datasets.
Using an RTX 4x2080Ti GPU cluster, it takes 23 .
8 hours to sample one million images on the CIFAR-10 sets.
With the same setup, it takes 26 .
1 hours to sample 100 K images for the 64 × 64 ImageNet dataset.
On both models, we use the publicly available checkpoints of pretrained generative models 10 .
Note that both training generative models and sampling from them is a one-time cost.
Once the pretrained checkpoints and synthetic images are made publicly available, they can be directly used in downstream tasks.
We will make our code and synthetic data publicly available.
[Table]
C D ELVING DEEPER INTO ROBUST DISCRIMINATION AND ARC
We propose a new metric ( ARC ), to rank different generative models in order of robustness transfer from their samples to real data.
Now we provide experimental details on how we measure ARC and its comparison with other baselines.
[Table]
Setup.
A critical component in our approach is training a robust binary discriminator to distinguish between real and synthetic data.
We use a ResNet-18 network for this task and train it for 100 epochs with a 0 .
1 learning rate, 128 batch size, and 1e-4 weight decay.
We use a randomly sampled set of one million images from each generative model.
We keep 10 , 000 synthetic images from this set for validation and train on the rest of them.
We speciﬁcally choose 10 , 000 images as it’s equal to the number of test images available in the CIFAR-10 test set, thus balancing both classes in our test set.
We train for only 391 steps per epoch, i.e., equivalent to a single pass through 50 , 000 training images in the CIFAR-10 dataset.
Thus over 100 epochs
, we effectively end up taking ﬁve passes through the one million synthetic images.
Given the randomness in multiple steps, we aggregate results over three different runs of our experiments.
C. W HY NON - ROBUST DISCRIMINATORS ARE NOT EFFECTIVE IN MEASURING PROXIMITY ?
We argue that most synthetic samples can be easily distinguished from real data, irrespective of proximity, in absence of adversarial perturbations ( (cid:15) = 0 ).
This is likely because deep neural networks have very high expressive power.
So a natural question is whether shallow networks, which have much lower capacity, are more suitable for this task.
We test this hypothesis by using a two-layer (16 and 32 ﬁlters) and a four-layer (16, 16, 32, and 32 ﬁlters) convolutional neural network.
We refer to them as CNN-2 and CNN-4, respectively.
We ﬁnd that even these shallow networks achieve more than 90 % accuracy in distinguishing synthetic images from real images (Table 9).
The CNN4 network itself is achieving more than 99 % accuracy for four out of seven generative models.
A much larger ResNet-18 network achieves near-perfect classiﬁcation accuracy for most models.
Such high success of even shallow networks uniformly across generative models shows that non-robust discrimination is not an effective measure of proximity.
C. O N EFFECTIVENESS OF ARC IN MEASURING PROXIMITY
In this section, we delve deeper into the comparison of our proposed metric ( ARC ) with other baselines.
We judge the success of each metric by how successfully it predicts the transfer of robustness from synthetic to real samples on the CIFAR-10 data.
(referred to as transferred robust accuracy).
We report our results in Table 10.
Is FID in CIFAR-10 feature space effective?
When calculating FID, the recommended approach is to measure it in the feature space of a network trained on the ImageNet dataset (Heusel et al., 2017).
One may ask, whether the reason behind the failure is using ImageNet feature space for
CIFAR-10 images.
This might be true as it is well known that most image datasets have their speciﬁc bias (Torralba & Efros, 2011).
To answer this question, we measure FID in the feature of a state-of-the-art LaNet (Wang et al., 2019) networks trained on the CIFAR-10 dataset.
We refer to this metric as FID (CIFAR-10).
Similar to FID in ImageNet feature space, FID in CIFAR-10 feature space also fails to predict robustness transfer.
It follows a similar trend as the former, where it ranks models like DiffBigGAN and StyleGAN much higher than other models.
Generalizing to natural training.
If the objective is to maximize clean accuracy instead of robustness, one may ask whether ARC will remain effective in selecting the generative model.
We answer this question by measuring the success of ARC in predicting how much clean accuracy is achieved on the CIFAR-10 test set when we train a ResNet-18 network only on one million synthetic images without any adversarial perturbation.
Note that ARC is dependent only on samples, thus can be directly used for this task.
We ﬁnd that ARC correctly ranks DDPM over StyleGAN model for transferred clean accuracy.
Similarly, it also correctly rank WGAN-ALP and E2GAN model higher than other BigGAN models where the former achieves higher clean accuracy on the CIFAR-10 test set.
However, there are small variations in transferred clean accuracy with some models, such as
WGAN-ALP and E2GAN, which ARC doesn’t capture in its ranking
[Table]
[-WGAN-ALP(UC) 92 .43 .12 .5 .
-]
[-E2GAN(UC) 92 .39 .11 .4 .8 .8 .1 . DiffCrBigGAN(C) 87 .33 .4 .0 .9 .9 .1 . NDA(C) 
 DiffBigGAN(C)-]C.
A DAPTIVE SAMPLING OF SYNTHETIC DATA .
Finding synthetic samples which leads to highest synthetic-to-real robustness transfer.
We use proximity of a synthetic sample to the original distribution, which we measure using synthetic score from our trained robust discriminators (using 0 .
25 / 255 size l ∞ perturbations), as a metric to judge transfer of performance from the proxy distribution to original distribution. [Figure] y (
[Figure] We sort the synthetic score for each of 6 M synthetic images from the DDPM model and combine them into ten equal-size groups.
Next, we adversarially train a
ResNet-18 network on images from each group, along with CIFAR-10 training images, and measure robustness achieved on the CIFAR-10 test set (Figure 5).
Our results validate the effectiveness of synthetic scores, where groups with the lowest synthetic score achieve highest robust test accuracy.
The difference in the robust test accuracy is up to 4 % between the group with the lowest score and the one with the highest score.
Improvement in performance with adaptive sampling.
We select of set of 10 M synthetic images (from a set of 15 M) with the lowest synthetic score.
We compare the success of these adaptively selected images with a set of 10 M randomly selected images.
We present our results in Table 11.
It shows that adaptively sampling further improves the performance of our framework ( PORT ) across threat models ( (cid:96) ∞ and (cid:96) 2 ) and network architectures.
D B RINGING IT ALL TOGETHER : U SING SYNTHETIC SAMPLES IN ROBUST TRAINING
In this section, we ﬁrst analyze the synthetic images and later provide additional analysis based on them in robust training.
We will primarily use synthetic images sampled from the DDPM and
StyleGAN model.
Analyzing synthetic images.
Since DDPM is an unconditional model, it only generates unlabelled synthetic images.
We label these images using a LaNet network on the CIFAR-10 dataset.
We visualize the frequency of different classes in Figure 6.
It shows that the synthetic images are almost uniformly distributed across classes.
On the ImageNet dataset, we use the classiﬁer conditioned sampling to generate labeled images from the improved DDPM model (Nichol & Dhariwal, 2021).
We also provide samples images from different generative models in Figure 10 and 11.
Hyperparameter search for γ .
Before using DDPM images in robust training, we perform a hyperparameter search for γ .
We consider ten different values from 0 to 1 and train a ResNet-18 network using PORT at each of them.
We measure both the clean accuracy and robust accuracy of each net- [Table] [Table] work (Figure 7).
We ﬁnd that γ = 0 .
4 achieves the highest clean and robust accuracy.
Thus we used γ = 0 .
4 in our experiments.
[Figure] [Figure]
D. S AMPLE COMPLEXITY OF ADVERSARIAL TRAINING
Given the ability to sample an unlimited amount of synthetic images from a proxy distribution
[Figure]
now we investigate the performance of adversarial training with an increasing number of training samples.
We train the network only on synthetic images and measure its performance on another held-out set of synthetic images.
We also measure how much the clean and robust accuracy transfers on the CIFAR-10 test set.
Setup.
We primarily work with the CIFAR-10 dataset and its two-class subset, i [Figure] e., an easier problem of binary classiﬁcation between class-1 ( automobile ) and class-9 ( truck ).
We refer to the latter as CIFAR-2.
We robustly train a ResNet-18 network on 2 K to 10 M synthetic images from the
StyleGAN model, as in both 10 -class and 2 -class setup.
We opt for StyleGAN over DDPM model as sampling images from the former is much faster, thus we were able to generate up to 10 M synthetic from it.
Note that the cost of adversarial training increases almost linearly with the number of attack steps and training images.
Thus to achieve manageable computational cost when training on millions of images, we opt for using only a 4-step PGD attack (PGD-4) in both training and evaluation.
Since robustness achieved with this considerably weak attack may not hold against a strong attack, such as AutoAttack, we opt for evaluating with the PGD-4 attack itself.
We also perform natural training, i.e., training on unmodiﬁed images in some experiments.
We test each network on a ﬁxed set of 100 K images from the StyleGAN and 10 K images from the CIFAR-10 test set.
Accuracy vs robustness trade-off.
We compare the clean accuracy achieved with both natural and adversarial training in Figure 8.
Indeed with a very small number of samples, clean accuracy in adversarial training is traded to achieve robustness.
This is evident from the gap between the clean accuracy of natural and adversarial training.
However, with the increasing number of training samples, this gap keeps decreasing for both CIFAR-2 and CIFAR-10 datasets.
Most interestingly, this trade-off almost vanishes when we use a sufﬁciently high number of training samples for the
CIFAR-2 classiﬁcation.
On sample complexity of adversarial training.
We report both clean and robust accuracy with adversarial training in Figure 9.
We ﬁnd that both clean and robust accuracy continues to improve with the number of training samples.
We also observe non-trivial generalization to test images from the CIFAR-10 dataset, which also improves with the number of training samples.
Both of these results suggest that even with a small capacity network, such as ResNet-18, adversarial robustness can continue to beneﬁt from an increase in the number of training samples.
[Figure]
Accuracy vs robustness tradeoff when training on an increasing amount of synthetic images from the StyleGAN model.
It shows that the drop in clean accuracy with adversarial training decreases with increase in training samples.
[Figure]
D. E XPLORING EFFECT OF IMAGE QUALITY OF SYNTHETIC SAMPLES
We explore different classiﬁers to label the unlabeled synthetic data generated from the DDPM model.
In particular, we use BiT (Kolesnikov et al., 2020),
SplitNet (Zhao et al., 2020), and
LaNet (Wang et al., 2019) where they achieve 98 .
7 %, and 99 .
% clean accuracy, respectively, on the CIFAR-10 dataset.
We notice that labels generated from different classiﬁers achieve slightly different downstream performance when used with adversarial training in the proposed approach.
We ﬁnd that only up to 10 % of synthetic images are labeled differently by these networks, which causes these differences.
On manual inspection, we ﬁnd that some of these images are of poor quality, i.e., images that aren’t photorealistic or wrongly labeled and remain hard to classify, even for a human labeler.
Since ﬁltering millions of images with a human in the loop is extremely costly, we use two deep neural networks, namely LaNet (Wang et al., 2019) and SplitNet (Zhao et al., 2020), to solve this task.
We avoid using labels from BiT as it requires transfer learning from
ImageNet (Deng et al., 2009) dataset, whereas our goal is to avoid any dependency on extra realworld data.
We discard an image when the predicted class of both networks doesn’t match and it is classiﬁed with less than 90% conﬁdence by both networks.
While the former step ﬂags images which are potentially hard to classify, the latter step ensures that we do not discard images where at least one network is highly conﬁdent in its prediction.
We also try the 50 % and 75 % conﬁdence threshold
but ﬁnd that 90 % gives the best downstream results.
In particular, using the ﬁltering step improves robust accuracy by another 0 .
[Figure]
[Figure] [Figure]
[Figure] [Figure]