O N I MPROVING A DVERSARIAL T RANSFERABILITY OF V ISION T RANSFORMERS
Anonymous authors
Paper under double-blind review
A BSTRACT
Vision transformers (ViTs) process input images as sequences of patches via selfattention; a radically different architecture than convolutional neural networks (CNNs).
This makes it interesting to study the adversarial feature space of ViT models and their transferability.
In particular, we observe that adversarial patterns found via conventional adversarial attacks show very low black-box transferability even for large ViT models.
We show that this phenomenon is only due to the sub-optimal attack procedures that do not leverage the true representation potential of ViTs.
A deep ViT is composed of multiple blocks, with a consistent architecture comprising of self-attention and feed-forward layers, where each block is capable of independently producing a class token.
Formulating an attack using only the last class token (conventional approach) does not directly leverage the discriminative information stored in the earlier tokens, leading to poor adversarial transferability of ViTs.
Using the compositional nature of ViT models, we enhance transferability of existing attacks by introducing two novel strategies speciﬁc to the architecture of ViT models.
(i) Self-Ensemble: We propose a method to ﬁnd multiple discriminative pathways by dissecting a single ViT model into an ensemble of networks.
This allows explicitly utilizing class-speciﬁc information at each ViT block.
(ii)
Token Reﬁnement: We then propose to reﬁne the tokens to further enhance the discriminative capacity at each block of ViT.
Our token reﬁnement systematically combines the class tokens with structural information preserved within the patch tokens.
An adversarial attack when applied to such reﬁned tokens within the ensemble of classiﬁers found in a single vision transformer has signiﬁcantly higher transferability and thereby brings out the true generalization potential of the ViT’s adversarial space.
Our code will be publicly released.
I NTRODUCTION
Transformers compose a family of neural network architectures based on the self-attention mechanism, originally applied in natural language processing tasks achieving state-of-the-art performance (Vaswani et al., 2017; Devlin et al., 2018; Brown et al., 2020).
The transformer design has been subsequently adopted for vision tasks (Dosovitskiy et al., 2020), giving rise to a number of successful vision transformer (ViT) models (Touvron et al., 2020; Yuan et al., 2021;
Khan et al., 2021).
Due to the lack of explicit inductive biases in their design, ViTs are inherently different from convolutional neural networks (CNNs) that encode biases e.g., spatial connectivity and translation equivariance.
ViTs process an image as a sequence of patches which are reﬁned through a series of self-attention mechanisms (transformer blocks), allowing the network to learn relationships between any individual parts of the input image.
Such processing allows wide receptive ﬁelds which can model global context as opposed to the limited receptive ﬁelds of CNNs.
These signiﬁcant differences between ViTs and
CNNs give rise to a range of intriguing characteristics unique to ViTs (Caron et al., 2021;
Tuli et al., 2021; Mao et al., 2021; Paul & Chen, 2021; Naseer et al., 2021b).
Adversarial attacks pose a major hindrance to the successful deployment of deep neural networks in real-world applications.
Recent success of ViTs means that adversarial properties of ViT models also become an important research topic.
A few recent works explore adversarial robustness of
ViTs (Shao et al., 2021; Mahmood et al., 2021; Bhojanapalli et al., 2021) in different attack settings.
Surprisingly, these works show that large ViT models exhibit lower transferability in black-box attack setting, despite their higher parameter capacity, stronger performance on clean images, and better generalization (Shao et al., 2021;
Mahmood et al., 2021).
This ﬁnding seems to indicate that as ViT performance improves, its adversarial feature space gets weaker.
In this work, we investigate whether the weak transferability of adversarial patterns from high-performing ViT models, as reported in recent works (Shao et al., 2021; Mahmood et al., 2021; Bhojanapalli et al., 2021), is a result of weak features or a weak attack.
To this end, we introduce a highly transferable attack approach that augments the current adversarial attacks and increase their transferability from ViTs to the unknown models.
Our proposed transferable attack leverages two key concepts, multiple discriminative pathways and token reﬁnement, which exploit unique characteristics of ViT models.
Our approach is motivated by the modular nature of ViTs (Touvron et al., 2020; Yuan et al., 2021; Mao et al., 2021): they process a sequence of input image patches repeatedly using multiple multi-headed self-attention layers (transformer blocks)
(Vaswani et al., 2017).
We refer to the representation of patches at each transformer block as patch tokens .
An additional randomly initialized vector ( class token 1 ) is also appended to the set of patch tokens along the network depth to distill discriminative information across patches.
The collective set of tokens is passed through the multiple transformer blocks followed by passing of the class token through a linear classiﬁer (head) which is used to make the ﬁnal prediction.
The class token interacts with the patch tokens within each block and is trained gradually across the blocks until it is ﬁnally utilized by the linear classiﬁer head to obtain class-speciﬁc logit values.
The class token can be viewed as extracting information useful for the ﬁnal prediction from the set of patch tokens at each block.
Given the role of the class token in ViT models, we observe that class tokens can be extracted from the output of each block and each such token can be used to obtain a class-speciﬁc logit output using the ﬁnal classiﬁer of a pretrained model.
This leads us to the proposed self-ensemble of models within a single transformer (Fig. 1).
We show that attacking such a self-ensemble (Sec. 3) containing multiple discriminative pathways signiﬁcantly improves adversarial transferability from ViT models, and in particular from the large ViTs.
Going one step further, we study if the class information extracted from different intermediate ViT blocks (of the self-ensemble) can be enhanced to improve adversarial transferability.
To this end, we introduce a novel token reﬁnement module directed at enhancing these multiple discriminative pathways.
The token reﬁnement module strives to reﬁne the information contained in the output of each transformer block (within a single ViT model) and aligns the class tokens produced by the intermediate blocks with the ﬁnal classiﬁer in order to maximize the discriminative power of intermediate blocks.
Our token reﬁnement exploits the structural information stored in the patch tokens and fuses it with the class token to maximize the discriminative performance of each block.
Both the reﬁned tokens and self-ensemble ideas are combined to design an adversarial attack that is shown to signiﬁcantly boost the transferability of adversarial examples, thereby bringing out the true generalization of ViTs’ adversarial space.
Through our extensive experimentation, we empirically demonstrate favorable transfer rates across different model families (convolutional and transformer) as well as different vision tasks (classiﬁcation, detection and segmentation).
B ACKGROUND AND R ELATED W ORK
Adversarial Attack Modeling: Adversarial attack methods can be broadly categorized into two categories, white-box attacks and black-box attacks.
While the white-box attack setting provides the attacker full access to the parameters of the target model, the black-box setting prevents the attacker from accessing the target model and is therefore a harder setting to study adversarial transferability.
White-box Attack: Fast Gradient Sign Method (FGSM) (Goodfellow et al., 2014) and Projected
Gradient Descent (PGD) (Madry et al., 2018) are two initially proposed white-box attack methods.
FGSM corrupts the clean image sample by taking a single step within a small distance (perturbation budget ✏ ) along the objective function’s gradient direction.
PGD corrupts the clean sample for multiple steps with a smaller step size, projecting the generated adversarial example onto the ✏ -sphere around the clean sample after each step.
Other state-of-the-art white-box attack methods include
Jacobian-based saliency map attack (Papernot et al., 2016), Sparse attack (Modas et al., 2019), Onepixel attack (Su et al., 2019), Carlini and Wagner optimization (Carlini & Wagner, 2017), Elastic-net (Chen et al., 2018), Diversiﬁed sampling (Tashiro et al., 2020), and more recently Auto-attack (Croce & Hein, 2020b).
We apply white-box attacks on surrogate models to ﬁnd perturbations that are then transferred to black-box target models.
Black-box Attack and Transferability: Black-box attacks generally involve attacking a source model to craft adversarial signals which are then applied on the target models.
While gradient estimation methods that estimate the gradients of the target model using black-box optimization methods such as Finite Differences (FD) (Chen et al., 2017;
Bhagoji et al., 2018) or Natural Evolution
Strategies (NES) (Ilyas et al., 2018; Jiang et al., 2019) exist, these methods are dependent on multiple queries to the target model which is not practical in most real-world scenarios.
In the case of adversarial signal generation using source models, it is possible to directly adopt white-box methods.
In our work, we adopt FGSM and PGD in such a manner.
Methods like (Dong et al., 2018) incorporate a momentum term into the gradient to boost the transferability of existing white-box attacks, building attacks named MIM.
In similar spirit, different directions are explored in literature to boost transferability of adversarial examples; a) Enhanced Momentum:
Lin et al .
(Lin et al., 2019) and Wang et al .
(Wang & He, 2021) improve momentum by using Nesterov momentum and variance tuning respectively during attack iterations, b) Augmentations: Xie et al .
(Xie et al., 2019) showed that applying differentiable stochastic transformations can bring diversity to the gradients and improve transferability of the existing attacks, c)
Exploiting Features: Multiple suggestions are proposed in the literature to leverage the feature space for adversarial attack as well.
For example, Zhou et al .
(Zhou et al., 2018) incorporate the feature distortion loss during optimization.
Similarly, (Inkawhich et al., 2020b;a; Huang et al., 2019) also exploit intermediate layers to enhance transferability.
However, combining the intermediate feature response with ﬁnal classiﬁcation loss is non-trivial as it might require optimization to ﬁnd the best performing layers (Inkawhich et al., 2020b;a), and d) Generative
Approach: Orthogonal to iterative attacks, generative methods (Poursaeed et al., 2018; Naseer et al., 2019; 2021a) train an autoencoder against the white-box model.
In particular, Naseer et al .
show that transferability of an adversarial generator can be increased with relativistic cross-entropy (Naseer et al., 2019) and augmentations (Naseer et al., 2021a).
Ours is the ﬁrst work to address limited transferability of ViT models.
The Role of Network Architecture:
Recent works exploit architectural characteristics of networks to improve the transferability of attacks.
While Wu et al.
(2020) exploit skip connections of models like ResNets and DenseNets to improve black-box attacks, Guo et al.
(2020) build on similar ideas focused on the linearity of models.
Our work similarly focuses on unique architectural characteristics of ViT models to generate more transferable adversarial perturbations with the existing white-box attacks.
Robustness of ViTs: Adversarial attacks on ViT models are relatively unexplored.
Shao et al.
(2021) and Bhojanapalli et al.
(2021) investigate adversarial attacks and robustness of ViT models studying various white-box and black-box attack techniques.
The transferability of perturbations from ViT models is thoroughly explored in (Mahmood et al., 2021) and they conclude that ViT models do not transfer well to CNNs, whereas we propose a methodology to solve this shortcoming.
Moreover, Mahmood et al.
(2021) explores the idea of an ensemble of CNN and ViT models to improve the transferability of attacks.
Our proposed ensemble approach explores a different direction by converting a single ViT model into a collection of models (self-ensemble) to improve attack transferability.
In essence, our proposed method can be integrated with existing attack approaches to take full advantage of the ViTs’ learned features and generate transferable adversaries.
E NHANCING A DVERSARIAL T RANSFERABILITY OF V I T S
Preliminaries: Given a clean input image sample x with a label y , a source ViT model F and a target model M which is under-attack, the goal of an adversarial attack is generating an adversarial signal, x 0 , using the information encoded within F , which can potentially change the target network’s prediction ( M ( x 0 ) argmax 6 = y ).
A set of boundary conditions are also imposed on the adversarial signal to control the level of distortion in relation to the original sample, i.e., k x  x 0 k p < ✏ , for a small perturbation budget ✏ and a p -norm, often set to inﬁnity norm ( ` 1 ).
Motivation: The recent ﬁndings (Shao et al., 2021; Mahmood et al., 2021) demonstrate low black-box transferability of ViTs despite their higher parametric complexity and better feature generalization.
Motivated by this behaviour, we set-up a simple experiment of our own to study the adversarial transferability of ViTs (see Fig. 2).
We note that transferability of adversarial examples found via momentum iterative fast gradient sign method (Dong et al., 2018) (MIM) at ` 1  16 on DeiT (Touvron et al., 2020) does not increase with model capacity.
In fact, adversarial transferability from DeiT base model (DeiT-B) on ResNet152 and large vision transformer (ViT-L (Dosovitskiy et al., 2020)) is lower than DeiT tiny model (DeiT-T).
This is besides the fact that DeiT-B has richer representations and around 17 ⇥ more parameters than
DeiT-T.
We investigate if this behavior is inherent to ViTs or merely due to a sub-optimal attack mechanism.
To this end, we exploit unique architectural characteristics of ViTs to ﬁrst ﬁnd an ensemble of networks within a single pretrained
ViT model (self-ensemble, right Fig. 1).
The class token produced by each self-attention block is processed by the ﬁnal local norm and classiﬁcation MLP-head to reﬁne class-speciﬁc information (Fig. 2).
In other words, our MIM E and MIM RE variants attack class information stored in the class tokens produced by all the self-attention blocks within the model and optimize for the adversarial example (Sec. 3.1 and 3.2).
Exploring the adversarial space of such multiple discriminative pathways in a self-ensemble generates highly transferable adversarial examples, as we show next.
3. S ELF -E NSEMBLE : D ISCRIMINATIVE P ATHWAYS OF V ISION T RANSFORMER
A ViT model (Dosovitskiy et al., 2020; Touvron et al., 2020), F , with n transformer blocks can be deﬁned as F =
( f 1  f 2  f 3  . . .
f n )  g , where f i represents a single ViT block comprising of multi-head self-attention and feed-forward layers and g is the ﬁnal classiﬁcation head.
To avoid notation clutter, we assume that g consists of the ﬁnal local norm and MLP-head (Touvron et al., 2020; Dosovitskiy et al., 2020).
Self-attention layer within the vision transformer model takes a sequence of m image patches as input and outputs the processed patches.
We will refer to the representations associated with the sequence of image patches as patch tokens, P t 2 R m ⇥ d (where d is the dimensionality of each patch representation).
Attention in ViT layers is driven by minimizing the empirical risk during training.
In the case of classiﬁcation, patch tokens are further appended with the class token
( Q t 2 R 1 ⇥ d ).
These patch and class tokens are reﬁned across multiple blocks ( f i ) and attention in these layers is guided such that the most discriminative information from patch tokens is preserved within the class token.
The ﬁnal class token is then projected to the number of classes by the classiﬁer, g .
Due to the availability of class token at each transformer block, we can create an ensemble of classiﬁers by learning a shared classiﬁcation head at each block along the ViT hierarchy.
This provides us an ensemble of n classiﬁers from a single ViT, termed as the self-ensemble :
[Equation]
We note that the multiple classiﬁers thus formed hold signiﬁcant discriminative information.
This is validated by studying the classiﬁcation performance of each classiﬁer (Eq. 1) in terms of top- (%) accuracy on ImageNet validation set, as demonstrated in Fig.
Note that multiple intermediate layers perform well on the task, especially towards the end of the ViT processing hierarchy.
For an input image x with label y , an adversarial attack can now be optimized for the ViT’s selfensemble by maximizing the loss at each ViT block.
However, we observe that initial blocks (1-6) for all considered DeiT models do not contain useful discriminative information as their classiﬁcation accuracy is almost zero (Fig. 3).
During the training of ViT models (Touvron et al., 2020; Yuan et al., 2021; Mao et al., 2021), parameters are updated based on the last class token only, which means that the intermediate tokens are not directly aligned with the ﬁnal classiﬁcation head, g in our self-ensemble approach (Fig. 3) leading to a moderate classiﬁcation performance.
To resolve this, we introduce a token reﬁnement strategy to align the class tokens with the ﬁnal classiﬁer, g , and boost their discriminative ability, which in turn helps improve attack transferability.
We explain the reﬁnement process below.
3. T OKEN R EFINEMENT
As mentioned above, the multiple discriminative pathways within a ViT give rise to an ensemble of classiﬁers (Eq. 1).
However, the class token produced by each attention layer is being processed by the ﬁnal classiﬁer, g .
This puts an upper bound on classiﬁcation accuracy for each token which is lower than or equal to the accuracy of the ﬁnal class token.
Our objective is to push the accuracy of the class tokens in intermediate blocks towards the upper bound as deﬁned by the last token.
For this purpose, we introduced a token reﬁnement module to ﬁne-tune the class tokens.
Our proposed token reﬁnement module is illustrated in Fig.
It acts as an intermediate layer inserted between the outputs of each block (after the shared norm layer) and the shared classiﬁer head.
Revisiting our baseline ensemble method (Fig. 1), we note that the shared classiﬁer head contains weights directly trained only on the outputs of the last transformer block.
While the class tokens of previous layers may be indirectly optimized to align with the ﬁnal classiﬁer, there exists a potential for misalignment of these features with the classiﬁer: the pretrained classiﬁer (containing weights compatible with the last layer class token) may not extract all the useful information from the previous layers.
Our proposed module aims to solve this misalignment by reﬁning the class tokens in a way such that the shared (pretrained) classiﬁer head is able to extract all discriminative information contained within the class tokens of each block.
Moreover, intermediate patch tokens may contain additional information that is not at all utilized by the class tokens of those blocks, which would also be addressed by our proposed block.
Therefore, we extract both patch tokens and the class token from each block and process them for reﬁnement, as explained next.
Patch Token Reﬁnement: One of the inputs to the token reﬁnement module is the set of patch tokens output from each block.
We ﬁrst rearrange these patch tokens to regain their spatial relationships.
The aim of this component within the reﬁnement module is to extract information relevant to spatial structure contained within the intermediate patch tokens.
We believe that signiﬁcant discriminative information is contained within these patches.
The obtained rearranged patch tokens are passed through a convolution block (standard ResNet block containing a skip connection) to obtain a spatially aware feature map, which is then average pooled to obtain a single feature vector (of same dimension as the class token).
This feature vector is expected to extract all spatial information from patch tokens.
Class Token Reﬁnement: By reﬁning the class tokens of each block, we aim to remove any misalignment between the existing class tokens and the shared (pretrained) classiﬁer head.
Also, given how the class token does not contain a spatial structure, we simply use a linear layer to reﬁne it.
We hypothesize that reﬁned class token at each block would be much more aligned with the shared classiﬁer head allowing it to extract all discriminative information contained within those tokens.
Merging Patch and Class Token:
We obtain the reﬁned class token and the patch feature vector (reﬁned output of patch tokens) and sum them together to obtain a merged token.
While we tested multiple approaches for merging, simply summing them proved sufﬁcient.
Training:
Given a ViT model containing k transformer blocks, we plugin k instances of our token reﬁnement module to the output of each block as illustrated in Figure 4.
We obtain the pretrained model, freeze all existing weights, and train only the k token reﬁnement modules for only a single epoch on ImageNet training set.
We used SGD optimizer with learning rate set to 0.001.
Training ﬁnishes in less than one day on a single GPU-V100 even for a large ViT model such as DeiT-B (Touvron et al., 2020).
As expected, the trained token reﬁnement module leads to increased discriminability of the class tokens, which we illustrate in Figure 5.
Note how this leads to signiﬁcant boosting of discriminative power especially in the earlier blocks, solving the misalignment problem.
We build on this enhanced discriminability of the ensemble members towards better transferability, as explained next.
3. A DVERSARIAL T RANSFER
Our modiﬁcations to ViT models with respect to multiple discriminative pathways and token reﬁnement are exploited in relation to adversarial transfer.
We consider black-box attack perturbations are generated using a source (surrogate) ViT model.
The source model is only pretrained on ImageNet, modiﬁed according to our proposed approach and is subsequently ﬁne-tuned to update only the token reﬁnement module for a single epoch.
We experiment with multiple white-box attacks, generating the adversarial examples using a joint loss over the outputs of each block.
The transferability of adversarial examples is tested on a range of CNN and ViT models.
Given input sample x and its label y , the adversarial object for our self-ensemble (Eq. 1) for the untargeted attack is deﬁned as,
[Equation]
[Table]
where [[ · ]] is an indicator function.
In the case of target attack, the attacker optimizes the above objective towards a speciﬁc target class instead of an arbitrary misclassiﬁcation.
E XPERIMENTS
We conduct thorough experimentation on a range of standard attack methods to establish the performance boosts obtained through our proposed transferability approach.
We create ` 1 adversarial attacks with ✏  16 and observe their transferability by using the following protocols:
Source (white-box) models: We mainly study three vision transformers from DeiT (Touvron et al., 2020) family due to their data efﬁciency.
Speciﬁcally, the source models are Deit-T, DeiT-S, and
DeiT-B (with 5, 22, and 86 million parameters, respectively).
They are trained without CNN distillation.
Adversarial examples are created on these models using an existing white-box attack (e.g., FGSM (Goodfellow et al., 2014), PGD (Madry et al., 2018) and MIM (Dong et al., 2018)) and then transferred to the black-box target models.
Target (black-box) models: We test on black-box transferability across several vision tasks including classiﬁcation, detection and segmentation.
We consider convolutional networks BiT-ResNet (BiT50) (Beyer et al., 2021), ResNet152 (Res152)
(He et al., 2016), Wide-ResNet-50-2 (WRN) (Zagoruyko & Komodakis, 2016), DenseNet201 (DN201) (Huang et al., 2017) and other ViT models including Token-to-Token transformer (T2T) (Yuan et al., 2021), Transformer in Transformer (TnT) (Mao et al., 2021), DINO (Caron et al., 2021), and Detection Transformer (DETR) (Carion et al., 2020) as the black-box target models.
Datasets: We use ImageNet training set to ﬁne tune our proposed token reﬁnement modules.
For evaluating robustness, we selected 5k samples from ImageNet validation set such that 5 random samples from each class that are correctly classiﬁed by ResNet50 and ViT small (ViT-S)
(Dosovitskiy et al., 2020) are present.
In addition, we conduct experiments on COCO (Lin et al., 2014)
(5k images) and PASCAL-VOC12 (Everingham et al., 2012) (around 1.2k images) validation set to test the cross-task transferability.
[Table]
Evaluation Metrics: We report fooling rate (percentage of samples for which the predicted label is ﬂipped after adding adversarial perturbations) to evaluate classiﬁcation.
In the case of object detection, we report the decrease in mean average precision (mAP) and for automatic segmentation, we use the popular Jaccard Index.
Given the pixel masks for the prediction and the ground-truth, it calculates the ratio between the pixels belonging to intersection and the union of both masks.
Baseline Attacks: We show consistent improvements for single step fast gradient sign method (FGSM)
(Goodfellow et al., 2014) as well as iterative attacks including PGD (Madry et al., 2018),
MIM (Dong et al., 2018) and input diversity (transformation to the inputs) (DIM) (Xie et al., 2019) attacks.
Iterative attacks ran for 10 iterations and we set transformation probability for DIM to default 0.7 (Xie et al., 2019).
Our approach is not limited to speciﬁc attack settings, but existing attacks can simply be adopted to our self-ensemble ViTs with reﬁned tokens.
Refer to appendices A-J for extensive analysis with more ViT designs, attacks, datasets (CIFAR10 & Flowers), computational cost comparison, and latent space visualization of our reﬁned token.
4. C LASSIFICATION
In this section, we discuss the experimental results on adversarial transferability across black-box classiﬁcation models.
For a given attack method ‘Attack’ , we refer ‘Attack E ’ and ‘Attack RE ’ as self-ensemble and self-ensemble with reﬁned tokens, respectively, which are the two variants of our approach.
We observe that adversarial transferability from ViT models to CNNs is only moderate for conventional attacks (Tables 1 & 2).
For example, perturbations found via iterative attacks from
DeiT-B to Res152 has even lower transfer than VGG19 bn .
However, the same attacks when applied using our proposed ensemble strategy (Eq. 1) with reﬁned tokens consistently showed improved transferability to other convolutional as well as transformer based models.
Strength of our method is also evident by blockwise fooling rate in white-box setting (Fig. 6).
It is noteworthy how MIM fails to fool the initial blocks of ViT, while our approach allows the attack to be as effective in the intermediate blocks as for the last class token. This ultimately allows us to fully exploit ViT’s adversarial space leading to high transfer rates for adversarial perturbations. We observe that models without inductive biases that share architecture similarities show higher transfer rate of adversarial [Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table] [Figure] [Table] [Figure]
[Table] [Table] [Figure] perturbations among them (e.g., from DeiT to ViT (Dosovitskiy et al., 2020)).
We further observe that models trained with the same mechanism but lower parameters are more vulnerable to black-box attacks. For example, ViT-S and T2T-T are more vulnerable than their larger counterparts, ViT-L and T2T-24. Also models trained with better strategies that lead to higher generalizability are less vulnerable to black-box attacks e.g., BiT50 is more robust than ResNet152 (Tables 1 and 2).
4. C ROSS -T ASK T RANSFERABILITY
Self-attention is the core component of transformer architecture regardless of the task; classiﬁcation (Dosovitskiy et al., 2020; Touvron et al., 2020; Yuan et al., 2021; Mao et al., 2021), object detection (Carion et al., 2020), or unsupervised segmentation (Caron et al., 2021).
We explore the effectiveness of our proposed method on two additional tasks: object detection (DETR) (Carion et al., 2020) and segmentation (DINO) (Caron et al., 2021).
We select these methods considering the use of transformer modules employing the self-attention mechanism within their architectures.
While the task of object detection contains multiple labels per image and involves bounding box regression, the unsupervised model DINO is trained in a self-supervised manner with no traditional image-level labels.
Moreover, DINO uses attention maps of a ViT model to generate pixel-level segmentations, which means adversaries must disrupt the entire attention mechanism to degrade its performance.
We generate adversarial signals on source models with a classiﬁcation objective using their initial predictions as the label.
In evaluating attacks on detection and segmentation tasks at their optimal setting, the source ViT need to process images of different sizes (e.g., over 896 ⇥ 896 pix for DETR).
To cater for this, we process images in parts (refer appendix G) which allows generation of stronger adversaries.
The performance degradation of DETR and DINO on generated adversaries are summarised in Tables 3 & 4.
For DETR, we obtain clear improvements.
In the more robust DINO model, our transferability increases well with the source model capacity as compared to the baseline.
C ONCLUSION
We identify a key shortcoming in current state-of-the-art approaches for adversarial transferability of vision transformers (ViTs) and show the potential for much strong attack mechanisms that would exploit the architectural characteristics of ViTs.
Our proposed novel approach involving multiple discriminative pathways and token reﬁnement is able to ﬁll in these gaps, achieving signiﬁcant performance boosts when applied over a range of state-of-the-art attack methods.
Reproducibility Statement : Our method simply augments the existing attack approaches and we used open source implementations.
We highlight the steps to reproduce all of the results presented in our paper, a) Attacks: We used open source implementation of patchwise attack (Gao et al., 2020) and Auto-Attack (Croce & Hein, 2020b) (refer Appendix B) with default setting.
Wherever necessary, we clearly mention attack parameters, e.g., iterations for PGD (Madry et al., 2018),
MIM (Dong et al., 2018) and DIM (Xie et al., 2019) in section 4 (Experiments: Baseline
Attack).
Similarly, transformation probability for DIM is set to the default value provided by the corresponding authors that is 0.7, b) Refined Tokens: We ﬁne tuned class tokens for the pretrained source models (used to create perturbations) using open source code base ( https: //github.com/pytorch/examples/tree/master/imagenet ).
We provided training details for ﬁne tuning in section 3.2.
Further, we will publicly release all the models with reﬁned tokens, c) Cross-Task Attack Implementation: We provided details in section 4.2 and pseudo code in appendix G for cross-task transferability (from classiﬁcation to segmentation and detection), and d) Dataset: We describe the procedure of selecting subset (5k) samples from
ImageNet val.
set in section 4.
We will also release indices of these samples to reproduce the results.
Ethics Statement : Since our work focuses on improving adversarial attacks on models, in the short run our work can assist various parties with malicious intents of disrupting real-world deployed deep learning systems dependent on ViTs.
However, irrespective of our work, the possibility of such threats emerging exists.
We believe that in the long run, works such as ours will support further research on building more robust deep learning models that can withstand the kind of attacks we propose, thus negating the short term risks.
Furthermore, a majority of the models used are pre-trained on ImageNet (ILSVRC’12).
We also conduct our evaluations using this dataset.
The version of ImageNet used contains multiple biases that portray unreasonable social stereotypes.
The data contained is mostly limited to the Western world and encodes multiple gender / ethnicity stereotypes Yang et al.
(2020) while also posing privacy risks due to unblurred human faces.
In future, we hope to use the more recent version of ImageNet Yang et al.
(2021) which could address some of these issues