Alleviating the Effect of Data Imbalance on Adversarial Training

Guanlin Li, Guowen Xu, Tianwei Zhang · Submission to ICLR 2024 · Withdrawn

TL;DR

Adversarial training on real-world, long-tailed datasets leads to severe underfitting on minority classes because generated adversarial examples (AEs) disproportionately collapse into head classes and compress tail-class representations. The authors propose REAT (Re-balancing Adversarial Training), a framework that uses an adaptive effective-number weighting strategy during AE generation alongside a tail-feature alignment penalty to preserve clean accuracy and boost true adversarial robustness.

What Problem Does This Paper Address?

Standard adversarial training (AT) typically assumes balanced class distributions. Real-world datasets, however, exhibit long-tailed distributions where a handful of "head" classes dominate the data while "body" and "tail" classes are scarce. Under long-tailed regimes, AT encounters two major bottlenecks:

  1. Unbalanced AE Generation: On-the-fly generated AEs overwhelmingly get misclassified into head classes, starving tail classes of informative adversarial gradients during training.
  2. Feature Space Compression: Head classes dominate the latent embedding space, shrinking the volume allocated to tail classes and impairing generalization.

Prior work, specifically RoBal, attempted to mitigate this via class-aware margin losses and cosine classifiers. However, the authors find that RoBal largely achieves its purported robustness through gradient obfuscation (vanishing gradients caused by weight/feature normalization), while completely ignoring intermediate "body" classes.

Methods

REAT rebalances adversarial training at two critical junctures: perturbation generation and feature representation.

  • Re-Balancing Loss (RBL) for AE Generation: Rather than relying standard cross-entropy to craft perturbations, REAT tracks the prediction counts of AEs across consecutive training epochs. It adapts the concept of effective number with a class-specific convergence parameter $\beta_i = \frac{N_i - 1}{N_i}$ to compute dynamic class weights $w_i$. Classes that receive excessive AE predictions in epoch $k-1$ are downweighted in epoch $k$, incentivizing the generator to produce diverse, less-overlapping AEs that explore tail-class regions.
  • Tail Feature Alignment (TAIL) Regularization: To prevent tail-class representations from collapsing, REAT defines a probabilistic feature space via softmax normalization over penultimate-layer feature dimensions. It applies a batch regularization term based on Kullback–Leibler (KL) divergence, weighted by smoothed inverse class frequencies: $$L = L_{\text{lt}} + \text{TAIL}$$ TAIL explicitly pushes tail samples away from non-tail samples while pulling samples of the same tail class closer together.

  • Base Objective Integration: REAT pairs these components with Balanced Softmax Loss (BSL) as the baseline long-tailed objective $L_{\text{lt}}$.

[Clean Input] ---> [Generate AEs with RBL] ---> [Model Forward Pass]
                         |                               |
              (Effective-number weights)          [Feature Space]
                         |                               |
                         v                               v
             Diverse / Balanced AEs               [TAIL Regularization]
                                                         +
                                                   [BSL Loss]

Datasets

The authors evaluated REAT on standard long-tailed vision benchmarks:

  • CIFAR-10-LT across imbalance ratios $\text{UR} \in \{10, 20, 50, 100\}$.
  • CIFAR-100-LT across imbalance ratios $\text{UR} \in \{10, 20, 50\}$.
  • Balanced Small (BS) Controls: Subsampled balanced subsets used to decouple the effect of reduced data volume ("data hunger") from class imbalance ("data unbalance").

Models evaluated include ResNet-18 and WideResNet-28-10 (WRN-28-10).

Key Insights and Ideas

  • Exposing RoBal's Gradient Obfuscation: RoBal's scale-invariant classification layer causes severe gradient vanishing. The authors show that a simple adaptive attack—multiplying the model logits by a constant factor of 10 during attack generation—substantially degrades RoBal's PGD accuracy (e.g., dropping from 38.46% to 33.54% on CIFAR-10-LT, $\text{UR}=50$).
  • Effective Numbers as a Perturbation Sampler: Treating AE generation as an active data sampling process allows effective-number formulations to penalize redundant perturbations across epochs, increasing the generation of tail-predicted AEs by roughly $5\times$.
  • Imbalance Hurts More Than Mere Data Scarcity: Experiments comparing long-tailed datasets to balanced subsets with equal total sample counts reveal that distributional imbalance degrades adversarial robustness far more severely than uniform data reduction.

Key Results

  • CIFAR-10-LT ($\text{UR}=50$, ResNet-18): REAT achieves 67.33% clean accuracy and 32.08% AutoAttack (AA) robust accuracy, outperforming both PGD-AT (66.99% clean, 31.15% AA) and RoBal (66.08% clean, 31.14% AA).
  • Under Adaptive Attacks: When evaluating against standard gradient-based attacks without obfuscation loopholes, REAT consistently maintains higher true robust accuracy across all perturbation step budgets.
  • Class-Level Balance: Per-class breakdowns show that while RoBal sacrificed intermediate "body" classes to favor tail classes, REAT maintains high accuracy on body classes while simultaneously improving tail-class performance.
  • Low Overhead: REAT introduces minimal wall-clock training overhead (adding only ~4–8 seconds per epoch on an NVIDIA V100 GPU compared to standard PGD-AT).

Limitations and Future Work

  • Remaining Robustness Gap: Although REAT beats existing baselines, a significant performance gap remains between models trained on long-tailed data and those trained on fully balanced sets.
  • Tail Data Hunger: Robustness is fundamentally data-demanding; reweighting losses and feature alignment cannot entirely overcome severe sample scarcity in extreme tails without external data or architectural priors.
  • Future Directions: Exploring data augmentation, synthetic sample generation (e.g., generative models), and customized robust architectures tailored specifically for long-tailed distributions.

Summary updated

Abstract

In this paper, we study adversarial training on datasets that obey the long-tailed distribution, which is practical but rarely explored in previous works. Compared with conventional adversarial training on balanced datasets, this process falls into the dilemma of generating uneven adversarial examples (AEs) and an unbalanced feature embedding space, causing the resulting model to exhibit low robustness and accuracy on tail data. To combat that, we propose a new adversarial training framework -- Re-balancing Adversarial Training (REAT). This framework consists of two components: (1) a new training strategy inspired by the effective number to guide the model to generate more balanced and informative AEs; (2) a carefully constructed penalty function to force a satisfactory feature space. Evaluation results on different datasets and model structures prove that REAT can effectively enhance the model's robustness and preserve the model's clean accuracy.
BibTeX
@misc{li2023alleviating,
  author = {Guanlin Li and Guowen Xu and Tianwei Zhang},
  title = {{Alleviating the Effect of Data Imbalance on Adversarial Training}},
  year = {2023},
  eprint = {2307.10205},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2307.10205},
}
Figure