Abstract
DeepRobust is a comprehensive, open-source PyTorch library designed for adversarial machine learning, uniquely covering both image and graph-structured data. It provides a unified platform with over 30 built-in algorithms, making it easier for researchers to benchmark attacks and develop robust defenses across diverse domains.
Introduction
Deep Neural Networks (DNNs) have demonstrated remarkable performance across various tasks but remain notoriously "brittle." Small, intentionally crafted perturbations—known as adversarial attacks—can cause these models to make confident, incorrect predictions. As AI systems are increasingly deployed in safety-critical areas like autonomous driving, healthcare, and financial systems, evaluating and improving model robustness has become a vital research priority.
While several libraries like Cleverhans and AdverTorch exist to support this research, they often suffer from two major limitations. First, they focus almost exclusively on image data, neglecting the growing importance of graph-structured data in domains like social networks and chemical modeling. Second, many toolkits prioritize attack methods over defense strategies, making it difficult to rigorously test new "shields." DeepRobust addresses these gaps by providing a standardized, modular framework for both images and graphs.
The DeepRobust Framework
DeepRobust is built on PyTorch and follows a highly modular design to ensure extensibility and ease of use. The library is split into two primary components: the Image Component and the Graph Component.
1. Image Component
This section implements standard adversarial techniques for continuous pixel data. It includes a wide range of gradient-based methods (e.g., FGSM, PGD), optimization-based attacks (e.g., C&W, L-BFGS), and black-box methods (e.g., Nattack, One Pixel). Crucially, it also features state-of-the-art defense mechanisms, such as adversarial training (TRADES, YOPO) and pre-processing techniques like Thermometer Encoding.
2. Graph Component
The library’s standout feature is its support for graph-structured data, addressing the unique challenges of attacking discrete structures.
- Targeted Attacks: Methods like Nettack and RL-S2V aim to flip the label of a specific node by perturbing its features or local connections.
- Global/Untargeted Attacks: Methods like Metattack treat the graph structure as a hyperparameter to be optimized, maximizing damage across the entire network.
- Defenses: Specialized Graph Neural Network (GNN) defenses are included, such as GCN-Jaccard (which removes edges between dissimilar nodes) and RGCN (which uses attention mechanisms to mitigate the impact of uncertain nodes).
Key Insights and Usability
A significant insight behind DeepRobust is that despite the mathematical differences between continuous pixels and discrete graph edges, both can be managed under a single software architecture. This unified interface allows for the "cross-pollination" of ideas between domains. Furthermore, the library emphasizes training efficiency by including methods like YOPO (You Only Propagate Once), making robust training practical even with limited hardware.
DeepRobust is designed for high usability. A consistent API allows researchers to load a dataset, initialize a victim model, and launch a complex attack like PGD in roughly 15 lines of code. It supports standard benchmarks including MNIST and CIFAR-10 for images, and Cora, Citeseer, and Pubmed for graphs.
Conclusion and Future Work
DeepRobust successfully integrates a massive breadth of adversarial research—over 30 algorithms—into a single, user-friendly package. While currently focused on standard benchmarks, future work aims to support larger-scale datasets and more diverse model architectures, such as Transformers and complex GNN variants. The authors maintain the library as an evolving resource to keep pace with the rapid developments in adversarial machine learning.
Summary updated