---
title: "On the (Statistical) Detection of Adversarial Examples (2017)"
description: "How statistical tests and an added outlier class detect adversarial examples, with experimental results and limits of the defense."
canonical: "https://research.elamur.ai/free/en/papers/grosse-2017-statistical-detection-adversarial-examples/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/grosse-2017-statistical-detection-adversarial-examples/)

[home](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2017](https://md.research.elamur.ai/free/en/papers/2017/) / On the (Statistical) Detection of Adversarial Examples

# On the (Statistical) Detection of Adversarial Examples

Paper · 2017 · Kathrin Grosse, Praveen Manoharan, Nicolas Papernot et al.

**Authors:** Kathrin Grosse, Praveen Manoharan, [Nicolas Papernot](https://md.research.elamur.ai/free/en/authors/nicolas-papernot/), Michael Backes A and [Patrick Drew McDaniel](https://md.research.elamur.ai/free/en/authors/patrick-drew-mcdaniel/) · **Year:** 2017 · **Venue:** arXiv (Cornell University) · **Licence:** [arXiv — non-exclusive license to distribute](http://arxiv.org/licenses/nonexclusive-distrib/1.0/)

[**330** citations OpenAlex, 2026-10-14](https://openalex.org/works?filter=cites:W2590523583) · arXiv (Cornell University) · [licence](http://arxiv.org/licenses/nonexclusive-distrib/1.0/)

- [arXiv 1702.06280](https://arxiv.org/abs/1702.06280)
- [OpenAlex](https://openalex.org/W2590523583)

## Deep dive: On the (Statistical) Detection of Adversarial Examples

How statistical tests and an added outlier class detect adversarial examples, with experimental results and limits of the defense. · about 37 minutes to read

**In this deep dive**

1. [Summary](#dd-summary)
2. [Ideas worth borrowing](#dd-ideas-worth-borrowing)
3. [How Mova uses it](#dd-how-mova-uses-it)
4. [The problem and its context](#dd-the-problem-and-its-context)
5. [The method, step by step](#dd-the-method-step-by-step)
6. [Experiments and results](#dd-experiments-and-results)
7. [What the ablations show](#dd-what-the-ablations-show)
8. [Limitations](#dd-limitations)
9. [What came after](#dd-what-came-after)

### Summary

An adversarial input is designed to make a classifier give the wrong answer while preserving what the input actually represents. A modified image should still depict the same digit; an altered malicious application should still be malicious. The paper asks whether these manipulations leave a statistical trace that a defender can recognize. Its central proposal is to examine not only whether an input crosses a classification boundary, but also whether it resembles the data the classifier was trained to handle. This connects adversarial defense to a basic assumption of [machine learning](https://md.research.elamur.ai/free/en/concepts/machine-learning/): examples encountered during use should have a sufficiently similar distribution to those available during training.

The authors investigate this idea through complementary mechanisms. A kernel-based statistical test compares a collection of suspicious inputs with a collection of legitimate examples. It operates directly on input features, so it does not require access to a network’s hidden activations. In many of the experiments, a batch containing $50$ adversarial examples is enough to reveal a distributional difference. The result depends on the attack, dataset, and way of grouping the samples. Broad perturbations are generally easier to detect than modifications affecting very few features, and some settings remain difficult even with substantially larger batches.

A batch-level warning does not identify which particular inputs caused it. The second mechanism therefore changes the classifier itself. The authors add an output category reserved for adversarial examples, then train a new classifier using both ordinary examples and adversarial examples generated beforehand. During use, a suspicious input can be assigned to this outlier category rather than forced into an ordinary class. The intended outcomes are either detection or recovery: the classifier can reject the manipulated input, or it can still assign the original correct label. Across the successful settings, the paper reports detection above $80$%. On DREBIN, however, direct attacks remain effective; the main improvement is that a successful attack must change more features.

The experiments cover handwritten digits, Android application features, and medical measurements. They include different attack procedures, comparisons between classifier families, and attacks transferred from substitute classifiers. These comparisons establish that useful statistical separation exists for the tested adversarial examples and that an additional output category can sometimes learn it. They also expose uneven generalization. Training with Jacobian-based saliency-map examples helps against fast-gradient examples on MNIST, while the reverse direction provides much less protection. A small neural network also benefits more than logistic regression on the medical data.

The paper’s broader argument—that adversarial examples should differ statistically from expected inputs—is stronger than the practical guarantee its experiments can supply. A detectable difference in sufficiently large samples does not imply reliable detection of every individual input. Nor do the tested adaptive strategies cover every possible attack. The authors acknowledge that an optimization-based attack subsequently bypassed their approach. The lasting contribution is therefore an experimental framework: distinguish population-level evidence of a distribution shift from input-level detection, measure rejection separately from correct classification, and test a defense against changes in attack strategy.

### Ideas worth borrowing

Distribution checks before prediction. The statistical test works on input features rather than on a particular classifier’s internal representation. This makes it useful as an independent diagnostic: a defender can ask whether incoming data resembles a reference population before relying on the predictions it produces. The transferable idea is to place an explicit check around the assumption that deployment data looks like training data. In another application, that check could support monitoring or investigation, even when it cannot establish that a particular input is malicious.

Separate detection from recovery. An adversarial input can fail to cause harm for different reasons. It may be recognized as suspicious, or the classifier may still return its original correct class. The paper reports these outcomes separately from the remaining errors. That distinction is useful whenever a system can abstain, reject, or request review. A single aggregate success rate can conceal whether the system has learned to answer accurately, learned to recognize uncertainty, or merely changed the distribution of its mistakes.

Condition the reference distribution. A collection of all legitimate inputs may be a weak comparison set for an input assigned to a particular class. The authors therefore compare suspicious examples with class-specific reference samples. This frequently makes the statistical difference easier to detect. The underlying idea applies more widely: evaluate whether an observation is plausible for the category being claimed, instead of asking only whether it resembles the overall population. The experiments also show why this should be tested rather than assumed, since the best conditioning choice varies with the attack.

Train an explicit refusal category. Ordinary classification assigns every input to one of the task’s expected categories, including inputs that fit none of them well. The outlier class gives the classifier another possible response. Its useful feature is conceptual simplicity: examples of unwanted behavior become training data for a distinct decision. Elsewhere, the same design can make rejection observable and measurable. Its limitation travels with it: a category learned from available negative examples does not automatically cover every unfamiliar or adversarial input.

Test transfer in both directions. The MNIST comparison between fast-gradient and saliency-map training is asymmetric. Protection learned from one attack transfers more effectively than protection learned from the other. A researcher can borrow the experimental pattern without assuming the explanation: train on one disturbance, evaluate on another, and then reverse the arrangement. This reveals whether a defense has learned a broad distinction or a narrow signature. Testing only the favorable direction would support a much stronger conclusion than the evidence warrants.

Measure the attacker’s remaining cost. On DREBIN, the defense does not reliably stop direct attacks, but successful manipulations require more changed features. This is a different outcome from detection and should be reported as such. In another setting, a defense may make an attack less convenient without preventing it. Measuring that burden can reveal a useful effect, provided the burden corresponds to a meaningful constraint. The paper’s own unrestricted feature modifications make clear why a numerical increase in perturbation cannot, on its own, establish practical security.

Treat rejected ordinary inputs as evidence. The authors suggest that legitimate examples sent to the outlier category may deserve expert examination. Such cases can expose ambiguous labels, unusual examples, or regions the classifier has learned poorly. The reusable idea is to investigate rejection errors instead of treating them only as a scalar penalty. This does not turn every rejection into a discovery, but it makes the rejection mechanism a possible source of information about the data and its annotation.

### How Mova uses it

For [Mova](https://md.research.elamur.ai/free/en/projects/mova/), a small transparent language system implemented in Rust, the paper suggests a way to separate an ordinary processing decision from a decision about whether an input belongs within the system’s expected operating conditions. This is a possible design direction, not an established Mova capability. The paper contains no experiment on Mova, no Rust implementation, and no evidence about adversarial language inputs. Its contribution to such a system would be an experimental approach and a set of distinctions to preserve.

A concrete starting point would be to define a stable representation of the inputs Mova is expected to accept. The statistical mechanism needs collections of feature vectors and a reference sample; it does not begin with a universal definition of suspicious language. A Mova experiment would therefore have to state what its features represent, which ordinary inputs supply the reference distribution, and what kinds of changes are being investigated. Without those choices, saying that an input is statistically unusual would leave the central measurement undefined.

The batch test could then serve as a monitoring layer. A collection of incoming inputs could be compared with a reference collection drawn from the intended operating domain. A detected difference would support the narrower conclusion that the incoming collection has changed in the measured representation. It would not establish that the inputs are attacks, identify the responsible examples, or explain the change. This follows directly from the paper’s separation between detecting a distributional discrepancy and assigning an adversarial label to an individual observation.

The class-wise experiments suggest a more specific possibility. If Mova makes an explicit categorical decision, its assigned category could determine the reference group used for a plausibility check. The question would become whether an input resembles ordinary examples receiving that category. This would mirror the paper’s comparison with the class predicted after perturbation. It would remain an idea to test: the MNIST fast-gradient exception shows that conditioning on the predicted class is not always the most effective choice.

An explicit rejection outcome is another possible borrowing. Instead of requiring every input to produce an ordinary decision, Mova could expose a separate result for cases outside a defined acceptance region. The paper’s learned outlier class supplies one example of this principle, but it does not prescribe how Mova should implement it. A transparent language system would need its own account of what triggers rejection and which evidence a user can inspect. The Rust implementation language does not establish any of those properties on its own.

Evaluation should preserve the paper’s distinction between detection, recovery, and error. For a Mova adaptation, an input that receives the intended answer should be counted differently from one that is rejected. Ordinary inputs rejected incorrectly would need their own measurement. These distinctions matter because a system can appear more resistant to attacks simply by refusing more inputs. The paper makes that tradeoff visible through legitimate-data accuracy, false outlier assignments, and the separate outcomes on manipulated inputs.

Finally, the strongest practical lesson is to avoid treating a successful first detector as a finished defense. A Mova investigation could compare different perturbation procedures, evaluate transfer from one procedure to another, and test inputs crafted with knowledge of the rejection mechanism. Those would be proposed experiments, not results inherited from the paper. The authors’ own acknowledgment of a later bypass makes the boundary clear: statistical differences can motivate a detector, while reliable security still requires evidence about the particular system, representation, and adversary.

### The problem and its context

#### Why an ordinary prediction rule becomes vulnerable

A classifier learns from a finite collection of labeled examples. During ordinary evaluation, its test data is expected to resemble the population represented by those examples. An adversary changes that arrangement. Instead of supplying an independently sampled observation, the adversary chooses an input because it is likely to produce a particular mistake.

The paper focuses on manipulations performed after training. Its motivating security example is malware classification. An application initially recognized as malicious can have its feature representation modified until the classifier calls it benign. The attack succeeds only in the classifier’s decision: the intended interpretation is that the application remains malicious. The corresponding image example is a digit whose altered pixels cause an incorrect label while leaving its identity intact.

This distinction between the classifier’s response and the input’s underlying class is essential. An ordinary example of another digit is not an adversarial example merely because it receives another label. The attack is meant to preserve the original meaning or function while changing the computational decision. The paper therefore discusses perturbation constraints as part of the attack setting. Images should remain recognizable, and malware should preserve its unwanted behavior.

The experiments deliberately relax some of those practical constraints. The authors want to examine strong perturbation procedures rather than establish that every generated example is a deployable attack. That choice broadens the attack search, but it also affects interpretation. A feature-space manipulation can be effective against a classifier without corresponding to a valid altered application or a meaningful medical observation.

#### Earlier defenses and the problem of adaptation

The paper describes adversarial training as a defense that includes manipulated examples during learning. It also discusses defensive distillation, which changes the training procedure to make established attacks harder to carry out. According to the authors, success against the attack used during development is insufficient: an adversary may change strategy and recover the ability to cause errors.

One concern is gradient masking. A defense may interfere with the information an attack uses to find a damaging perturbation while leaving vulnerable decisions in place. An attack computed directly against the defended classifier can then appear weak even though another route finds inputs that still cause mistakes. This is why the paper places substantial weight on substitute classifiers and transfer attacks.

Transferability means that an adversarial example constructed for one classifier can also fool another. The paper describes earlier black-box attacks that exploit this property. An adversary can learn an auxiliary predictor, generate adversarial examples against it, and submit those examples to the actual target. The attacker need not use the target’s own gradients to expose its errors.

The authors also mention game-theoretic approaches to adversarial classification, characterizing them as computationally demanding. Their proposed alternative begins with a different question: do attack-generated inputs have a feature distribution distinguishable from the expected one? If so, perhaps the defender can recognize something about the attack inputs themselves, rather than only making a particular optimization procedure less effective.

#### Why statistical testing is a natural tool

A two-sample test asks whether collections of observations are compatible with a shared source distribution. This is well matched to the paper’s first question because it does not require a semantic description of every possible attack. The defender needs a reference sample of expected inputs and a comparison sample containing the observations under investigation.

The paper reviews several earlier statistical approaches. Hotelling’s test concerns equality of means, while other methods use graph or tree structure. The authors choose a kernel-based test introduced by Gretton and colleagues because their inputs can be high-dimensional. The test measures a discrepancy between samples without requiring explicit probability distributions over all possible inputs.

That feature-space placement distinguishes the proposal from adversarial detectors discussed in the related-work section. Those approaches use internal neural-network activations or statistics derived from them. Their measurements depend on the particular network being examined. The proposed statistical test instead receives the input vectors directly.

This independence has a precise scope. It means that the same testing principle can be applied around different classifier architectures. It does not mean the test ignores the representation of the data. The representation still determines which differences are visible, and the kernel determines how observations contribute to the comparison.

#### Why a separate outlier category is a related but different contribution

The paper does not claim to invent rejection as a general classification idea. It discusses earlier work by Nguyen and colleagues that used an outlier category, and work by Bendale and colleagues on open-set networks that avoid confident predictions everywhere in the feature space. The authors distinguish their contribution through its adversarial motivation and evaluation.

They also compare their design with an auxiliary detector attached to a neural network. Their own approach adds a task output instead of a separate detection network whose operation depends on intermediate features. The proposed category is trained using precomputed adversarial examples, all assigned the same outlier label despite differences in their original classes or generation procedures.

This makes the outlier mechanism a learned approximation to a distributional distinction. The statistical test supplies evidence that collections can differ; the augmented classifier attempts to recognize individual members of the unwanted region. The connection is intuitive, but the second capability does not follow automatically from the first. Learning it, and testing how far it generalizes, is the purpose of the remaining experiments.

### The method, step by step

The method has a statistical branch and a classification branch. The first measures whether attack-generated data differs from expected data. The second uses examples of that difference to train an individual-input detector. They share a motivation, but the experiments evaluate them separately instead of presenting a fully validated combined pipeline.

From distribution comparison to individual detection The steps in order.

#### Define the ordinary classification task

The paper begins with a classifier that maps an input to a discrete label.

```
f(x) ↦ y
```

Here, f is the classifier, x is an input represented by features, and y is its assigned class. The input belongs to an input space X, while labels belong to a label set Y. Although the final decision is discrete, a classifier may first produce real-valued scores or probabilities and choose the class with the largest value.

A feature is one measured component of the input. In the image experiment, features correspond to pixel values. In the Android experiment, they encode properties of applications. In the medical experiment, they are selected measurements. The same statistical vocabulary applies across these settings, although the meaning and permitted modification of a feature differ.

For each class, the authors distinguish an underlying population distribution from what training allows the classifier to approximate. They write these as D_realᶜⁱ and D_trainᶜⁱ. The superscript Cᵢ identifies a particular class. The first distribution describes the class in the world; the second represents what is learned from the available examples.

The classes divide the training collection.

```
⋃ᵢ Cᵢ = X
```

The union symbol means that combining the class subsets Cᵢ recovers the training inputs X. The index i ranges over the task’s classes. This use of X refers to the training collection; elsewhere, the same letter also appears in the paper’s notation for the input domain.

For neural networks, the background discussion expresses the learning goal through prediction error.

```
‖f(x) − y‖
```

The expression measures a discrepancy between the output f(x) and the known target y. The norm signs indicate an error magnitude. This is a general description of fitting predictions to labeled examples, rather than a complete specification of every loss used in the experiments.

#### Define an adversarial modification

The attacker starts with an input and searches for a nearby version that changes the classifier’s decision.

```
f(x′, θ) ≠ f(x, θ), where x′ = x + δ and min δ
```

The original input is x, the modified input is x′, and θ denotes the classifier’s learned parameters. The perturbation δ has the same dimensionality as x. The inequality states that the decisions differ. The final term expresses the desire to keep the perturbation small.

The notation does not identify a universal norm or a complete constrained optimization problem. The experiments use attack-specific notions of perturbation, including an intensity parameter and the number of changed features. Those quantities should therefore be interpreted within their respective attack settings.

The authors consider both white-box and black-box knowledge. A white-box attacker knows the architecture, parameters, and training data. A black-box attacker interacts with the target through its outputs instead of receiving all of that information directly. In the transfer experiments, the authors deliberately provide substitute classifiers with the victim’s training data to create a strong comparison.

#### State the distributional hypothesis

The paper denotes the distribution of generated adversarial examples by D_advᶜⁱ. Its argument is that these examples preserve membership in their original semantic class while occupying regions not adequately represented by the learned class distribution.

```
D_advᶜⁱ ≠ D_trainᶜⁱ
```

D_advᶜⁱ is the distribution induced by adversarial generation for class Cᵢ. D_trainᶜⁱ is the learned distribution associated with that class. The inequality motivates a test for statistical separation.

The authors support this claim with an argument about approximation error: finite training data leaves a gap between the real class distribution and the learned one, and an adversary searches for inputs that exploit that gap. A careful interpretation should distinguish this motivation from a complete theorem about every classifier. Classification errors and distributional differences are related in the argument, but finite-sample detection still has to be demonstrated experimentally.

The practical hypothesis is narrower: a bounded collection of examples generated by available attacks will contain enough evidence for a consistent test to distinguish it from ordinary data. Consistency means that, when distributions differ, the test eventually rejects equality as the amount of evidence grows. It does not specify that the required collection will always be small.

#### Compare two samples

The statistical setup uses a reference collection and a comparison collection.

```
X₁ ∼ p, |X₁| = n; X₂ ∼ q, |X₂| = m
```

X₁ is sampled from distribution p and contains n observations. X₂ is sampled from q and contains m observations. The symbol ∼ means “sampled from,” and vertical bars indicate the size of a collection.

The competing hypotheses are:

```
H₀: p = q; H_A: p ≠ q
```

H₀ is the null hypothesis that both collections come from the same distribution. H_A is the alternative that their distributions differ. The test assesses whether the observations provide sufficient evidence against H₀.

The formal testing function is:

```
T(X₁, X₂): 𝒳ⁿ × 𝒳ᵐ → {0, 1}
```

T receives the collections X₁ and X₂. The space 𝒳 is the domain of individual observations; the superscripts indicate collections of the relevant sizes. The output set represents the binary testing decision.

The test also produces a p-value. Under the null hypothesis, this describes how surprising an outcome at least as extreme as the observed one would be. It is compared with a significance threshold α chosen beforehand. A sufficiently small p-value leads to rejection of the shared-distribution hypothesis. It should not be read as the probability that an input is malicious.

#### Measure discrepancy with a kernel

The main distance measure is maximum mean discrepancy, abbreviated MMD. Its sample-based expression compares averages of functions evaluated on the collections.

```
MMD_b[ℱ, X₁, X₂] = sup_{f ∈ ℱ} ((1/n) Σᵢ₌₁ⁿ f(x₁ᵢ) − (1/m) Σᵢ₌₁ᵐ f(x₂ᵢ))
```

MMD_b denotes the biased sample estimate. ℱ is the function family over which the comparison is made. The supremum selects the largest achievable difference between the sample averages. The observations x₁ᵢ belong to X₁, and x₂ᵢ belong to X₂. The counts n and m normalize the respective sums.

The letter f in this expression denotes a function used in the distributional comparison, rather than necessarily the classifier introduced earlier. The authors use a Gaussian kernel in their implementation. This lets the comparison operate through relationships among input observations without first estimating an explicit probability for every possible feature vector.

The paper also measures energy distance as an initial diagnostic. It describes this as a related distance-based comparison without the kernel transformation used in its MMD setup. Both quantities help establish whether different perturbations produce visibly different sample statistics before the authors turn to hypothesis testing.

The background discusses both biased and unbiased MMD formulations. The experimental procedure specifically reports computing the biased estimate with a Gaussian kernel. It then uses resampling to estimate the reference behavior needed for the test.

#### Estimate the test’s reference behavior

The authors use bootstrapping, meaning repeated sampling with replacement from available observations. In the experimental implementation, they perform $10,000$ iterations and compare the resulting p-value with $0.05$.

The paper defines confident detection operationally. For a given sample size, it runs the comparison on $200$ randomly selected pairs of collections. A setting is confidently detected only if every run rejects the null hypothesis. This is stricter than reporting that rejection occurs frequently, and it makes the meaning of the sample-size results concrete.

The reported acceptance percentages count how often the null hypothesis survives across those repetitions. Lower acceptance is desirable when the comparison collection is adversarial. For ordinary data, acceptance should remain high. The test therefore needs both kinds of evaluation: detecting manipulated collections and avoiding persistent warnings on legitimate ones.

The authors first compare whole datasets, then repeat the procedure with class-specific collections. In the class-wise version, suspicious examples can be grouped according to their original labels or according to the labels assigned after manipulation. These arrangements ask different questions about plausibility and produce different detection strengths.

#### Train the additional category

The individual detector begins with an ordinary trained classifier N_in and labeled training data.

```
D = {X, Y}
```

D is the training dataset, X contains its inputs, and Y contains their ordinary labels. The initial classifier is trained on these pairs.

The authors then generate adversarial inputs X_in against N_in. A fresh classifier N_p1 is trained on the expanded input collection.

```
X ∪ X_in
```

X supplies the ordinary examples and X_in supplies the precomputed adversarial examples. The union symbol indicates that both collections are used. Ordinary inputs retain their task labels; every generated adversarial input receives the new category C_out.

All attack types used in this training stage share that outlier label. The classifier is not asked to distinguish which generation procedure produced an example. Training batches contain $2/3$ ordinary examples and $1/3$ adversarial examples.

This procedure differs from regenerating adversarial examples continually against the classifier being trained. The negative examples are computed beforehand using another trained classifier. That distinction matters because the new decision boundaries may differ from the ones that produced the training attacks.

#### Evaluate against fresh attacks

Testing uses a separate labeled collection.

```
D_t = {X_t, Y_t}
```

D_t is the test dataset, with inputs X_t and ordinary labels Y_t. The authors generate fresh adversarial examples from these inputs against the augmented classifier, then measure their outcomes.

For the saliency-map attack, the target is the most competitive ordinary class other than the original decision. If the outlier category would otherwise be selected as the alternative, it is excluded. This prevents the attack from being credited merely for steering an input into the detector’s rejection category.

The outcomes are recovery, detection, and remaining error. Recovery means the perturbed input receives its original class. Detection means it receives C_out. Error covers adversarial inputs assigned another ordinary class. Ordinary test accuracy and false outlier assignments are measured separately.

#### Use different attack and classifier families

The fast gradient sign method, or FGSM, changes input features using the sign of a gradient. In the paper’s description, it is computationally inexpensive and affects the input broadly. Its perturbation magnitude is controlled by ε, and it does not aim at a specified alternative class.

The Jacobian-based saliency map approach, or JSMA, repeatedly selects features whose modification is useful for reaching a target class. It tends to change fewer features and requires more computation. The authors use cleverhans implementations for these attacks, naming v.0.1 for FGSM and v.1 for JSMA.

The SVM attack moves an input in relation to a linear separating boundary. The decision-tree attack searches toward a nearby leaf of another class and changes features associated with the relevant path conditions. Including these procedures broadens the investigation beyond a single neural-network attack.

The classifiers likewise vary with the data. MNIST uses a convolutional network, DREBIN a fully connected network, and MicroRNA a small neural network as well as logistic regression. Decision trees and linear support vector machines appear in the statistical experiments. The authors state that reproduction code was available by contacting them; they do not present a single integrated public implementation as the basis for the complete experimental pipeline.

### Experiments and results

#### Data and ordinary prediction performance

MNIST supplies grayscale digit images covering labels $0$ through $9$. The dataset description gives $60,000$ images and identifies $10,000$ as test examples, with each image measuring $28x28$ pixels. Elsewhere, the statistical experiments describe sampling from $60,000$ training observations and refer to a training-set size of $50,000$. These statements are not fully consistent, so they should not be silently converted into a single reconstructed split.

The MNIST neural network has convolutional layers using $5x5$ filters, each followed by max pooling, and a fully connected layer containing $1024$ neurons. Its ordinary-data accuracy before adding the defense is $99.2$%. The paper also reports MNIST accuracy of $92.7$% for the linear SVM and $67.4$% for the decision tree. These weaker starting classifiers affect which attack experiments are informative.

DREBIN contains $129,013$ Android applications: $123,453$ benign and $5,560$ malicious. The original representation has $545,333$ binary features. To accelerate adversarial generation, the authors reduce it to $955$ features. The random test partition contains one tenth of the applications.

The DREBIN neural network uses fully connected layers with $200$ neurons each. Before augmentation, its reported accuracy on legitimate test data is $97.7$%. The paper also states that the DREBIN classifiers generally exceed $97.5$% accuracy.

MicroRNA contains $3966$ observations, including $1280$ breast-cancer serum samples; the rest are controls. The authors select the $5$ features identified as most useful by the dataset’s original investigators. When a split is needed, they use a random training/test arrangement with a $1/10$ ratio.

Those medical features have different means and variances. Perturbations are therefore scaled with reference to feature variance rather than treated as identical raw changes across all measurements. The neural network has a hidden layer with $4$ neurons. The paper reports ordinary accuracy around $95$% for both the neural network and logistic regression, with a more specific logistic-regression baseline of $95.4$% in the outlier-training discussion.

#### Statistical distances reveal different attack footprints

The initial MNIST analysis compares ordinary data with adversarially altered collections using MMD and energy distance. Distances are averaged over randomly sampled collections containing $1,000$ inputs. The comparison between unmodified training and test data serves as a reference.

Most attacks increase the measured separation. FGSM produces a larger discrepancy as ε increases. JSMA and the decision-tree procedure produce subtler effects, consistent with their sparse modifications. The paper reports an average of $20$ changed pixels for JSMA and $1$ changed pixel for the decision-tree attack in this comparison.

The authors also examine mirroring, sub-sampling, and Gaussian blur. These transformations are useful controls because they change the inputs without being the adversarial procedures under investigation. Mirroring and sub-sampling affect both measured distances. Gaussian blur has a substantial effect on energy distance while producing a less pronounced MMD response.

These results are preliminary evidence, not calibrated detection rates. The authors explicitly treat the distance comparison as a sanity check and do not supply variances for it. Its value is to show that attacks can leave different statistical footprints and that the choice of discrepancy measure matters.

#### Batch detection often needs relatively few examples

For legitimate data, null-hypothesis acceptance is generally around $95$%, across the tested sample sizes. That result provides an ordinary-data reference for interpreting rejection on adversarial collections.

For many attack and dataset combinations, collections of $50$ adversarial examples are sufficient for confident detection under the paper’s repeated-test definition. The strongest separation is not universal. MNIST saliency-map examples need at least $100$ observations in the whole-distribution comparison. The decision-tree attack on MNIST resists detection in the reported setting.

The SVM attack is easier to identify statistically. A collection of $10$ adversarial examples suffices for confident rejection. This fits the earlier distance analysis, where that attack produced a relatively large discrepancy.

The class-wise procedure improves some of the difficult settings. On MNIST, it reduces the requirement for JSMA examples to $50$. The chart isolates that controlled comparison.

MNIST JSMA statistical detection, minimum sample size Class-wise comparison reaches confident detection with a smaller collection.

**The numbers**

| System or setting | adversarial examples required |
| --- | --- |
| Whole-distribution test | 100 |
| Class-wise test (this paper) | 50 |

For DREBIN, class-wise testing brings the reported requirement down to $10$ examples. On MicroRNA, the change concerns the decision-tree attack, where confident detection is also possible with $10$.

The paper generally finds that comparing manipulated inputs with legitimate examples from their predicted class is more effective than comparing with their original class. MNIST FGSM is an exception to that tendency. This prevents the class-wise result from being reduced to a universal rule about which reference label is best.

Some statistical experiments are omitted because the attack does not reduce accuracy sufficiently or the initial classifier is already too weak. The figure caption identifies attack reductions below $\<30$% as one exclusion condition. Other settings remain undetected even with $500$ observations. The headline sample-size result therefore describes successful tested configurations, not a fixed detection requirement for every attack.

#### The additional category has an ordinary-data cost

Adding the outlier output changes behavior on legitimate inputs. On MNIST, training converges somewhat more slowly, and ordinary accuracy lies between $98.0$% and $98.8$%, compared with the original $99.2$%.

On DREBIN, the paper describes a mean accuracy decrease of $0.2$% after adding the category. On MicroRNA, logistic-regression accuracy moves from roughly $95.4$% to $93.4$%. The authors report a similar ordinary-data effect for the neural network.

The MNIST false-positive analysis gives $0.5$% as an example of legitimate inputs wrongly assigned to the outlier category. This measurement should remain separate from overall accuracy. An ordinary input can also receive an incorrect ordinary label, and those errors have a different practical meaning from rejection.

#### MNIST detection depends on perturbation strength

For MNIST, the outlier mechanism can be trained with either FGSM or JSMA examples. The training settings described in the main detection-table caption are ε = $0.275$ for FGSM and ε ≤ $200$ for JSMA.

The reported trend is that stronger perturbations are more frequently detected, while weaker perturbations are more frequently recovered as their original class. Detection and recovery therefore substitute for one another to some extent as attack intensity changes.

That pattern explains why detection alone is an incomplete success measure. A small perturbation that remains correctly classified does not need to be rejected to defeat the attack. Conversely, a detector that rejects a heavily altered input has prevented an ordinary-class error without necessarily learning its original identity.

The paper describes a large fraction of MNIST adversarial inputs as either recovered or detected. Its broad claim of detection above $80$% applies to successful dataset settings, but the detailed table entries are not all reproduced numerically in the narrative. The result should therefore be presented with its qualitative dependence on attack and intensity rather than expanded into unsupported per-setting values.

#### DREBIN exposes a failure of direct protection

DREBIN is the clearest counterexample to a simple claim that the added category solves direct attacks. For FGSM, the authors report misclassification around $92.3$%, largely independent of ε. They then describe a post-training value of $92.2$% as accuracy while also stating that the classifier could not be hardened. The change in metric wording makes that particular before-and-after pair ambiguous.

The JSMA description is clearer. The original attack produces $99.991$% misclassification while changing $2.3$ features on average. Training with adversarial examples does not yield a substantial robustness improvement, but the required modification grows to $5.8$ features.

This is evidence of increased perturbation burden, not successful detection. The distinction is central to the paper’s overall findings. On this dataset, the defense’s favorable result concerns how much the attacker changes, while the direct attack still succeeds.

A modified saliency-map procedure with a weaker feature-selection heuristic initially changes $6.6$ features on average. After training against examples from that procedure, the same attack cannot generate adversarial inputs within a limit of $90$ changed features. That result demonstrates strong protection against this particular weaker search, while leaving the stronger attack’s effectiveness intact.

#### MicroRNA shows why classifier capacity matters

On MicroRNA, JSMA succeeds on only $40$% of generated examples, so the individual-detection study emphasizes FGSM. At ε = $1.0$, the original logistic regression has $95.7$% adversarial misclassification. Increasing ε further does not improve attack success in the reported experiment.

After outlier-class training at the same intensity, logistic regression still has $87.2$% adversarial error. Smaller perturbations are handled better, but the strong-perturbation result remains poor. The authors suggest that the linear classifier lacks the capacity needed to learn the desired distinction.

They therefore train a neural network. Before augmentation, it can be attacked with the same perturbation magnitude and success described for the baseline. With an outlier category, its adversarial misclassification falls to $0.7$% at the strongest ε setting.

MicroRNA FGSM at ε=1.0, adversarial misclassification The augmented neural network handles this attack much better than the logistic-regression settings.

**The numbers**

| System or setting | misclassification % |
| --- | --- |
| Original logistic regression | 95.7 |
| Logistic regression with outlier class | 87.2 |
| Neural network with outlier class (this paper) | 0.7 |

The comparison changes both capacity and training treatment across the full set of rows. It therefore supports a capacity-dependent interpretation, while stopping short of isolating every architectural cause. The paper’s within-family descriptions establish that the outlier category is helpful for the neural network and much less effective for logistic regression at the strong perturbation.

#### Transfer attacks produce a different vulnerability pattern

For black-box evaluation, the authors train substitutes using the same data as the defended classifier. One substitute has only the original task categories, denoted BB. Another includes the outlier category, denoted BB+1. Adversarial examples generated against these substitutes are then tested on the victim.

On MNIST, transferred FGSM examples are handled well. The paper reports no misclassified examples in the stated settings when ε > $0.4$ for BB+1 and ε > $0.275$ for BB. For transferred JSMA, adversarial misclassification is approximately $6.7$% with BB+1 and $2.7$% with BB. Most manipulated inputs are assigned to the outlier category.

DREBIN is markedly more resistant to transferred JSMA than to direct JSMA. With the augmented substitute, victim misclassification is $35.8$%, and $47.1$% of the inputs are detected. With the ordinary substitute, error is $0.8$%, and detection reaches $98.6$%.

DREBIN transferred JSMA, victim misclassification The substitute’s output categories strongly affect how often the transferred attack succeeds.

**The numbers**

| System or setting | misclassification % |
| --- | --- |
| Substitute with outlier class | 35.8 |
| Substitute without outlier class (this paper) | 0.8 |

The star marks the better-performing setting for the paper’s defended victim. Both rows evaluate that same defense; the comparison changes the attacker’s substitute.

MicroRNA again shows uneven behavior. Logistic regression detects smaller transferred perturbations through $0.4$, but adversarial error can rise to $88$% for larger ε. Neural networks do better in the maximum-perturbation setting, ε = $1.0$. The paper describes logistic regression as generally stronger under BB and neural networks as generally stronger under BB+1, while noting exceptions.

### What the ablations show

The paper does not present a single systematic component-removal ablation, but it offers several controlled comparisons that probe the proposed mechanisms and their failure cases.

#### Whole-distribution and class-wise comparisons test the reference choice

The statistical test is first applied to broad collections and then to class-conditioned collections. The kernel-based principle remains the same; the reference population changes.

The improvement for MNIST JSMA shows that a distributional difference can become more visible when ordinary variation across classes is removed. A manipulated example need not look dramatically unusual compared with all digits to look unusual compared with the particular digit class being considered.

Grouping by the original label and grouping by the predicted label provide another comparison. The predicted-class reference generally works better, suggesting that a wrong decision can be accompanied by poor statistical fit to the category being claimed. The MNIST FGSM exception shows that the geometry of the perturbation still matters.

This analysis does not mean the defender must know the original label during deployment. Original-label grouping is an experimental comparison that helps explain where the discrepancy lies. Predicted-label grouping is more directly connected to information the classifier itself supplies.

#### Perturbation magnitude tests how visible an attack becomes

Varying ε in FGSM reveals a recurring relationship: larger perturbations tend to produce stronger statistical separation and higher outlier detection. This is consistent with the distance measurements and the later detection results.

The recovery trend moves differently. Small changes can remain within a region where the augmented classifier returns the original class. As changes become larger, explicit detection becomes more important.

This comparison helps distinguish a detector that responds only to a large visual or numerical disturbance from a classifier that also preserves correct decisions under smaller changes. The paper reports evidence of both behaviors in successful settings, without establishing that either behavior covers all perturbation directions.

#### Sparse and broad attacks stress different weaknesses

FGSM changes inputs broadly, while JSMA selects features iteratively and the tree attack can modify very few features. Their statistical detectability differs accordingly.

The failure to detect the MNIST decision-tree attack in the reported setting is particularly informative. It shows that attack success need not create an easily measurable discrepancy for the selected test and available sample sizes. The average change of $1$ pixel in the distance experiment provides a concrete indication of how sparse that attack can be.

These comparisons also limit the interpretation of a favorable average result. A detector may work well for one family of perturbations because that family leaves a strong footprint. Evaluating a sparse alternative tests whether the defense has learned something broader than the most visible attack signature.

#### Cross-attack training reveals asymmetric generalization

The authors train the MNIST outlier category on one attack family and evaluate another. JSMA-based training also protects against FGSM. With sufficiently large perturbations, the reported misclassification is below $3$%.

The reverse arrangement is much less successful. An outlier category trained with FGSM examples gives only a modest improvement against JSMA compared with the original classifier.

This asymmetry is one of the paper’s most useful analyses. It shows that the existence of a shared outlier label does not make all adversarial training examples interchangeable. The regions covered by one generation procedure may overlap the vulnerabilities exposed by another in only one direction.

The authors suggest possible explanations involving targeted versus untargeted search and the relative quality of the perturbation procedure. They do not isolate those causes experimentally. The supported conclusion is the directional result itself.

#### The weaker DREBIN heuristic tests dependence on attack quality

The DREBIN experiment with a less effective feature-selection heuristic changes the attack’s starting difficulty. Training stops that modified procedure within the stated feature budget, even though the stronger JSMA remains successful.

This is a warning about interpreting attack failure. If a defense prevents a weaker search, the result can reflect properties of that search rather than elimination of the underlying vulnerability. The paper does not hide the stronger direct-attack result, which makes the comparison valuable.

At the same time, the stronger attack’s need for more changed features remains a distinct observation. The defense alters the search landscape or useful perturbation region enough to increase the reported burden, even where it does not prevent evasion.

#### Ordinary-input errors expose different learned regions

The MNIST confusion matrices suppress correct classifications so that the remaining mistakes are easier to inspect. Training with FGSM leaves ordinary-class confusion relatively similar to the original case. Training with JSMA sends more mistaken ordinary inputs to the outlier category.

The authors interpret this as possible evidence that the attack families occupy different regions relative to the ordinary classes. They suggest that JSMA examples may lie between class regions, while FGSM examples may occupy a more separate region.

That geometric account is a hypothesis drawn from observed errors. The matrices do not directly measure the proposed geometry. What they establish is that training on different adversarial examples changes which legitimate inputs are rejected.

#### Mixtures test the difference between an attack collection and a realistic stream

The authors mix adversarial examples with legitimate inputs and also combine different attack types. Statistical confidence falls as the adversarial fraction becomes smaller. Larger comparison collections can provide more evidence, while small collections with sparse adversarial content are harder to flag.

Combining attacks also weakens detection when one component is intrinsically difficult for the test. The troublesome MNIST tree examples reduce the clarity of collections that contain them.

These experiments directly qualify the attractive small-sample findings. A collection consisting entirely of detectable adversarial examples is easier to distinguish than an incoming stream containing occasional attacks. This is also the practical motivation for adding an individual-input mechanism.

### Limitations

#### The authors’ stated limits

The authors explicitly identify sample size as a major constraint on statistical testing. A consistent test can distinguish different distributions given enough evidence, but the amount required may be impractical or potentially unbounded for operational purposes. Small perturbations and changes to few features are less likely to produce confident detection in the tested setup.

They also state that the batch test cannot identify the particular manipulated members of a collection. Rejection says that the collections differ statistically. It does not attach an adversarial label to every observation in the suspicious group.

The individual detector depends on generalization from the adversarial examples used during training. The authors acknowledge that covering the entire feature space outside legitimate class regions is not feasible. Their outlier category therefore represents sampled unwanted regions instead of a complete boundary around every valid input.

DREBIN is an explicit weakness. Direct JSMA remains effective in spite of outlier training. The defense increases the number of altered features, but it does not reliably convert those attacks into detected outliers or recovered inputs. The paper discusses feature count, perturbation size, class distances, and adversarial variability as possible factors, without establishing a single explanation.

The authors also acknowledge the absence of formal security guarantees. Their adaptive and transfer experiments test particular strategies. They do not prove resistance to all adversaries that fit the broad knowledge assumptions.

Most decisively, the abstract includes a later qualification: optimization-based attacks have been shown to bypass the approach. The authors note their greater computational effort, but the qualification still rules out treating the defense as generally secure.

Poisoning is outside the evaluated scope. The discussion suggests that statistical reasoning might also help with malicious training data, yet the experiments concern attacks on inputs after training. Similarly, combining the mechanisms with defensive distillation or other defenses is proposed as future work rather than demonstrated as an evaluated system.

#### A distribution difference is not an attack diagnosis

A careful reader should separate statistical abnormality from malicious intent. The geometric controls already show that non-adversarial transformations can change the measured distributions. A warning from the test therefore indicates a discrepancy under its representation and kernel, not an independent finding about why the discrepancy occurred.

This distinction affects both false alarms and interpretation. A legitimate change in incoming data could require investigation without representing an attacker. Conversely, an attacker may produce inputs whose measurable distributional difference is too small for the available collection.

The same issue applies to the learned category. Its label for training indicates that an adversarial procedure generated the example. It does not establish a complete semantic characterization of every input the category will later receive.

#### Misclassification does not imply finite-sample separability

The paper’s formal intuition treats adversarial errors as evidence that attack-generated data differs from the learned class distribution. That is a useful motivation, but the transition from classification behavior to distributional detection requires care.

A classifier’s decision rule and a statistical sample distribution are different objects. A decision error does not by itself specify how large a discrepancy will be under a chosen kernel, how many examples will reveal it, or whether an individual observation can be recognized reliably.

The experiments address those practical questions for particular generation procedures. They provide empirical support for detectability in those cases. They do not turn the broad distributional argument into a universal finite-sample detection theorem.

The paper itself supplies evidence for this narrower reading: the tree attack remains hard to detect, sparse perturbations need more favorable comparisons, and benign dilution weakens the test. Those are not incidental exceptions to a guaranteed operational procedure; they define its practical scope.

#### The attack representation is not the deployed application

DREBIN uses a reduced feature representation, and the authors allow modifications without the restrictions used in earlier malware work. That strengthens the adversary in feature space, but it does not demonstrate that every modified vector corresponds to an executable application preserving malicious behavior.

FGSM and the SVM attack can also produce non-binary DREBIN features. The paper observes that these can be recognized as invalid for a binary representation. Statistical detection of such inputs is therefore not equivalent to detecting an attacker who respects the representation’s basic constraints.

The medical experiment has a related interpretive boundary. The paper evaluates classifier decisions on modified measurements. It does not establish that those modifications correspond to feasible changes in serum samples or to a realistic medical attacker’s capabilities.

These are limits of external applicability rather than reasons to discard the experiments. The experiments reveal behavior under defined feature perturbations. Practical security requires an additional account of which perturbations a real adversary can produce.

#### Capacity and attack strength are not fully isolated

The MicroRNA results support the claim that classifier choice matters. The neural network learns a much more useful outlier distinction than logistic regression at strong perturbation. However, the comparison does not isolate every architectural or optimization factor responsible for that difference.

Likewise, the DREBIN heuristic comparison shows sensitivity to attack procedure, but it does not supply a general measure of attack optimality. Preventing the weaker procedure cannot establish that all procedures with similar feature budgets will fail.

Cross-attack transfer is evaluated on MNIST, not across every dataset. The authors state that the corresponding experiment was not performed on DREBIN or MicroRNA because only one applicable attack was available for those settings. Generalization across attack families therefore has a narrower empirical basis than the full collection of datasets might suggest.

#### Reported metrics require careful reading

The paper typically separates recovered inputs, detected inputs, and remaining errors. That is a strength, but broad statements about robustness can still combine different phenomena. Low error may result from correct classification, rejection, or both.

The DREBIN FGSM passage introduces an additional ambiguity by switching from misclassification terminology to accuracy terminology around the post-training result. The surrounding discussion says hardening did not succeed, but the numerical pair should not be treated as a clean comparison on a consistently named metric.

The source also gives inconsistent descriptions of the MNIST training and test counts. Those statements do not justify reconstructing an exact split beyond what is explicitly reported.

Finally, several result tables are described through captions and narrative rather than complete numerical entries. The prose supports the central trends and selected values, but it does not support inventing full detection curves, unreported confidence intervals, or precise values read visually from figures.

#### A measured perturbation increase is not a complete security outcome

More changed features can mean greater attacker effort, but its practical importance depends on the feature constraints. If many features are freely alterable, a larger count may remain affordable. If a few features are tightly constrained, the same kind of increase could matter substantially.

The paper measures the change in its experimental representation. It does not establish a universal conversion from feature modifications to real-world attacker expense. The defensible conclusion is therefore that the defense increases the measured perturbation requirement in the stated DREBIN experiment.

The same restraint applies to the transfer results. Strong resistance to examples generated on a substitute does not supersede successful direct attacks. Different attack routes expose different properties of the defended classifier, and the strongest remaining successful route matters when assessing protection.

### What came after

The most consequential later development discussed by the authors is a bypass. They cite Carlini and Wagner’s work on defeating adversarial detectors and state that optimization-based attacks can overcome their approach. The paper characterizes these attacks as requiring greater computational effort. That distinction concerns attack cost, while the security implication is that the outlier mechanism does not provide general protection against a sufficiently adapted search.

This development sharpens the interpretation of the original experiments. The statistical test demonstrates distributional separation for tested attack populations. The learned category recognizes many examples from tested procedures and sometimes generalizes beyond its training attack. Neither result establishes that a future attacker cannot optimize around the decision mechanism. The later bypass is therefore directly relevant to the paper’s ambition to move beyond an arms race.

The later citing work [Baseline Defenses](https://md.research.elamur.ai/free/en/papers/jain-2023-baseline-defenses-adversarial-attacks-against/) addresses adversarial attacks against aligned language systems. Its title places it in the evaluation of defenses under adversarial input. The available citation establishes that it refers to this paper, but it does not specify which mechanism it adopts, critiques, or uses as background.

That boundary matters because the original experiments concern numerical feature perturbations for classification. A citation from a language-security study does not establish that Gaussian-kernel testing or an added outlier output was transferred unchanged. What can be carried forward at the level of research questions is the need to distinguish an attack-specific improvement from protection that survives adaptation. Whether Baseline Defenses uses that distinction in the same way cannot be determined from the citation information alone.

The other listed successor, [Certifying LLM Safety against Adversarial Prompting](https://md.research.elamur.ai/free/en/papers/kumar-2023-certifying-llm-safety-against-adversarial/), concerns safety certification under adversarial prompting. The title signals an emphasis on guarantees. That creates a useful point of comparison with the original paper, whose authors explicitly distinguish empirical robustness experiments from formal security guarantees.

The citation alone does not establish a shared statistical test, rejection architecture, certification method, or experimental result. It supports identifying a later connection to adversarial prompting, while leaving the technical relationship unspecified. Claims about how that work extends or replaces the outlier-class idea would require evidence beyond the listed citation.

Across these connections, the enduring question is how much a successful defense experiment really establishes. This paper contributes a clear decomposition: a population may look different, an individual detector may learn some of that difference, and an adaptive attacker may still find a route through. Its most reusable contribution is to keep those claims separate and test each at the level where it is supposed to operate.

## Cite

Cite as Kathrin Grosse, Praveen Manoharan, Nicolas Papernot, Michael Backes A and Patrick Drew McDaniel. 2017. On the (Statistical) Detection of Adversarial Examples. arXiv (Cornell University).

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.48550/arxiv.1702.06280](https://doi.org/10.48550/arxiv.1702.06280) · [arXiv 1702.06280](https://arxiv.org/abs/1702.06280)

```bibtex
@misc{grosse2017statistical,
  title = {{On the (Statistical) Detection of Adversarial Examples}},
  author = {Kathrin Grosse, Praveen Manoharan, Nicolas Papernot, Michael Backes A and Patrick Drew McDaniel},
  year = {2017},
  doi = {10.48550/arxiv.1702.06280},
  eprint = {1702.06280},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.48550/arxiv.1702.06280}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
