Abstract
Deep Neural Networks are vulnerable to adversarial attacks even in settings where the attacker has no direct access to the model being attacked. Such attacks usually rely on the principle of transferability, whereby an attack crafted on a surrogate model tends to transfer to the target model. We show that an ensemble of models with misaligned loss gradients can provide an effective defense against transfer-based attacks. Our key insight is that an adversarial example is less likely to fool multiple models in the ensemble if their loss functions do not increase in a correlated fashion. To this end, we propose Diversity Training, a novel method to train an ensemble of models with uncorrelated loss functions. We show that our method significantly improves the adversarial robustness of ensembles and can also be combined with existing methods to create a stronger defense.
Introduction
Deep Neural Networks (DNNs) are notoriously fragile; small, intentional perturbations to an input (adversarial attacks) can cause them to fail. A particularly dangerous type is the black-box attack, which relies on transferability. An attacker crafts an exploit on a "surrogate" model they own, and that same exploit often works on a "target" model they do not have access to.
This happens because different models often share a contiguous Adversarial Subspace (Adv-SS)—essentially, they have the same blind spots. While ensembles (using multiple models together) are a common defense, standard ensembles often learn similar features and thus share the same adversarial subspaces. This research aims to "shrink" this shared subspace so that an attack that fools one model is unlikely to fool another in the ensemble.
Diversity Training (DivTrain)
The core contribution of this work is a new regularization technique called Gradient Alignment Loss (GAL).
- The Intuition: If two models have gradients that point in the same direction, a single step in that direction increases the loss for both, making them easy to fool simultaneously. If the gradients point in different directions, an attack on one is unlikely to affect the other.
- The Metric: GAL measures the "coherence" (alignment) of loss gradients across the ensemble using cosine similarity. To make this mathematically efficient for optimization, the authors use a LogSumExp approximation of the maximum pairwise cosine similarity.
-
The Training: During training, the total loss function becomes: $$\text{Loss} = \text{Standard Cross-Entropy} + \lambda \cdot \text{GAL}$$ The hyperparameter $\lambda$ controls the trade-off between standard accuracy and adversarial diversity.
-
Activation Functions: Standard ReLU activations produce many zero gradients, which can hinder the GAL calculation. The authors utilize Leaky-ReLU to ensure gradients flow through the diversity term effectively.
Key Insights and Ideas
- Diversity as a Proxy for Robustness: By simply forcing models to be "different" in their gradient directions, one naturally reduces the dimensionality of the shared adversarial subspace without needing to know what the attacks look like during training.
- The "Venn Diagram" of Attacks: For a single model, an attack just needs to hit its adversarial subspace. For an ensemble, it must hit the intersection of subspaces. DivTrain effectively pulls those subspaces apart so the intersection is minimized.
- Complementary Defenses: DivTrain is additive and can be combined with existing defenses like Ensemble Adversarial Training (EnsAdvTrain) to produce even stronger results.
Experimental Results
The approach was evaluated on standard computer vision benchmarks, including MNIST and CIFAR-10, using various architectures like Conv-3, Conv-4, and ResNet-20/26.
- Robustness Gains: On CIFAR-10 (Conv-4 model) under a strong MI-FGSM attack, the baseline ensemble's accuracy dropped to 9.0%. The DivTrain ensemble maintained 35.0% accuracy. When combined with existing state-of-the-art defenses, accuracy jumped to 66.9%.
- Accuracy Trade-off: There is a small "tax" on clean (non-attacked) data. For example, on CIFAR-10, clean accuracy dropped from ~85% to ~82% to achieve higher robustness.
- Gradient Coherence: Histograms showed that DivTrain successfully shifted the distribution of gradient alignments from highly positive (aligned) to near-zero or negative (misaligned).
Limitations and Future Work
While DivTrain is excellent against black-box (transfer) attacks, if an attacker has full access to the entire diverse ensemble (white-box), they can still craft attacks, though it remains significantly harder than attacking a single model. Future work involves minimizing the "robustness tax" on clean accuracy and testing the scalability of GAL on massive models like Transformers or larger datasets like ImageNet.
Summary updated