Search

Search papers and lessons

Certified Adversarial Robustness via Randomized Smoothing

Jeremy M Cohen, Elan Rosenfeld, J. Zico Kolter · 2019

Cohen, Rosenfeld and Kolter prove a tight L2 robustness radius for classifiers smoothed with Gaussian noise, and certify a 49 percent top-1 ImageNet accuracy at radius 0.5.

On this page

  • Colour = topic mix
  • Probability
  • Inference
  • Calculus
  • Discrete math
  • Linear algebra
  • Neural network basics
  • ReadReady to readNot yet

TL;DR

Any classifier can be turned into a new classifier that votes over many noisy copies of its input. The paper proves that, when the noise is Gaussian, the vote guarantees a robustness radius in the L2 norm that cannot be enlarged by any analysis that uses only the vote probabilities. The method scales to ImageNet-size networks, where other certified defences had failed, and it certifies 49 percent top-1 accuracy at L2 radius 0.5 on ImageNet.

Builds on: Adversarial Examples, Randomized Smoothing, Lipschitz Continuity, Neyman–Pearson Lemma, Confidence Interval · Leads to: later certified-defence work that compares against smoothing as its baseline

Why it mattered

Before this paper, certified robustness for neural networks was limited to small problems. Exact verifiers had not been shown to scale to large networks, and the conservative methods were loose on expressive networks. The paper states that smoothing was the only certified adversarial defence then shown to work at full ImageNet resolution.

The result also gave a clean guarantee in the L2 norm, the natural measure for perturbing an image's pixel vector. The paper shows that Gaussian smoothing is tight: with no assumptions on the base classifier beyond the vote probabilities, no L2 ball larger than the certified one can be guaranteed.

By late 2026 the paper had about 2,400 citations on OpenAlex.

The problem

An adversarial example is an input changed by a tiny, carefully chosen amount that flips a model's answer (Adversarial Examples). Empirical defences such as Adversarial Training help against known attacks, but later attacks often broke them. What is needed is a certificate: a guarantee that the prediction stays the same inside a set around the input.

For neural networks, exact certificates are expensive, and conservative ones (based on bounds such as a Lipschitz Continuity constant) tend to be too loose for expressive networks. The question is how to get a certificate that works for an arbitrary, large network without assumptions on its architecture.

How it works

The method has two parts: a smoothed classifier, and a Monte Carlo procedure that estimates its certificate. Trace one input through it:

  1. Start with a base classifier and an input. Call the base classifier ff, which can be any network, and an image xx.
  2. Add Gaussian noise many times. Draw random noise ε\varepsilon from a Gaussian with standard deviation σ\sigma in each pixel, and run ff on x+εx + \varepsilon. Repeat for nn draws. Check: each draw gives one class label, so the nn draws give a histogram of votes.
  3. Pick the top class. The smoothed classifier g(x)g(x) returns the class that ff returns most often. Check: this is a majority vote, and it does not depend on the particular noise draws once nn is large.
  4. Estimate how sure the vote is. Let pAp_A be the true probability that ff returns the top class on the noisy input, and pBp_B the probability for the runner-up. With a binomial confidence bound, the procedure gets a lower bound pA‾\underline{p_A} on pAp_A that holds with probability 1−α1 - \alpha.
  5. Convert the vote margin into a radius. The certified radius is R=σ Φ−1(pA‾)R = \sigma\,\Phi^{-1}(\underline{p_A}) in the two-class case. Every input within L2 distance RR of xx is guaranteed to get the same class. Check: a vote that is almost unanimous gives a large radius; a vote near 50/50 gives a radius near zero.

Two practical points follow. First, the noise level σ\sigma is a single hyperparameter: a larger σ\sigma certifies larger radii but makes the base classifier less accurate on noisy inputs, so the two must be traded off. Second, because the base classifier is trained on clean images, it sees almost no noisy inputs, so the paper trains it with Gaussian data augmentation (Data Augmentation) at the same σ\sigma.

The paper uses two procedures. Predict returns the vote and abstains when the top class is not clearly ahead, with a guarantee that it is wrong with probability at most α\alpha. Certify uses a small first batch to pick the top class and a larger second batch to estimate pA‾\underline{p_A}, so that the selection step does not bias the estimate.

The math

Definition: Smoothed classifier

For a base classifier ff that maps inputs to classes, the smoothed classifier at xx is

g(x)=arg⁡max⁡c  P(f(x+ε)=c),ε∼N(0,σ2I).g(x) = \arg\max_{c}\; \mathbb{P}\bigl(f(x + \varepsilon) = c\bigr), \qquad \varepsilon \sim \mathcal{N}(0, \sigma^2 I).

Here σ\sigma is fixed and does not depend on xx, and II is the identity matrix, so the noise is independent across pixels.

Step 4 in symbols: the vote probabilities

Let cAc_A be the top class, with P(f(x+ε)=cA)=pA\mathbb{P}(f(x+\varepsilon) = c_A) = p_A, and let pBp_B be the largest probability among the other classes. The theorem assumes only lower and upper bounds on these quantities:

P(f(x+ε)=cA)≥pA‾≥pB‾≥max⁡c≠cAP(f(x+ε)=c).\mathbb{P}\bigl(f(x+\varepsilon)=c_A\bigr) \ge \underline{p_A} \ge \overline{p_B} \ge \max_{c \ne c_A}\mathbb{P}\bigl(f(x+\varepsilon)=c\bigr).

Step 5 in symbols: the certified radius

Let Φ\Phi be the standard Gaussian cumulative distribution function and Φ−1\Phi^{-1} its inverse. The theorem states that g(x+δ)=cAg(x + \delta) = c_A for every perturbation with ∥δ∥2<R\|\delta\|_2 < R, where

R=σ2(Φ−1(pA‾)−Φ−1(pB‾)).R = \frac{\sigma}{2}\bigl(\Phi^{-1}(\underline{p_A}) - \Phi^{-1}(\overline{p_B})\bigr).

When there are only two classes, pB‾=1−pA‾\overline{p_B} = 1 - \underline{p_A}, and the expression reduces to

R=σ Φ−1(pA‾),pA‾>12.R = \sigma\,\Phi^{-1}(\underline{p_A}), \qquad \underline{p_A} > \tfrac{1}{2}.

Interpretation: the radius grows with σ\sigma and with the gap between the top class's probability and the runner-up's. It also grows without bound as pA‾\underline{p_A} approaches 1, because Φ−1\Phi^{-1} grows without bound near 1.

Why the bound is tight

The proof uses a Neyman-Pearson argument (Neyman–Pearson Lemma). Among all base classifiers that have the stated vote probabilities at xx, the worst case for a shift δ\delta is a linear classifier whose boundary is perpendicular to δ\delta. For that classifier the vote at x+δx + \delta drops to Φ(Φ−1(pA‾)−∥δ∥2/σ)\Phi\bigl(\Phi^{-1}(\underline{p_A}) - \|\delta\|_2/\sigma\bigr), and this exceeds one half exactly when ∥δ∥2<σ Φ−1(pA‾)\|\delta\|_2 < \sigma\,\Phi^{-1}(\underline{p_A}). So no larger radius can be certified from the vote probabilities alone.

Worked examples

Example
The radius from a clear vote

Take σ=0.5\sigma = 0.5, pA‾=0.9\underline{p_A} = 0.9 and pB‾=0.1\overline{p_B} = 0.1 (two classes).

  1. Look up the inverse Gaussian CDF. Φ−1(0.9)≈1.2816\Phi^{-1}(0.9) \approx 1.2816 and Φ−1(0.1)≈−1.2816\Phi^{-1}(0.1) \approx -1.2816.
  2. Take the difference. 1.2816−(−1.2816)=2.56321.2816 - (-1.2816) = 2.5632.
  3. Multiply by σ/2=0.25\sigma / 2 = 0.25. R=0.25×2.5632=0.641R = 0.25 \times 2.5632 = 0.641.

Interpretation: any change of L2 size below about 0.64 cannot change the smoothed prediction, whatever the base classifier does. The actual image changed by such an amount would look the same to a person at this noise level.

Example
How many samples the vote needs

This is the case in which the base classifier returns the same class on every noisy draw. Let α=0.001\alpha = 0.001 be the failure probability, and suppose all nn draws agree. The one-sided binomial bound then gives pA‾=α1/n\underline{p_A} = \alpha^{1/n}. Take σ=1\sigma = 1.

  1. Use n=100n = 100 draws. pA‾=0.0011/100=eln⁡(0.001)/100=e−0.0691≈0.9332\underline{p_A} = 0.001^{1/100} = e^{\ln(0.001)/100} = e^{-0.0691} \approx 0.9332.
  2. Invert the Gaussian CDF. Φ−1(0.9332)≈1.5\Phi^{-1}(0.9332) \approx 1.5, so R≈1.5σR \approx 1.5\sigma.
  3. Repeat with n=1000n = 1000. pA‾=e−0.00691≈0.99312\underline{p_A} = e^{-0.00691} \approx 0.99312, and Φ−1(0.99312)≈2.46\Phi^{-1}(0.99312) \approx 2.46, so R≈2.46σR \approx 2.46\sigma.

Interpretation: even in the best case, the certified radius grows slowly with the number of samples, which is why the paper's certification step needs many draws. The bound is a property of the sample count, not of the classifier.

Example
A realistic budget at the ImageNet noise level

The paper's ImageNet experiments use σ=0.25\sigma = 0.25 and α=0.001\alpha = 0.001 with n=100,000n = 100{,}000 certification samples. Consider a case in which the base classifier agrees on all nn draws and the sample count is reduced to n=10,000n = 10{,}000. Find the certified radius in units of σ\sigma.

  1. Compute the lower bound. pA‾=0.0011/10000=e−0.00069078≈0.999309\underline{p_A} = 0.001^{1/10000} = e^{-0.00069078} \approx 0.999309.
  2. Compare with the Gaussian CDF. Φ(3.2)≈0.99931\Phi(3.2) \approx 0.99931, so Φ−1(0.999309)≈3.2\Phi^{-1}(0.999309) \approx 3.2.
  3. Scale by σ\sigma. The certified radius is about 3.2σ3.2\sigma, which is 0.80.8 at σ=0.25\sigma = 0.25.

Try it: repeat for n=100,000n = 100{,}000 to see how much further the radius grows with ten times the samples. Answer: pA‾=0.0011/100000=e−0.0000691≈0.9999309\underline{p_A} = 0.001^{1/100000} = e^{-0.0000691} \approx 0.9999309, and Φ−1(0.9999309)≈3.8\Phi^{-1}(0.9999309) \approx 3.8, so the radius is about 3.8σ3.8\sigma, or 0.950.95 at σ=0.25\sigma = 0.25. The gain from the tenfold increase is only about 0.6σ0.6\sigma.

Results

The paper reports approximate certified accuracy: the fraction of test images that Certify classifies correctly without abstaining, with a radius at least rr. On ImageNet with a ResNet-50 base classifier (Table 1):

L2 radiusBest sigmaCertified accuracyStandard accuracy
0.50.2549%67%
1.00.5037%57%
2.00.5019%57%
3.01.0012%44%

What these mean: the certified accuracy falls as the radius grows, and a larger σ\sigma is needed for larger radii, at a cost in standard accuracy. The paper's comparison to the earlier bounds of Lecuyer et al. and Li et al. shows that the new radius is larger for the same vote counts, because the earlier bounds are loose.

Other results from the text: Predict on ImageNet at σ=0.25\sigma = 0.25 with n=100n = 100 samples gave 65 percent top-1 accuracy at 0.15 seconds per prediction, and it abstained on 12 percent of images. Larger nn makes Predict cost more per image, and the paper reports fewer abstentions as nn grows. Certification costs far more, about 110 seconds per image on ImageNet.

Limits the paper states: the guarantee is for the smoothed classifier, not the base classifier, and it holds only with the failure probability α\alpha. An adversary who targets the vote can force Predict to abstain, and the empirical test with a projected-gradient attack found adversarial examples for the smoothed classifier at 1.5 times the certified radius 17 percent of the time, and at twice the radius 53 percent of the time. So the certificate is not tight in practice for every image; the paper's tightness is a statement about the vote probabilities alone.

Reading guide

Read the paper in this order:

Check yourself

QuestionIn one sentence, why does the smoothed classifier give a guarantee when the base classifier does not?Show answer

The guarantee depends only on the vote probabilities under Gaussian noise, which can be estimated and bounded by sampling. The base network's internal structure does not enter the argument, so the guarantee holds for any network, however large, while exact verification of the network itself is out of reach.

QuestionA two-class smoothed classifier has σ=1\sigma = 1 and a lower bound pA‾=0.8\underline{p_A} = 0.8. Compute the certified L2 radius to two decimals. You may use Φ−1(0.8)≈0.8416\Phi^{-1}(0.8) \approx 0.8416.Show answer

With two classes, R=σ Φ−1(pA‾)=1×0.8416=0.84R = \sigma\,\Phi^{-1}(\underline{p_A}) = 1 \times 0.8416 = 0.84.

QuestionWhy does the paper train the base classifier with Gaussian data augmentation rather than on clean images only?Show answer

The smoothed classifier only ever runs the base classifier on noisy copies of the input, so the base classifier must classify those copies correctly. A classifier trained only on clean images was never trained for that distribution, and its votes on noisy copies are less reliable. Training with Gaussian noise at the same σ\sigma makes the votes concentrate on the right class.

QuestionA team certifies with a fixed budget of n=100n = 100 samples and α=0.001\alpha = 0.001, and every sample agrees. Its noise level is σ=0.5\sigma = 0.5. What is the largest radius it can certify, to two decimals?Show answer

The bound is pA‾=0.0011/100≈0.9333\underline{p_A} = 0.001^{1/100} \approx 0.9333, and Φ−1(0.9333)≈1.50\Phi^{-1}(0.9333) \approx 1.50. The radius is σ×1.50=0.5×1.50=0.75\sigma \times 1.50 = 0.5 \times 1.50 = 0.75. The budget, not the classifier, limits the radius.

Sources

Read the full paper

Jeremy M Cohen, Elan Rosenfeld, J. Zico Kolter, 2019. arXiv:1902.02918