Source-linked AI summary
advertorch v0.1: An Adversarial Robustness Toolbox based on PyTorch
Gavin Weiguang Ding, Luyu Wang, Xiaomeng Jin
TL;DR
Adversarial robustness research needs implementations spanning attacks, defenses, and robust training. advertorch addresses this with modular PyTorch reference implementations and GPU execution, while requiring version and hyperparameter reporting for benchmarks.
Problem
Adversarial robustness research spans attacks, defenses, and robust training, creating a need for tools supporting these research directions.
Method
advertorch provides modular attacks, defenses, and robust-training implementations built around PyTorch’s dynamic computational graphs.
Results
The toolbox provides concise reference implementations with simple APIs and fast GPU-powered execution for adversarial robustness research.
Takeaways & Limitations
advertorch supports research workflows requiring reusable attack components, composable defenses, and adversarial-training reference implementations.
Takeaways & Limitations
Benchmark results require reporting the advertorch MAJOR.MINOR version and detailed hyperparameters, including attack settings.
Abstract
from arXiv · showhide
advertorch is a toolbox for adversarial robustness research. It contains various implementations for attacks, defenses and robust training methods. advertorch is built on PyTorch (Paszke et al., 2017), and leverages the advantages of the dynamic computational graph to provide concise and efficient reference implementations. The code is licensed under the LGPL license and is open sourced at https://github.com/BorealisAI/advertorch .
1 Introduction
advertorch is a PyTorch toolbox for adversarial robustness research spanning attacks, defenses, and robust training. It emphasizes concise, efficient implementations and aims to support research across these directions.
- Adversarial robustness research addresses attacks, detection, defenses for trained models, and robust training.
- advertorch provides tools for research in the adversarial robustness directions described above, with the current version covering attacks, defenses, and robust training.
- The toolbox aims for simple consistent APIs, concise PyTorch reference implementations, and fast GPU-powered execution.
- The report covers attack design and implementations, defenses and robust training, and versioning.
2 Attacks
advertorch organizes attacks around reusable components and implements gradient-based, other, and BPDA-enhanced attacks. Its component decoupling supports more versatile objectives without changing the underlying perturbation implementation.
- The toolbox includes gradient-based attacks, other attacks such as SinglePixelAttack and LocalSearchAttack, and a BPDA wrapper.
- Each attack separates prediction, loss calculation, and perturbation into three core components.
- Gradient-Based Attacks: For untargeted LinfPGDAttack, the classifier predicts logits, loss_fn computes gradients from predict(x) and y, and perturb modifies the input.
- Gradient-Based Attacks: Decoupled predict and loss_fn components let attacks reuse the same perturbation routine across classification and feature-matching objectives.
- Gradient-Based Attacks: Multi-objective attacks can target labels and feature representations together by using tuple-valued targets and predictions without changing the perturbation implementation.
- BPDA Wrapper: BPDAWrapper preserves a defense’s forward pass while replacing its backward pass with a specified substitute, such as the identity function.
3 Defenses and Robust Training
advertorch includes modular preprocessing defenses and reference implementations for robust training. Its defenses are PyTorch modules, while training support includes adversarial and provably robust approaches.
- Preprocessing-based Defenses: The current version implements JPEG filtering, bit squeezing, median smoothing, and several linear smoothing filters.
- Preprocessing-based Defenses: Preprocessing defenses are implemented as PyTorch modules that can be combined dynamically.
- Robust Training: Adversarially augmented and provably robust training are described as effective methods against worst-case perturbations.
- Robust Training: Because robust-training algorithms are not standardized and vary in ways that hinder modularization, advertorch provides representative reference implementations.
- Robust Training: The current training example implements Madry et al.’s adversarial training on MNIST.
4 Versioning and Reporting Benchmark Results
advertorch uses Semantic Versioning to distinguish incompatible changes, backward-compatible functionality, and bug fixes. Benchmark reports should include the version and detailed attack hyperparameters for reproducibility.
- advertorch follows MAJOR.MINOR.PATCH Semantic Versioning.
- MAJOR denotes incompatible API changes, MINOR adds backward-compatible functionality, and PATCH fixes backward-compatible bugs.
- Benchmark reports should state the MAJOR.MINOR version and detailed hyperparameters.
- For untargeted LinfPGDAttack, reporting should include the loss, perturbation bound, iteration count, step size, and random initialization status.