Imbalanced gradients: a subtle cause of overestimated adversarial robustness

Xingjun Ma, Linxi Jiang, Hanxun Huang, Zejia Weng, James Bailey, Yu-Gang Jiang

Abstract

Adversarial robustness evaluations often rely on gradient-based attacks to determine a model's vulnerability. This paper identifies Imbalanced Gradients (IG), a stealthy form of gradient masking where mathematically sound gradients fail to find adversarial examples because one loss term dominates others, leading the optimizer into suboptimal regions. We introduce the Gradient Imbalance Ratio (GIR) to quantify this effect and the Margin Decomposition (MD) attack to bypass it. Our evaluations show that many state-of-the-art defenses are significantly less robust than previously claimed, with some models seeing a 2-4% drop in accuracy under our stronger evaluation.

Introduction

The development of robust Deep Neural Networks (DNNs) is an ongoing "arms race" between defenses and adversarial attacks. A critical part of this process is the rigorous evaluation of proposed defenses. Historically, "obfuscated gradients"—where gradients are intentionally or unintentionally made unusable for optimization—have led to false claims of robustness. While standard sanity checks now exist to detect such issues, we uncover a more subtle phenomenon: Imbalanced Gradients. In these cases, gradients are informative but "imbalanced," causing standard attacks like AutoAttack to converge to poor local minima.

The Phenomenon of Imbalanced Gradients

Imbalanced Gradients occur when different components of a loss function provide conflicting directions, and one component's magnitude far exceeds the others. For instance, in a standard margin loss $L = z_{max} - z_y$, the gradient $\nabla_x z_y$ (associated with the correct label) might dominate $\nabla_x z_{max}$ (associated with the target class).

Illustration of imbalanced gradients where conflicting gradient terms can lead an attacker to a suboptimal 'dead end'.

This imbalance often arises from common training techniques like label smoothing. By flattening the logit distribution of incorrect classes, label smoothing reduces the magnitude of their gradients, allowing the gradient of the correct class to "bully" the attacker into a direction that preserves the correct classification, even when a successful perturbation exists nearby. Crucially, this phenomenon passes all five standard "sanity checks" used to detect obfuscated gradients, making it particularly stealthy.

Quantifying and Exploiting IG

To diagnose this issue, we propose the Gradient Imbalance Ratio (GIR). This metric measures the degree to which one loss term dominates another in dimensions where they disagree on the optimal attack direction using $L_1$ norms.

To overcome IG, we introduce the Margin Decomposition (MD) attack. Instead of optimizing the full margin loss directly, the MD attack uses a two-stage approach:

  1. Rebalancing Stage: The attacker targets individual terms (e.g., only minimizing $z_y$) with multiple restarts. This serves as an adversarial initialization, finding regions in the perturbation space where gradients are better balanced.
  2. Convergence Stage: The attack switches back to the full margin loss to fine-tune the adversarial example and ensure the final goal is met.

Experimental Evaluation

We conducted an extensive stress test on 24 defense models using CIFAR-10 and ImageNet. Our results demonstrate that IG is prevalent in many top-tier defenses.

Empirical results showing (a) GIR across models, (b) attack success rates of individual terms vs. combined loss, and (c) the resulting loss landscape.

Key findings include:

  • Robustness Overestimation: 11 out of 24 models were susceptible to IG. The MD attack reduced their reported robustness by over 1%, with defenses like Bilateral and Sense dropping by 2-4%.
  • Superiority over AutoAttack: Our MD ensemble (MDE) outperformed AutoAttack on 16 out of 20 CIFAR-10 models and on ImageNet Vision Transformers (XCiT-S), reducing reported robustness from 41.78% to 40.26%.
  • Counter-intuitive Success: As shown in Figure (b) above, attacking a single term of the loss function is often more successful than attacking the combined margin loss in imbalanced models. This is because the single term avoids the "tug-of-war" where a dominant term misleads the attack.

Conclusion

Imbalanced Gradients represent a significant pitfall in adversarial robustness research. They provide a false sense of security while appearing mathematically sound. We recommend that researchers use the GIR metric to monitor their models and include the MD attack in their evaluation suites to ensure a more accurate assessment of robustness in future defense designs.

Summary updated

BibTeX
@article{ma2024imbalanced,
  author = {Xingjun Ma and Linxi Jiang and Hanxun Huang and Zejia Weng and James Bailey and Yu-Gang Jiang},
  title = {{Imbalanced gradients: a subtle cause of overestimated adversarial robustness}},
  journal = {Machine Learning},
  year = {2024},
  doi = {10.1007/s10994-023-06328-7},
}
Figure