Title: MIXUP INFERENCE: BETTER EXPLOITING MIXUP TO DEFEND ADVERSARIAL ATTACKS

Abstract: It has been widely recognized that adversarial examples can be easily crafted to fool deep networks, which mainly root from the locally unreasonable behavior nearby input examples. Applying mixup in training provides an effective mechanism to improve generalization performance and model robustness against adversarial perturbations, which introduces the globally linear behavior in-between training examples. However, in previous work, the mixup-trained models only passively defend adversarial attacks in inference by directly classifying the inputs, where the induced global linearity is not well exploited. Namely, since the locality of the adversarial perturbations, it would be more efficient to actively break the locality via the globality of the model predictions. Inspired by simple geometric intuition, we develop an inference principle, named mixup inference (MI), for mixup-trained models. MI mixups the input with other random clean samples, which can shrink and transfer the equivalent perturbation if the input is adversarial. Our experiments on CIFAR-10 and CIFAR-100 demonstrate that MI can further improve the adversarial robustness for the models trained by mixup and its variants.

1. INTRODUCTION:

Deep neural networks (DNNs) have achieved state-of-the-art performance on various tasks (Goodfellow et al., 2016) . However, counter-intuitive adversarial examples generally exist in different domains, including computer vision (Szegedy et al., 2014) , natural language processing (Jin et al., 2019) , reinforcement learning (Huang et al., 2017) , speech (Carlini & Wagner, 2018) and graph data (Dai et al., 2018) . As DNNs are being widely deployed, it is imperative to improve model robustness and defend adversarial attacks, especially in safety-critical cases. Previous work shows that adversarial examples mainly root from the locally unstable behavior of classifiers on the data manifolds (Goodfellow et al., 2015; Fawzi et al., 2016; 2018; Pang et al., 2018b) , where a small adversarial perturbation in the input space can lead to an unreasonable shift in the feature space.

On the one hand, many previous methods try to solve this problem in the inference phase, by introducing transformations on the input images. These attempts include performing local linear transformation like adding Gaussian noise (Tabacof & Valle, 2016) , where the processed inputs are kept nearby the original ones, such that the classifiers can maintain high performance on the clean inputs. However, as shown in Fig. 1 (a), the equivalent perturbation, i.e., the crafted adversarial perturbation, is still δ and this strategy is easy to be adaptively evaded since the randomness of x 0 w.r.t x 0 is local (Athalye et al., 2018) . Another category of these attempts is to apply various non-linear transformations, e.g., different operations of image processing (Guo et al., 2018; Xie et al., 2018; Raff et al., 2019) . They are usually off-the-shelf for different classifiers, and generally aim to disturb the adversarial perturbations, as shown in Fig. 1(b ). Yet these methods are not quite reliable since there is no illustration or guarantee on to what extent they can work.

On the other hand, many efforts have been devoted to improving adversarial robustness in the training phase. For examples, the adversarial training (AT) methods (Madry et al., 2018; Zhang et al., 2019; Shafahi et al., 2019) induce locally stable behavior via data augmentation on adversarial examples. However, AT methods are usually computationally expensive, and will often degenerate model x is the crafted adversarial example, x0 is the original clean example, which is virtual and unknown for the classifiers. δ is the adversarial perturbation.

performance on the clean inputs or under general-purpose transformations like rotation (Engstrom et al., 2019) . In contrast, the mixup training method (Zhang et al., 2018) introduces globally linear behavior in-between the data manifolds, which can also improve adversarial robustness (Zhang et al., 2018; Verma et al., 2019a) . Although this improvement is usually less significant than it resulted by AT methods, mixup-trained models can keep state-of-the-art performance on the clean inputs; meanwhile, the mixup training is computationally more efficient than AT. The interpolated AT method (Lamb et al., 2019 ) also shows that the mixup mechanism can further benefit the AT methods.

However, most of the previous work only focuses on embedding the mixup mechanism in the training phase, while the induced global linearity of the model predictions is not well exploited in the inference phase. Compared to passive defense by directly classifying the inputs (Zhang et al., 2018; Lamb et al., 2019) , it would be more effective to actively defend adversarial attacks by breaking their locality via the globally linear behavior of the mixup-trained models. In this paper, we develop an inference principle for mixup-trained models, named mixup inference (MI). In each execution, MI performs a global linear transformation on the inputs, which mixups the input x with a sampled clean example x s , i.e., x = λx + (1 -λ)x s (detailed in Alg. 1), and feed x into the classifier as the processed input.

There are two basic mechanisms for robustness improving under the MI operation (detailed in Sec. 3.2.1), which can be illustrated by simple geometric intuition in Fig. 1(c ). One is perturbation shrinkage: if the input is adversarial, i.e., x = x 0 + δ, the perturbation δ will shrink by a factor λ after performing MI, which is exactly the mixup ratio of MI according to the similarity between triangles.

Another one is input transfer: after the MI operation, the reduced perturbation λδ acts on random x0 . Comparing to the spatially or semantically local randomness introduced by Gaussian noise or image processing, x0 introduces spatially global and semantically diverse randomness w.r.t x 0 . This makes it less effective to perform adaptive attacks against MI (Athalye et al., 2018) . Furthermore, the global linearity of the mixup-trained models ensures that the information of x 0 remained in x0 is proportional to λ, such that the identity of x 0 can be recovered from the statistics of x0 .

In experiments, we evaluate MI on CIFAR-10 and CIFAR-100 (Krizhevsky & Hinton, 2009) under the oblivious attacks (Carlini & Wagner, 2017) and the adaptive attacks (Athalye et al., 2018) . The results demonstrate that our MI method is efficient in defending adversarial attacks in inference, and is also compatible with other variants of mixup, e.g., the interpolated AT method (Lamb et al., 2019) . Note that Shimada et al. (2019) also propose to mixup the input points in the test phase, but they do not consider their method from the aspect of adversarial robustness.

2. PRELIMINARIES:

In this section, we first introduce the notations applied in this paper, then we provide the formula of mixup in training. We introduce the adversarial attacks and threat models in Appendix A.1.

2.1. NOTATIONS:

Given an input-label pair (x, y), a classifier F returns the softmax prediction vector F (x) and the predicted label ŷ = arg max j∈[L] F j (x), where L is the number of classes and

[L] = {1, • • • , L}.

The classifier F makes a correct prediction on x if y = ŷ. In the adversarial setting, we augment the data pair (x, y) to a triplet (x, y, z) with an extra binary variable z, i.e.,

z = 1, if x is adversarial, 0, if x is clean. (1)

The variable z is usually considered as hidden in the inference phase, so an input x (either clean or adversarially corrupted) can be generally denoted as x = x 0 + δ • 1 z=1 . Here x 0 is a clean sample from the data manifold p(x) with label y 0 , 1 z=1 is the indicator function, and δ is a potential perturbation crafted by adversaries. It is worthy to note that the perturbation δ should not change the true label of the input, i.e., y = y 0 . For p -norm adversarial attacks (Kurakin et al., 2017; Madry et al., 2018) , we have δ p ≤ , where is a preset threshold. Based on the assumption that adversarial examples are off the data manifolds, we formally have x 0 + δ / ∈ supp(p(x)) (Pang et al., 2018a) .

2.2. MIXUP IN TRAINING:

In supervised learning, the most commonly used training mechanism is the empirical risk minimization (ERM) principle (Vapnik, 2013) , which minimizes

1 n n i=1 L(F (x i ), y i ) on the training dataset D = {(x i , y i )} n

i=1 with the loss function L. While computationally efficient, ERM could lead to memorization of data (Zhang et al., 2017) and weak adversarial robustness (Szegedy et al., 2014) .

As an alternative, Zhang et al. (2018) introduce the mixup training mechanism, which minimizes 1 m m j=1 L(F (x j ), ỹj ). Here xj = λx j0 + (1 -λ)x j1 ; ỹj = λy j0 + (1 -λ)y j1 , the input-label pairs (x j0 , y j0 ) and (x j1 , y j1 ) are randomly sampled from the training dataset, λ ∼ Beta(α, α) and α is a hyperparameter. Training by mixup will induce globally linear behavior of models in-between data manifolds, which can empirically improve generalization performance and adversarial robustness (Zhang et al., 2018; Tokozume et al., 2018a; b; Verma et al., 2019a; b) . Compared to the adversarial training (AT) methods (Goodfellow et al., 2015; Madry et al., 2018) , trained by mixup requires much less computation and can keep state-of-the-art performance on the clean inputs.

3. METHODOLOGY:

Although the mixup mechanism has been widely shown to be effective in different domains (Berthelot et al., 2019; Beckham et al., 2019; Verma et al., 2019a; b) , most of the previous work only focuses on embedding the mixup mechanism in the training phase, while in the inference phase the global linearity of the trained model is not well exploited. Compared to passively defending adversarial examples by directly classifying them, it would be more effective to actively utilize the globality of mixup-trained models in the inference phase to break the locality of adversarial perturbations.

3.1. MIXUP INFERENCE:

The above insight inspires us to propose the mixup inference (MI) method, which is a specialized inference principle for the mixup-trained models. In the following, we apply colored y, ŷ and y s to visually distinguish different notations. Consider an input triplet (x, y, z), where z is unknown in advance. When directly feeding x into the classifier F , we can obtain the predicted label ŷ. In the adversarial setting, we are only interested in the cases where x is correctly classified by F if it is clean, or wrongly classified if it is adversarial (Kurakin et al., 2018) . This can be formally denoted as

1 y =ŷ = 1 z=1 .

(2)

The general mechanism of MI works as follows. Every time we execute MI, we first sample a label y s ∼ p s (y), then we sample x s from p s (x|y s ) and mixup it with x as x = λx + (1 -λ)x s . p s (x, y) denotes the sample distribution, which is constrained to be on the data manifold, i.e., supp(p s (x)) ⊂ supp(p(x)). In practice, we execute MI for N times and average the output predictions to obtain F MI (x), as described in Alg. 1. Here we fix the mixup ratio λ in MI as a hyperparameter, while similar properties hold if λ comes from certain distribution.

3.2. THEORETICAL ANALYSES:

Theoretically, with unlimited capability and sufficient clean samples, a well mixup-trained model F can be denoted as a linear function H on the convex combinations of clean examples (Hornik et al., 1989; Guo et al., 2019) , i.e., ∀x i , x j ∼ p(x) and λ ∈ [0, 1], there is

EQUATION

Algorithm 1 Mixup Inference (MI)

Input: The mixup-trained classifier F ; the input x.

Hyperparameters: The sample distribution p s ; the mixup ratio λ; the number of execution N . Initialize F MI (x) = 0;

for k = 1 to N do Sample y s,k ∼ p s (y s ), x s,k ∼ p s (x s |y s,k ); Mixup x with x s,k as xk = λx + (1 -λ)x s,k ; Update F MI (x) = F MI (x) + 1 N F (x k ); end for Return: The prediction F MI (x) of input x.

Specially, we consider the case where the training objective L is the cross-entropy loss, then H(x i ) should predict the one-hot vector of label y i , i.e., H y (x i ) = 1 y=yi . If the input x = x 0 + δ is adversarial, then there should be an extra non-linear part G(δ; x 0 ) of F , since x is off the data manifolds. Thus for any input x, the prediction vector can be compactly denoted as

EQUATION

)

According to Eq. ( 3) and Eq. ( 4), the output of x in MI is given by:

EQUATION

where

EQUATION

where ∞ -→ represents the limitation when the execution times N → ∞. Now we separately investigate the y-th and ŷ-th (could be the same one) components of F (x) according to Eq. ( 5), and see how these two components differ from those of F (x). These two components are critical because they decide whether we can correctly classify or detect adversarial examples (Goodfellow et al., 2016) . Note that there is H y (x 0 ) = 1 and H ys (x s ) = 1, thus we have the y-th components as

F y (x) = 1 + G y (δ; x 0 ) • 1 z=1 ; F y (x) = λ + (1 -λ) • 1 y=ys + G y (λδ; x0 ) • 1 z=1 . (7)

Furthermore, according to Eq. ( 2), there is 1 y=ŷ = 1 z=0 . We can represent the ŷ-th components as

EQUATION

)

From the above formulas we can find that, except for the hidden variable z, the sampling label y s is another variable which controls the MI output F (x) for each execution. Different distributions of sampling y s result in different versions of MI. Here we consider two easy-to-implement cases:

MI with predicted label (MI-PL): In this case, the sampling label y s is the same as the predicted label ŷ, i.e., p s (y) = 1 y=ŷ is a Dirac distribution on ŷ.

MI with other labels (MI-OL)::

In this case, the label y s is uniformly sampled from the labels other than ŷ, i.e., p s (y) = U ŷ (y) is a discrete uniform distribution on the set {y ∈ [L]|y = ŷ}.

We list the simplified formulas of Eq. ( 7) and Eq. ( 8) under different cases in Table 1 for clear representation. With the above formulas, we can evaluate how the model performance changes with and without MI by focusing on the formula of

EQUATION

Specifically, in the general-purpose setting where we aim to correctly classify adversarial examples (Madry et al., 2018) , we claim that the MI method improves the robustness if the prediction 

MI-PL MI-OL:

z = 0 z = 1 z = 0 z = 1 Fy(x) 1 1 + Gy(δ; x0) 1 1 + Gy(δ; x0) Fy(x) 1 λ + Gy(λδ; x0) λ λ + (1 -λ) • 1y=y s + Gy(λδ; x0) F ŷ (x) 1 G ŷ (δ; x0) 1 G ŷ (δ; x0) F ŷ (x) 1 (1 -λ) + G ŷ (λδ; x0) λ G ŷ (λδ; x0)

value on the true label y increases while it on the adversarial label ŷ decreases after performing MI when the input is adversarial (z = 1). This can be formally denoted as

EQUATION

)

We refer to this condition in Eq. ( 10) as robustness improving condition (RIC). Further, in the detection-purpose setting where we want to detect the hidden variable z and filter out adversarial inputs, we can take the gap of the ŷ-th component of predictions before and after the MI operation, i.e., ∆F ŷ (x; p s ) as the detection metric (Pang et al., 2018a) . To formally measure the detection ability on z, we use the detection gap (DG), denoted as

EQUATION

A higher value of DG indicates that ∆F ŷ (x; p s ) is better as a detection metric. In the following sections, we specifically analyze the properties of different versions of MI according to Table 1 , and we will see that the MI methods can be used and benefit in different defense strategies.

3.2.1. MIXUP INFERENCE WITH PREDICTED LABEL:

In the MI-PL case, when the input is clean (i.e., z = 0), there is F (x) = F (x), which means ideally the MI-PL operation does not influence the predictions on the clean inputs. When the input is adversarial (i.e., z = 1), MI-PL can be applied as a general-purpose defense or a detection-purpose defense, as we separately introduce below:

General-purpose defense: If MI-PL can improve the general-purpose robustness, it should satisfy RIC in Eq. ( 10). By simple derivation and the results of Table 1 , this means that

EQUATION

Since an adversarial perturbation usually suppress the predicted confidence on the true label and promote it on the target label (Goodfellow et al., 2015) , there should be G ŷ (δ; x0 ) > 0 and G y (δ; x0 ) < 0.

Note that the left part of Eq. ( 12) can be decomposed into

EQUATION

)

Here Eq. ( 13) indicates the two basic mechanisms of the MI operations defending adversarial attacks, as shown in Fig. 1(c ). The first mechanism is input transfer, i.e., the clean input that the adversarial perturbation acts on transfers from the deterministic x 0 to stochastic x0 . Compared to the Gaussian noise or different image processing methods which introduce spatially or semantically local randomness, the stochastic x0 induces spatially global and semantically diverse randomness. This will make it harder to perform an adaptive attack in the white-box setting (Athalye et al., 2018) .

The second mechanism is perturbation shrinkage, where the original perturbation δ shrinks by a factor λ. This equivalently shrinks the perturbation threshold since λδ p = λ δ p ≤ λ , which means that MI generally imposes a tighter upper bound on the potential attack ability for a crafted perturbation.

Besides, empirical results in previous work also show that a smaller perturbation threshold largely weakens the effect of attacks (Kurakin et al., 2018) . Therefore, if an adversarial attack defended by these two mechanisms leads to a prediction degradation as in Eq. ( 12), then applying MI-PL would improve the robustness against this adversarial attack. Similar properties also hold for MI-OL as described in Sec. 3.2.2. In Fig. 2 , we empirically demonstrate that most of the existing adversarial attacks, e.g., the PGD attack (Madry et al., 2018) satisfies these properties. 

Clean inputs:

Adversarial inputs ∆' " = ' " *(; % # $ -' " (; # $ ∆' - " = ' - " (; # $ -' - " *(; % # $ Figure 2 : The results are averaged on 100 randomly test clean samples of CIFAR-10. The adversarial attack is untargeted PGD-10. Note that the ∆Gy calculated here is the minus value of it in Eq. ( 12) and Eq. ( 15).

Detection-purpose defense: According to Eq. ( 11), the formula of DG for MI-PL is

EQUATION

By comparing Eq. ( 12) and Eq. ( 14), we can find that they are consistent with each other, which means that for a given adversarial attack, if MI-PL can better defend it in general-purpose, then ideally MI-PL can also better detect the crafted adversarial examples.

3.2.2. MIXUP INFERENCE WITH OTHER LABELS:

As to MI-OL, when the input is clean (z = 0), there would be a degeneration on the optimal clean prediction as F y (x) = F ŷ (x) = λ, since the sampled x s does not come from the true label y. As compensation, MI-OL can better improve robustness compared to MI-PL when the input is adversarial (z = 1), since the sampled x s also does not come from the adversarial label ŷ in this case.

General-purpose defense: Note that in the MI-OL formulas of Table 1 , there is a term of 1 y=ys . Since we uniformly select y s from the set [L] \ {ŷ}, there is E(1 y=ys ) = 1 L-1 . According to the RIC, MI-OL can improve robustness against the adversarial attacks if there satisfies

EQUATION

)

Note that the conditions in Eq. ( 15) is strictly looser than Eq. ( 12), which means MI-OL can defend broader range of attacks than MI-PL, as verified in Fig. 2 .

Detection-purpose defense: According to Eq. ( 11) and Table 1 , the DG for MI-OL is

EQUATION

It is interesting to note that DG MI-PL = DG MI-OL , thus the two variants of MI have the same theoretical performance in the detection-purpose defenses. However, in practice we find that MI-PL performs better than MI-OL in detection, since empirically mixup-trained models cannot induce ideal global linearity (cf. Fig. 2 in Zhang et al. (2018) ). Besides, according to Eq. ( 6), to statistically make sure that the clean inputs will be correctly classified after MI-OL, there should be ∀k ∈ [L] \ {y},

EQUATION

)

4. EXPERIMENTS:

In this section, we provide the experimental results on CIFAR-10 and CIFAR-100 (Krizhevsky & Hinton, 2009) to demonstrate the effectiveness of our MI methods on defending adversarial attacks.

Our codes are available at https://github.com/P2333/Mixup-Inference. 

4.1. SETUP:

In training, we use ResNet-50 (He et al., 2016) and apply the momentum SGD optimizer (Qian, 1999) on both CIFAR-10 and CIFAR-100. We run the training for 200 epochs with the batch size of 64. The initial learning rate is 0.01 for ERM, mixup and AT; 0.1 for interpolated AT (Lamb et al., 2019) . The learning rate decays with a factor of 0.1 at 100 and 150 epochs. The attack method for AT and interpolated AT is untargeted PGD-10 with = 8/255 and step size 2/255 (Madry et al., 2018) , and the ratio of the clean examples and the adversarial ones in each mini-batch is 1 : 1 (Lamb et al., 2019) . The hyperparameter α for mixup and interpolated AT is 1.0 (Zhang et al., 2018) . All defenses with randomness are executed 30 times to obtain the averaged predictions (Xie et al., 2018) .

4.2. EMPIRICAL VERIFICATION OF THEORETICAL ANALYSES:

To verify and illustrate our theoretical analyses in Sec. 3, we provide the empirical relationship between the output predictions of MI and the hyperparameter λ in Fig. 2 . The notations and formulas annotated in Fig. 2 correspond to those introduced in Sec. 3. We can see that the results follow our theoretical conclusions under the assumption of ideal global linearity. Besides, both MI-PL and MI-OL empirically satisfy RIC in this case, which indicates that they can improve robustness under the untargeted PGD-10 attack on CIFAR-10, as quantitatively demonstrated in the following sections. 

4.3. PERFORMANCE UNDER OBLIVIOUS ATTACKS:

In this subsection, we evaluate the performance of our method under the oblivious-box attacks (Carlini & Wagner, 2017) . The oblivious threat model assumes that the adversary is not aware of the existence of the defense mechanism, e.g., MI, and generate adversarial examples based on the unsecured classification model. We separately apply the model trained by mixup and interpolated AT as the classification model. The AUC scores for the detection-purpose defense are given in Fig. 3 (a). The results show that applying MI-PL in inference can better detect adversarial attacks, while directly detecting by the returned confidence without MI-PL performs even worse than a random guess.

We also compare MI with previous general-purpose defenses applied in the inference phase, e.g., adding Gaussian noise or random rotation (Tabacof & Valle, 2016) ; performing random padding or resizing after random cropping (Guo et al., 2018; Xie et al., 2018) . The performance of our method and baselines on CIFAR-10 and CIFAR-100 are reported in Table 2 and Table 3 , respectively. Since for each defense method, there is a trade-off between the accuracy on clean samples and adversarial samples depending on the hyperparameters, e.g., the standard deviation for Gaussian noise, we carefully select the hyperparameters to ensure both our method and baselines keep a similar performance on clean data for fair comparisons. The hyperparameters used in our method and baselines are reported in Table 4 and Table 5 . In Fig. 3 (b), we further explore this trade-off by grid searching the hyperparameter space for each defense to demonstrate the superiority of our method.

As shown in these results, our MI method can significantly improve the robustness for the trained models with induced global linearity, and is compatible with training-phase defenses like the interpolated AT method. As a practical strategy, we also evaluate a variant of MI, called MI-Combined, which applies MI-OL if the input is detected as adversarial by MI-PL with a default detection threshold; otherwise returns the prediction on the original input. We also perform ablation studies of ERM / AT + MI-OL in Table 2 , where no global linearity is induced. The results verify that our MI methods indeed exploit the global linearity of the mixup-trained models, rather than simply introduce randomness.

4.4. PERFORMANCE UNDER WHITE-BOX ADAPTIVE ATTACKS:

Following Athalye et al. (2018) , we test our method under the white-box adaptive attacks (detailed in Appendix B.2). Since we mainly adopt the PGD attack framework, which synthesizes adversarial examples iteratively, the adversarial noise will be clipped to make the input image stay within the valid range. It results in the fact that with mixup on different training examples, the adversarial perturbation will be clipped differently. To address this issue, we average the generated perturbations over the adaptive samples as the final perturbation. The results of the adversarial accuracy w.r.t the number of adaptive samples are shown in Fig. 4 . We can see that even under a strong adaptive attack, equipped with MI can still improve the robustness for the classification models. 

5. CONCLUSION:

In this paper, we propose the MI method, which is specialized for the trained models with globally linear behaviors induced by, e.g., mixup or interpolated AT. As analyzed in Sec. 3, MI can exploit this induced global linearity in the inference phase to shrink and transfer the adversarial perturbation, which breaks the locality of adversarial attacks and alleviate their aggressivity. In experiments, we empirically verify that applying MI can return more reliable predictions under different threat models.

A MORE BACKGROUNDS:

In this section, we provide more backgrounds which are related to our work in the main text.

A.1 ADVERSARIAL ATTACKS AND THREAT MODELS Adversarial attacks. Although deep learning methods have achieved substantial success in different domains (Goodfellow et al., 2016) , human imperceptible adversarial perturbations can be easily crafted to fool high-performance models, e.g., deep neural networks (DNNs) (Nguyen et al., 2015) .

One of the most commonly studied adversarial attack is the projected gradient descent (PGD) method (Madry et al., 2018) . Let r be the number of iteration steps, x 0 be the original clean example, then PGD iteratively crafts the adversarial example as

EQUATION

where clip x, (•) is the clipping function. Here x * 0 is a randomly perturbed image in the neighborhood of x 0 , i.e., Ů (x 0 , ), and the finally returned adversarial example is x = x * r = x 0 + δ, following our notations in the main text.

Threat models. Here we introduce different threat models in the adversarial setting. As suggested in Carlini et al. (2019) , a threat model includes a set of assumptions about the adversarys goals, capabilities, and knowledge.

Adversary's goals could be simply fooling the classifiers to misclassify, which is referred to as untargeted mode. Alternatively, the goals can be more specific to make the model misclassify certain examples from a source class into a target class, which is referred to as targeted mode. In our experiments, we evaluate under both modes, as shown in Table 2 and Table 3. Adversary's capabilities describe the constraints imposed on the attackers. Adversarial examples require the perturbation δ to be bounded by a small threshold under p -norm, i.e., δ p ≤ . For example, in the PGD attack, we consider under the ∞ -norm.

Adversary's knowledge describes what knowledge the adversary is assumed to have. Typically, there are three settings when evaluating a defense method:

• Oblivious adversaries are not aware of the existence of the defense D and generate adversarial examples based on the unsecured classification model F (Carlini & Wagner, 2017 ). • White-box adversaries know the scheme and parameters of D, and can design adaptive methods to attack both the model F and the defense D simultaneously (Athalye et al., 2018) . • Black-box adversaries have no access to the parameters of the defense D or the model F with varying degrees of black-box access (Dong et al., 2018) .

In our experiments, we mainly test under the oblivious setting (Sec. 4.3) and white-box setting (Sec. 4.4), since previous work has already demonstrated that randomness itself is efficient on defending black-box attacks (Guo et al., 2018; Xie et al., 2018) .

A.2 INTERPOLATED ADVERSARIAL TRAINING:

To date, the most widely applied framework for adversarial training (AT) methods is the saddle point framework introduced in Madry et al. (2018) :

EQUATION

Here θ represents the trainable parameters in the classifier F , and S is a set of allowed perturbations.

In implementation, the inner maximization problem for each input-label pair (x, y) is approximately solved by, e.g., the PGD method with different random initialization (Madry et al., 2018) .

As a variant of the AT method, Lamb et al. (2019) propose the interpolated AT method, which combines AT with mixup. Interpolated AT trains on interpolations of adversarial examples along with interpolations of unperturbed examples (cf. Alg. 1 in Lamb et al. (2019) ). Previous empirical results demonstrate that interpolated AT can obtain higher accuracy on the clean inputs compared to the AT method without mixup, while keeping the similar performance of robustness. Generality. According to Sec. 3, except for the mixup-trained models, the MI method is generally compatible with any trained model with induced global linearity. These models could be trained by other methods, e.g., manifold mixup (Verma et al., 2019a; Inoue, 2018; Lamb et al., 2019) . Besides, to better defend white-box adaptive attacks, the mixup ratio λ in MI could also be sampled from certain distribution to put in additional randomness.

Methods:

Empirical gap. As demonstrated in Fig. 2 , there is a gap between the empirical results and the theoretical formulas in Table 1 . This is because that the mixup mechanism mainly acts as a regularization in training, which means the induced global linearity may not satisfy the expected behaviors. To improve the performance of MI, a stronger regularization can be imposed, e.g., training with mixup for more epochs, or applying matched λ both in training and inference.

B.2 ADAPTIVE ATTACKS FOR MIXUP INFERENCE:

Following Athalye et al. (2018) , we design the adaptive attacks for our MI method. Specifically, according to Eq. ( 6), the expected model prediction returned by MI is:

EQUATION

Note that generally the λ in MI comes from certain distribution. For simplicity, we fix λ as a hyperparameter in our implementation. Therefore, the gradients of the prediction w.r. 

:



Figures and Tables:

Figure1: Intuitive mechanisms in the input space of different input-processing based defenses. x is the crafted adversarial example, x0 is the original clean example, which is virtual and unknown for the classifiers. δ is the adversarial perturbation.

Figure3: Results on CIFAR-10. (a) AUC scores on 1,000 randomly selected test clean samples and 1,000 adversarial counterparts crafted on these clean samples. (b) The adversarial accuracy w.r.t clean accuracy on 1,000 randomly selected test samples. The adversarial attack is untargeted PGD-10, with = 8/255 and step size 2/255. Each point for a certain method corresponds to a set of hyperparameters.

Figure 4: Classification accuracy under the adaptive PGD attacks on CIFAR-10. The number of adaptive samples refers to the execution times of sampling xs in each iteration step of adaptive PGD. The dash lines are the accuracy of trained models without MI-OL under PGD attacks.

rotation Rotation degree range [-40 • , 40 • ]Mixup +Xie et al. (2018) The random crop size is randomly selected from[16, 24]    Mixup +Guo et al. (2018) The random crop size is randomly selected from[22, 30]    ERM + MI-OL (ablation study)The λOL = 0.6Mixup + MI-OLThe λOL = 0.5Mixup + MI-CombinedThe λOL = 0.5, λOL = 0.4, threshold is 0.2 Interpolated AT -Interpolated AT + Gaussian noise Noise standard deviation σ = 0.075 Interpolated AT + Random rotation Rotation degree range [-30 • , 30 • ] Interpolated AT + Xie et al. (2018) The random crop size is randomly selected from [20, 28] Interpolated AT + Guo et al. (2018) The random crop size is randomly selected from [20, 28] AT + MI-OL (ablation study) The λOL = 0.8 Interpolated AT + MI-OL The λOL = 0.6 B TECHNICAL DETAILS We provide more technical details about our method and the implementation of the experiments. B.1 MORE DISCUSSION ON THE MI METHOD

The the simplified formulas of Eq. (7) and Eq. (8) in different versions of MI. Here MI-PL indicates mixup inference with predicted label; MI-OL indicates mixup inference with other labels.

Table content: <table/>

Classification accuracy (%) on the oblivious adversarial examples crafted on 1,000 randomly sampled test points of CIFAR-10. Perturbation = 8/255 with step size 2/255. The subscripts indicate the number of iteration steps when performing attacks. The notation ≤ 1 represents accuracy less than 1%. The parameter settings for each method can be found in Table4.

Table content: <table><tr><td/><td/><td/><td/><td/><td/><td/><td/><td>Untargeted Mode</td><td>Targeted Mode</td></tr><tr><td/><td colspan="3">Methods</td><td/><td/><td colspan="3">Cle. PGD10 PGD50 PGD200 PGD10 PGD50 PGD200</td></tr><tr><td/><td colspan="3">Mixup</td><td/><td/><td colspan="2">93.8</td><td>3.6</td><td>3.2</td><td>3.1</td><td>≤ 1</td><td>≤ 1</td><td>≤ 1</td></tr><tr><td/><td colspan="4">Mixup + Gaussian noise</td><td/><td colspan="2">84.4</td><td>13.5</td><td>9.6</td><td>8.8</td><td>37.7</td><td>28.6</td><td>27.9</td></tr><tr><td colspan="5">Mixup + Random rotation</td><td/><td colspan="2">82.0</td><td>21.8</td><td>18.7</td><td>18.2</td><td>38.9</td><td>32.5</td><td>26.5</td></tr><tr><td colspan="5">Mixup + Xie et al. (2018)</td><td/><td colspan="2">82.1</td><td>23.0</td><td>19.6</td><td>19.1</td><td>38.4</td><td>31.1</td><td>25.2</td></tr><tr><td colspan="5">Mixup + Guo et al. (2018)</td><td/><td colspan="2">83.3</td><td>31.2</td><td>28.8</td><td>28.3</td><td>57.8</td><td>49.1</td><td>48.9</td></tr><tr><td colspan="6">ERM + MI-OL (ablation study)</td><td colspan="2">81.6</td><td>7.4</td><td>6.4</td><td>6.1</td><td>33.0</td><td>26.7</td><td>23.2</td></tr><tr><td/><td colspan="3">Mixup + MI-OL</td><td/><td/><td colspan="2">83.9</td><td>26.1</td><td>18.8</td><td>18.3</td><td>55.6</td><td>51.2</td><td>50.8</td></tr><tr><td/><td colspan="4">Mixup + MI-Combined</td><td/><td colspan="2">82.9</td><td>33.7</td><td>31.0</td><td>30.7</td><td>56.1</td><td>49.7</td><td>49.4</td></tr><tr><td/><td colspan="3">Interpolated AT</td><td/><td/><td colspan="2">89.7</td><td>46.7</td><td>43.5</td><td>42.5</td><td>65.6</td><td>62.5</td><td>61.9</td></tr><tr><td colspan="6">Interpolated AT + Gaussian noise</td><td colspan="2">84.7</td><td>55.6</td><td>53.7</td><td>53.5</td><td>70.1</td><td>69.1</td><td>69.0</td></tr><tr><td colspan="8">Interpolated AT + Random rotation 83.4</td><td>57.8</td><td>56.7</td><td>55.9</td><td>69.8</td><td>68.2</td><td>67.4</td></tr><tr><td colspan="6">Interpolated AT + Xie et al. (2018)</td><td colspan="2">82.1</td><td>59.7</td><td>58.4</td><td>57.9</td><td>71.1</td><td>69.7</td><td>69.3</td></tr><tr><td colspan="8">Interpolated AT + Guo et al. (2018) 83.9</td><td>60.9</td><td>60.7</td><td>60.3</td><td>73.2</td><td>72.1</td><td>71.6</td></tr><tr><td colspan="5">AT + MI-OL (ablation study)</td><td/><td colspan="2">81.2</td><td>56.2</td><td>55.8</td><td>55.1</td><td>67.7</td><td>67.2</td><td>66.4</td></tr><tr><td colspan="5">Interpolated AT + MI-OL</td><td/><td colspan="2">84.2</td><td>64.5</td><td>63.8</td><td>63.3</td><td>75.3</td><td>74.7</td><td>74.5</td></tr><tr><td>1</td><td/><td/><td/><td/><td/><td/><td/></tr><tr><td>0.8 0.9</td><td/><td/><td/><td>0.78</td><td>0.72</td><td>0.88</td><td>0.84</td></tr><tr><td>0.7</td><td/><td/><td/><td/><td/><td/><td/></tr><tr><td>0.6</td><td/><td/><td/><td/><td/><td/><td/></tr><tr><td>0.5</td><td>Random guess</td><td/><td/><td/><td/><td/><td/></tr><tr><td>0.4</td><td/><td/><td/><td/><td/><td/><td/></tr><tr><td>0.3</td><td>0.23</td><td/><td/><td/><td/><td/><td/></tr><tr><td>0.2</td><td/><td/><td/><td/><td/><td/><td/></tr><tr><td>0.1</td><td>0.08</td><td>0.05</td><td>0.01</td><td/><td/><td/><td/></tr><tr><td>0</td><td/><td/><td/><td/><td/><td/><td/></tr><tr><td/><td colspan="2">Mixup</td><td/><td colspan="4">Mixup + MI-PL</td></tr><tr><td/><td colspan="3">PGD-10 (untargeted)</td><td colspan="4">PGD-50 (untargeted)</td></tr><tr><td/><td colspan="3">PGD-10 (targeted)</td><td colspan="4">PGD-50 (targeted)</td></tr></table>

Classification accuracy (%) on the oblivious adversarial examples crafted on 1,000 randomly sampled test points of CIFAR-100. Perturbation = 8/255 with step size 2/255. The subscripts indicate the number of iteration steps when performing attacks. The notation ≤ 1 represents accuracy less than 1%. The parameter settings for each method can be found in Table5.

Table content: <table><tr><td/><td/><td colspan="3">Untargeted Mode</td><td/><td>Targeted Mode</td><td/></tr><tr><td>Methods</td><td colspan="7">Cle. PGD10 PGD50 PGD200 PGD10 PGD50 PGD200</td></tr><tr><td>Mixup</td><td>74.2</td><td>5.5</td><td>5.3</td><td>5.2</td><td>≤ 1</td><td>≤ 1</td><td>≤ 1</td></tr><tr><td>Mixup + Gaussian noise</td><td>65.0</td><td>5.5</td><td>5.3</td><td>5.3</td><td>10.0</td><td>4.3</td><td>4.1</td></tr><tr><td>Mixup + Random rotation</td><td>66.2</td><td>7.8</td><td>6.7</td><td>6.3</td><td>21.4</td><td>15.5</td><td>15.2</td></tr><tr><td>Mixup + Xie et al. (2018)</td><td>66.3</td><td>9.6</td><td>7.6</td><td>7.4</td><td>30.2</td><td>22.5</td><td>22.3</td></tr><tr><td>Mixup + Guo et al. (2018)</td><td>66.1</td><td>13.1</td><td>10.8</td><td>10.5</td><td>33.3</td><td>26.3</td><td>26.1</td></tr><tr><td>Mixup + MI-OL</td><td>68.8</td><td>12.6</td><td>9.4</td><td>9.1</td><td>37.0</td><td>29.0</td><td>28.7</td></tr><tr><td>Mixup + MI-Combined</td><td>67.0</td><td>14.8</td><td>11.7</td><td>11.3</td><td>31.4</td><td>26.9</td><td>26.7</td></tr><tr><td>Interpolated AT</td><td>64.7</td><td>26.6</td><td>24.1</td><td>24.0</td><td>52.0</td><td>50.1</td><td>49.8</td></tr><tr><td>Interpolated AT + Gaussian noise</td><td>60.4</td><td>32.6</td><td>31.6</td><td>31.4</td><td>50.1</td><td>50.0</td><td>49.6</td></tr><tr><td colspan="2">Interpolated AT + Random rotation 62.6</td><td>34.5</td><td>32.4</td><td>32.1</td><td>51.0</td><td>49.9</td><td>49.7</td></tr><tr><td>Interpolated AT + Xie et al. (2018)</td><td>62.1</td><td>42.2</td><td>41.5</td><td>41.3</td><td>57.1</td><td>56.3</td><td>55.8</td></tr><tr><td colspan="2">Interpolated AT + Guo et al. (2018) 61.5</td><td>36.2</td><td>33.7</td><td>33.3</td><td>53.8</td><td>52.4</td><td>52.2</td></tr><tr><td>Interpolated AT + MI-OL</td><td>62.0</td><td>43.8</td><td>42.8</td><td>42.5</td><td>58.1</td><td>56.7</td><td>56.5</td></tr></table>

The parameter settings for the methods in Table2. The number of execution for each random method is 30.

Table content: <table/>

t. the input x is:

Table content: <table><tr><td>∂F MI (x) ∂x</td><td>= E ps</td><td colspan="2">∂F (λx + (1 -λ)x s ) ∂x</td><td/><td>(21)</td></tr><tr><td/><td>= E ps</td><td colspan="2">∂F (u) ∂u u=λx+(1-λ)xs</td><td>•</td><td>∂λx + (1 -λ)x s ∂x</td><td>(22)</td></tr><tr><td/><td>= λE ps</td><td>∂F (u) ∂u</td><td colspan="3">| u=λx+(1-λ)xs .</td><td>(23)</td></tr></table>

Peer review (iclr2020):
Notes: -Paper claims that adversarial examples stem from locally non-linear behavior. However, wasn*t this the exact opposite of the conclusion of *Explaining and Harnessing Adversarial Examples* (Goodfellow 2015)? It is cited in this paper but I think the proper conclusion is the opposite of what is written here. -Linearity however may still be an important component since it simplifies the problem of adversarial robustness. -Many techniques try to introduce adversarial robustness through transformations during inference time. -Paper claims that adversarial training induces locally linear behavior - but I*m rather skeptical of this claim. Think about something like KNN with k=1 and euclidean distance. This should be L2-robust on the training set, yet very non-linear. -I understand the contents of Figure 1, but I*m not sure exactly what conclusion I should draw from it. -The novel procedure presented is *Mixup Inference*. This involves classifying using interpolations of test inputs. -Two mechanisms are proposed for why this could help. One is that the magnitude of the perturbation will shrink after doing mixup (although the signal in the original image will also shrink, so I*m not sure if I like this argument). The second argument is that the adversarial perturbation will have to appear with different random examples which will force the attack to be more *universal* to succeed. This second argument I find much more compelling. -The notation is rather abusive since the random variable and the same have the same name but this is common in machine learning. -The technique if I understand correctly (Algorithm 1) amounts to using an average of the prediction at the original point along with an average of the mixes going to all other points in the dataset. -The paper is a bit slow to explain what distribution lambda will come from - but it effects the algorithm a lot (especially if the distribution is symmetric or asymmetric). Comments: -There is another paper (Shimada 2019) that also uses interpolation at test time and should be cited here, although I admit that paper is written in a confusing way so the connection may not be immediately obvious: https://arxiv.org/pdf/1906.08412v1.pdf -I have a suggestion for the organization of the paper that I think would improve it. I would suggest to first introduce the method in a clear fashion (after motivating it), along with the equations. Then, *after that*, clearly and separately introduce the analysis of the *optimal linear model*: *a well mixup-trained model F can be denoted as a linear function H on the convex combinations of clean examples*. I think that would make the paper much clearer. -For example, how can we actually know what G_k() is unless we know the adversarial perturbation (which shouldn*t generally be possible during inference)? I found this discussion to be rather confusing (basically section 3.1) although admittedly it might be my own fault. -Why does mixup-inference hurt the clean accuracy by 10% (table 2)? This seems like quite a lot to me. Still the degree of robustness does seem impressive. And I also believe that the obtained robustness of this technique along with AT is state of the art. -It might be nice to see examples of attacks on the resulting model, especially the one with the best robustness. It*s possible that Linf-bounded attacks against *this model* will be perceptible, which would support lowering the epsilon-attack-budget (which is actually a good thing for the research field as it*s evidence that maybe this epsilon shouldn*t be considered practically imperceptible). Review: This paper was interesting, because it has nice experimental results and seems like a good idea, but I feel like the paper needs to be improved. The biggest issue is that the paper repeatedly claims that adversarial robustness can be improved by making networks more linear, yet I believe that this is the opposite of what prior work has found. I also found the exposition of the idea to be confusing as it simultaneously introduces the idea and an analysis of the technique - I would much prefer if the technique were introduced first and the analysis under some optimal assumptions moved to a different section.