L EARNING TO D EFENSE BY L EARNING TO A TTACK
Anonymous authors
Paper under double-blind review
A BSTRACT
Adversarial training provides a principled approach for training robust neural networks.
From an optimization perspective, the adversarial training is essentially solving a minimax robust optimization problem.
The outer minimization is trying to learn a robust classiﬁer, while the inner maximization is trying to generate adversarial samples.
Unfortunately, such a minimax problem is very difﬁcult to solve due to the lack of convex-concave structure.
This work proposes a new adversarial training method based on a generic learning-to-learn (L2L) framework.
Speciﬁcally, instead of applying the existing hand-designed algorithms for the inner problem, we learn an optimizer, which is parametrized as a convolutional neural network.
At the same time, a robust classiﬁer is learned to defense the adversarial attack generated by the learned optimizer.
Our experiments over CIFARand CIFAR-100 datasets demonstrate that the L2L outperforms existing adversarial training methods in both classiﬁcation accuracy and computational efﬁciency.
Moreover, our L2L framework can be extended to the generative adversarial imitation learning and stabilize the training.
I NTRODUCTION
This decade has witnessed great breakthroughs in deep learning in a variety of applications, such as computer vision (Taigman et al., 2014; Girshick et al., 2014;
He et al., 2016; Liu et al., 2017).
Recent studies (Szegedy et al., 2013), however, show that most of these deep learning models are very vulnerable to adversarial attacks.
Speciﬁcally, by injecting a small perturbation to a normal sample, one can obtain an adversarial example.
Although the adversarial example is semantically indistinguishable from the normal one, it can fool deep learning models and undermine the security of deep learning, causing reliability problems in autonomous driving, biometric authentication, etc.
Researchers have devoted many efforts to studying efﬁcient adversarial attack and defense (Szegedy et al., 2013; Goodfellow et al., 2014b; Nguyen et al., 2015; Zheng et al., 2016; Madry et al., 2017;
Carlini and Wagner, 2017).
There is a growing body of work on generating adversarial examples, e.g., fast gradient sign method (FGSM, Goodfellow et al.
(2014b))
, projected gradient method (PGM, Kurakin et al. (2016)), Carlini-Wagner (CW, Paszke et al.
etc.
As for defense, Goodfellow et al.
(2014b) propose to robustify the network by adversarial training, which trains over the adversarial examples and still requires the network to output the correct label.
Further, Madry et al.
(2017) formalize the adversarial training as the following minimax optimization problem:
[Equation]
(1) where { ( x i , y i ) } ni =1 ⊂ R d × Y are n pairs of input feature and the corresponding label, (cid:96) denotes a loss function, f ( · ; θ ) denotes the neural network with parameter θ , and
δ i ∈ B denotes the perturba- tion for x i in constraint B .
The existing literature on the optimization also refers to θ as the primal variable and
δ i ’s as the dual variables.
Different from the well-studied convex-concave problem 1 , problem (1) is very challenging since (cid:96) is nonconvex in θ and nonconcave in δ .
As a result, there may be many equilibria, and majority of them are unstable.
In the existing optimization literature, there is no algorithm to converge to a stable equilibrium with theoretical guarantees.
Empirically, the existing primal-dual algorithms may perform poorly for solving (1).
Minimax formulation (1) naturally provides us with a uniﬁed perspective on prior works of adversarial training.
Such a minimax problem consists of two optimization problems, an inner maximization problem and an outer minimization problem: The inner problem targets on ﬁnding an optimal attack for a given data point ( x , y ) maximizing the loss, which essentially is the adversarial attack; The outer problem aims to ﬁnd a θ so that the loss given by the inner problem is minimized.
For solving (1), Goodfellow et al.
(2014b) propose to use FGSM to solve the inner problem.
Kurakin et al.
then ﬁnd that FGSM with true label predicted suffers from a “label leaking” effect, which can ruin the adversarial training.
Madry et al.
(2017) further suggest to solve the inner problem by PGM and obtain a better result than FGSM, since FGSM essentially is one iteration PGM.
However, adversarial training needs to ﬁnd a δ i for each ( x i , y i ) , thus the dimension of the overall search space for all data is substantial, which makes the computation expensive.
Instead, we propose a new learning-to-learn (L2L) framework that provides a more principled and efﬁcient way for adversarial training.
Speciﬁcally, we parameterize the optimizer of the inner maximization problem by a neural network denoted by g ( A ( x , y, θ ); φ ) , where A ( x , y, θ ) denotes the input of the optimizer g .
We also call the optimizer as the attacker network.
Since the neural network is very powerful in function approximation, our parameterization ensures that g is able to yield strong adversarial perturbations.
Under our framework, instead of directly solving δ i , we update the parameter φ of g .
Our training procedure becomes updating the parameters of two neural networks, which is very similar to generative adversarial network (GAN, Goodfellow et al.
(2014a)).
The proposed L2L is a generic framework and can be extended to other minimax optimization problems, e.g., generative adversarial imitation learning, which is studied in Section 4.
Different from the hand-designed methods that compute the adversarial perturbation for each individual sample using gradients from backpropagation, our methods generate the perturbations for all samples through the shared attacker g .
This enables the attacker g to learn potential common structures of the perturbations.
Therefore, our method is capable of yielding strong perturbations and accelerating the training process.
Furthermore, L2L framework is very ﬂexible : we can either choose different input
A ( x , y, θ ) , or use different attacker architecture.
For example, we can include gradient information in A ( x , y, θ ) and use a recurrent neural network (RNN) to mimic multi-step gradient-type methods.
Instead of simply computing the high order information with ﬁnite difference approximation or multiple gradients, by parameterizing the algorithm as a neural network, our proposed methods can capture this information in a much smarter way (Finn et al., 2017).
Our experiments demonstrate that our proposed methods not only outperform existing adversarial training methods, e.g., PGM training, but also enjoy the computational efﬁciency over CIFAR-10 and CIFAR-100 datasets (Krizhevsky and Hinton, 2009).
The research on L2L has a long history (Schmidhuber, 1987; 1992; 1993; Younger et al., 2001;
Hochreiter et al., 2001; Andrychowicz et al., 2016).
The basic idea is that one ﬁrst models the updating formula of complicated optimization algorithms in a parametric form, and then uses some simple algorithms, e.g., stochastic gradient algorithm to learn the parameters of the optimizer.
Among existing works, Hochreiter et al.
(2001) propose a system allowing the output of backpropagation from one network to feed into an additional learning network, with both networks trained jointly; Based on this, Andrychowicz et al.
(2016) further show that the design of an optimization algorithm can be cast as a learning problem.
Speciﬁcally, they use long short-term memory RNNs to model the algorithm and allow the RNNs to exploit structure in the problems of interest in an automatic way, which is undoubtedly one of the most popular methods for learning-to-learn.
However, there are two major drawbacks of the existing L2L methods: (1) It requires a large amount of datasets (or a large number of tasks in multi-task learning) to guarantee the learned optimizer to generalize, which signiﬁcantly limits their applicability (most of the related works only consider the image encoding as the motivating application); (2) The number of layers/iterations in RNNs for modeling algorithms cannot be large to avoid signiﬁcant computational burden in backpropagation.
Our contribution is that we ﬁll the blank of the L2L framework in solving the minimax problem, and our proposed methods do not suffer from the aforementioned drawbacks: (1) The attacker g with a different φ essentially generates a different task/dataset.
Therefore, for adversarial training, we have sufﬁciently many tasks for learning-to-learn; (2) The inner problem does not need a large scale RNN, and we use a convolutional neural network (CNN) or a length-two RNN (the sequence of length equals 2) as our attacker network, which eases the computation.
Our work is also related to GAN and dual-embedding (Dai et al., 2016).
All three solve minimax problems and share some common ground.
We discuss these works in Section 5.
Notations .
Given a ∈ R , denote ( a ) + as max( a, 0) .
Given x , y ∈ R d , denote x i as the i -th element of x , || x || ∞ =
max i | x i | as (cid:96) ∞ -norm of x , and x ◦ y =
[ x 1 y 1 , · · · , x d y d ] (cid:62) as element-wise product.
M ETHOD
This paper focuses on (cid:96)
∞ -norm attack.
We deﬁne the (cid:96) ∞ -ball with center 0 and radius (cid:15) by B ( (cid:15) )
= { δ ∈ R d : || δ || ∞ ≤ (cid:15) } and the corresponding projection as follows:
[Equation]
where sign and max are element-wise operators.
2. A DVERSARIAL T RAINING
The goal of adversarial training is to robustify neural networks.
Recall that from a robust optimization perspective, given n samples { ( x i , y i ) } ni =1 , where x i is the i -th feature vector and y
i is the corresponding label, adversarial training is reformulated as the following optimization problem (1):
[Equation]
where f denotes the network with parameter θ , (cid:96) denotes a loss function, and (cid:15) is the maximum perturbation magnitude.
We ﬁrst demonstrate the hardness of solving problem (1).
Ideally, we want to obtain the optimal solution for the inner problem
[Equation]
; θ ) , y i ) . However, note that the loss function (cid:96) ( f ( x i + δ i ; θ ) , y i ) is highly nonconcave in δ i .
Therefore, in reality the δ i we obtained is very unlikely to be the optimum δ ∗ i .
This then often leads to a highly unreliable or even completely wrong search direction, e.g.,
[Equation]
which may further results in a limiting cycle shown in Figure 1 (Detailed discussion is provided in
Appendix D).
This becomes even worse when sample noises exist.
Input: { ( x i , y i ) } ni =1 : clean data, α : learning rate, N : number of epochs, (cid:15) : maximum perturbation magnitude.
for t ← 1 to N do Sample a minibatch
M t for i in M t do δ i ← argmax δ i ∈B ( (cid:15) ) (cid:96) ( f ( x i
+ δ i ; θ ) , y i )
Generate adversarial perturbation for ( x i , y i ) θ ← θ − α 1 |M t | (cid:80) i ∈M t ∇ θ (cid:96) ( f ( x i + δ i ; θ ) , y i )
Update θ over adversarial data { ( x i + δ i , y i ) } i ∈M t
In the existing literature, the standard pipeline of adversarial training is shown in Algorithm 1.
Since the step of generating adversarial perturbation δ i in Algorithm 1 is intractable, most adversarial training methods adopt hand-designed algorithms.
For example, Kurakin et al.
(2016) propose to solve the inner problem approximately by ﬁrst order methods such as PGM.
Speciﬁcally, PGM iteratively updates the adversarial perturbation by the projected sign gradient ascent method for each sample:
Given one sample ( x i , y i ) , at the t -th iteration, PGM takes
[Equation]
where (cid:101) x ti =
x i + δ t − 1 i , η is the perturbation step size, T is a pre-deﬁned total number of iterations, and δ
i = 0 , t = 1 , · · · , T .
Finally PGM takes δ i =
δ Ti .
Note that FGSM essentially is one-iteration
PGM.
Besides, some works adopt other optimization methods, such as momentum gradient method (Dong et al., 2018), and L-BFGS (Tabacof and Valle, 2016).
However, except for FGSM, all require numerous queries for gradients through backpropagation, which is computationally expensive.
2. L EARNING TO D EFENSE BY L EARNING TO A TTACK (L2L)
Since the objective function is nonconvex-nonconcave, there is no guarantee for hand-designed methods to perform well.
Instead, we propose to learn an optimizer for the inner problem.
Specifically, we parameterize the attacker by a Neural Network g ( A ( x , y, θ ); φ ) , where A ( x , y, θ ) , the input of the network g , summaries the information of data and neural network f ( · ; θ ) .
We then convert problem (1) to
[Equation]
where φ ∗ is deﬁned as the solution to the following optimization problem:
[Equation]
Solving problem (3) naturally consists of two stages.
In the ﬁrst stage, the classiﬁer f aims to ﬁt over all perturbed data; While in the second stage, given a certain f obtained in the ﬁrst stage, the attacker network g targets on generating optimal perturbations under constraints δ i ’s ∈ B ( (cid:15) ) .
Since δ i
= g ( A ( x i , y i ; θ ); φ ) , constraints can be simply handled by a tanh activation function in the last layer of g .
Speciﬁcally, because the magnitude of tanh output is bounded by 1, after we rescale the output by (cid:15) , the output of g automatically satisﬁes the constraints.
Optimizer Classiﬁer
[Equation]
[Table]
+Y9NhUON37lRCnTxPCMqsIRKUlARNeF06eVDXQXTg1F6ODr49GJw/Gp7xF32hD1lz1jKXrJj9o6dsAnj7Cv7xX6zP9Eweh99jsYbadTb1jxmnYhm/wAS5tYC</latexit> r x
[Equation]
) <latexit sha1_base64="HqAakRG62MGE2GCxus3HrXHyNMM=">AAAC0HicbVHLbtNAFJ2YVwmvFJZsLKJKKUhRXJBAYlMeCzaIAk1bqQ7R9fg6GWU8tmauIdFohFgh8QN8DVv4Bv6GsZMFbnul0Ryde67OfSSlFIZGo7+d4NLlK1evbV3v3rh56/ad3vbdI1NUmuOYF7LQJwkYlELhmARJPCk1Qp5IPE4Wr+r88WfURhTqkFYlTnKYKZEJDuSpaS+KFSQSpsswRikHy0dxipLgkx3Qrntu48bBakxdTHMkcLvTXn80HDURngfRBvTZJg6m253vcVrwKkdFXIIxp9GopIkFTYJLdN24MlgCX8AMbePnwh1PpWFWaP8UhQ3b0kFuzCpPvDIHmpuzuZq8KHdaUfZsYoUqK0LF10ZZJUMqwno9YSo0cpIrD4Br4TsM+Rw0cPJL7O78b0Oz0n9Sgmvzi7Lu2bTnMqBq5jX6DWh86/t6Ics5JEg2brrMnH13GDnL/WDO5s4qL/+IdLE0KWTaKkiW6wqNCr/wIs9BpQ9johQzqCR5FZHzp4vOHuo8ONobRo+He++f9Pdfbo64xe6zB2zAIvaU7bM37ICNGWc/2S/2m/0JPgTL4GvwbS0NOpuae6wVwY9//IjoMQ==</latexit>
[Figure]
x
[Equation]
>AAACnnicbVFNaxRBEO0dv+L6lejRS+ [Equation] /LTCLoSSKKeAlJMJssZJdQ01Oz22x/0V2jWYY5e/CqP85/Y8/uHpwkBU0/Xr2iXlXlTslAafq3l9y5e+/+g62H/UePnzx9tr3z/CzYygscCausH+cQUEmDI5KkcOw8gs4VnueLT23+/Dv6IK05paXDqYaZkaUUQJE6ubrcHqTDdBX8Jsg2YMA2cXy50/s5KayoNBoSCkK4yFJH0xo8SaGw6U+qgA7EAmZYr/w1fDdSBS+tj88QX7EdHegQljqPSg00D9dzLXlb7qKi8v20lsZVhEasG5WV4mR5OywvpEdBahkBCC+jQy7m4EFQXEl/9/82NHPxUwqaLr9wrefQnSuAaZnPGDfg8TD6+qjcHHKkerJyWTb10WnW1CIO1tS6qU2Uf0O6XZpbVXQK8qt1hUeDP4TVGkzxZkJUYAmVoqgiauLpsuuHugnO9obZ/nDv5O3g4MPmiFvsJXvFXrOMvWMH7Cs7ZiMmGLJf7Df7k/DkS3KYHK2lSW9T84J1Ihn/AwTC0+I [Figure]
/latexit
[Figure]
This framework is very ﬂexible.
We can choose different A ( x , y, θ ) as the input and mimic multi-step gradient algorithms shown in Figure 2.
Here we provide three examples:
Naive Attacker Network.
This is the simplest example among our methods, taking the original image x
i as the input, i.e.,
A ( x i , y i , θ ) =
x i and δ i = g
( x i ; φ ) .
Under this setting, L2L training is similar to GAN training.
The major difference is that the generator in GAN yields synthetic data by transforming random noises, while the naive attacker network generates perturbations by transforming training samples.
[Figure]
Gradient Attacker Network.
Motivated by handdesigned methods, e.g., FGSM, we design an attacker which takes the gradient information into computation.
Speciﬁcally, we concatenate image x i and gradient ∇ x (cid:96) ( f ( x i ; θ ) , y i ) from backpropagation as the input of g , i.e., [Equation]
and
[Equation]
i
[Equation]
Since more information is provided, we expect the attacker network to be more effective to learn and yield more powerful perturbations.
Multi-Step Gradient Attacker Network.
We adapt the RNN to mimic a multi-step gradient update.
Speciﬁcally, we use the gradient attacker network as the cell of RNN sharing the same parameter φ .
As we mentioned earlier, the number of layers/iterations in the RNN for modeling algorithms cannot be very large so as to avoid signiﬁcant computational burden in backpropagation.
In this paper, we focus on a length-two RNN to mimic a two-step gradient update.
The corresponding perturbation becomes:
[Equation]
, where (cid:101) x i =
x i + δ (0) i and δ (0)
i
[Equation]
Taking gradient attacker network as an example, Figure 3 illustrates how L2L works and jointly trains two networks: The ﬁrst forward pass is used to obtain gradient of the classiﬁcation loss over clean data; The second forward pass is used to generate perturbation δ i by attacker g ; The third forward pass is used to calculate the adversarial loss (cid:96) in (3). Since our gradient attacker network only needs one backpropagation to query gradient, it amortizes the adversarial training cost, which leads to better computational efﬁciency. Moreover, L2L may adapt to the underlying optimization problem and yield better solution for the inner problem.
The corresponding procedure of L2L is shown in Algorithm 2.
Input: { ( x i , y i ) } ni =1 : clean data, α 1 , α 2 : learning rates, N : number of epochs, (cid:15) : maximum perturbation magnitude.
for t ← 1 to N do Sample a minibatch
M t for i in M t do u
i ← ∇ x (cid:96) ( f ( x i ; θ ) , y i )
δ i ← g ( x i , u i ; φ ) Generate perturbation by g θ ← θ − α 1 1 |M t | (cid:80) i ∈M t ∇ θ (cid:96) ( f ( x i + δ i ; θ ) , y i )
Update θ over adversarial data { ( x i + δ i , y i ) } i ∈M t φ ← φ + α 2 1 |M t | (cid:80) i ∈M t ∇ φ (cid:96) ( f ( x i + δ i θ ) , y i )
Update φ over adversarial data { ( x i
+ δ i , y i ) }
i ∈M t
To demonstrate the effectiveness and computational efﬁciency of our methods, we compare our methods with
PGM training over CIFAR-10 and
CIFAR-100 datasets.
All experiments are done in PyTorch with one NVIDIA
Ti GPU.
For simplicity, we denote Plain Net as the classiﬁer network trained over clean data only, PGM Net as the classiﬁers with PGM training, and Naive L2L, Grad L2L, and 2-Step L2L as classiﬁers using L2L training with corresponding attacker networks.
Classiﬁer Network.
All experiments adopt a 34-layer wide residual network (WRN-34-10,
Zagoruyko and Komodakis (2016)) implemented by Zhang et al.
as the classiﬁer network.
For each method, we train the classiﬁer network from scratch.
For Plain Nets, we adapt the same training procedure as Zagoruyko and Komodakis (2016).
We use cross entropy as the loss function.
Conv: [ k = 3 × 3 , c = 64 , s = 1 , p = 1 ], BN+ReLU ResBlock: [ k = 3 × 3 , c = 128 , s = 1 , p = 1 ] ResBlock: [ k = 3 × 3 , c = 256 , s = 1 , p = 1 ]
ResBlock: [ k = 3 × 3 , c = 128 , s = 1 , p = 1 ]
Conv: [ k = 3 × 3 , c = 3 , s = 1 , p = 1 ], tanh
Attacker Network. Table 1 presents the architecture of our attacker network 2 .
The ResBlock uses the same structure as the generator proposed in Miyato et al.
The detailed structure of ResBlock is provided in Appendix B. Batch normalization (BN) and activations, e.g.,
ReLU and tanh , are applied when speciﬁed.
The tanh function easily makes the output of attacker satisfy the constraints.
White-box and Black-box.
We compare different methods under both white-box and black-box settings.
Under the white-box setting, attackers can access all parameters of target models and generate adversarial examples based on the models; whereas under the black-box setting, accessing parameters is prohibited.
Therefore, we adopt the standard transfer attack method from Liu et al.
Due to the space limit, we leave results of the black-box setting in Appendix A.
Robust Evaluation.
We evaluate the robustness of the networks by PGM and CW attacks with the maximum perturbation magnitude (cid:15) = 0 .
031 (after rescaling the pixels to [0 , 1] ) over CIFARand CIFAR-100.
For PGM attack, we use 20 and 100-iteration PGM with a perturbation step size η = 0 .
003 , and for each sample we initial the adversary randomly in the (cid:96) ∞ ball of radius (cid:15) centered at the natural sample.
For CW attack, we adopt the implementation from Paszke et al.
(2017), and set the maximum number of iterations as 100 .
For each method, we repeat 5 runs with different random initial seed and report the worst result .
For CIFAR-10, we also evaluate the robustness of our Grad L2L and 2-Step L2L networks using random attacks, for which we uniformly sample 10000 perturbations in the (cid:96) ∞ ball with radius (cid:15) = 0 .
031 adding to each test sample.
We also evaluate the robustness of our Grad L2L and 2-Step L2L networks under their own attackers.
L2L. To update classiﬁer’s parameter θ , we use the SGD algorithm with Polyak’s momentum (parameter 0 .
9 , Liu et al.
and weight decay (parameter 2 × 10 − 4 , Krogh and Hertz (1992));
To update the attacker’s parameter φ , we use the Adam optimizer (parameter [0 . 9 , 0 . 999] , Kingma and
Ba (2014)) and weight decay (parameter 2 × 10 − 4 ) so that it adaptively balances the inner and outer optimization.
In addition, we train the whole network for 100 epochs and set the initial learning rate for SGD as 0 .
1 , the learning rate decay parameter as 0 .
1 with decay schedule [30,60,90], and the initial learning rate for Adam optimizer as 0 .
001 without learning rate decay.
PGM Adversarial Training.
For CIFAR-10, we directly report the result from Madry et al.
(2017) as the baseline; For CIFAR-100, we train a PGM Net as a baseline.
To update the parameter θ , we use the same conﬁguration of SGD algorithm in L2L.
Moreover, we adopt the setting from Madry et al.
(2017), that is, we ﬁrst use 10-iteration PGM with the perturbation step size 0 .
007 in (2) to generate the adversarial samples, and then train the PGM Net over these samples
[Table] [Table]
[Table]
As can be seen, without gradient information, Naive L2L is vulnerable to the PGM attack.
However, when the attacker utilizes the gradient information, Grad L2L and 2-Step L2L signiﬁcantly outperform the PGM Net over CIFAR-10 and CIFAR100, with a small loss for the clean accuracy. From the experiments on CIFAR10, our Grad L2L and 2-Step L2L are robust to random attacks, where the accuracy is only slightly lower than the clean accuracy.
Furthermore, the accuracy of our Grad/2-Step L2L model under the Grad/2Step
L2L attacker is comparable to the accuracy under PGM attacks, which shows that L2L attackers are able to generate strong attacks. As can be seen, PGM-100 is stronger than Grad L2L attacker ( 47 . 72% vs. 49 .
68% ), but similar to the 2-Step L2L attacker ( 52 . 07% vs. This means the strength of 2-Step L2L attacker is much stronger than Grad L2L attacker and explains why 2-Step L2L is stronger than Grad L2L and PGM net.
In addition, Table 3 shows the one epoch running time of all methods over CIFAR-10 and CIFAR-100.
As can be seen, Grad L2L and 2-Step L2L is much faster than PGM Net. By further comparing the accuracy of Grad/2Step L2L and PGM Net in Table 2, we ﬁnd that L2L enjoys computational efﬁciency.
In addition, Figure 4 presents the robust accuracy against number of iterations (ﬁxed perturbation magnitude (cid:15) = 0 . 031 ) and perturbation magnitude (ﬁxed number of iterations T = 10 ).
As can be seen, 2-Step L2L is much more robust than PGM Net.
Visualization of Adversarial Examples.
Figure 5 provides an illustrative example of the adversarial perturbations generated by FGSM, PGM-20 and 2-Step L2L attacker for a cat over CIFAR-10.
As can be seen, the attacks for these two networks are very different.
Moreover, the perturbation generated by the 2-Step L2L attacker is much more smooth than FGSM and PGM.
In this example, 2-Step L2L labels all adversarial samples correctly; whereas the PGM Net is fooled by the PGMattack and misclassiﬁes it as a dog .
[Figure]
E XTENSION : G ENERATIVE A DVERSARIAL I MITATION L EARNING
Our proposed L2L is a generic framework and can be applied to a broad class of minimax optimization problems.
Here, we investigate the generative adversarial imitation learning (GAIL, Ho and Ermon (2016)).
GAIL aims to learn a policy from expert’s behavior, by recovering the expert’s cost function and extracting a policy from the recovered cost function, which can also be formulated as a minimax optimization problem.
We then show that under the L2L framework, we stabilize the GAIL training by replacing the inner optimizer with a neural network.
Original GAIL.
GAIL solves the following minimax optimization problem:
[Equation]
where π ( · ; θ π ) is the trained policy parameterized by θ π , π E denotes the expert policy, D ( · , · ; θ D ) is the discriminator parameterized by θ
D , λH ( π ) denotes a entropy regularizer with tuning parameter λ , ( s, a ) and ( (cid:101) s, (cid:101) a ) denote the state-action for the trained policy and expert policy, respectively.
By optimizing 4, the discriminator D distinguishes the state-action ( s, a ) generated from the learned policy π with the sampled trajectories ( (cid:101) s, (cid:101) a ) generated from some expert policy π E .
In the original
GAIL training, for each iteration, we update the parameter of D , θ D , by stochastic gradient ascend and then update θ π by the trust region policy optimization (TRPO, Schulman et al.
GAIL with L2L .
Similar to the adversarial training with L2L, we apply our L2L framework to
GAIL by parameterizing the inner optimizer as a neural network U
(; θ U ) with parameter θ U .
Its input contains two parts: parameter θ D and the gradient of loss function with respect to θ D :
[Equation]
In practice, we use a minibatch (several sample trajectories) to estimate g D ( θ D , θ π ) , denoted as (cid:98) g D ( θ D , θ π ) .
Speciﬁcally, at the t -th iteration, we ﬁrst calculate (cid:98) g t D
= (cid:98) g D ( θ t D , θ tπ ) and then update θ t
+1D =
U ( θ t D , (cid:98) g
t D ; θ t U ) .
Next, we update θ U by gradient ascend based on the sample estimate of
E s,a [Equation] s ; [Equation]
[Equation]
The detailed algorithm is presented in Appendix C.
Experiments .
We compare the performance of the original GAIL and GAIL with L2L on two simulated environments: CartPole and Mountain Car (Brockman et al., 2016).
As can be seen in Figure 6, we ﬁnd that GAIL has a sudden performance drop after training for a long time.
We conjecture that this is because the discriminator overﬁts the expert trajectories and converges to a bad optimum, which is not generalizable.
On the other hand, GAIL with L2L is much more stable.
It is very important to real applications of GAIL: since the reward in real-world environment is usually unaccessible, we cannot know whether there is a sudden performance drop or not.
With L2L, we can stabilize the training and obtain a much more reliable algorithm for real-world applications.
[Figure]
D ISCUSSIONS
Closely related works :
• By leveraging the Fenchel duality and feature embedding technique, Dai et al.
(2016) convert a learning conditional distribution problem to a minimax problem , which is similar to naive attacker network.
Both approaches, however, lack the primal information.
In contrast, gradient attacker network considers the gradient information of primal variables, and achieves good results.
• Goodfellow et al.
(2014a) propose the GAN, which is very similar to our L2L framework.
Both GAN and L2L contain one generator network and one classiﬁer network, and jointly train these two networks.
There are two major difference between GAN and our framework: (1) GAN aims to transform the random noises to the synthetic data which is similar to the training examples, while ours targets on transforming the training examples to the adversarial examples for robustifying the classiﬁer; (2) Our generator network does not only take the training examples (analogous to the random noise in GAN) as the input, but also exploits the gradient information of the objective function, since it essentially represents an optimization algorithm.
The training procedure of these two, however, are quite similar.
We adopt some tricks from GAN training to our framework to stabilize training process, e.g., in Grad L2L, we adopt the two-time scale trick (Heusel et al., 2017).
• There are some other works simply combining the GAN framework and adversarial training together.
For example, Baluja and Fischer (2017) and Xiao et al.
(2018) propose some ad hoc GANbased methods to robustify neural networks.
Speciﬁcally, for generating adversarial examples, they only take training examples as the input of the generator, which lacks the information of the outer mimnimization problem.
Instead, our proposed L2L methods (e.g., Grad L2L, 2-step L2L) connect outer and inner problems by delivering the gradient information of the objective function to the generator.
This is a very important reason for our performance gain on the benchmark datasets.
As a result, the aforementioned GAN-based methods are only robust to simple attacks, e.g., FGSM, on simple data sets, e.g., MNIST, but fail for strong attacks, e.g., PGM and CW, on complicated data sets, e.g. CIFAR, where our L2L methods achieve signiﬁcantly better performance. Training Stability : For improving the training stability, we use both clean image and the corresponding gradient as the input of the attacker. Without such gradient information, the attacker severely suffers from training instability, e.g., the Naive Attacker Network. Furthermore, we try another architecture with downsampling modules, called “slim attacker” in Appendix B.
We observed that the slim attacker also suffers from training instability.
We suspect that the downsampling causes the loss of information. Thus, we tried to enhance the slim attacker by skip layer connections. Although the robust performance is still worse than the proposed architecture, it improves a lot. Beneﬁts of our neural network approach in adversarial training : (1) Since the neural network has been known to be powerful in function approximation, Our attacker network g can yield strong adversarial perturbations.
Since they are generated by the same attacker, the attacker g essentially learns some common structures across all samples; (2) The attacker networks in our experiments are actually overparametrized , which is conjectured to ease the training of deep neural networks.
We believe that similar phenomena happen to our attacker network, and ease the adversarial training.
Appendix A B LACK - BOX A TTACK
Under the black-box setting, we ﬁrst train a surrogate model with the same architecture of the target model but a different random seed, and then attackers generate adversarial examples to attack the target model by querying gradients from the surrogate model.
The black-box attack highly relies on the transferability, which is the property that the adversarial examples of one model are likely to fool others.
However, the transferred attack is very unstable, and often has a large variation in its effectiveness.
Therefore, results of the black-box setting might not be reliable and effective.
Thus we only present one result here to demonstrate the robustness of different models.
[Table] [Table]
[Table]
B S LIM N ETWORK
Table 7 presents another architecture that we used in the L2L. In this network, the second convolutional layer uses downsampling, while the second last deconvolutional layer uses upsampling.
Due to the downsampling, this network is computationally cheap and thus it is computationally fast.
For example the running time of per epoch for L2L with slim attacker is 480; whereas L2L with the other architecture is 620.
However, it loses some information of input and is less stable than the original architecture (Table 1).
Inspired by residual learning in He et al.
(2016), we address the above issues by using a skip layer connection to ease the training of this network.
Speciﬁcally, the last layer takes the concatenation of A ( x , y, θ ) and the output of the second last layer as input. Figurepresents the architecture of ResBlocks.
PReLU is a special type of Leaky ReLU with a learnable slope parameter.
Conv
[Table]
[ k = 3 × [Table] [Table] = 128 , s = 1 , p = 1 ], BN+
[Table] ResBlocks: [channel = 256]
ResBlocks: [channel = 128], BN
DeConv: [ k = 4 × 4 , c = 16 , s = 2 , p = 1 ], BN+ReLU
Conv: [ k = 3 × 3 , c = 3 , s = 1 , p = 1 ], tanh
[Figure]
Table 8 shows the results of L2L with the architecture shown in Table 7.
[Table]
2-Step L2L 75. C G ENERATIVE A DVERSARIAL I MITATION L EARNING C. A LGORITHMS
Algorithm {+
+}
Learning- generative adversarial imitation learning
Input:
Expert trajectories ( (cid:101) s, (cid:101) a ∼ π E ( (cid:101) s )) , initial policy, discriminator and updater parameters θ π , θ D , θ U .
for t ← 1 to N do Sample trajectories ( s, a
[Equation]
Compute gradient: g t D ←
[Equation]
Update the discriminator parameters:
[Equation]
Update the updater parameters θ U by minimizing:
[Equation]
Update the policy parameters θ π by a policy step using the TRPO rule (Ho and Ermon (2016))
C. E XPERIMENT S ETTING
Updater Architecture We use simple 3-layer perceptron with a skip layer as our updater.
The number hidden units are ( 2 m → 8 m → 4 m → m ), where m is the dimension of θ D that depends on the original task.
For the ﬁrst and the second layer, we use PReLu as the activation function, while the last layer has no activation function.
Finally we add the output to θ D in the original input as the updated parameter for the discriminator network.
Hyperparameter Settings For all baselines we exactly follows the setting in Ho and Ermon (2016), except that we use a 2-layer discriminator with number of hidden units ( ( s, a ) → 64 → 32 → 1 ) using tanh as the activation.
We use the same neural network architecture for π and the same optimizer conﬁguration.
The expert trajectories are obtained by an expert trained using TRPO.
For L2L based GAIL, we also use Adam optimizer to update the θ U with the same conﬁguration as updating θ D in original GAIL. D L IMITING C YCLE
Limiting cycle is a well-known issue for minimax machine learning problem [4,5].
The reason behind limiting cycle is that different from minimization problems, a minimax optimization problem is more complicated and can be highly nonconvex-nonconcave, where the inner problem can not be solved exactly.
Here we provide a concrete example: we consider the following optimization problem:
[Equation]
Then at the t -th iteration, the update direction will be ( − y t , x t ) .
If we start from (1 , 0) with a stepsize of 0 . 0001 , this update will result in a limiting circle: x 2 + y 2 = 1 and never reach the stable equilibrium (0 , 0) as shown in Figure 8.
[Figure]
E R OBUSTNESS E VALUATION C HECKLIST
Recently, there are many works on robustness defense that have been proven ineffective (Athalye et al., 2018; Carlini et al., 2019).
Our work follows the most reliable and widely used robust model approach — adversarial training, which ﬁnds a set parameters to make the model robust.
We do not make any modiﬁcation to ﬁnal classiﬁer model.
Unlike previous works (e.g. Defense-GAN,
Samangouei et al.
, our model does not take the attacker as a part of the ﬁnal model and does not use shattered/obfuscated/masked gradient as a defense mechanism.
We also demonstrate that the evaluation of the robustness of our proposed L2L method is trustworthy by verifying all items listed in (Carlini et al., 2019).
E. S HATTERED /O BFUSCATED /M ASKED G RADIENT
In this section we verify that our proposed L2L method does not fall into the pitfall of shattered/obfuscated/masked gradient, which have proven ineffective.
To see this, we checked every item recommended in section 3.1 of Athalye et al.
• One-step attacks perform better than iterative attacks: Figure 4 shows that the PGM attack is stronger with larger number of iterations.
• Black-box attacks are better than white-box attacks: Appendix A shows that the black-box transfer attack is much weaker than white white-box attacks.
• Unbounded attacks do not reach 100% success: We evaluate the model robustness against attack with extremely large perturbation to show that unbounded attacks do reach 100% success.
Speciﬁcally, we use the PGM-10 attack with various perturbation magnitudes (cid:15) ∈ [0 , 1] and stepsize (cid:15) 10 .
Figure 9 shows that the PGM attack eventually reach 100% success as the perturbation magnitude increases.
[Figure]
[Figure]
[Figure]
• Random sampling ﬁnds adversarial examples:
In Table 2, we show that random search is not better than Gradient based method and is rather weak against our model.
• Increasing distortion bound does not increase success: Figure 4 shows that the PGM attack becomes stronger as the perturbation magnitude increases.
E. R OBUSTNESS E VALUATION C HECKLIST
Carlini et al.
(2019) also provide an evaluation checklist, and we now check each of common severe ﬂaws and common pitfalls as follows:
• State a precise threat model: We do not have any adversary detector; We do not use shattered/Obfuscated/Masked gradient.
We do not have a denoiser.
Our model has no aware of the attack mechanism, including PGM and CW attacks.
• Adaptive attacks: We used CW, PGM, and L2L attacker attack.
• Report clean model accuracy: We reported.
• Do not use Fast Gradient Sign Method.
We use PGM-20 and PGM-100 and CW.
• Do not only use attacks during testing that were used during training.
We use different evaluation criteria to evaluate all models.
• Perform basic sanity tests: It is provided in Figure 4.
• Generate an attack success rate vs. perturbation budget: Figure 4.
• Verify adaptive attacks perform better than any other (e.g., blackbox, and brute-force search): The above table and Appendix A in the paper.
• Describe the attacks applied:
In Section 3. • Apply a diverse set of attacks: We tried PGM attack (with different perturbation magnitude and iterations), blackbox attack (transfer attack), CW attack (adaptive attack), L2L attack (adaptive and designed for this particular model), Bruteforce random search (gradient-free attack) • Suggestions for randomized defenses: We are not.
• Suggestions for non-differentiable components (e.g., by performing quantization or adding extra randomness): We have no additional non-differentiable component.
• Verify that the attacks have converged: Figure 4 shows that the PGM attack eventually converges.
• Carefully investigate attack hyperparameters: Figure• Compare against prior work: We compared our algorithm to PDM net.
L2L is more computationally efﬁcient and the L2L model is more robust due to the fact that L2L attack is strong enough.
Unlike Defense-GAN, we do not use the generator (attacker in L2L) as the denoising module and do not change the ﬁnal prediction model.