Interpretability-Guided Test-Time Adversarial Defense

Akshay R. Kulkarni, Tsui-Wei Weng

Abstract

Deep Neural Networks (DNNs) are vulnerable to adversarial perturbations that can drastically alter predictions with human-imperceptible changes. While adversarial training offers a robust solution, its computational cost is prohibitive for many applications. This paper introduces Interpretability-Guided Defense (IG-Defense), a novel, training-free test-time defense. IG-Defense identifies and masks "unimportant" neurons during inference based on class-specific importance rankings. By restricting the activation shifts that adversaries exploit, IG-Defense improves robust accuracy across CIFAR and ImageNet benchmarks while remaining significantly faster than existing test-time methods.

Introduction

The susceptibility of Deep Neural Networks to adversarial attacks remains a critical barrier to their deployment in safety-critical systems. Adversarial training, the current gold standard for defense, requires retraining models on perturbed data, a process that can be 150–200 times more computationally intensive than standard training.

To mitigate these costs, researchers have turned to test-time defenses, which aim to secure pre-trained models during inference. These typically involve input purification or on-the-fly model adaptation. However, these methods are often computationally expensive (8–500x slower than a standard pass) and can be bypassed by adaptive attacks. IG-Defense addresses these challenges by leveraging internal model interpretability to create a defense that is both efficient and resilient.

Methodology

IG-Defense operates through a three-step process designed to "silence" the pathways an adversary might use to trick the network.

  1. Neuron Importance Ranking (Offline): Before deployment, neurons are ranked by their contribution to specific classes. The authors propose two metrics: LO-IR (Leave-one-Out), which measures logit changes upon masking, and CD-IR (CLIP-Dissect), which uses the CLIP model to map neurons to class-level concepts.
  2. Vanilla Forward Pass (Online): For each input image, the model performs an initial forward pass to generate a "soft-pseudo-label." To prevent the adversary from easily manipulating this initial guess, Randomized Smoothing is applied by adding Gaussian noise to the input.
  3. Masked Forward Pass (Online): Based on the pseudo-label, the model selects the top-$k$ important neurons for the predicted class. A weighted mask is applied to the penultimate layer, zeroing out unimportant neurons. A second forward pass then produces the final, more robust prediction.
The three-step IG-Defense pipeline: offline neuron ranking, vanilla forward pass for pseudo-labeling, and masked forward pass for final prediction.

The Activation Shift Insight

The motivation for IG-Defense stems from an analysis of how adversarial attacks succeed. By examining the internal activations of models under attack, the researchers observed a consistent "activation shift." In a successful attack, the perturbation decreases the activation of neurons important to the ground-truth class while significantly increasing the activation of neurons associated with a target (incorrect) class.

Analysis of activation changes during successful and unsuccessful PGD attacks, showing how adversarial perturbations shift importance toward incorrect classes.

By masking neurons that are unimportant to the predicted class, IG-Defense effectively blocks the "hijacking" of these neurons by adversarial noise. This forces the network to rely solely on features relevant to the most likely class, making it much harder for small perturbations to flip the final decision.

Experimental Results

The effectiveness of IG-Defense was evaluated using the RobustBench benchmark across multiple architectures (ResNet, WideResNet) and datasets:

  • Robustness Gains: IG-Defense achieved significant improvements in robust accuracy under AutoAttack: +2.6% on CIFAR10, +4.9% on CIFAR100, and +2.8% on ImageNet-1k.
  • Computational Efficiency: A key advantage of IG-Defense is its speed. By replacing complex optimization with simple masking operations, it maintains a 2x overhead relative to a standard forward pass. This makes it 4x faster than the strongest competing test-time defenses.
  • Adaptive Attack Resilience: The defense remains effective even against adaptive attacks designed to exploit the pseudo-labeling step, maintaining a 1.5% lead over state-of-the-art alternatives.

Discussion and Conclusion

IG-Defense demonstrates that interpretability is not just a tool for understanding models, but a viable mechanism for securing them. By using "soft" masking—weighting the mask by the pseudo-label probability—the defense avoids the pitfalls of gradient masking, ensuring that the model remains truly robust rather than just difficult to differentiate.

While highly effective, the defense's performance is tied to the accuracy of the initial pseudo-label. If an attack is strong enough to completely subvert the first pass, the subsequent masking may reinforce the error. Future work may explore multi-layer masking or more robust pseudo-labeling techniques to further harden the defense. Overall, IG-Defense provides a practical, scalable path toward deploying robust DNNs in real-world environments.

Summary updated

BibTeX
@inproceedings{kulkarni2024interpretability,
  author = {Akshay R. Kulkarni and Tsui-Wei Weng},
  title = {{Interpretability-Guided Test-Time Adversarial Defense}},
  booktitle = {European Conference on Computer Vision},
  year = {2024},
  doi = {10.1007/978-3-031-72913-3\_26},
}
Figure