HyperNetworks with statistical filtering for defending adversarial examples

Zhun Sun, Mete Ozay, Takayuki OkataniarXiv 2017

Abstract

Deep learning algorithms have been known to be vulnerable to adversarial perturbations in various tasks such as image classification. This problem was addressed by employing several defense methods for detection and rejection of particular types of attacks. However, training and manipulating networks according to particular defense schemes increases computational complexity of the learning algorithms. In this work, we propose a simple yet effective method to improve robustness of convolutional neural networks (CNNs) to adversarial attacks by using data dependent adaptive convolution kernels. To this end, we propose a new type of HyperNetwork in order to employ statistical properties of input data and features for computation of statistical adaptive maps. Then, we filter convolution weights of CNNs with the learned statistical maps to compute dynamic kernels. Thereby, weights and kernels are collectively optimized for learning of image classification models robust to adversarial attacks without employment of additional target detection and rejection algorithms. We empirically demonstrate that the proposed method enables CNNs to spontaneously defend against different types of attacks, e.g. attacks generated by Gaussian noise, fast gradient sign methods and a black-box attack.

Introduction

Deep Convolutional Neural Networks (CNNs) are notoriously fragile. Human-imperceptible adversarial perturbations can trick state-of-the-art models into misclassifying inputs with high confidence. Current defenses typically fall into two categories: adversarial training, which is computationally expensive and often overfits to specific attacks, or detection/rejection systems that add significant latency. This research proposes a "spontaneous" defense: a network architecture that is inherently more robust to a wide variety of attacks by design, without requiring exposure to adversarial examples during its training phase.

Proposed Method: Statistical Hyper-Convolution (SHC)

The core innovation is the Statistical Hyper-Convolution (SHC) layer. In a standard CNN, convolution kernels are fixed once training is complete. In this work, the authors introduce a HyperNetwork ($T_\theta$)—a secondary network that dynamically adjusts the primary model's weights based on the statistical properties of the input data.

The architecture of the Statistical Hyper-Convolution (SHC) layer, showing the HyperNetwork $T_\theta$ generating adaptive maps $M$ to filter weights $W$.

As illustrated in the architecture above, the process follows these steps:

  1. Statistical Extraction: The HyperNetwork calculates the channel-wise mean ($\mu_X$) and standard deviation ($\sigma^2_X$) for every input feature map.
  2. Adaptive Mapping: These statistics are used to generate a "statistical adaptive map" ($M$).
  3. Weight Filtering: This map is multiplied (Hadamard product) with the standard stationary weights ($W$) of the CNN.
  4. Dynamic Convolution: The resulting "dynamic kernels" ($H$) are used for the actual convolution operation.

By making the weights dependent on input statistics, the network effectively creates a "moving target." The decision boundary shifts slightly for every perturbation, making it significantly harder for gradient-based attacks to find a reliable direction to break the model.

Experimental Results

The authors evaluated their method using the ILSVRC-2012 (ImageNet) dataset across several architectures, including ResNet-18 and ResNet-50.

Robustness to Adversarial Attacks

The SHC-equipped models showed dramatic improvements in robustness. On ResNet-18, the standard model's accuracy plummeted to 10.54% under Fast Gradient Sign Method (FGSM) attacks, while the SHC version maintained 44.34% accuracy. The models also showed superior resilience to Gaussian noise, maintaining a 2-4% accuracy lead even under heavy noise conditions.

Visual representation of adversarial noise levels, corresponding RCD scores, and model confidence $p_y$.

To provide a more nuanced view of model confusion, the authors introduced the Relative Confidence Diminution (RCD) metric. As shown in the figure above, RCD measures how much an attack reduces the model's confidence in the correct label relative to the noise in incorrect labels. This metric highlights how the SHC layer preserves internal logic better than vanilla architectures.

Black-Box Resilience

In black-box scenarios (e.g., LocSearchAdv), where attackers do not have access to internal gradients, the SHC models proved much harder to fool. It took approximately 60 additional steps for the attack to achieve the same level of confusion on an SHC model compared to a standard one.

Conclusion

Statistical Hyper-Convolution offers a structural defense that improves robustness without specialized training or secondary monitors. While not an invincible shield—iterative black-box attacks can eventually find a path around the dynamic boundary—it represents a significant step toward inherently robust deep learning. Future work will explore more complex HyperNetworks and the theoretical reasons why these specific statistical properties provide such effective defense.

Summary updated

BibTeX
@misc{sun2017hypernetworks,
  author = {Zhun Sun and Mete Ozay and Takayuki Okatani},
  title = {{HyperNetworks with statistical filtering for defending adversarial examples}},
  year = {2017},
  eprint = {1711.01791},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1711.01791},
}
Figure