Skip to content

Protecting Neural Networks with Hierarchical Random Switching: Towards Better Robustness-Accuracy Trade-off for Stochastic Defenses

Protecting Neural Networks with Hierarchical Random Switching: Towards Better Robustness-Accuracy Trade-off for Stochastic Defenses

arXiv· arXiv:1908.07116· IJCAI· Xiao Wang, Siyue Wang, Pin-Yu Chen, Yanzhi Wang, Brian Kulis, Xue Lin, Peter ChinBoston University; Northeastern University; IBM ResearchIndexed by this site · 16 days ago· Originally publishedDefenses

Quick read

Defenses

Based on the paper PDF (AI-generated); refer to the original

The authors propose a robustness-accuracy trade-off metric DES for randomized defenses and a defense method HRS, stating that on CIFAR-10 its DES is at least 3 times that of other randomized defenses, and present a defense against adversarial reprogramming.

Threat modelDefense paper. The attacker's goal is adversarial misclassification (FGSM/CW/PGD/CW-PGD, targeted, white-box) and adversarial reprogramming; the settings include standard white-box (the attacker knows the model structure and parameters) and two adaptive white-box settings: EOT (sampling n=10 gradients and taking the mean) and fixed randomness (the attacker knows the base model and knows that a randomization defense is deployed). The victim system is a CNN classifier on MNIST/CIFAR-10.

Questions
Randomized network defenses (SAP, defensive dropout, Gaussian noise) can improve adversarial robustness, but the authors point out that the cost is a drop in test accuracy on clean data, and that different defenses differ in defense rate and accuracy, making fair comparison difficult.
Methods
The authors propose DES (defense rate gain divided by test accuracy drop) to measure the trade-off, and propose HRS: dividing the network into several blocks, each block containing multiple parallel channels, randomly switching the active channel at runtime, and training block by block with a linear-complexity bottom-up algorithm.
Experiments and results
Evaluated on MNIST/CIFAR-10 with FGSM/CW/PGD/CW-PGD and two adaptive attacks, EOT and fixed randomness. On CIFAR-10 with ε=8/255, the ASR of HRS is 51.1% (PGD), while other random defenses are 100%; the mean DES of HRS is highest under each attack on CIFAR-10. The authors state that HRS also reduces adversarial reprogramming accuracy.
Limitations and future work
The paper does not specifically discuss limitations. Experiments cover: two datasets, MNIST and CIFAR-10, and two CNN architectures; attacks are FGSM/CW/PGD/CW-PGD plus EOT and fixed randomness; defense comparisons are SAP, dropout, Gaussian noise, and adversarial training (adversarial training only on CIFAR-10); reprogramming tests only one transfer, CIFAR-10→MNIST.
Experimental setupHRS (Hierarchical Random Switching)、SAP (Stochastic Activation Pruning) et al. · MNIST、CIFAR-10 · ASR、defense rate et al.
Evaluated models
HRS (Hierarchical Random Switching)SAP (Stochastic Activation Pruning)Defensive DropoutGaussian NoiseAdversarial Training
Benchmarks
MNISTCIFAR-10
Metrics
ASRdefense rateDEStest accuracyreprogramming test accuracy
AI summaryHierarchical Random Switching (HRS) protects neural networks through randomly switched channel blocks, preventing attackers from exploiting fixed model structure and parameters. The paper also proposes the Defense Efficiency Score (DES) metric, measuring the gain in attack failure obtained by a defense at the cost of test accuracy degradation. Experiments show that HRS can resist state-of-the-art white-box and adaptive adversarial misclassification attacks, is the first defense against adversarial reprogramming, and in most settings has an average DES at least 5 times that of existing stochastic network defenses.

Hierarchical Random Switching (HRS) protects neural networks through randomly switched channel blocks, preventing attackers from exploiting fixed model structure and parameters. The paper also proposes the Defense Efficiency Score (DES) metric, measuring the gain in attack failure obtained by a defense at the cost of test accuracy degradation. Experiments show that HRS can resist state-of-the-art white-box and adaptive adversarial misclassification attacks, is the first defense against adversarial reprogramming, and in most settings has an average DES at least 5 times that of existing stochastic network defenses.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    Randomized defenses trade test accuracy for robustness; the authors propose the trade-off metric DES and the defense HRS with a better trade-off.

    Core problem: existing randomized network defenses improve adversarial robustness while causing a drop in test accuracy on clean data, and there is a lack of a unified metric to compare the robustness-accuracy trade-off of different defenses.

    • Problem setting: DNNs are vulnerable to adversarial misclassification attacks and adversarial reprogramming under the norm-ball input perturbation threat model (Introduction). Randomized defenses (SAP, defensive dropout, adding Gaussian noise) interfere with attackers through random input gradients, but the authors point out that the cost is degraded performance on legitimate data.
    • Shortcomings of existing methods: the authors state that current defenses' robustness gains come at the cost of a noticeable drop in test accuracy; and even under the same threat model, different defenses have different defense rates and accuracies, making direct comparison difficult (Section 4).
    • Core observation: the authors observe through two sets of experiments (Section 3.1, Appendix A): the likelihood of finding a successful adversarial example along a random direction is very low; models with the same architecture but different initializations each have different vulnerabilities. The authors therefore argue that attacking a randomized model requires finding a common weakness that holds for all random variants, which is harder than attacking a deterministic model.
    • Paper proposes: (1) Defense Efficiency Score (DES), measuring the defense rate gain per unit drop in test accuracy; (2) Hierarchical Random Switching (HRS), which divides the network into several blocks with randomly switched channels, along with a bottom-up training algorithm; the authors state that HRS is also the first defense against adversarial reprogramming (Section 7, stated by the authors as "to the best of our knowledge").
    • Threat model (Sections 2, 6.1):
      • Attacker goal: adversarial misclassification (FGSM, CW, PGD, CW-PGD, all targeted, white-box implementations) and adversarial reprogramming (reprogramming a CIFAR-10 model into an MNIST classifier).
      • Attacker knowledge: standard white-box—knows the target model's structure and parameters; two adaptive white-box settings—EOT (knows randomization is deployed) and fixed randomness (knows the base model and knows about the randomized defense).
      • Attacker capability: perturb the input within an l∞ ball; EOT can sample n=10 gradients and average them; fixed randomness can disable the randomization module (for HRS, fixing one activation path).
      • Victim system: CNN image classifiers on MNIST and CIFAR-10.
  2. What related research exists?

    Related work falls into three categories: randomization defenses, adversarial attacks and adaptive attacks, and adversarial reprogramming; the baselines are SAP, dropout, Gaussian noise, and adversarial training.

    Randomized network defenses (baselines directly compared in the paper)

    • SAP (Dhillon et al., 2018): randomly drops neuron outputs according to weighted probabilities and amplifies the remaining outputs. Under PGD/CW-PGD attacks on CIFAR-10, the paper points out that at the same test accuracy level SAP has almost no defensive effect (ASR 100%, Section 6.2).
    • Defensive Dropout (Wang et al., 2018a): also uses dropout at inference time, with different dropout rates possible for training and testing; the difference from SAP is that dropout is equiprobable and enabled in both training and testing phases (Section 3.2).
    • Gaussian Noise (Liu et al., 2017): adds Gaussian noise before each convolutional layer, with different standard deviations for the input layer and other layers ("init-noise" and "inner-noise").

    Adversarial attacks and adaptive attacks

    • Misclassification attacks: FGSM (Goodfellow et al., 2015, single-step l∞ attack), CW (Carlini and Wagner, 2017b, optimization-based attack), PGD (Madry et al., 2017, iterative FGSM), CW-PGD (Athalye et al., 2018, applying the CW loss to PGD).
    • Adaptive attacks and security checks: Athalye et al. (2018) propose the security-check principles for obfuscated gradients and the EOT attack; the paper adopts these principles to validate robustness claims, and uses two adaptive settings, EOT and fixed randomness, to verify that HRS's robustness does not come from gradient obfuscation (Sections 1, 6.1).
    • Ensemble defense (Tramèr et al., 2017): uses multiple different networks for ensemble defense; the paper points out that HRS differs in requiring only a single base network architecture (Section 1).

    Adversarial reprogramming

    • Adversarial Reprogramming (Elsayed et al., 2018): learns an input transformation hf and an output transformation hg to "reprogram" a model for task Ta to perform task Tb, with computational cost depending only on hf and hg, allowing an attacker to covertly exploit the target model (Section 2.2). The paper states that there was previously no defense against it.

    Deterministic defenses

    • Adversarial Training (Madry et al., 2017): trains with adversarial examples; the paper points out that on CIFAR-10 with ε=8/255 it achieves a 56.6% defense rate accompanied by a 7.11% drop in test accuracy (Section 4), illustrating the trade-off problem. Compared only on CIFAR-10 because the authors state it has no large accuracy drop on MNIST (footnote 3).

    Positioning: the authors state that this paper differs from the above work in proposing a standardized trade-off comparison metric DES, and that HRS achieves a higher DES through decentralized randomization while not depending on a specific attack and requiring only a single base architecture (Sections 1, 5.1).

  3. How does the paper address this problem?

    DES is used to quantify the trade-off; HRS divides the network into blocks, each block has multiple parallel channels and switches randomly, combined with bottom-up block-by-block training.

    The overall approach has two parts: first propose Defense Efficiency Score (DES) as a standardized trade-off metric, then propose Hierarchical Random Switching (HRS), a randomization defense, and its training algorithm.

    Problem setting and the DES metric

    • Characterizing the trade-off: defense strength is adjusted by a control factor (dropout rate, noise variance, number of HRS channels, ε bound of adversarial training); the authors point out that greater strength gives a higher defense rate and lower test accuracy (Section 4, Figure 2).
    • DES definition: DESD,A(θ) = Δ d / Δ t, where ∆d is the gain in the proportion of adversarial examples generated by attack A that fail to fool defense D (strength factor θ), and ∆t is the drop in test accuracy relative to the unprotected base model; in practice ∆d/(∆t+η) is computed, with η=0.002 to offset noise when ∆t is close to 0 (Section 4).
    • Fair comparison method: first select a target range of defense rate or accuracy drop, then compare the mean and variance of the DES of each defense falling within the range (Section 4).

    HRS model structure

    • Random switching blocks: the base network is divided into M blocks, each block is replaced by a switching block containing N parallel channels (different weights, same structure), and the switcher randomly assigns the block input to one channel at runtime (Figure 3).
    • Activation path: at any moment the active channels of each block form one activation path with the same structure as the base model; the authors argue that as long as every path is functionally complete, the model can approach the base model on legitimate data, while random switching prevents the attacker from exploiting a fixed structure (Section 5.1).
    • Decentralized randomization: each variant of HRS has equal status, and there is no central surrogate model that can be exploited; the authors argue that the variants of dropout/Gaussian noise are all derived from the base model, which becomes a centralized surrogate and may be exploited by fixed-randomness attacks (Section 5.1).

    Bottom-up training algorithm

    • Block-by-block training: first build N1 randomly initialized paths for the 1st block, train them independently to convergence and freeze them; then when training the 2nd block, activate the random switching of the 1st block, forcing subsequent blocks to adapt to its changes; continue until all blocks are trained (Section 5.2).
    • Complexity and effect: the authors state that the algorithm has linear time complexity, training is stable, and each channel is decentralized; the full procedure is in Algorithm 1 of Appendix B.

    Evaluation method

    • Attack implementation: FGSM, CW, PGD, and CW-PGD are all in white-box, targeted settings; PGD/CW-PGD run 100 iterations with step size 0.1, and CW uses L2 distortion with 10 rounds of binary search over c (Appendix C.1).
    • Three attack settings: standard white-box; EOT (sampling n=10 input gradients and taking the mean; a preliminary experiment in Appendix C.3 shows gains saturate for n>10); fixed randomness (disabling the randomization module, i.e., for HRS fixing one activation path) (Section 6.1).
    • Fairness control: the strength factor of each defense is adjusted so that test accuracy is at the same level; the accuracy values are reported in Table A2 of Appendix C.6 (Section 6).
    • Success criterion: misclassification defense is measured by attack success rate (ASR) and defense rate (1−ASR); whether reprogramming succeeds is measured by the MNIST test accuracy after reprogramming (Sections 6, 7).
  4. What experiments did the paper conduct?

    Four defenses are evaluated on MNIST/CIFAR-10 with four attacks and three attack settings; HRS is superior in both DES and ASR, and adversarial reprogramming is also tested.

    Experimental Setup

    • Defenses under test: SAP, Defensive Dropout (0.1/0.3/0.7, with 0.7 omitted for MNIST), Gaussian Noise, HRS (10×10, 20×20, 30×30, 2 switching blocks), all added to the same base model; adversarial training is also compared (CIFAR-10 only).
    • Base models: one CNN each for MNIST and CIFAR-10 (architecture in Appendix C.4 Table A1); base test accuracy MNIST 99.04%, CIFAR-10 79.17% (Table A2).
    • Datasets: MNIST, CIFAR-10 (the paper does not report the sample sizes used or number of repetitions).
    • Attacks: FGSM, CW, PGD, CW-PGD, white-box, targeted; three settings: standard white-box, EOT (n=10), fixed randomness.
    • Metrics: ASR, defense rate (1−ASR), DES, test accuracy; the scatter plots in Figure 5 use CIFAR-10 ε=8/255, MNIST ε=64/255.
    • Accuracy alignment: the strength factor is adjusted so that the test accuracies of the defenses are similar (Table A2: on CIFAR-10, SAP 79.16%, Dropout 0.1 79.08%, Gaussian 78.04%, HRS 10×10 78.93%).

    Main Results

    Table 2 gives mean DES (CIFAR-10 and MNIST, three attacks):

    Swipe horizontally to read the table

    DatasetDefenseFGSMPGDCW-PGD
    MNISTDropout11.9917.9419.55
    MNISTGaussian14.9071.7882.76
    MNISTHRS36.4176.6474.90
    CIFAR-10Dropout1.090.810.76
    CIFAR-10Gaussian2.736.175.47
    CIFAR-10Adv. Train5.057.376.57
    CIFAR-10HRS32.2335.4335.55

    According to Table 2. SAP does not appear in this table; the paper does not explain why.

    • The authors state that HRS has the highest DES on all CIFAR-10 attacks and most MNIST attacks, leading other defenses by at least 3 times on CIFAR-10 (Section 6.3); on MNIST PGD and CW-PGD, Gaussian's DES is higher than HRS, a counterexample within the table.
    • Figure 2 gives mean DES under PGD attack on CIFAR-10: Dropout 0.815, Gaussian 6.176, Adv. Train 7.367, HRS 35.429; the authors state that HRS's mean DES is more than 3 times higher than SOTA.
    • The abstract states that in most settings HRS's average DES is at least 5 times that of existing randomized defenses; the main text and Figure 2 state more than 3 times; both versions are presented here side by side.

    ASR Analysis of Misclassification Attacks (Figure 4, Table 1)

    • CIFAR-10, ε=8/255: on HRS, the ASR of PGD and CW-PGD is 51.1% and 54.5% respectively, with test accuracy dropping by at most 0.48%; the authors state that other randomized defenses have 100% ASR at the same accuracy level, and adversarial training with the same defense rate drops 7% more accuracy (Section 6.2).
    • Adaptive attacks: the authors state that EOT only slightly increases ASR for all defenses and requires n times the gradient computation; fixed randomness has an effect on SAP/dropout/Gaussian similar to EOT but without multiple sampling, and for HRS is actually worse than standard white-box, which the authors attribute to HRS's decentralized randomization (Section 6.2).
    • Gradient standard deviation and defense rate (Table 1, PGD multiple strengths): Base deviation 0, defense rate 29.18%; Gaussian 0.6413, 39.92%; HRS 30×30 0.7983, 69.70%; the authors state that input gradient standard deviation is strongly correlated with defense performance, and Figure 1 shows that the input gradients of SAP/dropout/Gaussian have a unimodal distribution while this trend is not obvious for HRS.

    Defense Against Adversarial Reprogramming (Section 7, Appendix E)

    • Setup: reprogram the CIFAR-10 base model from Section 6 into an MNIST classifier, with the input transformation using locally connected layers (kernel 2×2, 3×3) and the output transformation being the identity mapping.
    • Unprotected baseline: after reprogramming, MNIST test accuracy reaches up to 90.53% (2×2) and 95.07% (3×3).
    • Defense results: Figure 6 gives the reprogramming accuracy curves within 50 epochs; the authors state that HRS can reduce reprogramming test accuracy, while other defenses are less effective (the specific values in the figure are unreadable in the text conversion).

    Other Ablations and Analysis

    • Number of blocks (Table A3, CIFAR-10, CW-PGD, 5 channels per block): at ε=8/255, the ASR of 1/2/3-block is 85.5%/81.2%/65.9%, and test accuracy is 78.78%/78.74%/74.92%; the authors state that the number of blocks can serve as a defense strength control factor.
    • Number of channels: the authors state that the more HRS channels, the stronger the defense (Section 6.2, corresponding to the defense rate 61.03%→69.70% from 10×10→30×30 in Table 1).
    • EOT sample count: preliminary experiments show that the benefit saturates for n>10, so n=10 is used (Appendix C.3).
    • Gaussian parameters: on CIFAR-10, using the recommended standard deviation would drop accuracy to 60%, so 10 times smaller values of 0.02/0.01 are used instead (Appendix C.2).
  5. What are some points that can be further explored?

    The paper does not specifically discuss limitations; the experiments cover only two datasets, two CNNs, and four types of attacks.

    Limitations and future directions noted by the authors

    The paper does not specifically discuss limitations. There is no Limitations or Future Work subsection in the main text or conclusion; the only statement related to future work is footnote 1, which notes that the appendix and code have been placed in the authors' repository (this is a resource note rather than a discussion of limitations).

    Scope of experimental coverage

    • Datasets and models: only two image datasets, MNIST and CIFAR-10, each with one CNN architecture (Appendix C.4); HRS is implemented with 2 switching blocks and at most 30×30 channels (Section 6.1).
    • Attack coverage: misclassification attacks are FGSM, CW, PGD, and CW-PGD, all targeted and white-box; adaptive attacks are EOT (n=10) and fixed randomness (Section 6.1).
    • Defense comparison: three randomized defenses, SAP, Defensive Dropout, and Gaussian Noise; adversarial training is compared only on CIFAR-10 (footnote 3); the DES comparison in Table 2 does not include SAP, and the paper does not explain why.
    • Reprogramming experiments: only one task transfer, CIFAR-10→MNIST, with the input transformation as a locally connected layer (kernel 2×2, 3×3) and the output transformation as the identity mapping (Section 7).
    • Unreported information: the paper does not report the sample size, number of repetitions, or statistical significance tests for each experiment; most of the specific values in Figure 4 and Figure 6 are not given in the main text.
  6. Summarize the main content of the paper

    Proposes the trade-off metric DES and the random switching defense HRS, achieving a higher defense rate at a lower accuracy loss on MNIST/CIFAR-10.

    This is an adversarial example defense paper that addresses the trade-off problem of randomized defenses where "improved robustness comes with a drop in test accuracy," and proposes the trade-off metric DES and the defense method HRS.

    • Problem to solve: random defenses such as SAP, defensive dropout, and Gaussian noise come at the cost of a clear accuracy drop, and different defenses are difficult to compare fairly; adversarial reprogramming previously had no defense (according to the authors).
    • Method highlights: DES = defense rate gain/test accuracy drop, used for standardized comparison; HRS divides the network into several blocks, each containing multiple parallel channels, randomly switching the active channel at runtime, combined with linear-complexity bottom-up block-by-block training; the authors emphasize that its decentralized randomization makes fixed-randomness adaptive attacks fail instead.
    • Main results: on CIFAR-10 with ε=8/255, the ASR of HRS under PGD/CW-PGD attacks is 51.1%/54.5%, with accuracy dropping by at most 0.48%, while other random defenses have ASR 100% (Section 6.2); in mean DES, HRS is highest under each attack on CIFAR-10 (35.43 under PGD, 7.37 for adversarial training, Table 2), but on MNIST under PGD/CW-PGD, Gaussian is higher; HRS 30×30 has a defense rate of 69.70% under multiple PGD strengths (Table 1).
    • Reprogramming: an unprotected CIFAR-10 model can be reprogrammed to 95.07% MNIST accuracy (kernel 3×3); the authors state that HRS can reduce reprogramming accuracy, while other defenses are less effective (Figure 6).
    • Authors' conclusion: HRS achieves a better robustness-accuracy trade-off under both standard and adaptive attacks, and the authors state that it is the first defense against adversarial reprogramming; the paper does not discuss limitations, and experiments are limited to MNIST/CIFAR-10 and two CNNs.

Related papers

Show 3 more papers
Read originalIJCAI