Synergy-of-Experts: Collaborate to Improve Adversarial Robustness
Anonymous Author(s)
AfﬁliationAddress email
Abstract
Learning adversarially robust models requires invariant predictions to a smallneighborhood of its natural inputs, often encountering insufﬁcient model capacity .
There is research showing that learning multiple sub-models in an ensemble couldmitigate this insufﬁciency, further improving the generalization and the robustness.
However, the ensemble’s voting-based strategy excludes the possibility that the truepredictions remain with the minority .
Therefore, this paper further improves theensemble through a collaboration scheme—Synergy-of-Experts (SoE).
Comparedwith the voting-based strategy, the SoE enables the possibility of correct predictionseven if there exists a single correct sub-model.
In SoE, every sub-model ﬁts itsspeciﬁc vulnerability area and reserves the rest of the sub-models to ﬁt othervulnerability areas, which effectively optimizes the utilization of the model capacity.
Empirical experiments verify that SoE outperforms various ensemble methodsagainst white-box and transfer-based adversarial attacks.
Introduction
Deep models have been widely applied in various real-world applications including high-stakesscenarios (such as in healthcare, ﬁnance, and autonomous driving).
An increasing concern is whetherthese models make adversarially robust decisions [1, 2].
Recently, there are research revealing thatan adversarially robust method requires invariant predictions to a small neighborhood of its naturalinputs, thus often encountering insufﬁcient model capacity [3, 4].
This limits the further improvementof robustness and has the undesirable degradation of generalization [5].
Learning multiple sub-models in an ensemble [6, 7] can mitigate this insufﬁciency.
Remarkably,there are research [8, 9, 10] proposing to minimize the vulnerability overlaps between each pair ofsub-models and improving both robustness and generalization over a single model.
However, thevoting-based ensemble may waste the limited capacity of multiple models.
In the example of three sub-models (see Figure 1(b)), the adversarial input that lies in the black areascan fool the ensemble successfully, i.e., more than half of sub-models must correctly classify theadversarial input.
Therefore, the ensemble’s voting-based strategy excludes the possibility that truepredictions remain with the minority .
In other words, learning an ensemble requires more than half ofthe sub-models to ﬁt the same vulnerability areas, which leaves the following question unansweredwhether
we could only leverage a single sub-model to ﬁt a vulnerability area and reserve the rest ofthe sub-models to ﬁt other vulnerability areas.
Inspired by mixture-of-experts (MoE) [11], we propose to learn a collaboration among multiple submodels to optimally utilize the limited capacity.
As shown in Figure 1(c), the adversarial input thatlies in the vulnerability overlaps of all sub-models can undoubtedly fool the collaboration.
Comparedwith the ensemble in Figure 1(b)), collaboration enables the possibility of correct predictions evenif there exists a single correct sub-model.
Besides, learning a collaboration could enable every [Figure] sub-model to ﬁt its vulnerability area, which could collectively ﬁx broader vulnerability areas.
Then,sub-models could collaboratively choose a trustworthy one to make the ﬁnal predictions.
Classic MoE methods assume that the problem space is separable, and the separability is irrelevantto the learned model [11].
However, the non-i.i.d adversarial inputs [12] depend on the learnedmodels and are hard to be classiﬁed by a learned gate in MoE. To tackle the above challenge, wepropose Synergy-of-Experts (SoE), which explicitly builds the relationship between learned modelsand adversarial inputs.
Speciﬁcally, each sub-model has dual heads: one outputs a vector of predictedprobability f θ ( · ) ; another outputs a scalar that measures the conﬁdence of the prediction.
In theadversarial training phase, given an adversarial input x , each sub-model chooses an easy one(s) tofeed itself.
The other head is meanwhile updated by comparing the predicted probability on the truelabel— f yθ ( · ) (a scalar).
In the inference phase, given an input, SoE chooses a sub-model with thelargest conﬁdence as the representative to output the overall prediction.
We highlight our key contributions as follows.
• We provide a new perspective on learning multiple sub-models for defending againstadversarial attacks.
We show that the collaboration could make better decisions than the ensemble (Proposition 1), which implies collaboration may ﬁx broader vulnerability
areas.• We propose a novel collaboration framework—SoE (see Section 3.2).
In the training phase,SoE minimizes the vulnerability overlap of all sub-models;
In the inference phase, SoE could
effectively choose a representative sub-model to make correct predictions.
We also provide
a comprehensive analysis illustrating the rationale of SoE in Appendix.
• Empirical experiments corroborate the SoE outperforms various ensemble methods [10, 8,9, 13] against white-box and transfer attacks.
Related Work
Adversarial attack.
Adversarial attacks aim to craft the human-imperceptible adversarial inputto fool the deep models.
Adversarial attacks could be roughly divided into white-box attacks inwhich the adversary is fully aware of the model’s structures [1, 14, 15, 16, 17, 18, 19, 20, 21, 22,23, 24, 25, 26] and black-box attacks in which the deep models are treated as black boxes to theadversary [27, 28, 29, 30, 31, 32, 33, 34, 35, 36].
This paper focuses on building effective defenseand select both white-box and black-box attack methods as our robustness evaluation metrics.
Adversarial defense.
Defending adversarial attacks is a challenging task and researchers haveproposed various solutions.
Certiﬁed defense tries to learn provably robust deep models against normbounded (e.g., (cid:96) 2 and (cid:96) ∞ ) perturbations [37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49].
Empiricaldefense.
leverages adversarial data to build effective defense such as adversary detection [50, 51,52 , 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68] and adversarial training (AT), inwhich AT stands out as the most effective defense.
Researchers have investigated various aspectsof AT, such as improving AT’s robustness or generalization [5, 69, 70, 71, 72, 73, 74, 75, 76, 77,78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 3], ﬁxing AT’s undesirable robust overﬁtting [90, 91],improving AT’s training efﬁciency [92, 93, 94, 95, 96, 97], understanding/interpreting AT’s uniquetraits [98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 49, 108, 109], etc.
Besides, researchers have also actively investigated robust-structured models [110, 111, 112, 113, 114, 115, 116].
Nevertheless,the above research thoroughly investigated a single model; this paper focuses on the collaborationamong multiple models for adversarial defense.
Ensemble methods for adversarial robustness.
The most relevant studies are the ensemble methods.
Ensemble methods such as bagging [6] and boosting [7] have been investigated for signiﬁcantlyimproving the model’s generalization.
Motivated by the beneﬁts of ensemble methods in improvinggeneralization, researchers introduced an ensemble to improve the model robustness [10, 9, 8, 117].
Tramèr et al.
[117] proposed to reduce the adversarial transferability by training a single model withadversarial examples from multiple pretrained sub-models.
Pang et al.
[8] introduce a regularization method—ADP—to encourage high diversity in the non-maximal predictions of sub-models.
Kariyappa et al.
[9] improved the ensemble diversity by maximizing the introduced cosine distancebetween the gradients of sub-models with respect to the input.
Yang et al.
[10] proposed to distillnon-robust features in the input and diversify the adversarial vulnerability.
These methods reducedoverlaps of vulnerability areas between sub-models [10].
Compared with voting strategy in ensemble,mixture-of-experts (MoE) assumes that the problem space can be divided into multiple sub-problemsthrough a gate module [11, 118].
However, in adversarial training, the adversarial samples, whichdepend on the learned models, are not i.i.d.
A vanilla MoE is hard to identify the best performingsub-models for each adversarial sample without the information about the learned models.
Collaboration to Defend Against Adversarial Attacks3.1 Superiority of Collaboration
This section shows a collaboration , in theory, could make better decisions than an ensemble .
Ensemble.
Suppose that there are M learned sub-models { f θ 1 , f θ 2 , ..., f θ M } , given an input x , Msub-models make predictions (cid:8) f [Equation] [Equation] x ) , f
[Equation]
[Equation] x ) , ..., f θ M ( x ) [Equation] The ensemble outputs a ﬁnal predictionensemble( x, f θ 1 , ..., f θ M ) by the voting-based strategy:
[Equation]
where 1 is the indicator function and K denotes the number of classes.
Note that the ensembleoutputs the predicted label y that agrees with the majority predictions of the sub-models.
Deﬁnition 1 (best-performing sub-model) .
Given an input x and its label y , the best-performingsub-model achieves the lowest objective loss on the data ( x, y ) among all M sub-models:
[Equation]
104 Note that the best-performing sub-model is w.r.t.
the input data ( x, y ) , i.e., different input datacorrespond to different best-performing sub-models. positive sample negative sample sub [Figure] a sub
[Figure]
(a) Assign data to their best-performing sub-models
x <latexit sha1_base64="Pbc+1s8Sc82XeqeLL9Ole7+uVlw=">AAACxHicjVHLSsNAFD2Nr1pfVZdugkVwVRKp6LIoiMsW7AO0SJJO69DJg8lELEV/wK1+m/gH+hfeGVNQi+iEJGfOvefM3Hv9RPBUOc5rwZqbX1hcKi6XVlbX1jfKm1vtNM5kwFpBLGLZ9b2UCR6xluJKsG4imRf6gnX80amOd26ZTHkcXahxwnqhN4z4gAeeIqp5d12uOFXHLHsWuDmoIF+NuPyCK/QRI0CGEAwRFGEBDyk9l3DhICGuhwlxkhA3cYZ7lEibURajDI/YEX2HtLvM2Yj22jM16oBOEfRKUtrYI01MeZKwPs028cw4a/Y374nx1Hcb09/PvUJiFW6I/Us3zfyvTteiMMCxqYFTTYlhdHVB7pKZruib21+qUuSQEKdxn+KScGCU0z7bRpOa2nVvPRN/M5ma1fsgz83wrm9JA3Z/jnMWtA+qbq162KxV6if5qIvYwS72aZ5HqOMcDbSM9yOe8GydWcJKrewz1Srkmm18W9bDB220j4U=</latexit> featureexactor P head E head g  <latexit sha1_base64="KXCfkoyAXpEn449EMfAWF4Xk03o=">AAACy3icjVHLTsJAFD3UF+ILdemmkZi4agpihB3RjRsTTOSRACFtGWBiX2mnJogs/QG3+l/GP9C/8M5YEo0hOk3bM+fec2buvXbo8liY5ltGW1peWV3Lruc2Nre2d/K7e804SCKHNZzADaK2bcXM5T5rCC5c1g4jZnm2y1r27YWMt+5YFPPAvxGTkPU8a+TzIXcsQVR71J92wzGf9fMF0yhVK+ZJVf8NioapVgHpqgf5V3QxQAAHCTww+BCEXViI6emgCBMhcT1MiYsIcRVnmCFH2oSyGGVYxN7Sd0S7Tsr6tJeesVI7dIpLb0RKHUekCSgvIixP01U8Uc6SXeQ9VZ7ybhP626mXR6zAmNi/dPPM/+pkLQJDVFQNnGoKFSOrc1KXRHVF3lz/VpUgh5A4iQcUjwg7Sjnvs640sapd9tZS8XeVKVm5d9LcBB/yljTg+RT1xaBZMopl4/S6XKidp6PO4gCHOKZ5nqGGS9TRUHN8wjNetCst1u61h69ULZNq9vFjaY [Table]
ecfDyPa9GzEJeNc1h549sJkpCLod9KYdMeLCnPWyOSNfrJSNk4r+OyjkDbVySFbNz76igz58MMRwweFBUOzARERPGwUYCAjrYkpYSJGt8hwzZEgbE4sTwyR0TN8h7doJ6tFeekZKzegUh96QlDqOSOMTL6RYnqarfKycJbrIe6o85d0m9LcSL5dQgRGhf+nmzP/qZC0CA5RVDTbVFChEVscSl1h1Rd5c/1aVIIeAMBn3KR9SzJRy3mddaSJVu+ytqfLviilRuWcJN8aHvCUNeD5FfXHQKOYLpfzpdSlXPU9GncYBDnFM8zxDFZeooU7eHp7wjBftSou1e+3hi6qlEs0+fizt8RN955Pz</latexit> (K-dim vector) (scalar) ˆ p ( x ) <latexit sha1_base64="vHf4JuwSfHN9bcLOxGS5EE+IepE=">AAAC3nicjVHLSsNAFD2Nr1pfVVfiJliEuimpVHRZdOOygn1AW2qSTtvQvEgmYgnBnTtx6w+41c8R/0D/wjtjBLWITsjMmXPvOTN3ruHbVsg17SWjzMzOzS9kF3NLyyura/n1jUboRYHJ6qZne0HL0ENmWy6rc4vbrOUHTHcMmzWN8YmINy9ZEFqee84nPus6+tC1Bpapc6J6+a24M9J53DE8ux9OHFpiP0mS4tVeL1/QSpoc6jQop6CAdNS8/DM66MODiQgOGFxwwjZ0hPS1UYYGn7guYuICQpaMMyTIkTaiLEYZOrFjmoe0a6esS3vhGUq1SafY9AekVLFLGo/yAsLiNFXGI+ks2N+8Y+kp7jah1Ui9HGI5RsT+pfvM/K9O1MIxwJGswaKafMmI6szUJZKvIm6ufqmKk4NPnMB9igeETan8fGdVakJZu3hbXcZfZaZgxd5McyO8iVtSg8s/2zkNGvulcqV0cFYpVI/TVmexjR0UqZ+HqOIUNdTJ+xoPeMSTcqHcKLfK3Ueqkkk1m/g2lPt3Z3Waew==</latexit>
[Figure]
x
[Table]
[Table]
[Table]
[Table]
f ✓
[Table]
` ( f ✓ best (˜ x ✓ 1 ) ,y )
[Table]
[Table]
[Figure]
[Table] ✓ [Table] +QXswsLa+srmXXN6qhFwU2q9ie4wV1ywyZw11WEVw4rO4HzBxaDqtZgxMZr12xIOSeey5GPmsNzZ7Lu9w2BVHt7FZTcKfD4uvxRdwUfSbMdmyxUIzH7WzOyBtq6dOgkIAcklX2si9oogMPNiIMweBCEHZgIqSngQIM+MS1EBMXEOIqzjBGhrQRZTHKMIkd0LdHu0bCurSXnqFS23SKQ29ASh27pPEoLyAsT9NVPFLOkv3NO1ae8m4j+luJ15BYgT6xf+kmmf/VyVoEujhSNXCqyVeMrM5OXCLVFXlz/UtVghx84iTuUDwgbCvlpM+60oSqdtlbU8XfVKZk5d5OciO8y1vSgAs/xzkNqvv5QjF/cFbMlY6TUaexjR3s0TwPUcIpyqiQ9w0e8YRn7VK71e60+89ULZVoNvFtaQ8fRn6a2Q==</latexit>
[Figure] (a2) collaboration training [Figure] ( x ) <latexit sha1_base64="7ctncwgFuMdaXoGwpIQz8wNf/kc=">AAACznicjVHLTsJAFD3UF+ILdemmkZjghrQGo0uiG5eYyCMBQtoywMTSNtMpkRDi1h9wq59l/AP9C++MJVGJ0Wnanjn3nDtz73Ujn8fSsl4zxtLyyupadj23sbm1vZPf3avHYSI8VvNCPxRN14mZzwNWk1z6rBkJ5oxcnzXc20sVb4yZiHkY3MhJxDojZxDwPvccSVRr0J22oyGfFe+Ou/mCVbL0MheBnYIC0lUN8y9oo4cQHhKMwBBAEvbhIKanBRsWIuI6mBInCHEdZ5ghR96EVIwUDrG39B3QrpWyAe1Vzli7PTrFp1eQ08QReULSCcLqNFPHE51Zsb/lnuqc6m4T+rtprhGxEkNi//LNlf/1qVok+jjXNXCqKdKMqs5LsyS6K+rm5peqJGWIiFO4R3FB2NPOeZ9N7Yl17aq3jo6/aaVi1d5LtQne1S1pwPbPcS6C+knJLpdOr8uFykU66iwOcIgizfMMFVyhipru+COe8GxUjbExM+4/pUYm9ezj2zIePgC26JOV</latexit>
Collaboration. Suppose that there are M learned sub-models { f θ 1 , f θ 2 , ..., f θ M } .
Given an inputx , sub-models make predictions (cid:8) f θ 1 ( x ) , f θ 2 ( x ) , ..., f θ M ( x ) (cid:9) .
The collaboration tries to output aﬁnal prediction collaboration( x, f θ 1 , ..., f θ M ) by the best-performing sub-model:collaboration
[Equation]
x
[Equation]
) 110 Proposition 1.
Given M learned sub-models, the predicted accuracy of the collaboration is upperbounded that of the ensemble, i.e.,
[Equation]
113 Proof.
Given an ( x, y ) ∈ D , if the ensemble’s prediction is correct, at least one sub-model makescorrect prediction, i.e., 1 f θ best ( x )=
y holds; therefore, the collaboration’ prediction is correct.
Ifthe collaboration’s prediction is correct, there exists a case that the majority of sub-models makeconsistent but wrong predictions, while a single sub-model’s prediction is correct; then, ensemble’sprediction is wrong.
Therefore, Proposition 1 holds.
From Proposition 1, a collaboration could achieve an equal or higher performance than an ensemble.
Compared with the ensemble, the collaboration requires the identiﬁcation of the best-performingsub-models using label information.
Next, we will introduce a realization of our collaborationframework.
3.2 Realization of collaboration for defending against
adversarial attacks
Notation.
We ﬁrstly introduce the needed notations.
Suppose X and Y denote input space andoutput space, where Y = { 1 , ..., K } for a K -class classiﬁcation problem.
There are N samplesin the dataset D
=
{ ( x, y ) } ,
where x ∈ X and y ∈ Y
Let d inf ( x, x (cid:48) )
= (cid:107) x − x (cid:48) (cid:107) ∞ denotes theinﬁnity distance metric, and B (cid:15)
[ x ] = { x (cid:48) ∈ X | d inf ( x, x (cid:48) ) ≤ (cid:15) } is the closed ball of of radius (cid:15) > 0centered at x .
To search for adversarial data within norm ball B (cid:15) [ x ] , [5] proposed a projected gradientdescent (PGD) method that iteratively searches for adversarial data ˜ x
( x refers to natural data).
f θ ( x )outputs a K-dimensional predicted probability, i.e., ˆ p ( x ) =
[ˆ p 1 ( x ) , ..., ˆ p K ( x )] .
Goal of collaboration.
1) ensure the correct prediction of the best-performing sub-model for agiven input, and 2) select the best-performing sub-model among all sub-models to make predictions.
First, intuitively, every sub-model in a collaboration should maximize its expertise to ﬁt its areas andleave the remaining areas ﬁtted by others.
As a result, the collaboration can minimize the vulnerabilityoverlaps of all sub-models.
Section 4 shows “minimizing the vulnerability overlap of all sub-models”is “minimizing the objective loss of the best-performing sub-models”.
Therefore, during the trainingphase, the given data should always be allocated to the sub-model that has the lowest objective loss. In other words, the sub-models always choose the easiest data to learn.
In the example of Figure 2(a),i ) Data 3 (cid:13) is misclassiﬁed by both sub-models.
The blue sub-model is near Data 3 (cid:13) and has the lowestobjective loss. We assign the blue sub-model to ﬁt Data 3 (cid:13) . ii ) Data 2 (cid:13) is correctly classiﬁed by thepink model but wrongly classiﬁed by the blue model; for ease of effort, we assign the pink model toﬁt Data 2 (cid:13) , because the collaboration can correctly be classiﬁed Data 2 (cid:13) by selecting the pink modelas the representative. iii ) Data 1 (cid:13) is correctly classiﬁed by both models.
The blue model is far from
Data 1 (cid:13) and takes the lowest effort on ﬁtting it; therefore, we assign the blue model to ﬁt Data 1 (cid:13) .
Second, to select the best-performing sub-model, we construct dual-head structured sub-models .
Asshown in Figure 2(b), our sub-model has dual heads: 1) predictor (P) head: f θ predicts the label
Input: the sub-models dual heads { f θ i } Mi =1 and { g φ i } Mi =
where
f θ i outputs the label prediction and g φ outputs approximated conﬁdence, training dataset D hyperparameter σ ; 1:
D do 2:
M do 3:
Obtain
; 4: for
M do 5:
Calculate the approximated conﬁdence, i.e., g φ j (˜ x θ i ) ; 6:
Minimize BCE loss (cid:96) φ = BCE( g φ j (˜ x θ i ) , ˆ p y
(˜ x θ i )) to update module g φ j ; 7:
Collect sub-model
i ’s cross entropy (CE) loss on data ˜
x
θ i : (cid:96) (cid:0) f θ j (cid:0) ˜
x θ i (cid:1) , y (cid:1) ; 8: end for 9:
Calculate surrogate loss on data ˜ x
θ i : ˆ (cid:96) m = − σ ln (cid:80) Mj =1 exp (cid:18) − (cid:96) ( f θj ( ˜ x θi ) ,y ) σ (cid:19) ; 10:
Update { f θ
Mi minimizing ˆ (cid:96) m ; // choose the best performing sub model to ﬁt ˜ x
θ i 11: end for 12: end for probability
f θ ( x ) =
ˆ p ( x ) =
[ˆ p 1 ( x ) , ..., ˆ p K ( x )] (a vector); 2) evaluator (E) head: g φ approximatesthe conﬁdence of the prediction ˆ p ( x ) .
Note that we use g φ to approximate the true label probability ˆ p y ( x ) , which denotes the true conﬁdenceof a given prediction ˆ p ( x ) .
Meanwhile, the largest conﬁdence corresponds to the lowest objective loss,and vice versa (see theoretical proof in Proposition 2).
Therefore, the best-performing sub-modelscould be identiﬁed using the approximated conﬁdence ( g φ ( x ) ) by the E head.
To defend against adversarial attacks, the collaboration needs to learn from adversarial data.
Algorithm 1,2 along with Figure 3 articulates how to learn such the collaboration.
In particular, thetraining of our framework SoE is as follows:
the sub-model training: the sub-models ﬁt adversarial samples from their own or other
sub
-models;
the collaboration training: the sub-models ﬁt adversarial samples from the collaboration.
The sub-model training.
As shown in Figure 3(a1), given a natural training data x and its labely , we use the PGD method to obtain M adversarial variants { ˜ x θ i } Mi =1 of M sub-models as existingbaselines do.
For each adversarial variant ˜ x
θ i , we assign the best-performing sub-model to learn andupdate its feature extractor and label head.
This process corresponds to Lines 1–8 and Lines 9–10 in
Algorithm 1.
Note that in Line 9, we use a surrogate loss to approximate the sub-model assignmentprocess (reasons see Eq.
5 and 6).
As shown in Figure 3(b), given an adversarial variant ˜ x θ i , wepropose to use the binary-cross-entropy (BCE) loss between the predicted label probability on thetrue label (i.e., ˆ p y
(˜ x θ i ) ) and the approximated conﬁdence (i.e., g φ (˜ x θ i ) ) to update each sub-model’s
E head.
This process corresponds to Lines 5–6 in Algorithm 1.
The collaboration training.
During the sub-model training, we learn the most adversarial datafrom each sub-model using the sub-models performing best.
The most adversarial samples cannotattack the collaboration successfully.
However, there may exist harmful samples (which may not bethe most adversarial for any client) that are unexplored and can attack all sub-models.
Therefore,the sub-model training may converge without a full exploration of the adversarial samples.
(Theexperimental veriﬁcation about this could be found in Section 4.4.)
To defend these potentialadversarial samples, we propose the collaboration training shown in Figure 3 (a2) and Algorithm 2.
Firstly, we propose to generate the adversarial samples that can worsen the outputs of the collaboration.
In particular, for each data sample x , we output the prediction ˆ p ( x ) whose conﬁdence g φ ( x ) is thehighest.
We perturb x to fool the prediction using PGD method.
Then we minimize a surrogated lossto ﬁt this adversarial data ˜ x .
This process is detailly shown in Algorithm 2.
During the inference phase shown in Algorithm 3 in Appendix, once M sub-models are properlylearned, SoE chooses a representative sub-model whose conﬁdence is the highest among all submodels, and then outputs this sub-model’s prediction. Algorithm Input sub dual { f θ i } Mi =1 and { g φ i } Mi =1 , where
f θ i outputs the label prediction and g approximated conﬁdence, training dataset hyperparameter Obtain ˜ x by perturbing x to worsen the prediction the adversarial samples of the collaboration 8: Minimize BCE loss to update the g of all sub models; 9: 3.3 Analyses of SoE
Optimizing the best-performing sub-models.
We ﬁrstly show that minimizing the vulnerabilityoverlap of all sub-models is equal to minimizing the objective loss of the best-performing sub-models.
For ease of optimization of the best-performing sub-model, we provide a surrogate loss.
The vulnerability overlap of all sub-models refers to the set of adversarial data (˜ x, y ) that aremisclassiﬁed by all sub-models, i.e., all sub-models’ objective loss is higher than a certain degreeδ : min θ i ∈{ θ 1 ,...,θ M } (cid:96) ( f θ i (˜ x, y )) > δ, ˜ x ∈ ˜ D , where ˜ D denotes the vulnerability overlap of allsub-models.
To reduce the vulnerability overlap of all sub-models, we only need to reduce objective loss of asingle model, which is equal to minimizing the loss of the best-performing sub-model, i.e.,
[Equation]
where (cid:96) best (˜ x θ i , y ) =
[Equation]
[Equation]
where ˜ x θ i is the adversarial data generated by the sub-model f θ i .
While directly performing the outer minimization in Eq.(5) may cause a trivial solution (e.g., there isonly one optimized sub-model), for ease of the optimization of Eq.(5)
(Corresponding to Lines 9–10in Algorithm 1), we provide a surrogate objective as follows.
[Equation]
where ˆ (cid:96) m
(˜ x θ i , y ) = − σ
[Equation]
(cid:80) Mj =
[Equation]
exp
[Equation]
and σ > 0 is a pre-deﬁned hyper-parameter.
In Eq.(6), we approximate the objective min θ j ∈{ θ 1 ,θ 2 ,...,θ M } (cid:96) (cid:0) f θ j
(˜ x θ i ) , y (cid:1) using a smooth surro- 197 gated maximum function due to min
[Figure] [Equation]
The proof of Eq.(7) is in Appendix.
The best-performing sub-model has the highest conﬁdence.
We show that a sub-model withthe highest conﬁdence achieves the minimum of the objective loss among all sub-models, i.e., thebest-performing sub-model.
Proposition 2.
Given an input x , the sub-model that has the highest conﬁdence corresponds to thebest-performing sub-model, i.e.,
[Equation] [Equation]
where conﬁdence corresponds to the probability of the true label in a given ˆ p ( x ) .
To learn the Ehead to approximate the conﬁdence of ˆ p ( x ) , we could simply compare its output with the predictedprobability on the true label (i.e., ˆ p y ( x ) ), then update the E head by gradient descent (corresponds to
Lines 6–7 in Algorithm 1).
Given an input to the collaboration, our dual-head structured sub-modelscan collaboratively decide the best-performing sub-model by comparing the values of the E head(corresponds to Algorithm 3 in Appendix).
Note that the E head may be susceptible to adversarial attacks in the white-box setting.
In ourimplementation, we use a simple linear structure to regress the conﬁdence.
Experimental results onadaptive attacks demonstrate the reliability of our framework.
Experiments
In this section, we conduct experiments on a benchmark dataset to verify the effectiveness of ourmethod in defending against white-box and transfer attacks.
Then we provide ablation studiesto demonstrate the signiﬁcance of the collaboration training described in Algorithm 2.
1 Theexperimental results about black-box attacks and more discussions could be found in Appendix.
4.1 Experimental Setup
Following the work in [10], we compare our method with various related methods, including ADP [8],
GAL [9], DVERGE [10] and MoRE [13].
We use ResNet-20 [119] as sub-models in all methods forfair comparisons, and we use CIFAR10 as the data set, a classical image dataset [120] that has 50,000training images and 10,000 test images.
4.2 Performance on White-box attack
As there are mainly two threat modes in the adversarial attack setting: white-box attack and black-boxattack.
White-box attack refers to that attackers know all the information about the models, includingtraining data, model architectures, and parameters, while black-box attackers have no access to theinformation about the model’s structures and parameters and rely on surrogate models to generatetransferable adversarial examples.
We compare our method with 4 baselines on defending against white-box attacks using a subsetof CIFAR10 .
We use 50-step PGD with ﬁve random starts and the step size of (cid:15)/ 5 to attack allmethods as in [10].
We learn the models in adversarial training and evaluate the robustness undervarious attacks with the same (cid:15) .
For example, to evaluate the robustness under white-box attack with(cid:15) = 0 .
01 , we ﬁrst learn the models in adversarial training with (cid:15) = 0 .
We evaluate all methodsfollowing the setting in [10].
In particular, we randomly select 1000 samples under different (cid:15) .
Forthe PGD attack, we select the cross-entropy loss to update the perturbations to search for adversarialsamples.
In addition to the robustness, we also report the performance of all methods on clean datawith the adversarial training under different (cid:15) .
[Table]
From Table 1, SoE achieves a better robustness performance under white-box attack.
The resultsverify that collaboration signiﬁcantly improves the utilization of the limited model capacity.
Therefore,
SoE can ﬁt more adversarial data and have a relatively smaller vulnerable area.
Performance on Adaptive Attacks.
We follow the suggestions in [121] and conduct two different adaptive attacks to fool the dual heads simultaneously.
For the ﬁrst adaptive attack,we attack the E head to minimize the conﬁdence of the best-performing sub-model.
In particular, we maximize l 1 = BCE( g φ j ( x ) , 1) , where j = arg max i ∈
[ M ] g φ i ( x ) means the j - 246 th sub-model is identiﬁed as the best-performing sub-model.
For the second adaptive attack, we try to achieve a mismatch between the correct predictions and the highest conﬁdence.
Speciﬁcally, we maximize l 2 = − log (cid:104)
f θ j ( x ) y ∗ g φ j ( x ) + 1 − g φ j ( x ) (cid:105) , where j =arg max i ∈
[ M ] − log (cid:104)
f θ i ( x ) y ∗ g φ
i ( x ) + 1 − g φ i ( x ) (cid:105) .
We conduct experiments by maximizingthe weighted loss (cid:96) adp= (cid:96) ( f θ ( x ) , y ) + λ · (cid:96) 1 and (cid:96) adp= (cid:96) ( f θ ( x ) , y ) + λ · (cid:96) 2 with varying λ .
Therobustness with respect to λ on the stronger adaptive attack (i.e., the attack achieves a higher successrate) is shown in Figure 4.
[Table] [Table]
253 Though both adaptive attacks could attack the predictor and the evaluator simultaneously, the evaluatorin our method is robust to the adversarial samples because of its sample structure.
As seen in Figure 4and Table 1, our method is slightly degraded by adaptive attacks and still outperforms baseline models.
4.3 Performance on Transfer Attack
Due to the transferability of adversarial examples, transfer adversaries can craft adversarial examplesbased on surrogate models and perform an attack on the target model.
In our experiments, we followthe transfer attack setting in [10] and select 1000 test samples randomly.
We use hold-out baselineensembles with three ResNet-20 sub-models as the surrogate models to generate adversarial samples.
In particular, we use three attack methodologies: PGD with momentum [35], SGM [29] which addsweight to the gradient through the skip connections of the model, and M-FGSM [36] which randomlyaugments the input images in each step.
For each sample, three adversarial variants are using thethree attack methods.
Only when the model can classify all kinds of adversarial variants can themodel successfully defend against adversarial attacks.
We show the results of all methods in Table 2.
Furthermore, we also use a more challenging setting following the work in [10].
We use hold-outbaseline models with 3, 5, and 8 ResNet-20 sub-models as the surrogate models.
Meanwhile, wegenerate adversarial samples with cross-entropy loss and CW loss [15].
For each sample, we generate30 adversarial variants, and only if the model classiﬁes all the 30 variants can the model defend thetransfer attack successfully.
The results are shown in Table 3.
In our experiments, GAL is hard to learn stably in adversarial training.
In Table 2, when 0 .
01 ≤ (cid:15) ,
SoE achieves a better performance compared with baselines.
With the increase of (cid:15) , the volumeof (cid:15) -ball increases exponentially.
The performances of all methods get worse signiﬁcantly becauseof insufﬁcient model capacity.
Similar results can also be found in Table 3.
Since SoE addressesmore adversarial data using a collaboration mechanism, it achieves a relatively better robustnessperformance as (cid:15) increases.
4.4 Ablation Studies
To make full use of the limited modal capacity of an ensemble, SoE proposes the sub-model training(shown in Algorithm 1), which makes the adversarial samples from sub-models be learned by thebest-performing ones.
The sub-model training enables the most adversarial attacks of sub-models [Figure] could be successfully defended.
However, learning from the most adversarial samples of all submodels could converge without a full exploration of the vulnerable area.
Therefore, we propose thecollaboration training (shown in Algorithm 2), which ﬁts the adversarial samples unexplored before.
To verify the signiﬁcance of the collaboration training, we conduct ablation studies under two transferattacks.
In particular, we train two kinds of models to defend against the attacks: 1).
SoE ; 2).
SoE without the collaboration training.
The two transfer attacks are generated as stated in Section 4.3,1).
attacks with 3 adversarial variants; 2).
attacks with 30 adversarial variants.
We show the robustness of two methods in Figure 5.
From Figure 5(a) and 5(b), when 0 .
01 ≤ (cid:15) ≤0 . 04 , SoE without the collaboration training achieves a similar robustness compared with SoE. Itmeans that the sub-model owns relatively sufﬁcient model capacity and the adversarial samplescould be largely explored by the sub-model training.
However, when (cid:15) ≥ 0 .
04 , the robustness of
SoE without the collaboration training degrades signiﬁcantly.
In this case, the need for model capacityincreases dramatically.
The most adversarial samples identiﬁed by the sub-model training cannotcover all cases, and our proposed the collaboration training mitigates it effectively.
Conclusion
In this paper we study an essential question in the ﬁeld of adversarial attacks that when we shouldcollaborate.
( i )
If a single model can handle everything, there is no need for multiple models.
( ii )
If a single model can only handle a part of the whole, collaboration among multiple models makessense.
Adversarial defense is a typical task that falls into the circumstance ( ii ) because a single modelhardly ﬁts adversarial data.
We provided a collaboration framework—SoE—as the defense strategyover ensemble methods, and empirical experiments indeed veriﬁed the efﬁcacy of SoE. Future workincludes applying our collaboration framework to other areas such as kernel methods, fairness, andfederated model etc.
Checklist
For all authors...
(a) Do the main claims made in the abstract and introduction accurately reﬂect the paper’s contribu-
tions and scope?
[Yes] We discuss it in Appendix
(b) Did you describe the limitations of your work?
[Yes] The limitations are in Appendix
(c) Did you discuss any potential negative societal impacts of your work?
[Yes] The societal impacts
are in Appendix
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them?
[Yes]
If you are including theoretical results...
(a) Did you state the full set of assumptions of all theoretical results?
[Yes]
(b) Did you include complete proofs of all theoretical results?
[Yes] The proofs are in Appendix.3.
If you ran experiments...
(a) Did you include the code, data, and instructions needed to reproduce the main experimentalresults (either in the supplemental material or as a URL)?
[Yes] The source codes are madepublicly available.
(b) Did you specify all the training details (e
g., data splits, hyperparameters, how they were chosen)?[Yes]
The training details are in Appendix.
(c) Did you report error bars (e.g., with respect to the random seed after running experiments
multiple times)?
[Yes]
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs,internal cluster, or cloud provider)?
[Yes] The devices of computing are in Appendix.
If you are using existing assets (e g., code, data, models) or curating/releasing new assets...
(a) If your work uses existing assets, did you cite the creators?
[Yes]
(b) Did you mention the license of the assets?
[Yes]
(c) Did you include any new assets either in the supplemental material or as a URL?
[N/A]
(d) Did you discuss whether and how consent was obtained from people whose data you’re us
ing/curating?
[Yes [Table]
) Did you discuss whether the data you are using/curating contains personally identiﬁable informa-
tion or offensive content?
[Yes] We discuss our used data in Section 4 and Appendix. [Table]
If you used crowdsourcing or conducted research with human subjects.. [Table] [Table] , if
[Table]
[Table]
[Table] you [Table] any
[Table]
, with
[Table]
Institutional
[Table]
Board (
[Table]
[Table]
, if
[Table]
[Table]
[Table]
) Did you include the estimated hourly wage paid to participants and the total amount spent on
participant compensation?
[N/A
[Table]
A Theoretical Proofs
The proof of Eq.(7) is as follows.
Proof.
Since we have
[Equation]
9) considering that − δ ln
( x ) monotonically decreases w.r.t x , we have
[Equation]
ln
[Equation]
where − δ ln
[Equation]
= min
[Equation]
ln
[Equation]
M
[Equation]
and−
[Equation]
ln
[Equation]
σ (cid:19) =
min θ j ∈{ θ 1 ,θ 2 ,...,θ M } (cid:96) (cid:0) f
θ j
(˜ x θ i ) , y (cid:1) , so Eq.(7) holds.
The proof of Proposition 2 is as follows.
Proof.
The objective loss depends on the label probability (e.g., cross-entropy loss (cid:96) =
− ln p
y ( x )) , and the 603 loss monotonically decreases with respect to p y ( x ) , so the best-performing sub-model has the highest labelprobability.
Combined the fact that conﬁdence( p ( x )) monotonically increases w.r.t.
p y ( x ) , the best-performing 605 sub-model corresponds to the highest conﬁdence; therefore, Eq.(8) holds.
B Algorithm in inference phaseAlgorithm 3 SoE (inference phase)
Input: the learned sub-models
f θ i } Mi = with { g φ i }
Mi =1 , test input x
The whole pipeline of our method during inference is summarized in Algorithm 3.
For an input natural (or 608 adversarial) sample, each sub-model outputs the prediction using P head and the conﬁdence using E head.
Thenthe collaboration predicts the label as the prediction with the highest conﬁdence.
C More Discussions about SoE
2 x     xaveraging linear sub-models y =
y =
(a) ensemble    2 x   xcollaboration
[Figure]
C.1 the Behavior of SoE on Synthetic Data
To demonstrate the behavior of collaboration, we apply our collaboration framework on the well-known XOR 613 problem as an example.
In XOR problem, there is a binary training set D
= { x i , y i ) } ni =1 , where y i ∈ {± 1 } .
For the samples 615 with the label y i = 1 , the input feature x is independently sampled from the two Gaussian distributions 616 x ∈ N ( µ = [1 , 1] , σ = 0 .
1 · I 2 ) and x ∈ N ( µ = [ − 1 , − 1] , σ = 0 .
1 · I 2 ) , where N ( µ = [1 , 1] , σ = 0 .
1 · I 2 )denotes 2-d Gaussian distribution with the mean vector µ = [1 , 1] and covariance matrix σ = 0 .
1 · I 2 .
For the 618 samples with the label y i = − 1 , we sample the input feature independently x i ∈ N ( µ = [ − 1 , 1] , σ = 0 .
1 · I 2 ) 619 and x i ∈ N ( µ = [1 , − 1] , σ = 0 .
1 · I 2 ) .
Suppose there are two linear sub-models f 1 ( x ) = a 1 · x + b 1 and f 2 ( x ) = a 2 · x + b 2 .
Ensemble methods 621 output a prediction ˆ p ( x ) by a voting-based strategy e.g., averaging the predictions as the output, i.e., ˆ p ( x ) =1 M · (cid:80) Mi
=1 f θ i ( x ) .
Collaboration aims to 1).
minimize the mean square error (MSE) of the best-performing sub-models; 2).
optimize 624 the module g 1 and g 2 to measure the quality of the multiple predictions during inference.
From Figure 6(a), learning multiple linear sub-models and averaging the predictions (ensemble) is still a linear 626 model, so it cannot tackle XOR problem.
Collaboration can address XOR which classiﬁes each sample bylearning to specify the sub-tasks to different sub-models.
From Figure 6(b), the samples are assigned to two 628 sub-models, in which the blue samples are assigned to f 1 and the red samples are assigned to f 2 .
Finally, itoutput the prediction by identifying the best-performing sub-models.
[Figure]
C.2 Visualization of the our Collaboration Scheme
To intuitively understand the collaboration mechanism of our proposed SoE, we show the decision boundaries of 632 the ensemble and the collaboration in Figure 7.
{+In particular, we learn the ensemble and the collaboration with 
+}
ResNet-20 sub-models on CIFAR10 dataset with adversarial training.
The same color areas in Figure 7 denotes 634 the same predicted label.
The black regions means that the models predict correctly while other color regionsmeans that the models are fooled and predict incorrectly.
The ensemble defending against attacks requires
C.3 Optimization Efﬁciency
The training cost is a notable issue.
We compare the training cost of all methods from the two aspects; 1).
642 parameters and GFLOPs: all methods have the same model architecture (ResNet20), so all methods have asimilar number of parameters and GFLOps.
Compared with baselines, our method has an additional head (E 644 head), which is a one-layer MLP with 128 parameters and has a negligible computation cost; 2).
training manner;all methods except DVERGE achieve adversarial training by generating adversarial samples using PGD attack.
The time consumption of all methods using the device Geforce 2080Ti (100 epochs) is in Table 4.
[Table]
DVERGE distills non-robust features by computing transferable adversarial samples, which have an O( N 2 ) timecomplexity in which N is the number of sub-models, so it has a relatively large time consumption.
Our method 649 outperforms baselines by training an additional E head and it could cause an additional small-time consumptionas shown in the above table.
C.4 a Single Big Model or a Collaboration
advantages of the SoE Compared with SoE, a single big model may be difﬁcult to ﬁt the adversarial 653 data.
For a big single model with a deeper structure, it may face gradient vanish or gradient explosion duringoptimization.
Without a well-designed optimization method, it could be more vulnerable to an imperceptible 655 perturbation compared to a simple model.
The SoE alleviates this problem by learning multiple relatively smallmodels.disadvantages of the SoE
A single big model may be a direct solution for addressing insufﬁcient capacity in 658 adversarial training.
Compared with learning a single big model, SoE needs to design a complicated mechanismto improve the utilization of the model capacity.
C.5 SoE in Adversarial Training Can Avoid a Trivial Optimization
As our proposed collaboration mechanism enhances the performance of the best-performing sub-model.
One 662 may wonder whether it obtains a trivial case, e.g., only one sub-model is properly trained.
In fact, our SoE doesnot bring such a trivial case.
Fitting the adversarial data consumes a tremendous model capacity so the model 664 usually cannot ﬁt all adversarial samples.
For a learned sub-model, there still exist adversarial samples thatcannot handle.
From our proposed collaboration mechanism, these adversarial samples generated from a learned 666 sub-model are more likely to be assigned to other sub-models which perform better.
Therefore, in our SoE, allsub-models will be trained.
[Table]
To experimentally verify this claim, we present the accuracy on clean data of all three sub-models with adversarial 669 training ( (cid:15) = 0 .
02 ) in the Table 5.
From the Table 5, all sub-models have a similar performance on the cleandata.
D More Experimental Results and AnalysisD.1 Performance on Black-box Attack
In addition to transfer attack, query attack can also craft adversarial samples based on the predicted scores of the 674 model.
To evaluate the robustness of SoE under query attack, we use Square Attack method [122] to attackall methods.
Square Attack selects localized square-shaped updates at random positions in each step [122].
In 676 particular, we set 0 .
01 ≤ (cid:15) ≤ 0 .
07 and learn the models for each method with adversarial training.
Then werandomly select 1000 samples from the test set and evaluate the robustness of each method under Square Attack 678 with 5000 iterations.
We repeated the experiments under 5 different random seeds and the results are presentedin Table 6.
From Table 6, SoE outperforms the baselines under query attack.
SoE optimizes the utilization of the model 681 capacity by specifying each sub-model to handle the "speciﬁc" adversarial attacks, which defends against query
[Table]
D.2 Analysis about the Number of Sub-models
[Table]
To explore the effect of the number of sub-models, we conduct experiments under transfer attacks with different 690 number of sub-models ( 1 ≤ N ≤ 5 ).
The results are shown in the following Figure 8 and Figure 9.
From Figure 8, as (cid:15) = 0 .
01 , multiple sub-models achieve a similar adversarial robustness compared with a 692 single model.
In this case, a single has enough model capacity and the collaboration is not necessary.
When0 .
02 ≤ (cid:15) ≤ 0 . 03 , SoE achieves a better performance as the number of sub-models increases.
If (cid:15) > 0 . 04 ,
SoE with multiple sub-models still outperforms a single model.
However, SoE having N = 3 sub-models 695 achieves a comparable robustness compared with SoE having N = 5 .
The volume of the sample surrounding isexponentially ( (1 + (cid:15) ) |X| ) large with the input X [3].
With the increase of (cid:15) , the required model capacity has asharp rise.
We guess that given a large (cid:15) (e.g., (cid:15) = 0 . 07 ), more sub-models (e.g., N = 5 ) may be insufﬁcient to improve the performance further compared with learning SoE with N = 3 .
Similar phenomenon could also be 699 found in Figure 9 when there are 30 generated adversarial variants.
D.3 Analysis about the Model Capacity of SoE
A model with sufﬁcient capacity to cover all cases does not need to collaborate with others.
To verify this claim, 702 we conduct experiments using the ResNet model with different depths and show the clean accuracy ( % ) ofsingle/multiple models in the following table.
[Table]
From the Table 7, with depth = 2 , the model has the insufﬁcient model capacity to learn the feature extractor, 705 SoE can have a relatively large improvement (2.0).
As the depth of the model is 20, the model has sufﬁcientmodel capacity to ﬁt all data samples.
SoEachieves a slight improvement compared with a single model (0.6).
Compared with standard training, adversarial data are adaptively changed based on the current model to smooth 708 the natural data’s local neighborhoods.
The volume of these surroundings is exponentially large.
The modeloften encounters insufﬁcient model capacity especially when there is a relatively large (cid:15) ball.
Therefore, it is 710 urgent to improve the utilization of the capacity for adversarial training.
E Implementation Details
the design of the E head In our experiments, we use ResNet20 as our backbone model.
For the additional
E head, we propose to use a one-layer MLP to model the relationship between the prediction and its conﬁdence.
Our design of the E head is based on the following aspects: 1).
convenient optimization; a simple modelstructure can be optimized easily and will not bring a signiﬁcant computation cost; 2).
robustness; a complex 716 E head may be vulnerable to the adversarial attack.
Therefore, in our implementation, we choose to learn asimple E head for each sub-model to improve its robustness.
The source codes are made publicly available at 718 https com synergyofexperts/synergy_of_experts .
Training devices We run our experiments on a local Linux server.
We use Pytorch framework to implement 720 our model and train all models on GeForce RTX 2080 Ti GPUs.