Robust Ensemble Model Training via Random Layer Sampling Against Adversarial Attack

Hakmin Lee, Hong Joo Lee, Seong Tae Kim, Yong Man Ro

Abstract

Deep neural networks are notoriously vulnerable to adversarial attacks. This paper introduces a highly efficient defense mechanism called Random Layer Sampling (RLS), which dynamically mixes and matches layers from a small set of base models to create an exponentially large number of unique network paths. This effectively hides the model's true gradients from attackers, drastically improving adversarial robustness without the massive memory overhead usually required by traditional ensemble methods.

Introduction

Deep neural networks can be easily fooled by "adversarial examples"—images with tiny, human-imperceptible perturbations designed to cause misclassification. In "white-box" attacks, the attacker has full access to the model's architecture and weights, allowing them to calculate exact gradients to craft these perturbations.

A common defense strategy is ensemble training, where multiple different models are trained, and their predictions are averaged. Because the models are diverse, an attack that fools one might not fool the others. However, traditional ensembles are resource-intensive; improving robustness requires scaling up the number of models, which linearly increases the number of parameters, memory usage, and training time. This paper addresses this bottleneck: achieving the diversity and gradient-hiding benefits of a massive ensemble without the crippling parameter bloat.

Methodology

The authors propose an Ensemble Model Training Framework via Random Layer Sampling (RLS). Instead of training dozens of separate models, they train a small set of $M$ "sub-models" (e.g., $M=2$), all sharing the same architecture with $L$ layers but initialized with different weights.

Overview of the Random Layer Sampling (RLS) framework, showing how sub-models are combined to create a sampled model set.

The framework operates through three key stages:

  1. Random Layer Sampling (RLS): During the forward pass, the network dynamically constructs a "sampled model." For every layer $l$, the framework randomly selects the weights from one of the $M$ sub-models.
  2. Group Optimization: To ensure sub-models learn diverse features, $K$ different models are sampled during training and optimized simultaneously based on their mean prediction.
  3. Inference: At test time, the system generates $N$ randomly sampled models and averages their outputs for the final prediction.

Because the attacker does not know which specific combination of layers will be sampled at test time, the gradients they calculate to craft their attack become unreliable—a concept known as gradient ambiguity.

Experimental Setup

The method was evaluated on three standard image classification benchmarks:

  • MNIST: Handwritten digits.
  • SVHN: Street View House Numbers.
  • CIFAR-10: 10 classes of common objects and animals.

Key Insights

  • Exponential Diversity from Linear Parameters: By storing $M$ sub-models, RLS can theoretically generate $M^L$ unique model combinations. For a 50-layer network with just 2 sub-models, this results in $2^{50}$ possible architectures using only twice the parameters of a single model.
  • Architecture Roulette: White-box attacks (like PGD or C&W) rely on precise gradient calculations. By randomly swapping layers on the fly, the computational graph changes every time an image is processed, forcing the attacker to target a moving target.
  • Forced Diversity: The group optimization strategy successfully forces underlying sub-models to learn orthogonal representations, as evidenced by improved Interrater Agreement (IA) scores compared to standard ensembles.

Results

The authors tested the method using ResNet-50 and VGG-16 architectures, utilizing $M=2$ sub-models and averaging $N=10$ samples at test time.

Performance comparison of the proposed RLS method against baseline models under various adversarial attacks using ResNet-50.

As shown in the results for ResNet-50, the RLS method provides massive robustness gains. Against the powerful Carlini & Wagner (C&W) attack on CIFAR-10, a standard baseline model's accuracy plummeted to 16.4%, while the proposed RLS method maintained a robust 87.9% accuracy. Similarly, under the PGD attack on CIFAR-10, RLS achieved 70.9% accuracy, significantly outperforming other ensemble-based defenses like ADP (61.7%) and RSE (45.8%).

Discussion and Limitations

While RLS significantly improves robustness with low memory overhead, it introduces some trade-offs:

  • Inference Latency: Running $N$ forward passes at test time to average predictions increases latency compared to a single forward pass.
  • Adaptive Attacks: The defense relies heavily on gradient randomization. Future work should evaluate its effectiveness against advanced adaptive attacks, such as Expectation Over Transformation (EOT), which are designed to bypass randomized defenses by calculating expected gradients.
  • Scalability: Further research is needed to scale this framework to larger datasets like ImageNet or combine it with explicit Adversarial Training for even greater robustness.

Summary updated

BibTeX
@inproceedings{lee2020robust,
  author = {Hakmin Lee and Hong Joo Lee and Seong Tae Kim and Yong Man Ro},
  title = {{Robust Ensemble Model Training via Random Layer Sampling Against Adversarial Attack}},
  booktitle = {BMVC},
  year = {2020},
  url = {https://openreview.net/forum?id=HnthRgaJXpY},
}
Figure