Blending adversarial training and representation-conditional purification via aggregation improves adversarial robustness

Emanuele Ballarin, Alessio ansuini, Luca Bortolussi

Abstract

In this work, we propose a novel adversarial defence mechanism for image classification - CARSO - blending the paradigms of adversarial training and adversarial purification in a synergistic robustness-enhancing way. The method builds upon an adversarially-trained classifier, and learns to map its internal representation associated with a potentially perturbed input onto a distribution of tentative clean reconstructions. Multiple samples from such distribution are classified by the same adversarially-trained model, and a carefully chosen aggregation of its outputs finally constitutes the robust prediction of interest. Experimental evaluation by a well-established benchmark of strong adaptive attacks, across different image datasets, shows that CARSO is able to defend itself against adaptive end-to-end white-box attacks devised for stochastic defences. With a modest clean accuracy penalty, our method improves by a significant margin the state-of-the-art for Cifar-10, Cifar-100, and TinyImageNet-200 $\ell_\infty$ robust classification accuracy against AutoAttack.

Introduction

Deep learning models are notoriously fragile; small, imperceptible perturbations, known as adversarial attacks, can cause them to fail catastrophically. Currently, the two primary defense paradigms are Adversarial Training (AT)—training the model on "broken" images—and Adversarial Purification—using a separate model to "clean" the image before classification.

However, both approaches have inherent limitations. AT often reaches a performance ceiling, while standard purification is frequently bypassed by "end-to-end" white-box attacks that treat the purifier and classifier as a single target. The authors introduce CARSO (Counter-Adversarial Recall of Synthetic Observations), which addresses this gap by synergistically combining these two paradigms rather than simply stacking them.

Methods

The CARSO framework consists of three main components designed to work in concert:

  1. The Classifier: A standard, frozen, adversarially-trained model (e.g., a WideResNet).
  2. The Purifier (CVAE): Instead of cleaning raw pixels, this Conditional Variational Autoencoder takes the internal representations (activations) from the classifier as its "hint." It learns to map these potentially corrupted internal features back to a distribution of plausible "clean" image reconstructions.
  3. Robust Aggregation: At inference time, the system generates multiple (e.g., 8) purified reconstructions. These are all fed back into the classifier. Rather than simple averaging, CARSO uses a normalised doubly-exponential logit product to aggregate the outputs. This mathematical choice makes the final prediction much harder for an attacker to manipulate by tilting just one or two samples.
The CARSO architecture: blending adversarial training with representation-conditional purification.

The training process is specialized, utilizing "adversarially-balanced batches" that mix clean data with various strengths of FGSM and PGD attacks to ensure the purifier is robust against diverse attack vectors.

Key Insights and Experimental Setup

The core innovation of CARSO lies in the realization that representations are richer than pixels. A classifier’s internal activations contain a "trace" of the amplification process that occurs during an attack. By conditioning the purifier on these activations, it gains a superior "hunch" of the original clean image.

Furthermore, the aggregation mechanism serves as a critical security feature. Most stochastic defenses fail because an attacker can find a single "weak" sample. CARSO’s doubly-exponential aggregation requires an attacker to successfully fool almost all generated reconstructions simultaneously to change the final label.

The method was evaluated on three standard computer vision benchmarks: CIFAR-10, CIFAR-100, and TinyImageNet-200. The authors employed the AutoAttack suite, the gold standard for evaluating robustness, ensuring that the results are not merely the product of "gradient obfuscation." Notably, CARSO is end-to-end differentiable, allowing it to be tested against the strongest possible adaptive white-box attacks.

Key Results

CARSO significantly outperformed existing state-of-the-art (SOTA) models across all tested datasets:

  • CIFAR-10: Achieved 76.13% robust accuracy against AutoAttack, an 8.4% increase over the base adversarially-trained classifier. It also outperformed the best existing diffusion-based purification models.
  • CIFAR-100: Achieved 66.65% robust accuracy, a 27.47% jump over the classifier alone.
  • TinyImageNet: Achieved 53.56% robust accuracy, improving upon the SOTA by over 22%.

While there is a modest "clean accuracy penalty" (e.g., a ~5.6% drop on CIFAR-10), the trade-off for massive gains in security is substantial.

Limitations and Future Work

Despite its performance, CARSO faces several challenges. The "clean accuracy penalty" remains a trade-off; improving the "cross-talk" between the purifier and classifier could minimize this. Additionally, the computational overhead is higher than standard models because multiple reconstructions must be generated and classified for every input. Scaling to full-resolution ImageNet also remains a challenge due to the complexity of the VAE reconstruction task. Future work may also focus on optimizing layer selection for conditioning to further improve performance and efficiency.

Summary updated

BibTeX
@article{ballarin2025blending,
  author = {Emanuele Ballarin and Alessio ansuini and Luca Bortolussi},
  title = {{Blending adversarial training and representation-conditional purification via aggregation improves adversarial robustness}},
  journal = {Accepted by TMLR},
  year = {2025},
  url = {https://openreview.net/forum?id=40BXthYscW},
}
Figure