G ENERATING A DVERSARIAL E XAMPLES WITH A DVERSARIAL N ETWORKS
Anonymous authors
Paper under double-blind review
A BSTRACT
Deep neural networks (DNNs) have been found to be vulnerable to adversarial examples resulting from adding small-magnitude perturbations to inputs.
Such adversarial examples can mislead DNNs to produce adversary-selected results.
Different attack strategies have been proposed to generate adversarial examples, but how to produce them with high perceptual quality and more efﬁciently requires more research efforts.
In this paper, we propose AdvGAN to generate adversarial examples with generative adversarial networks (GANs), which can learn and approximate the distribution of original instances.
For AdvGAN, once the generator is trained, it can generate adversarial perturbations efﬁciently for any instance, so as to potentially accelerate adversarial training as defenses.
We apply AdvGAN in both semi-whitebox and black-box attack settings.
In semi-whitebox attacks, there is no need to access the original target model after the generator is trained, in contrast to traditional white-box attacks.
In black-box attacks, we dynamically train a distilled model for the black-box model and optimize the generator accordingly.
Adversarial examples generated by AdvGAN on different target models have high attack success rate under state-of-the-art defenses compared to other attacks.
Our attack has placed the ﬁrst with 92.76% accuracy on a public MNIST black-box attack challenge (M ˛adry et al., 2017b).
I NTRODUCTION
Deep Neural Networks (DNNs) have achieved great successes in a variety of applications ranging from image recognition (Krizhevsky et al., 2012;
He et al., 2016) to speech processing (Hinton et al., 2012) and from robotics training (Levine et al., 2016) to medical diagnostics (Ciresan et al., 2012).
However, recent work has demonstrated that DNNs are vulnerable to adversarial perturbations (Szegedy et al., 2014; Goodfellow et al., 2015).
An adversary can add small-magnitude perturbations to inputs and generate adversarial examples to mislead DNNs.
Such maliciously perturbed instances can cause the learning system to misclassify them into either a maliciously-chosen target class (in a targeted attack) or classes that are different from the ground truth (in an untargeted attack).
Different algorithms have been proposed for generating such adversarial examples, such as the fast gradient sign method (FGSM)
(Goodfellow et al., 2015) and optimization-based methods (Carlini & Wagner, 2017a;
Liu et al., 2017).
Most of the the current attack algorithms (Carlini & Wagner, 2017a; Liu et al., 2017) rely on optimization schemes with simple pixel space metrics, such as L ∞ distance from a benign image, to encourage visual realism.
To generate more perceptually realistic adversarial examples, in this paper, we propose to train a feed-forward network to generate perturbations such that the resulting example must be realistic according to a discriminator network.
We apply generative adversarial networks (GANs) (Goodfellow et al., 2014) to produce adversarial examples in both the semi-whitebox and black-box settings.
As conditional GANs are capable of producing high-quality images (Isola et al., 2017), we apply a similar paradigm to produce perceptually realistic adversarial instances.
We name our method AdvGAN.
Note that in the previous white-box attacks, such as FGSM and optimization methods, the adversary needs to have white-box access to the architecture and parameters of the model all the time.
However, by deploying AdvGAN, once the feed-forward network is trained, it can instantly pro- duce adversarial perturbations for any input instances without requiring access to the model itself anymore.
We name this attack setting semi-whitebox .
To evaluate the effectiveness of our attack strategy AdvGAN, we ﬁrst generate adversarial instances based on AdvGAN and other attack strategies on different target models.
We then apply the stateof-the-art defenses to defend against these generated adversarial examples (Goodfellow et al., 2015;
Tramèr et al., 2017a; M ˛adry et al., 2017a).
We evaluate these attack strategies in both semi-whitebox and black-box settings.
We show that adversarial examples generated by AdvGAN can achieve a high attack success rate, potentially due to the fact that these adversarial instances appear closer to real instances compared to other recent attack strategies.
Our contributions are listed as follows.
• Different from the previous optimization-based methods, we train a conditional adversarial network to directly produce adversarial examples, which are both perceptually realistic and achieve state-of-the-art attack success rate against different target models.
• We show that AdvGAN can attack black-box models by training a distilled model.
We propose to dynamically train the distilled model with query information and achieve high black-box attack success rate and targeted black-box attack, which is difﬁcult to achieve for transferability-based black-box attacks.
• We use the state-of-the-art defense methods to defend against adversarial examples and show that AdvGAN achieves much higher attack success rate under current defenses. • We apply AdvGAN on M ˛adry et al.’s
MNIST challenge (2017a) and achieve 88.93% accuracy on the published robust model in the semi-whitebox setting and 92.76% in the blackbox setting, which wins the top position in the challenge (M ˛adry et al., 2017b).
R ELATED W ORK
Here we review recent work on adversarial examples and generative adversarial networks.
A number of attack strategies to generate adversarial examples have been proposed in the white-box setting, where the adversary has full access to the classiﬁer (Szegedy et al., 2014; Goodfellow et al., 2015; Carlini & Wagner, 2017a;
Moosavi-Dezfooli et al., 2015; Papernot et al., 2016; Biggio et al., 2013; Kurakin et al., 2016).
Goodfellow et al.
propose the fast gradient sign method (FGSM), which applies a ﬁrst-order approximation of the loss function to construct adversarial samples.
Formally, given an instance x , an adversary generates adversarial example x
A = x + η with L ∞ constraints in the untargeted attack setting as η = (cid:15) · sign ( ∇ x (cid:96) f
( x, y )) , where (cid:96) f ( · ) is the cross-entropy loss used to train the neural network f , and y represents the ground truth of x .
Optimization based methods have also been proposed to optimize adversarial perturbation for targeted attacks while satisfying certain constraints (Carlini & Wagner, 2017a; Liu et al., 2017).
Its goal is to minimize the objective function as || η || + λ(cid:96) f
( x A , y ) , where ||·|| is an appropriately chosen norm function.
However, the optimization process is slow and can only optimize perturbation for one speciﬁc instance each time.
In contrast, our feed-forward network can produce perturbation for any instance.
It achieves higher attack success rate against different defenses and performs much faster than the current attack algorithms.
Independently from our work, feed-forward networks have been applied to generate adversarial perturbation (Baluja & Fischer, 2017).
However, Baluja & Fischer combine the re-ranking loss and an L 2 norm loss, aiming to constrain the generated adversarial instance to be close to the original one in terms of L 2 ; while we apply a deep neural network as a discriminator to help distinguish the instance with other real images to encourage the perceptual quality of the generated adversarial examples.
Black-box Attacks Current learning systems usually do not allow white-box accesses against the model for security reasons.
Therefore, there is a great need for black-box attacks analysis.
Most of the black-box attack strategies are based on the transferability phenomenon (Papernot et al., 2017), where an adversary can train a local model ﬁrst and generate adversarial examples against it, hoping the same adversarial examples will also be able to attack the other models.
Many learning systems allow query accesses to the model.
However, there is little work that can leverage query-based access to target models to construct adversarial samples and move beyond transferability.
Papernot et al.
(2017) proposed to train a local substitute model with queries to the target model to generate adversarial samples, but this strategy still relies on transferability.
In contrast, we show that the proposed AdvGAN can perform black-box attacks without depending on transferability.
Generative Adversarial Networks (GANs) (Goodfellow et al., 2014) have achieved visually appealing results in both image generation (Radford et al., 2015; Gulrajani et al., 2017; Berthelot et al., 2017) and manipulation (Zhu et al., 2016) settings.
Recently, image-to-image conditional GANs have further improved the quality of synthesis results (Isola et al., 2017; Zhu et al., 2017).
We adopt a similar adversarial loss and image-to-image network architecture to learn the mapping from an original image to a perturbed output such that the perturbed image cannot be distinguished from real images in the original class.
Different from prior work, we aim to produce output results that are not only visually realistic but also able to mislead target learning models.
G ENERATING A DVERSARIAL E XAMPLES WITH A DVERSARIAL N ETWORKS 3. P ROBLEM D EFINITION
Let X ⊆ R n be the feature space, with n the number of features.
Suppose that ( x i , y i ) is the
i th instance within the training set, which is comprised of feature vectors x i ∈ X , generated according to some unknown distribution x i ∼ P data , and y i ∈ Y the corresponding true class labels.
The learning system aims to learn a classiﬁer f : X → Y from the domain X to the set of classiﬁcation outputs Y , where |Y| denotes the number of possible classiﬁcation outputs.
Given an instance x , the goal of an adversary is to generate adversarial example x A , which is classiﬁed as f ( x A ) (cid:54) =
y (untargeted attack), where y denotes the true label; or f ( x A ) =
t (targeted attack) where t is the target class. x A should also be close to the original instance x in terms of L 2 or other distance metric.
3. A DV GAN F RAMEWORK
Figure 1 illustrates the overall architecture of AdvGAN, which mainly consists of three parts: a generator G , a discriminator D , and the target neural network f .
Here the generator G takes the original instance x as its input and generates a perturbation G ( x ) .
Then x + G ( x ) will be sent to the discriminator D , which is used to distinguish the generated data and the original instance x .
The goal of D is to encourage that the generated instance is indistinguishable with the data from its original class.
To fulﬁll the goal of fooling a learning model, we ﬁrst perform the white-box attack, where the target model is f in this case.
f takes x + G ( x ) as its input and outputs its loss L adv , which represents the distance between the prediction and the target class t (targeted attack), or the opposite of the distance between the prediction and the ground truth class (untargeted attack).
The adversarial loss (Goodfellow et al., 2014) can be written as:
[Equation]
Here, the discriminator D aims to distinguish the perturbed data x + G ( x ) from the original data x .
Note that the real data is sampled from the true class, so as to encourage that the generated instances are close to data from the original class.
The loss for fooling the target model f in a targeted attack is:
[Equation]
where t is the target class and (cid:96) f denotes the loss function (e.g., cross-entropy loss) used to train the original model f .
The L fadv loss encourages the perturbed image to be misclassiﬁed as target class t .
Here we can also perform the untargeted attack by maximizing the distance between the prediction and the ground truth, but we will focus on the targeted attack in the rest of the paper.
To bound the magnitude of the perturbation, which is a common practice in prior work (Carlini &
Wagner, 2017a; Liu et al., 2017; Bartlett & Wegkamp, 2008), we add a soft hinge loss on the Lnorm as
[Equation] where c denotes a user-speciﬁed bound.
This can also stabilize the GAN’s training, as shown in Isola et al.
Finally, our full objective can be expressed as
[Equation]
where α and β control the relative importance of each objective.
Note that L GAN here is used to encourage the perturbed data to appear similar to the original data x , while L f adv is leveraged to generate adversarial examples, optimizing for the high attack success rate.
We obtain our G and D by solving the minmax game arg min G max D L .
3. B LACK - BOX A TTACKS WITH A DVERSARIAL N ETWORKS
Static Distillation For black-box attack, we assume adversaries have no prior knowledge of training data or the model itself.
In our experiments in Section 4, we randomly draw data that is disjoint from the training data of the black-box model to distill it, since we assume the adversaries have no prior knowledge about the training data or the model.
To achieve black-box attacks, we ﬁrst build a distilled network f based on the output of the black-box model b (Hinton et al., 2015).
Once we obtain the distilled network f , we carry out the same attack strategy as described in the white-box setting (see Equation (4)).
Here, we minimize the following network distillation objective:
[Equation]
where f ( x ) and b ( x ) denote the output from the distilled model and black-box model respectively for the given training image x , and H denotes the commonly used cross-entropy loss.
By optimizing the objective over all the training images, we can obtain a model f which behaves very close to the black-box model b .
We then carry out the attack on the distilled network.
Note that unlike training the discriminator D , where we only use the real data from the original class to encourage that the generated instance is close to its original class, here we train the distilled model with data from all classes.
Dynamic Distillation Only training the distilled model with all the pristine training data is not enough, since it is unclear how close the black-box and distilled model perform on the generated adversarial examples, which have not appeared in the training set before.
Here we propose an alternative minimization approach to dynamically make queries and train the distilled model f and our generator G jointly.
We perform the following two steps in each iteration.
During iteration i :
[Table] Update G i given a ﬁxed network f i − 1 : We follow the white-box setting (see Equation 4) and train the generator and discriminator based on a previously distilled model f i − 1 .
We initialize the weights G i as G i − 1 .
[Equation]
Update f
i given a ﬁxed generator G i : First, we use f i − 1 to initialize f i .
Then, given the generated adversarial examples x + G i ( x ) from G i , the distilled model f i will be updated based on the set of new query results for the generated adversarial examples against the black-box model, as well as the original training images.
[Equation]
where we use both the original images x and the newly generated adversarial examples x + s G i ( x ) to update f .
In the experiment section, we compare the performance of both the static and dynamic distillation approaches and observe that simultaneously updating G and f produces higher attack performance.
See Table 2 for more details.
E XPERIMENTAL R ESULTS
In this section, we ﬁrst evaluate AdvGAN for both semi-whitebox and black-box settings on MNIST (LeCun & Cortes, 1998) and CIFAR-10 (Krizhevsky et al., 2014).
We also perform a semi-whitebox attack on the ImageNet dataset(Deng et al., 2009).
We then apply AdvGAN to generate adversarial examples on different target models and test the attack success rate for them under the state-of-theart defenses and show that our method can achieve higher attack success rates compared to other existing attack strategies.
We generate all adversarial examples for different attack methods based on the L ∞ bound as 0.3 on MNIST and 8 on CIFAR-10, for a fair comparison.
In general, as shown in Table 1, AdvGAN has several advantages over other white-box and blackbox attacks.
For instance, regarding computation efﬁciency, AdvGAN performs much faster than others even including the efﬁcient FGSM, although AdvGAN needs extra training time to train the generator.
All these strategies can perform targeted attack except transferability based attack, although the ensemble strategy can help to improve.
Besides, FGSM and optimization methods can only perform white-box attack, while AdvGAN is able to attack in semi-whitebox setting.
Implementation Details Our code and models will be available upon publication.
We adopt a similar architecture from image-to-image translation literature (Isola et al., 2017; Zhu et al., 2017).
In particular, we use the architecture of generator G from Johnson et al.
(2016), and our discriminator
D ’s architecture is similar to model C for MNIST and ResNet-32 for CIFAR-10.
We apply the loss in Carlini & Wagner (2017c) as our loss L f adv = max(max i (cid:54) =
t f ( x A ) i − f ( x A ) t , κ ) , where t is the target class, and f represents the target network in the semi-whitebox setting and the distilled model in the black-box setting.
We set the conﬁdence κ = 0 for both Opt.
and AdvGAN.
We use Adam as our solver (Kingma & Ba, 2014), with a batch size of 128 and a learning rate of 0.001.
For GANs training, we use the least squares objective proposed by LSGAN (Mao et al., 2016), as it has been shown to produce better results with more stable training.
Models Used in the Experiments For MNIST, in all of our experiments, we generate adversarial examples for three models whose architectures are shown in Appendix A. Models A and B are
[Table]
used in Tramèr et al. (2017b), which represent different architectures.
Model C is the target network architecture used in (Carlini & Wagner, 2017a) for evaluating optimization based strategy.
For
CIFAR-10, we select ResNet-32 and Wide ResNet-34 (He et al., 2016; Zagoruyko & Komodakis, 2016) for our experiments.
Speciﬁcally, we use a 32-layer ResNet implemented in TensorFlowand Wide ResNet derived from the variant of “w32-10 wide.”
4 We show the classiﬁcation accuracy of pristine MNIST and CIFAR-10 test data (p) and attack success rate of adversarial examples generated by AdvGAN on different models in Table 2.
4. A DV GAN IN SEMI - WHITEBOX S ETTING
First, we apply different architectures for the target model f as listed in Appendix A for MNIST and with ResNet and Wide ResNet for CIFAR-10.
We ﬁrst apply AdvGAN to perform semi-whitebox attack against each model on MNIST dataset.
From the performance of semi-whitebox attack (Attack Rate (w)) in Table 2, we can see that AdvGAN is able to generate adversarial instances to attack all models with high attack success rate.
We also generate adversarial examples from the same original instance x , targeting other different classes, as shown in Figures 2.
In the semi-whitebox setting on MNIST (a)-(c), we can see that the generated adversarial examples for different models appear close to the ground truth/pristine images (lying on the diagonal of the matrix). Figure 2 (d)-(f) show the generated adversarial examples on MNIST in black-box setting.
These adversarial examples generated by AdvGAN can successfully fool the black-box model and be misclassiﬁed as the target class shown on the top.
The original images are shown on the diagonal. We also generate adversarial examples based on random original images, and results are shown in Appendix C.
In addition, we analyze the attack success rate based on different loss functions on MNIST.
Under the same bounded perturbations (0.3), if we replace the full loss function in (4) with L = ||G ( x ) || 2 + L f adv , which is similar to the objective used in Baluja & Fischer (2017), the attack success rate becomes 86.2%.
If we replace the loss function with L =
L hinge + L f adv , the attack success rate is 91.1%, compared to that of AdvGAN, 98.3%.
Similarly, on CIFAR-10, we apply the same semi-whitebox attack for ResNet and Wide ResNet based on AdvGAN, and Figure 3(a) shows some adversarial examples, which are perceptually realistic.
We show adversarial examples for the same original instance targeting different other classes.
It is clear that with different targets, the adversarial examples keep similar visual quality compared to the pristine instances on the diagonal.
We also apply AdvGAN to generate adversarial examples on the ImageNet as shown in Figurewith L ∞ bound as 8.
The added perturbation is unnoticeable while all the adversarial instances are misclassiﬁed into other target classes with high conﬁdence.
[Figure]
4. A DV GAN IN B LACK - BOX S ETTING
In this section, we evaluate the performance of AdvGAN for the black-box attack.
Our black-box attack here is based on the dynamic distillation strategy.
We construct a local model to distill model f , and we select the architecture of Model C as our local model.
Note that we randomly select a subset of instances disjoint from the training data of AdvGAN to train the local model; that is, we assume the adversaries do not have any prior knowledge of the training data or the model itself.
With the dynamic distillation strategy, the adversarial examples generated by AdvGAN achieve an attack success rate, above 90% for MNIST and 80% for CIFAR-10, compared to 30% and 10% with the static distillation approach, as shown in Table 2.
We apply AdvGAN to generate adversarial examples for the same instance targeting different classes on MNIST and randomly select some instances to show in Figure 2 (d)-(f).
By comparing with the pristine instances on the diagonal, we can see that these adversarial instances can achieve high perceptual quality as the original digits. Speciﬁcally, the original digit is somewhat highlighted by adversarial perturbations, which implies a type of perceptually realistic manipulation.
Figure 3 (b) shows similar results for adversarial examples generated on CIFAR-10.
These adversarial instances appear photo-realistic compared with the original ones on the diagonal.
We show additional results in Appendix C.
4. A TTACK E FFECTIVENESS U NDER D EFENSES
Facing different types of attack strategies, various defenses have been provided.
Among them, different types of adversarial training methods are the most effective.
Goodfellow et al.
ﬁrst propose adversarial training as an effective way to improve the robustness of DNNs, and Tramèr
[Figure]
et al. (2017a) extend it to ensemble adversarial learning. M ˛adry et al. (2017a) have also proposed robust networks against adversarial examples based on well-deﬁned adversaries. Given the fact that AdvGAN strives to generate adversarial instances from the underlying true data distribution, it can essentially produce more photo-realistic adversarial perturbations compared with other attack strategies.
Thus, AdvGAN could have a higher chance to produce adversarial examples that are resilient under different defense methods.
In this section, we quantitatively evaluate this property for AdvGAN compared with other attack strategies.
Threat Model As shown in the literature, most of the current defense strategies are not robust when attacking against them (Carlini & Wagner, 2017b;
He et al., 2017).
Here we consider a weaker threat model, where the adversary is not aware of the defenses and directly tries to attack the original learning model, which is also the ﬁrst threat model analyzed in Carlini & Wagner (2017b).
In this case, if an adversary can still successfully attack the model, it implies the robustness of the attack strategy.
Under this setting, we ﬁrst apply different attack methods to generate adversarial examples [Figure] based on the original model without being aware of any defense.
Then we apply different defenses to directly defend against these adversarial instances.
Semi-whitebox Attack First, we consider the semi-whitebox attack setting, where the adversary has white-box access to the model architecture as well as the parameters.
Here, we replace f in Figure 1 with our model A, B, and C, respectively.
As a result, adversarial examples will be generated against different models.
We use three adversarial training defenses to train different models for each model architecture: standard FGSM adversarial training (Adv.)
(Goodfellow et al., 2015), ensemble adversarial training (Ensemble) (Tramèr et al., 2017b), and iterative training (Iter.
Adv.)
(M ˛adry et al., 2017a).
5 We evaluate the effectiveness of these attacks against these defended models.
In
Table 3, we show that the attack success rate of adversarial examples generated by AdvGAN on different models is higher than those of the fast gradient sign method (FGSM) and optimization methods (Opt.)
(Carlini & Wagner, 2017a).
Black-box Attack
For AdvGAN, we use model B as the black-box model and train a distilled model to perform black-box attack against model B and report the attack success rate in Table 4. For the black-box attack comparison purpose, transferability based attack is applied for FGSM and optimization-based methods (Opt.).
We use FGSM and optimization-based methods (Opt.) to attack model A on MNIST, and we use these adversarial examples to test on model B and report the corresponding classiﬁcation accuracy.
We can see that the adversarial examples generated by the black-box AdvGAN consistently achieve much higher attack success rate compared with other attack methods.
For CIFAR-10, we use ResNet as black-box model and train a distilled model to perform black-box attack against ResNet.
To evaluate black-box attack for optimization method and FGSM, we use adversarial examples generated by attacking Wide ResNet and test them on ResNet to report black-box attack results for these two methods.
In addition, we apply AdvGAN to the MNIST challenge (M ˛adry et al., 2017b).
Among all the methods, for white-box attack we achieve 88.93% accuracy on the published local model as shown in Table 5.
For the reported black-box attack, we achieved the accuracy as 92.76%, outperforming all other state-of-the-art attack strategies. [Table] [Table]
A DVERSARIAL P ERTURBATION A NALYSIS .
To understand the adversarial perturbation pattern better, we plot out corresponding perturbations (ampliﬁed by a factor of 10) for CIFAR-10 in Figure 3 (c) and (d) and ImageNet in Figure 4 (b). From the visualization of perturbation, it shows that the perturbations do not resemble anything in particular about the original image or the target class. Although training AdvGAN exposes it to realistic instances, the perturbations it generates do not simply interpolate towards an example of the target class.  C ONCLUSION
In this paper, we propose AdvGAN to generate adversarial examples using generative adversarial networks (GANs).
In our AdvGAN framework, once trained, the feed-forward generator can produce adversarial perturbations efﬁciently.
It can also perform both semi-whitebox and black-box attacks with high attack success rate.
In addition, when we apply AdvGAN to generate adversarial instances on different models without knowledge of the defenses in place, the generated adversar- [Table] ial examples can attack the state-of-the-art defenses with higher attack success rate than examples generated by the competing methods.
This property makes AdvGAN a promising candidate for improving adversarial training defense methods.
The generated adversarial examples produced by AdvGAN preserve high perceptual quality due to GANs’ distribution approximation property.
A A RCHITECTURE OF M ODELS
[Table]
B N ETWORK ARCHITECTURES
Generator architecture We follow the naming rules used in Johnson et al.
(2016)’s
Github repository 6 as well as Zhu et al.
Let c3s1-k denotes 3 × 3 Convolution-InstanceNorm-ReLU layer with k ﬁlter and stride 1.
Rk means residual block that contains two 3 × 3 convolution layers with the same numbers of ﬁlters.
dk denotes the 3 × 3 Convolution-InstanceNorm-ReLU layer with k ﬁlters and stride 2.
The generator structures consists of:
[Equation] [Equation] [Equation] Discriminator architecture We use CNNs as our discriminator network (Radford et al., 2015).
Let Ck denote a 4 × 4 Convolution-InstanceNorm-LeakyReLU layer with k ﬁlters and stride 2 .
After the last conv layer, we apply a FC layer to produce a 1 dimensional output.
We do not use InstanceNorm for the ﬁrst C8 layer.
We use leaky ReLUs with slope 0 .
The discriminator architecture is:
[Figure]
FC
C A DDITIONAL A DVERSARIAL E XAMPLES
[Figure]
[Figure]
[Figure]
[Table]