GradMDM: Adversarial Attack on Dynamic Networks

Jianhong Pan, Lin Geng Foo, Qichen Zheng, Zhipeng Fan, Hossein Rahmani, Qiuhong Ke, Jun Liu

Dynamic Neural Networks (DyNNs) are designed for efficiency, adaptively skipping redundant computations based on the input. However, this flexibility introduces a unique vulnerability: "energy-oriented" adversarial attacks that aim to maximize computational load, forcing these models to process simple inputs with maximum resources. In their paper "GradMDM: Adversarial Attack on Dynamic Networks," Pan et al. identify critical flaws in existing attacks—specifically suboptimal balancing of image distortion and gradient conflicts—and propose a novel method to overcome them.

The Challenge: Efficiency vs. Imperceptibility

Previous attacks often struggle to find the optimal balance between increasing network complexity and maintaining image quality (the Pareto Frontier). Furthermore, when attempting to activate multiple gating mechanisms simultaneously, the gradients often conflict: an update that opens one gate might inadvertently close another. This "tug-of-war" leads to inefficient optimization and visible image artifacts.

GradMDM Methodology

The authors introduce GradMDM (Gradient Magnitude and Direction Manipulation), featuring two primary innovations:

1. Power Loss ($L_P$)

Instead of a standard linear loss, GradMDM employs a power function controlled by a hyperparameter $\alpha$. This function prioritizes gates near the activation threshold, effectively "pulling" the optimization landscape to encourage more activations without requiring excessive image perturbations.

The effect of the power factor $\alpha$ on the optimization landscape. Increasing $\alpha$ pushes the optimization toward the extrema of the gating functions more effectively.

2. Complexity Gradient Masking (CGM)

To resolve gradient conflicts, CGM monitors the direction of updates. If a gradient intended to increase complexity would negatively impact already-activated gates, CGM projects that gradient onto an orthogonal path. This ensures that the attack progresses without undoing previous successes.

Key Results and Performance

GradMDM was evaluated on benchmarks including ImageNet and CIFAR-10/100 across various dynamic architectures like SkipNet and ManiDP.

Performance comparison and mechanism visualization. Panel B illustrates how CGM resolves gradient conflicts, while Panel C shows GradMDM achieving significantly higher complexity increases at lower MSE compared to baselines.
  • Effectiveness: On ImageNet, GradMDM achieved an Average Recovery Percentage (ARP) of 99.3% for SkipNet, effectively forcing the dynamic model to perform nearly all possible computations.
  • Image Quality: GradMDM maintains superior image fidelity (higher PSNR, lower MSE) compared to state-of-the-art attacks like DeepSloth and ILFO.
  • Optimization Speed: By resolving gradient conflicts, GradMDM converges faster, requiring significantly fewer iterations to achieve a successful attack.

Conclusion

GradMDM represents a significant advancement in energy-oriented adversarial attacks. By intelligently manipulating gradient magnitudes and directions, it exposes the fragility of dynamic network efficiency. While defenses like adversarial training can mitigate these threats, they often reduce the original efficiency of the network, highlighting a critical trade-off for future AI development.

Summary updated

Abstract

Dynamic neural networks can greatly reduce computation redundancy without compromising accuracy by adapting their structures based on the input. In this paper, we explore the robustness of dynamic neural networks against <italic xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">energy-oriented attacks</i> targeted at reducing their efficiency. Specifically, we attack dynamic models with our novel algorithm GradMDM. GradMDM is a technique that adjusts the direction and the magnitude of the gradients to effectively find a small perturbation for each input, that will activate more computational units of dynamic models during inference. We evaluate GradMDM on multiple datasets and dynamic models, where it outperforms previous energy-oriented attack techniques, significantly increasing computation complexity while reducing the perceptibility of the perturbations <uri xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink">https://github.com/lingengfoo/GradMDM</uri> .
BibTeX
@article{pan2023gradmdm,
  author = {Jianhong Pan and Lin Geng Foo and Qichen Zheng and Zhipeng Fan and Hossein Rahmani and Qiuhong Ke and Jun Liu},
  title = {{GradMDM: Adversarial Attack on Dynamic Networks}},
  journal = {IEEE Trans. Pattern Anal. Mach. Intell.},
  year = {2023},
  url = {https://openreview.net/forum?id=_TOky329FK},
}
Figure