Skip to content

Randomness in ML defenses helps persistent attackers and hinders evaluatorsRandomness in ML Defenses Helps Persistent Attackers and Hinders Evaluators

arXiv· arXiv:2302.13464· Keane Lucas, Matthew Jagielski, Florian Tramèr, Lujo Bauer, Nicholas CarliniCarnegie Mellon University; Google Research; ETH ZurichIndexed by this site · 27 days ago· Originally publishedDefenses

Quick read

Analysis and theory

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

The authors argue that white-box defenses should avoid randomness: under repeated queries, randomized defenses have lower robustness than their deterministic versions, and the deterministic versions have comparable white-box robustness.

Questions
Many ML defenses rely on randomness; the authors question whether randomness truly improves adversarial robustness, and point out that randomness brings problems for deployment security and robustness evaluation.
Methods
Propose the Nag Factor threat model (the attacker repeatedly submits the same input); construct deterministic versions of Randomized Smoothing, EBM–Def, and DiffPure and compare them using PGD; propose Subspace Grid-sweep to brute-force search adversarial regions in low-dimensional subspaces in order to test gradient obfuscation.
Experiments and results
Under repeated queries, the robust accuracy of randomized smoothing decreases as the number of attempts increases, while the deterministic version remains unchanged; the white-box robustness of the deterministic versions of the three defenses is comparable to the originals (deterministic DiffPure 67% vs. original 88%); Grid-sweep finds vulnerable points on the kWTA defense model that PGD cannot find.
Limitations and future work
The authors point out that deterministic smoothing loses the provable robustness certificate, and that the difference between empirical results and whether the attacker knows the fixed seed remains to be studied; experiments are conducted only on CIFAR-10 image classification, and the paper does not report the number of data points and repetitions for each experiment.
Experimental setupRandomized Smoothing、Deterministic Smoothing et al. · CIFAR-10 · robust accuracy、误分类概率 et al.
Threat model
The attacker's goal is to cause at least one misclassification, can repeatedly submit the same input multiple times, requires no optimization, and only needs to know the black-box hard-label classification result of each query (Nag Factor); the role of randomness under the strongest white-box setting is also evaluated. The victim system is an ML classifier employing a randomized defense.
Evaluated models
Randomized SmoothingDeterministic SmoothingEBM–DefDiffPurek-Winners-Take-All
Benchmarks
CIFAR-10
Metrics
robust accuracy误分类概率脆弱数据点比例(fraction of vulnerable datapoints)对抗样本距离分布
AI summaryThe authors argue that white-box ML defenses should avoid randomness wherever possible, and show that a new problem with randomized defenses in deployment makes them less secure than deterministic defenses. The paper provides evidence that making defenses deterministic can simplify robustness evaluation without weakening the effectiveness of genuinely robust defenses. The authors also propose a new defense evaluation framework that exploits the deterministic properties of defenses to better evaluate their adversarial robustness.

The authors argue that white-box ML defenses should avoid randomness wherever possible, and show that a new problem with randomized defenses in deployment makes them less secure than deterministic defenses. The paper provides evidence that making defenses deterministic can simplify robustness evaluation without weakening the effectiveness of genuinely robust defenses. The authors also propose a new defense evaluation framework that exploits the deterministic properties of defenses to better evaluate their adversarial robustness.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    The authors question whether randomness improves adversarial robustness, and argue that white-box defenses should avoid randomness as much as possible.

    Core question: does randomness in ML defenses truly improve adversarial robustness, or does it instead reduce security and hinder evaluation.

    • Problem setting: many empirically effective defenses (such as Randomized Smoothing, DiffPure) and provably robust defenses rely on randomness, and prior work held that randomization makes networks more robust to iterative attacks. The authors cite claims from Xie et al. (2018a) and Raff et al. (2019) as the view being challenged.
    • Existing shortcomings: the authors state that defense evaluation has been shown to be difficult, many initially effective defenses are quickly broken by adaptive attacks, and randomness is considered one of the main factors causing evaluation difficulty (citing Gao et al., 2022); once randomized defenses are broken, it becomes unclear whether randomness is beneficial.
    • Core observation: the authors argue that the empirical robustness of the studied defenses does not come from randomness, but from other effects that can be reproduced deterministically (such as the self-ensemble of multi-inference aggregation, and deterministic purification processes).
    • Paper contributions: propose the Nag Factor threat model; construct deterministic versions of three randomized defenses and compare white-box robustness; propose the Subspace Grid-sweep evaluation framework to test gradient obfuscation.
    • Threat model (Nag Factor, section 3):
      • Goal: the attacker's goal is to cause at least one misclassification.
      • Capability: can repeatedly submit the same input multiple times, without optimization.
      • Knowledge: only needs to know the black-box hard-label classification result of each query.
      • Victim system: an ML classifier employing a randomized (non-deterministic) defense; the applicable setting is scenarios with low query cost and high payoff.
  2. What related research exists?

    Related work covers attack and evaluation suites, various defenses, randomized defenses, and the debate over whether randomness is beneficial.

    ML attacks and evaluation suites

    • FGSM of Goodfellow et al. (2015), PGD of Madry et al. (2018), Boundary Attack of Brendel et al. (2018)—common adversarial attacks that perturb the input within an Lp distance constraint ε to cause misclassification.
    • Rauber et al. (2017, 2020), Croce et al. (2021), Dong et al. (2019)—standardized attack suites (foolbox, AutoAttack, etc.) used for fair benchmark comparison of defense robustness.

    ML defenses

    • Adversarial training of Madry et al. (2018); adversarial example detection of Pang et al. (2018); input refinement of Nie et al. (2022), Grathwohl et al. (2020), Song et al. (2018), etc.; preprocessing techniques of Xie et al. (2018a), Raff et al. (2019).
    • Athalye et al. (2018a), Tramèr et al. (2020), Carlini & Wagner (2017)—the paper cites them to point out that a lower attack success rate may be misleading, that defenses with gradient masking do not truly reduce vulnerability, and that adaptive attacks can target defense weaknesses.

    Randomized defenses and the debate over randomness

    • Randomized Smoothing of Cohen et al. (2019), EBM–Def of Grathwohl et al. (2020), DiffPure of Nie et al. (2022)—the three randomized defenses for which this paper constructs deterministic versions.
    • Xie et al. (2018a) claims that randomization improves robustness; Xie et al. (2018b) subsequently breaks that defense with an attack using the same transformation; Athalye et al. (2018b) generalizes it to EOT. Gao et al. (2022) points out limitations of randomized preprocessing defenses.
    • Dong et al. (2019)—the paper cites it to explain that randomness is effective for query-based black-box attacks; Cohen et al. (2019), Jia et al. (2020), Levine & Feizi (2019) use randomness to support provable robustness certificates.

    Comparison baselines and benchmarks: The experiments use PGD (Madry et al., 2018) to attack the randomized and deterministic versions of each defense; the Subspace Grid-sweep case study compares an undefended model with a k-Winners-Take-All (Xiao et al., 2020) defended model; the datasets are all CIFAR-10 (Krizhevsky, 2009).

    The authors position this paper as: challenging the popular view that "randomness improves robustness," arguing that white-box defenses should avoid randomness, and providing tools that simplify evaluation by exploiting determinism.

  3. How does the paper address this problem?

    Construct deterministic versions of three randomized defenses to compare robustness, and propose the Subspace Grid-sweep brute-force search evaluation framework.

    Overall approach: first propose the Nag Factor threat model to show the additional vulnerability of randomness in deployment, then convert three randomized defenses into deterministic versions to compare white-box robustness, and finally propose the Subspace Grid-sweep evaluation method.

    Nag Factor threat model and formalization

    • Let the probability that a randomized classifier predicts sample (x, y) correctly in a single prediction be p(x, y), and that of a deterministic classifier be q(x, y); the authors point out that under a single random sampling the two have equal expectation.
    • After N independent samplings, the probability that the randomized classifier is correct all N times is p(x, y)N ≤ q(x, y), and as long as p(x, y) < 1 it is strictly less—that is, under repeated attempts the randomized classifier is necessarily more vulnerable.
    • Deterministic Smoothing: Fix the random seed before each prediction, and all inference uses the same set of corruptions, making predictions have no variance.

    Deterministic versions of the three defenses

    • Randomized Smoothing: Fix the seed and reuse the same set of Gaussian corruptions; use 100,000 base classifier inferences grouped by group size n and take the mode, computing the misclassification probability for each data point.
    • EBM–Def: The only source of randomness is the initial corruption added before refinement; fixing the seed makes it deterministic; the refinement process itself is deterministic.
    • DiffPure: Fix the seed of the initial noise; and introduce an intermediate version—cycling among k seeds (k ∈ {1, 2, 3, 5, 10, 50, 100}), where k=1 is fully deterministic.

    White-box robustness comparison method

    • Execute PGD separately on the randomized and deterministic versions: Randomized Smoothing implements PGD as in the original source; EBM–Def uses foolbox's PGD with binary search; DiffPure uses AutoAttack's PGD; all use the defenses' public code and the attack implementations used in the original source, with CIFAR-10 test data points as input.

    Subspace Grid-sweep evaluation framework

    • Approach: Deterministic defenses allow directly brute-force searching for "adversarial regions" near the original point that cause misclassification, to test whether gradient-guided methods can also find these regions; if they cannot, gradient obfuscation may exist.
    • Subspace construction: Use K orthogonal basis vectors of length D to form a K × D matrix M, projecting the high-dimensional space into a 1–6 dimensional subspace (D for CIFAR-10 is 3072).
    • Three searches: Within a K-dimensional ball of radius ε, grid-sweep divides each axis into B bins (under L∞, searching B^K points); additionally perform random search with the same number of points; then execute PGD within the subspace.
    • Determination: Compare the proportion of vulnerable data points found by each method; if grid-sweep or random sampling can find them but PGD cannot, the authors consider that the defense may only make adversarial regions harder to find by gradient methods (gradient obfuscation), rather than reducing their number.
  4. What experiments did the paper conduct?

    Compare the robustness of the randomized and deterministic versions of three defenses on CIFAR-10, and use Grid-sweep to test kWTA's gradient obfuscation.

    Experimental setup

    • Subjects: The randomized and deterministic versions of Randomized Smoothing (base classifier trained on CIFAR-10 with Gaussian noise within L∞ radius 0.5), EBM–Def, and DiffPure; case studies are the k-Winners-Take-All defense model and the undefended model.
    • Dataset: CIFAR-10 test data points (the paper does not state the number of test points used).
    • Attacks: PGD—Randomized Smoothing implemented per Cohen et al. (2019); EBM–Def uses foolbox's PGD with binary search; DiffPure uses AutoAttack's A-PGD.
    • Metrics: robust accuracy; misclassification probability per data point; Grid-sweep experiments report the proportion of vulnerable data points found by each method out of the union of all methods.
    • Parameters: Smoothing experiments compute 100,000 base classifier inferences with Gaussian corruptions for each test point, grouped by n; EBM–Def uses 1, 2, 5 Markov chains, ε ∈ {0.0001, 0.0002, 0.0005, 0.0010}; Grid-sweep subspace 1–6 dimensions, number of bins 9–1001, ε = 0.5 (L2), PGD 1/10/20 restarts.
    • Number of repetitions: The paper does not report the number of repetitions for each experiment; shaded regions in Figure 2 and Figure 3 are 95% confidence intervals.

    Main results

    Table 1: Proportion of vulnerable data points found by each search method (ε = 0.5, L2; relative to the union of all methods)

    Swipe horizontally to read the table

    ModelGrid-sweepRand-samplePGD 1 repPGD 10 repPGD 20 rep
    Undefended0.980.990.921.001.00
    kWTA-defended0.950.880.630.860.91
    • The authors state that on the undefended model, PGD (10, 20 restarts) and Grid-sweep find almost all vulnerable points, indicating that gradient methods are not hindered.
    • The authors state that on the kWTA defense model, PGD cannot find vulnerable points that Grid-sweep can find, indicating that kWTA does not reduce the number of adversarial examples but only makes them harder to find by gradient methods (gradient obfuscation), consistent with Tramèr et al. (2020).

    Nag Factor: robustness under repeated queries

    • What was measured: The attacker repeatedly submits the same input, comparing the robust accuracy of Randomized and Deterministic Smoothing as the number of attempts and the number of corruptions n vary (Figure 2).
    • Results: In Figure 2a, under all n settings the robustness of Randomized Smoothing is lower than that of Deterministic Smoothing, including the n = 100 used in the original source; in Figure 2b, the accuracy of Deterministic Smoothing is a horizontal line, while Randomized Smoothing decreases as the number of attempts increases (specific values are not labeled on the figure).
    • Authors' interpretation: Randomness exposes the classifier to the Nag Factor, directly reducing adversarial robustness.

    Comparison of randomized and deterministic versions under white-box PGD

    • Randomized Smoothing: Figure 3 shows that the robust accuracy of both converges to the same value at about 5 corruptions, far fewer than the 100 in the original source; the authors consider that robustness comes from the self-ensemble effect of aggregating multiple inferences rather than noise randomness.
    • EBM–Def: Figure 4 shows that under 1, 2, 5 Markov chains and four ε thresholds, the average adversarial distance of the two versions is almost the same; Figure 7 (Appendix B) shows that the adversarial example distance distributions are almost identical, with only a slight difference with 1 chain.
    • DiffPure: Figure 5 shows that the deterministic version (1 seed) has robust accuracy of 67%, alternating 2 seeds gives 83%, and the original randomized version gives 88% (against AutoAttack's A-PGD); with 3 seeds it is the same as the randomized version. The authors consider that most of the robustness comes from the deterministic denoising process; the 1 seed version retains 76% of the randomized version's robustness (67% versus 88%).

    Other ablations and analyses

    • Grid-sweep dimensions and number of bins (Appendix A): On the undefended model with 1–6 dimensions and bins 1001→9, Grid-sweep finds a proportion of 0.96–1, and PGD 10/20 rep are both 1 (Table 2).
    • Same settings on the kWTA model: Grid-sweep 0.91–1, PGD 20 rep decreases from 0.96 to 0.83 as dimensions increase (Table 3).
    • DiffPure seed cycle length k ∈ {1, 2, 3, 5, 10, 50, 100}: from k=3 onward the robustness is the same as the randomized version (Figure 5).
  5. What are some points that can be further explored?

    The authors point out that deterministic smoothing loses theoretical properties such as robustness certificates, and the experiments are limited to CIFAR-10 image classification.

    Limitations and future directions noted by the authors

    • Deterministic smoothing loses the provable robustness certificate (section 6, Theoretical Aspects): after fixing the seed, corruption is no longer a valid Monte Carlo estimate, and the robustness certificate can no longer be proven; theoretically Deterministic Smoothing should be easier to attack, but the empirical attack success rate is essentially the same as that of an attacker unaware of corruption (with at least 5 corruptions).
    • Future direction one (section 6, Future Work): the authors consider it worth explicitly studying the effect of an attacker knowing or not knowing the fixed random seed on its capability.
    • Future direction two (section 6, Future Work): the authors consider it worth studying whether black-box attacks are more helpful for evaluating deterministic versions of randomized defenses—if black-box attacks are more effective against the deterministic versions, this may suggest that the defense has weaknesses masked by randomness.
    • Evaluation recommendation (section 6): the authors recommend that authors of randomized defenses provide deterministic versions for evaluation, because the extra effort required to expose weaknesses of randomized defenses lacks corresponding empirical robustness gains.

    Scope of experiments

    • Experiments are conducted only on CIFAR-10 image classification, involving three defenses—Randomized Smoothing, EBM–Def, DiffPure—and a k-Winners-Take-All case study.
    • White-box attacks use only PGD (including the foolbox and AutoAttack implementations); the Nag Factor experiment is hard-label repeated querying.
    • Subspace Grid-sweep searches 1–6 dimensional subspaces, ε = 0.5 (L2), with PGD up to 20 restarts.
    • The paper does not report the number of test data points and the number of repetitions used in each experiment; Figure 2 and Figure 3 report 95% confidence intervals.
    • The paper discusses black-box attacks: the authors cite Dong et al. (2019) to explain that randomness reduces the effectiveness of black-box attacks for evaluation, and list this as a future direction.
  6. Summarize the main content of the paper

    The authors argue that white-box ML defenses should avoid randomness: randomness reduces security under repeated queries and is not necessary for robustness.

    An analysis paper on adversarial defense design that challenges the popular view that "randomness improves adversarial robustness" and argues that white-box defenses should avoid randomness as much as possible in both deployment and evaluation.

    • Problem to solve: Many defenses rely on randomness, but the authors argue that randomness is neither a source of robustness, and also introduces new vulnerabilities and increases evaluation difficulty.
    • Method highlights: Proposes the Nag Factor threat model—the attacker repeatedly submits the same input, and the probability that a randomized classifier is correct all N times is p^N, which is necessarily no higher than that of a deterministic classifier; constructs fixed-seed deterministic versions of Randomized Smoothing, EBM–Def, and DiffPure and compares them using PGD; proposes Subspace Grid-sweep, which brute-force searches a 1–6 dimensional subspace for adversarial regions to test for gradient obfuscation.
    • Main results:
      • Under repeated queries, the robust accuracy of Randomized Smoothing decreases with the number of attempts, while Deterministic Smoothing remains unchanged, and the randomized version is worse under all corruption settings (Figure 2).
      • Under white-box PGD, the two versions of Randomized Smoothing converge to the same value at about 5 corruptions; the two versions of EBM–Def are almost identical; the deterministic version of DiffPure is 67% versus 88% for the randomized version, and cycling through 3 seeds makes it the same as the randomized version (Figure 3–5).
      • Grid-sweep finds a vulnerable point of 0.95 on the kWTA defense model, while PGD 1 rep finds only 0.63; the authors state that kWTA only makes adversarial examples harder to find by gradient methods (Table 1).
    • Authors' conclusion: Randomness can directly increase a defense's vulnerability to repeated attackers, is often unnecessary for maintaining robustness, and removing randomness allows better evaluation using Subspace Grid-sweep; the authors recommend that future defenses avoid randomness as much as possible, and if randomness is used, its deterministic version should also be evaluated.

Related papers

Show 3 more papers
Read originalarxiv.org