The Adversarial Robustness Toolbox (ART) is an open-source Python library that implements attacks, defenses, robustness metrics and certification methods for machine learning models. In AI security, it serves as a common workbench where red teams and model developers can simulate realistic threats and measure how well a model withstands them.
IBM Research released ART in 2018, and the project was later contributed to the LF AI & Data Foundation under the MIT license. It is framework-agnostic, supporting models built with PyTorch, TensorFlow, Keras, scikit-learn, XGBoost, LightGBM and other libraries, and it covers images, tabular data, audio and video tasks.
How the Adversarial Robustness Toolbox is organized
ART is built around estimators: wrapper classes such as PyTorchClassifier or SklearnClassifier that give every model the same interface for predictions, loss values and, where available, gradients. Attacks and defenses interact only with this interface, so the same attack code runs against models from different frameworks.
On top of the estimators, ART groups its modules by role. The table below shows the main module families and their purpose.
| Module | Purpose | Examples |
|---|---|---|
| Estimators | Uniform model wrappers | Classifiers, object detectors, speech recognizers |
| Attacks | Generate adversarial inputs or extract information | FGSM, PGD, Carlini–Wagner, membership inference |
| Defenses | Harden models or inputs | Adversarial training, feature squeezing, activation clustering |
| Metrics | Quantify robustness | CLEVER score, empirical robustness, loss sensitivity |
| Certification | Prove bounds on behavior | Randomized smoothing, interval bound propagation |
Estimators also record model metadata that attacks need, such as the number of classes, the input shape and the valid clip values of the input range. Supplying these values correctly is essential, because an attack that ignores them may produce inputs that a real system would never accept. Beyond classification, ART provides estimators for object detection, speech recognition and generative models, so attacks such as adversarial patches can target detectors directly.
Threat categories covered by ART
ART organizes attacks into four threat categories that follow the life cycle of a model. Each category corresponds to a different attacker goal and requires different defenses, which is why a single robustness test is never sufficient.
| Category | Attacker goal | Representative attacks |
|---|---|---|
| Evasion | Cause wrong predictions at inference time | FGSM, PGD, DeepFool, adversarial patch |
| Poisoning | Corrupt training to plant errors or backdoors | Backdoor triggers, clean-label poisoning |
| Extraction | Steal model functionality through queries | Copycat CNN, knockoff networks |
| Inference | Reveal private training data | Membership inference, attribute inference, model inversion |
Evasion attacks differ further by attacker knowledge. White-box attacks such as the projected gradient descent attack use model gradients, while black-box attacks such as HopSkipJump or boundary attacks rely only on query results. Testing both kinds helps reveal gradient masking, where a defense blocks gradient-based attacks without making the model truly robust.
Defenses and robustness evaluation
ART classifies defenses by where they act in the pipeline: before the model, during training, inside the model, after the model or as separate detectors. Combining several layers is common, but each layer must be tested with adaptive attacks that know the defense exists.
| Defense type | Where it acts | Examples |
|---|---|---|
| Preprocessor | Transforms inputs before prediction | Spatial smoothing, JPEG compression, feature squeezing |
| Trainer | Changes the training procedure | Adversarial training with PGD examples |
| Transformer | Modifies the trained model | Defensive distillation, Neural Cleanse |
| Postprocessor | Alters returned outputs | Rounding, reverse sigmoid, top-k labels |
| Detector | Flags suspicious inputs or data | Activation clustering, spectral signatures |
For measurement, ART reports empirical robustness, the average minimal perturbation an attack needs, and the CLEVER score, an estimate of a lower bound on that perturbation. Certified robustness methods such as randomized smoothing go further and provide a provable radius within which the prediction cannot change, at the cost of extra computation and some clean accuracy.
Using ART in a security assessment
A typical ART assessment follows a repeatable test plan rather than running a single attack. The steps below reflect common practice in teams that evaluate image classifiers, fraud models or speech systems.
- Define the threat model: attacker knowledge, query budget and the allowed perturbation, for example an L-infinity bound of 8/255 for images.
- Wrap the model in the matching ART estimator, including preprocessing and clip values.
- Run a baseline evasion suite with fast attacks such as FGSM, then stronger iterative attacks such as PGD.
- Add black-box and adaptive attacks to detect gradient masking.
- Apply candidate defenses and repeat the full suite, recording clean and robust accuracy.
- Test privacy and extraction risks when the model is exposed through a public API.
The result is a robust accuracy curve across perturbation sizes, which gives decision makers a far more honest picture than clean test accuracy alone.
Limitations and common mistakes
ART is a research-grade toolkit, not a turnkey security product. It focuses mainly on classical machine learning and deep learning models; testing large language models for prompt injection or jailbreaks usually calls for dedicated tools such as garak or PyRIT.
- Weak attack settings: too few PGD iterations or a single random start overstate robustness.
- Mismatched preprocessing: wrong clip values or normalization make attacks run in the wrong input space.
- Non-adaptive evaluation: testing a defense only with attacks that ignore it yields a false sense of security.
- Ignoring cost: adversarial training can multiply training time several times and reduce clean accuracy.
Results from ART are only as meaningful as the threat model behind them. A model that resists small pixel perturbations may still fail against physical patches, poisoned training data or simple query-based theft. Reports should therefore state the attack budget, attacker knowledge and dataset for every number, so that robustness claims can be reproduced and compared.
In everyday language
AI models can be fooled by tiny, carefully chosen changes. A sticker on a road sign may confuse a car camera. The Adversarial Robustness Toolbox lets builders try these tricks first.
It works like a crash test lab for AI. Engineers attack their own model in a safe setting. Then they add protections and test again. The goal is to find weak spots before real attackers do.
Seen in the real world
A bank security team plans to deploy an image classifier that checks scanned identity documents during online account opening. Before launch, the team wraps the PyTorch model in an ART estimator and runs a PGD attack with an L-infinity budget of 4/255.
Clean accuracy is 97 percent, but robust accuracy falls to 11 percent, showing that nearly invisible pixel changes could let forged documents pass. The team adds adversarial training and JPEG compression preprocessing, then reruns the suite with an adaptive attack that accounts for the compression step.
After hardening, robust accuracy at the same budget reaches about 58 percent, while clean accuracy drops to 95 percent. The team also runs a membership inference test to confirm the model does not leak customer images. The documented results become part of the model risk review required before release.