Papers
Topics
Authors
Recent
Search
2000 character limit reached

Rethinking Softmax Cross-Entropy Loss for Adversarial Robustness

Published 25 May 2019 in cs.LG, cs.CR, and stat.ML | (1905.10626v3)

Abstract: Previous work shows that adversarially robust generalization requires larger sample complexity, and the same dataset, e.g., CIFAR-10, which enables good standard accuracy may not suffice to train robust models. Since collecting new training data could be costly, we focus on better utilizing the given data by inducing the regions with high sample density in the feature space, which could lead to locally sufficient samples for robust learning. We first formally show that the softmax cross-entropy (SCE) loss and its variants convey inappropriate supervisory signals, which encourage the learned feature points to spread over the space sparsely in training. This inspires us to propose the Max-Mahalanobis center (MMC) loss to explicitly induce dense feature regions in order to benefit robustness. Namely, the MMC loss encourages the model to concentrate on learning ordered and compact representations, which gather around the preset optimal centers for different classes. We empirically demonstrate that applying the MMC loss can significantly improve robustness even under strong adaptive attacks, while keeping state-of-the-art accuracy on clean inputs with little extra computation compared to the SCE loss.

Summary

  • The paper proposes MMC loss that explicitly induces high sample density in feature space, significantly enhancing adversarial robustness.
  • It leverages preset, optimally dispersed class centers to cluster features and improve intra-class compactness.
  • Empirical evaluations on MNIST, CIFAR-10, and CIFAR-100 show that MMC yields higher robustness against strong adaptive attacks with minimal extra computation.

Deep neural networks trained with the standard Softmax Cross-Entropy (SCE) loss are known to be vulnerable to adversarial attacks. Existing work suggests that adversarially robust generalization requires significantly more data than standard training, implying that commonly used datasets might be insufficient for training robust models. Instead of collecting more data, this paper explores the strategy of better utilizing existing data by manipulating the local sample distribution in the feature space to induce regions of high sample density, which could provide sufficient local samples for robust learning.

The authors first analyze the SCE loss and its variants (termed generalized SCE or g-SCE) and show that these losses, due to the softmax function, provide supervisory signals that encourage learned features to spread sparsely in the feature space, particularly when the loss value is minimized towards zero. This sparsity leads to low sample density around feature points, which is hypothesized to be detrimental to robust learning. The analysis shows that the loss contours of g-SCE losses are generally hyperspheres or hyperplanes, and minimizing the loss tends to push features away from the center of these contours towards infinity, resulting in feature points being sparse.

To address this, the paper proposes the Max-Mahalanobis Center (MMC) loss, defined as LMMC(Z(x),y)=12zμy22\mathcal{L}_{\text{MMC}}(Z(x),y)=\frac{1}{2}\|z-\mu_{y}^*\|_2^2, where z=Z(x)z=Z(x) is the feature of input xx, yy is the true label, and μy\mu_y^* are preset, untrainable class centers. These μy\mu_y^* centers are generated according to a criterion that maximizes the minimal angle between any two centers, providing optimal inter-class dispersion. The MMC loss is based on minimizing the squared distance between the feature vector and the corresponding class center, framing training as a regression problem towards these fixed centers.

The theoretical analysis of the MMC loss shows that it explicitly induces high-density regions in the feature space. The sample density nearby a feature point is proportional to the number of samples for that class (NkN_k) and inversely proportional to a power of the loss value (CC), specifically Nkpk(C)/C(d1)/2\propto N_k \cdot p_k(C) / C^{(d-1)/2}. This means that as the loss CC is minimized towards zero, the sample density around the center μy\mu_y^* exponentially increases. This property ensures that feature points of the same class gather compactly around their respective centers, creating locally sufficient samples for robust classification.

The MMC loss offers several practical advantages:

  1. Induces High Sample Density: By encouraging features to cluster around preset centers, it creates high-density regions beneficial for robustness, unlike g-SCE losses which promote sparsity.
  2. Structured Representations: It leads to more structured and orderly feature distributions.
  3. Better Exploits Model Capacity: It allows the network to focus on minimizing intra-class compactness while inter-class dispersion is controlled by the preset centers, avoiding the need to balance these like the Center Loss.
  4. Faster Convergence: It generally converges faster than SCE and its variants.
  5. Little Extra Computation: Training with MMC adds minimal computational overhead compared to standard SCE.
  6. Compatibility: It can be combined with existing defenses like adversarial training to further improve robustness.

Empirical evaluations are conducted on MNIST, CIFAR-10, and CIFAR-100 datasets using various adaptive attacks, including white-box ll_\infty PGD, l2l_2 C&W, black-box transfer-based MIM, and gradient-free SPSA attacks. Adaptive attacks are crucial for robust evaluation and are designed specifically against the MMC objective. The results demonstrate that models trained with MMC loss achieve significantly better robustness against these strong adaptive attacks compared to baselines like SCE, Center loss, MMLDA, and L-GM, often requiring much larger perturbations to fool the network. Importantly, MMC maintains clean accuracy comparable to SCE and is also shown to be more robust to general transformations like Gaussian noise and rotation compared to standard adversarial training methods. Ablation studies confirm that the use of optimally dispersed centers contributes to the improved robustness. The paper also shows that MMC can better leverage the capacity of deeper network architectures compared to SCE.

The paper includes technical details on generating the Max-Mahalanobis centers and discusses the choice of the squared-error form for the loss in the adversarial setting. It also proposes potential variants of the MMC loss, such as Elastic MMC (EMC) and Hierarchical MM centers, to enhance adaptability for more complex tasks or datasets.

In conclusion, the paper argues that SCE loss induces feature sparsity detrimental to robustness. It proposes the MMC loss as a regression-based alternative using preset, optimally dispersed centers to explicitly induce high-density feature regions and learn structured representations. Extensive experiments with adaptive attacks demonstrate that MMC significantly improves adversarial robustness with minimal computational overhead, while maintaining high clean accuracy, making it a practical and effective defense mechanism.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Continue Learning

We haven't generated follow-up questions for this paper yet.

Collections

Sign up for free to add this paper to one or more collections.