Rethinking Clustering for Robustness

Motasem Alfarra, Juan C. Pérez, Adel Bibi, Ali K. Thabet, Pablo Arbelaez, Bernard Ghanem

TL;DR

This paper proposes ClusTR, a novel training framework that leverages semantic clustering in feature space to achieve robust deep neural networks without relying on adversarial training. ClusTR demonstrates competitive and even superior robustness compared to traditional adversarial training methods, offering a more efficient path to robust models.

What Problem Does This Paper Address?

Deep neural networks (DNNs) have achieved remarkable success, but they are notoriously vulnerable to adversarial attacks – imperceptible input perturbations that can drastically alter their predictions. While adversarial training has been the go-to solution for improving robustness, it's computationally expensive and can sometimes lead to a drop in accuracy on clean data. This paper explores a complementary approach: can learning semantically-aligned features, which are known to emerge from adversarial training, directly lead to robustness? The authors investigate the connection between semantic clustering and robustness, aiming to develop an adversary-free training method that achieves robust models.

Methods

The core of this work lies in the theoretical connection established between clustering-based classifiers and robustness. The authors derive a robustness certificate for these classifiers, showing that their robustness radius is directly related to the distance between cluster centers in the feature space. This insight leads to the development of ClusTR (Clustering Training for Robustness).

ClusTR is a framework that encourages semantic clustering of features during training. It utilizes a Clustering Loss, such as the Magnet Loss, which pulls features of the same class closer to their respective cluster centers and pushes them away from other class centers. A key innovation is the use of a warm start initialization: ClusTR first performs standard cross-entropy training to achieve reasonable performance, then fine-tunes the network using the Magnet Loss. This warm start significantly speeds up convergence without sacrificing robustness.

For enhanced robustness, ClusTR can be combined with a lightweight adversarial training technique called QTRADES. This involves a single PGD step to generate adversaries, making it computationally efficient.

Datasets

The experiments were conducted on the following datasets:

  • CIFAR10
  • CIFAR100
  • SVHN
  • Synthetic binary classification datasets (used for illustrating the effect of warm start on robustness radius).

Key Insights and Ideas

  • Semantics to Robustness: The paper demonstrates that encouraging semantic alignment through clustering in feature space can directly lead to robust models, reversing the common understanding that robustness leads to semantic features.
  • Robustness Certificate for Clustering: A theoretical bound is derived for clustering-based classifiers, quantifying their robustness radius. This provides a principled way to understand and optimize for robustness.
  • ClusTR: Adversary-Free Robustness: The proposed ClusTR framework offers a viable alternative to adversarial training, achieving significant robustness gains without the need to generate adversarial examples during training.
  • Warm Start Efficiency: The warm start strategy in ClusTR dramatically reduces training time while maintaining or even improving robustness.
  • Clustering Loss as a Robustness Regularizer: The Magnet Loss, originally designed for metric learning, is shown to inherently promote robustness when used within the ClusTR framework.

Key Results

  • ClusTR outperforms adversarially-trained networks by up to 4% under strong PGD attacks on CIFAR10 and SVHN.
  • ClusTR achieves higher natural accuracy (accuracy on clean data) compared to Free Adversarial Training (Free AT) by 1-7% on CIFAR10 and SVHN, respectively.
  • The warm start initialization in ClusTR reduces training time by approximately 20-25% (e.g., from 106 to 83 minutes on CIFAR10) while yielding a larger robustness radius.
  • ClusTR+QTRADES (ClusTR combined with lightweight adversarial training) achieves state-of-the-art performance, outperforming strong PGD attacks by significant margins (e.g., 16.84% and 29.47% on CIFAR10 and SVHN, respectively).
  • The robustness of ClusTR is shown to be largely agnostic to the choice of the perturbation budget $\epsilon$.

Limitations and Future Work

  • Threat Model: The paper primarily focuses on $\ell_\infty$ attacks with a specific $\epsilon$ value (8/255). While the robustness is shown to be agnostic to $\epsilon$, the authors acknowledge that other types of attacks might exist.
  • Adaptive Attacks: While ClusTR+QTRADES shows strong performance against standard PGD attacks, it experiences a drop in accuracy when subjected to adaptive attacks specifically designed to break its objective. However, the performance drop is noted as marginal compared to other defenses.
  • Choice of Clustering Loss: While the Magnet Loss is used, the theoretical framework is agnostic to the specific clustering loss. Exploring other clustering losses could be a future direction.
  • Optimizing QTRADES: The paper uses a quick version of adversarial training (QTRADES). Investigating other adversarial training schemes to equip ClusTR could potentially yield even greater robustness gains.
  • Ablation on D: The paper explores the effect of $D$ (number of nearest clusters considered for prediction) and finds that considering approximately 20% of clusters yields the best performance, but a more thorough ablation study could be beneficial.

Summary updated

BibTeX
@inproceedings{alfarra2021rethinking,
  author = {Motasem Alfarra and Juan C. Pérez and Adel Bibi and Ali K. Thabet and Pablo Arbelaez and Bernard Ghanem},
  title = {{Rethinking Clustering for Robustness}},
  booktitle = {BMVC},
  year = {2021},
  url = {https://openreview.net/forum?id=XiylkskyqTb},
}
Figure