This code is implemented in PyTorch, and we have tested the code under the following environment settings:
python = 3.8.10
pytorch = 1.9.0+cu111
autoattack = 0.1
What is in this repository
auto_adv: the core codes for A², contains the super-attacker in adv_x.py, the attacker space in genotypes.py, the attack cell in cell.py, the operations in operations.py, and the Gumbel Softmax in sample.py;
train_[cifar10, cifar100, svhn].py: the codes for CIFAR-10, CIFAR-100, and SVHN respectively;
other codes: the basic code from AWP.
How to run it
For A² with a PreAct ResNet-18 on CIFAR-10 under L∞ threat model (8/255), run codes as follows,
A²
Code for “Automated Adversarial Training”.
Requisite
This code is implemented in PyTorch, and we have tested the code under the following environment settings:
python = 3.8.10pytorch = 1.9.0+cu111autoattack = 0.1What is in this repository
auto_adv: the core codes for A², contains the super-attacker inadv_x.py, the attacker space ingenotypes.py, the attack cell incell.py, the operations inoperations.py, and the Gumbel Softmax insample.py;train_[cifar10, cifar100, svhn].py: the codes for CIFAR-10, CIFAR-100, and SVHN respectively;How to run it
For A² with a PreAct ResNet-18 on CIFAR-10 under L∞ threat model (8/255), run codes as follows,
where
$DATASET_DIRis the path to the dataset.For TRADES-A² with a WRN-34-10 on CIFAR10 under L∞ threat model (8/255), run codes as follows,
For MART-A², just set
MARTto$LOSS.For AWP-A² with a WRN-34-10 on CIFAR10 under L∞ threat model (8/255), run codes as follows,
To verify the effectiveness of A² further, we run
attack.pyto evaluate the robustness of the defense model against FGSM, PGD, C&W and AutoAttack:Reference Code: