When multiple neural networks are trained on the same dataset, they tend to learn remarkably similar representations. Even if they use different architectures or initializations, their loss landscapes often align. In the context of security, this phenomenon is a disaster: it creates a shared adversarial subspace. An attacker can compute an adversarial perturbation on a cheap, local "substitute" model, and that same perturbation will successfully fool a completely different "target" model. This is the core mechanism behind transferable adversarial attacks.
To prevent this transferability, a growing body of research focuses on gradient diversification—explicitly forcing different models, internal paths, or tasks to have orthogonal or negatively correlated gradients. If the sensitivity vectors of two models are perpendicular, an adversarial step designed to maximize the loss of one model will project to near-zero along the sensitivity direction of the other, effectively becoming harmless noise.
Shared Subspace (Vulnerable) Orthogonal Gradients (Robust)
Model A Gradient Model A Gradient
\ |
\ (Aligned) |
\ +---- Model B Gradient
Model B Gradient
The Geometry of Gradient Alignment
In a standard ensemble, the collective defense is only as strong as its weakest link if all members share a common blind spot. As Yang et al. observe in On the Certified Robustness for Ensemble Models and Beyond, the primary challenge in securing ensembles is this natural tendency for sub-models to share gradient directions. When loss landscapes align, a single perturbation vector can simultaneously increase the loss across the entire group, rendering redundancy useless.
To break this alignment, researchers introduce geometric constraints directly into the training objective. The most direct way to decorrelate model logic is to penalize the cosine similarity between their input gradients. Ross et al. introduced this via Local Independence Training (LIT) in Ensembles of Locally Independent Prediction Models, using a squared cosine similarity penalty that forces models to extrapolate in different directions. Similarly, the authors of Adversarial Defence by Diversified Simultaneous Training of Deep Ensembles proposed a penalty term that minimizes input-gradient similarity to ensure that an attack optimized for one model is perceived as harmless noise by others.
What are the mathematical limits of this geometric spread? Dabouei et al. proved in Exploiting Joint Robustness to Adversarial Perturbations that for a set of $k$ models, the absolute theoretical lower bound for minimizing cosine similarity is $-1/(k-1)$. By targeting this optimal geometric spread, training forces the ensemble into a "tug-of-war" configuration.
Furthermore, Dabouei et al. and Zhang et al. in Defending Adversarial Examples by Negative Correlation Ensemble emphasize that controlling gradient magnitude is just as critical as direction. If one model develops a disproportionately large gradient, an attacker can exploit that single highly sensitive model to shift the collective decision. Equalizing sensitivity prevents the creation of a single weak link. Going a step further than first-order gradients, Boroojeny et al. argue in Training Robust Ensembles Requires Rethinking Lipschitz Continuity that making models individually robust via standard Lipschitz smoothing actually forces them to become more structurally similar. To resolve this, they propose orthogonalizing the primary singular vectors (the most sensitive directions) of corresponding layers across different models.
Diversifying the Internal Architecture
The intuition of gradient orthogonality extends far beyond ensembles of independent networks. The same principles can be engineered into the internal components, stochastic paths, or task boundaries of a single model.
Stochastic Paths and Moving Targets
Instead of running multiple models, a defense can introduce architectural stochasticity so that the network becomes a moving target. Wang et al. demonstrate this in Block Switching: A Stochastic Approach for Deep Learning Security by randomly switching between parallel architectural channels at runtime. This creates a multimodal and widely dispersed distribution of input gradients, obscuring any single stable optimization direction.
Similarly, Ma et al. explore this concept through weight and feature space manipulation:
- In Adversarial Robustness through Random Weight Sampling, the authors show that injecting noise into weights only thwarts attacks if the gradients generated by different random weight samples have low cosine similarity.
- In Adversarial Robustness via Deformable Convolution with Stochasticity, the authors apply this to structural inference paths, minimizing gradient similarity across random sampling masks to treat robustness as a problem of minimizing attack transferability across internal network states.
Sub-Task and Multi-Exit Orthogonality
Gradient alignment can also be disrupted across different outputs or tasks. In multi-exit networks, where early exits save computation, an attacker might exploit an early exit to craft an attack that carries through to the final layer. To prevent this, Ham et al. introduce cross-exit orthogonal distillation in NEO-KD: Knowledge-Distillation-Based Adversarial Training for Robust Multi-Exit Neural Networks. By forcing the non-ground-truth predictions of different exits to be mutually orthogonal, they diversify how different layers perceive non-target classes, blocking cross-exit transferability.
For multi-task or self-supervised models, Liu et al. demonstrate in Adversarial Robustness: From Self-Supervised Pre-Training to Fine-Tuning that different pretext tasks have complementary vulnerabilities. By enforcing orthogonality between the gradients of various task-specific losses, the model is forced to defend against a broader range of adversarial directions in the feature space.
The Attacker's Perspective and Evaluation Pitfalls
The relationship between gradient diversity and transferability is a two-way street. Understanding how gradient misalignment breaks attacks has allowed researchers to design more potent black-box attacks by deliberately seeking out or engineering gradient consensus.
In Stochastic Variance Reduced Ensemble Adversarial Attack for Boosting the Adversarial Transferability, Xiong et al. note that the high variance of gradient directions across different architectures introduces noise into the optimization process, making it difficult to find a stable perturbation. They use variance reduction to stabilize the optimization path. Similarly, Chen et al. develop an adaptive ensemble attack in An Adaptive Model Ensemble Adversarial Attack for Boosting Adversarial Transferability that explicitly filters out conflicting gradient information to prevent the generated noise from overfitting to the surrogate ensemble.
Conversely, an attacker can use orthogonality as an exploration tool. Wang et al. propose a method called Diversified Weight Pruning in Enhancing Targeted Attack Transferability via Diversified Weight Pruning, where they intentionally generate highly orthogonal gradients from a diverse set of pruned model variations. This forces the attack to explore entirely distinct directions in the feature space, increasing the probability of discovering a perturbation that transfers to an unknown victim model.
The Illusion of Security: Gradient Cancellation
A critical warning for researchers designing diversity-based defenses is raised by Yu et al. in MORA: Improving Ensemble Robustness Evaluation with Model Reweighing Attack. They demonstrate that aggressively forcing sub-models to be diverse can lead to gradient cancellation.
When individual gradients point in wildly opposing directions, their sum or average approaches zero:
$$\nabla_x \mathcal{L}_{\text{ensemble}} = \frac{1}{k} \sum_{i=1}^k \nabla_x \mathcal{L}_i \approx \mathbf{0}$$
This vanishing sum creates a false sense of security. Standard gradient-based optimization tools (like PGD) fail because they cannot find a clear direction to follow, leading researchers to believe the model is robust. However, the underlying adversarial vulnerabilities still exist; the defense has merely obstructed the evaluation process. Attacks that dynamically reweigh or select specific sub-models can easily bypass this cancellation effect, highlighting that true robustness requires a careful balance between gradient independence and genuine feature security.
Key Foundational Work
Exploiting Joint Robustness to Adversarial Perturbations (2020) — contributed 5 concept elements to this direction.
Toward Adversarial Robustness by Diversity in an Ensemble of Specialized Deep Neural Networks (2020) — contributed 2 concept elements to this direction.
Adversarial Robustness: From Self-Supervised Pre-Training to Fine-Tuning (2020) — contributed 2 concept elements to this direction.