Home

Awesome

AutoAttack

"Reliable evaluation of adversarial robustness with an ensemble of diverse parameter-free attacks"
Francesco Croce, Matthias Hein
ICML 2020
https://arxiv.org/abs/2003.01690

We propose to use an ensemble of four diverse attacks to reliably evaluate robustness:

Note: we fix all the hyperparameters of the attacks, so no tuning is required to test every new classifier.

News

Adversarial Defenses Evaluation

We here list adversarial defenses, for many threat models, recently proposed and evaluated with the standard version of AutoAttack (AA), including

See below for the more expensive AutoAttack+ (AA+) and more options.

We report the source of the model, i.e. if it is publicly available, if we received it from the authors or if we retrained it, the architecture, the clean accuracy and the reported robust accuracy (note that might be calculated on a subset of the test set or on different models trained with the same defense). The robust accuracy for AA is on the full test set.

We plan to add new models as they appear and are made available. Feel free to suggest new defenses to test!

To have a model added: please check here.

Checkpoints: many of the evaluated models are available and easily accessible at this Model Zoo.

CIFAR-10 - Linf

The robust accuracy is evaluated at eps = 8/255, except for those marked with * for which eps = 0.031, where eps is the maximal Linf-norm allowed for the adversarial perturbations. The eps used is the same set in the original papers.
Note: ‡ indicates models which exploit additional data for training (e.g. unlabeled data, pre-training).

Update: this is no longer maintained, but an up-to-date leaderboard is available in RobustBench.

#papermodelarchitecturecleanreport.AA
1(Gowal et al., 2020)availableWRN-70-1691.1065.8765.88
2(Gowal et al., 2020)availableWRN-28-1089.4862.7662.80
3(Wu et al., 2020a)availableWRN-34-1587.6760.6560.65
4(Wu et al., 2020b)availableWRN-28-1088.2560.0460.04
5(Carmon et al., 2019)availableWRN-28-1089.6962.559.53
6(Gowal et al., 2020)availableWRN-70-1685.2957.1457.20
7(Sehwag et al., 2020)availableWRN-28-1088.98-57.14
8(Gowal et al., 2020)availableWRN-34-2085.6456.8256.86
9(Wang et al., 2020)availableWRN-28-1087.5065.0456.29
10(Wu et al., 2020b)availableWRN-34-1085.3656.1756.17
11(Alayrac et al., 2019)availableWRN-106-886.4656.3056.03
12(Hendrycks et al., 2019)availableWRN-28-1087.1157.454.92
13(Pang et al., 2020c)availableWRN-34-2086.4354.3954.39
14(Pang et al., 2020b)availableWRN-34-2085.14-53.74
15(Cui et al., 2020)*availableWRN-34-2088.7053.5753.57
16(Zhang et al., 2020b)availableWRN-34-1084.5254.3653.51
17(Rice et al., 2020)availableWRN-34-2085.345853.42
18(Huang et al., 2020)*availableWRN-34-1083.4858.0353.34
19(Zhang et al., 2019b)*availableWRN-34-1084.9256.4353.08
20(Cui et al., 2020)*availableWRN-34-1088.2252.8652.86
21(Qin et al., 2019)availableWRN-40-886.2852.8152.84
22(Chen et al., 2020a)availableRN-50 (x3)86.0454.6451.56
23(Chen et al., 2020b)availableWRN-34-1085.3251.1351.12
24(Sitawarin et al., 2020)availableWRN-34-1086.8450.7250.72
25(Engstrom et al., 2019)availableRN-5087.0353.2949.25
26(Kumari et al., 2019)availableWRN-34-1087.8053.0449.12
27(Mao et al., 2019)availableWRN-34-1086.2150.0347.41
28(Zhang et al., 2019a)retrainedWRN-34-1087.2047.9844.83
29(Madry et al., 2018)availableWRN-34-1087.1447.0444.04
30(Pang et al., 2020a)availableRN-3280.8955.043.48
31(Wong et al., 2020)availableRN-1883.3446.0643.21
32(Shafahi et al., 2019)availableWRN-34-1086.1146.1941.47
33(Ding et al., 2020)availableWRN-28-484.3647.1841.44
34(Atzmon et al., 2019)*availableRN-1881.3043.1740.22
35(Moosavi-Dezfooli et al., 2019)authorsWRN-28-1083.1141.438.50
36(Zhang & Wang, 2019)availableWRN-28-1089.9860.636.64
37(Zhang & Xu, 2020)availableWRN-28-1090.2568.736.45
38(Jang et al., 2019)availableRN-2078.9137.4034.95
39(Kim & Wang, 2020)availableWRN-34-1091.5157.2334.22
40(Wang & Zhang, 2019)availableWRN-28-1092.8058.629.35
41(Xiao et al., 2020)*availableDenseNet-12179.2852.418.50
42(Jin & Rinard, 2020)availableRN-1890.8471.221.35
43(Mustafa et al., 2019)availableRN-11089.1632.320.28
44(Chan et al., 2020)retrainedWRN-34-1093.7915.50.26

CIFAR-100 - Linf

The robust accuracy is computed at eps = 8/255 in the Linf-norm, except for the models marked with * for which eps = 0.031 is used.
Note: ‡ indicates models which exploit additional data for training (e.g. unlabeled data, pre-training).

Update: this is no longer maintained, but an up-to-date leaderboard is available in RobustBench.

#papermodelarchitecturecleanreport.AA
1(Gowal et al. 2020)availableWRN-70-1669.1537.7036.88
2(Cui et al., 2020)*availableWRN-34-2062.5530.2030.20
3(Gowal et al. 2020)availableWRN-70-1660.8630.6730.03
4(Cui et al., 2020)*availableWRN-34-1060.6429.3329.33
5(Wu et al., 2020b)availableWRN-34-1060.3828.8628.86
6(Hendrycks et al., 2019)availableWRN-28-1059.2333.528.42
7(Cui et al., 2020)*availableWRN-34-1070.2527.1627.16
8(Chen et al., 2020b)availableWRN-34-1062.15-26.94
9(Sitawarin et al., 2020)availableWRN-34-1062.8224.5724.57
10(Rice et al., 2020)availableRN-1853.8328.118.95

MNIST - Linf

The robust accuracy is computed at eps = 0.3 in the Linf-norm.

#papermodelcleanreport.AA
1(Gowal et al., 2020)available99.2696.3896.34
2(Zhang et al., 2020a)available98.3896.3893.96
3(Gowal et al., 2019)available98.3493.7892.83
4(Zhang et al., 2019b)available99.4895.6092.81
5(Ding et al., 2020)available98.9592.5991.40
6(Atzmon et al., 2019)available99.3597.3590.85
7(Madry et al., 2018)available98.5389.6288.50
8(Jang et al., 2019)available98.4794.6187.99
9(Wong et al., 2020)available98.5088.7782.93
10(Taghanaki et al., 2019)retrained98.8664.250.00

CIFAR-10 - L2

The robust accuracy is computed at eps = 0.5 in the L2-norm.
Note: ‡ indicates models which exploit additional data for training (e.g. unlabeled data, pre-training).

Update: this is no longer maintained, but an up-to-date leaderboard is available in RobustBench.

#papermodelarchitecturecleanreport.AA
1(Gowal et al., 2020)availableWRN-70-1694.74-80.53
2(Gowal et al., 2020)availableWRN-70-1690.90-74.50
3(Wu et al., 2020b)availableWRN-34-1088.5173.6673.66
4(Augustin et al., 2020)authorsRN-5091.0873.2772.91
5(Engstrom et al., 2019)availableRN-5090.8370.1169.24
6(Rice et al., 2020)availableRN-1888.6771.667.68
7(Rony et al., 2019)availableWRN-28-1089.0567.666.44
8(Ding et al., 2020)availableWRN-28-488.0266.1866.09

How to use AutoAttack

Installation

pip install git+https://github.com/fra31/auto-attack

PyTorch models

Import and initialize AutoAttack with

from autoattack import AutoAttack
adversary = AutoAttack(forward_pass, norm='Linf', eps=epsilon, version='standard')

where:

To apply the standard evaluation, where the attacks are run sequentially on batches of size bs of images, use

x_adv = adversary.run_standard_evaluation(images, labels, bs=batch_size)

To run the attacks individually, use

dict_adv = adversary.run_standard_evaluation_individual(images, labels, bs=batch_size)

which returns a dictionary with the adversarial examples found by each attack.

To specify a subset of attacks add e.g. adversary.attacks_to_run = ['apgd-ce'].

TensorFlow models

To evaluate models implemented in TensorFlow 1.X, use

from autoattack import utils_tf
model_adapted = utils_tf.ModelAdapter(logits, x_input, y_input, sess)

from autoattack import AutoAttack
adversary = AutoAttack(model_adapted, norm='Linf', eps=epsilon, version='standard', is_tf_model=True)

where:

If TensorFlow's version is 2.X, use

from autoattack import utils_tf2
model_adapted = utils_tf2.ModelAdapter(tf_model)

from autoattack import AutoAttack
adversary = AutoAttack(model_adapted, norm='Linf', eps=epsilon, version='standard', is_tf_model=True)

where:

The evaluation can be run in the same way as done with PT models.

Examples

Examples of how to use AutoAttack can be found in examples/. To run the standard evaluation on a pretrained PyTorch model on CIFAR-10 use

python eval.py [--individual] --version=['standard' | 'plus']

where the optional flags activate respectively the individual evaluations (all the attacks are run on the full test set) and the version of AA to use (see below).

Other versions

AutoAttack+

A more expensive evaluation can be used specifying version='plus' when initializing AutoAttack. This includes

Randomized defenses

In case of classifiers with stochastic components one can combine AA with Expectation over Transformation (EoT) as in (Athalye et al., 2018) specifying version='rand' when initializing AutoAttack. This runs

Custom version

It is possible to customize the attacks to run specifying version='custom' when initializing the attack and then, for example,

if args.version == 'custom':
	adversary.attacks_to_run = ['apgd-ce', 'fab']
        adversary.apgd.n_restarts = 2
        adversary.fab.n_restarts = 2

Other options

Random seed

It is possible to fix the random seed used for the attacks with, e.g., adversary.seed = 0. In this case the same seed is used for all the attacks used, otherwise a different random seed is picked for each attack.

Log results

To log the intermediate results of the evaluation specify log_path=/path/to/logfile.txt when initializing the attack.

Citation

@inproceedings{croce2020reliable,
    title = {Reliable evaluation of adversarial robustness with an ensemble of diverse parameter-free attacks},
    author = {Francesco Croce and Matthias Hein},
    booktitle = {ICML},
    year = {2020}
}
@inproceedings{croce2021mind,
    title={Mind the box: $l_1$-APGD for sparse adversarial attacks on image classifiers}, 
    author={Francesco Croce and Matthias Hein},
    booktitle={ICML},
    year={2021}
}