Adversarial attacks pose a fundamental challenge to deep learning models. Most traditional defenses attempt to harden a single, deterministic model's decision boundary via techniques like adversarial training. However, an intelligent adversary with white-box or query access can often map out this static boundary and find a vulnerability.
Stochastic model selection shifts the defensive paradigm from hardening a static boundary to deploying a dynamic, unpredictable target. Instead of relying on one deterministic model at inference time, these systems maintain a diverse pool of models and randomly select which model (or subset of models) processes each incoming query. By introducing uncertainty directly into the execution path, this strategy aims to break the optimization loops that attackers rely on to generate adversarial perturbations.
The Core Intuition: Breaking the Attacker's Optimization
To understand why stochastic model selection works, we must look at how adversarial examples are constructed. Whether an attacker uses gradient-based optimization in a white-box setting or finite-difference approximations in a query-based black-box setting, they are essentially solving an optimization problem tailored to a specific target function $f(x)$.
If the target function changes unpredictably with every single query, the attacker's optimization process fractures:
- Disrupting Gradient Estimation: In query-based black-box attacks, adversaries observe changes in outputs across sequential, slightly perturbed inputs to estimate the local gradient. As Vo et al. demonstrate with their defense framework, randomly sampling different models for each query breaks the assumption of static model behavior. The feedback the attacker receives becomes highly noisy and incoherent, preventing them from learning the model's underlying dynamics.
- Exploiting Low Transferability: For an adversarial example to successfully fool a randomized system, the perturbation must generalize across the entire pool of available models. By constructing pools with high architectural diversity—such as mixing Convolutional Neural Networks (CNNs) and Vision Transformers (ViTs)—Mahmood et al. exploit the fact that adversarial configurations rarely transfer cleanly between fundamentally different architectures.
An input optimized to exploit a vulnerability in Model A will likely land safely within the correct decision zone of Model B.
Game-Theoretic Foundations
This "security through uncertainty" strategy is not merely an empirical heuristic; it is rooted in game theory. The interaction between a defender and an attacker can be modeled as a zero-sum game.
Biggio et al. formalized this early on, demonstrating that introducing randomness into a classifier's decision boundary creates a region of ambiguity that complicates an attacker's reverse-engineering efforts. Building on this, Pinot et al. mathematically proved that no single deterministic classifier can be optimally robust against all possible adversarial strategies. Instead, a randomized mixture of multiple classifiers is a mathematical necessity to achieve optimal defense in a game-theoretic equilibrium, forcing the adversary to choose an attack strategy without knowing the active target function.
To operationalize this equilibrium, Sengupta et al. introduced MTDeep, which frames the defense as a Bayesian Stackelberg Game. This framework computes an optimal probability distribution for switching between different network architectures at test time, maximizing accuracy for legitimate users while minimizing the success rate of malicious inputs.
Deterministic Defense:
Input ----> [ Fixed Model ] ----> Static Decision Boundary (Easy to optimize against)
Stochastic Defense:
/--> [ Model A ] (p=0.3)
Input ----> ----> [ Model B ] (p=0.5) ----> Dynamic Decision Boundary (Moving Target)
\--> [ Model C ] (p=0.2)
Achieving Ensemble Robustness at Single-Model Cost
A naive approach to leveraging multiple models is to run an entire ensemble and aggregate their predictions (e.g., via voting or averaging). While effective, standard ensembles scale computational costs linearly with the number of models.
Stochastic model selection bypasses this overhead. As explored by Dbouk et al. (2023), randomized ensemble classifiers (RECs) select and execute exactly one model from the pool per inference request. This mechanism achieves the theoretical robustness of a massive ensemble while maintaining the computational footprint and latency of a single model.
To make this pool resilient, researchers have focused on specialized training and composition strategies:
- Diversity Optimization: Liu et al. show that simply grouping random models is insufficient. Ensembles must be explicitly optimized for disagreement (using metrics like the Kappa statistic) to ensure that their failure modes do not overlap.
- Hybrid Defense Frameworks: Rather than relying purely on randomness, frameworks like AdvMS, proposed by Wang et al., combine adversarial training with random model switching to spread the defensive burden across both empirical hardening and architectural uncertainty.
- Input Reformation: Other approaches, such as MagNet by Meng et al., complement stochastic classifier selection by using a randomized ensemble of autoencoders at the front end to detect or "reform" perturbed inputs back to the normal data manifold before they ever reach the target classifier.
The Cat-and-Mouse Game: Adaptive Attacks
The primary vulnerability of stochastic model selection lies in the assumption that the attacker cannot bypass the randomness. If an defense relies on "gradient obfuscation" rather than true structural robustness, it remains vulnerable to adaptive adversaries.
In a critical evaluation of the field, Dbouk et al. (2022) demonstrated that many early gains attributed to randomized ensembles were an illusion caused by weak evaluation metrics. The authors introduced the ARC (Adversarial Robustness Cleaner) attack, which successfully circumvents stochastic defenses by optimizing against the expected output of the entire pool rather than a single instance. This revelation proved that if the models in the pool share common vulnerabilities, an adaptive attacker can still find a single, universal perturbation that defeats all of them simultaneously.
In response to this vulnerability, subsequent work by Dbouk et al. (2023) introduced training algorithms like BARRE. Instead of training models independently, BARRE minimizes the joint vulnerability of the pool, mathematically ensuring that the models' decision boundaries are sufficiently orthogonal to withstand expectation-based adaptive attacks.
Key Foundational Work
MagNet: a Two-Pronged Defense against Adversarial Examples (2017) — contributed 1 concept elements to this direction.
Adversarial Pattern Classification Using Multiple Classifiers and Randomisation (2008) — contributed 1 concept elements to this direction.