Randomized smoothing is a defense that converts any base classifier into a smoothed classifier by predicting the class that the base model returns most often when random Gaussian noise is added to the input, and that yields a provable robustness certificate: a radius within which no adversarial perturbation can change the prediction. In AI security, it is the most scalable known method for certified robustness against norm-bounded adversarial examples.
Unlike empirical defenses, which are judged by how well they resist known attacks, randomized smoothing offers a mathematical guarantee that holds against every attack within the certified radius, including attacks not yet invented. The guarantee is probabilistic in a precise sense: it holds with a chosen confidence level, typically 99.9%.
How randomized smoothing produces a certificate
The method defines a new classifier g from a base classifier f. For an input x, g returns the class with the highest probability under f(x + ε), where ε is drawn from an isotropic Gaussian distribution with standard deviation sigma. Because the noise blurs the decision boundary, small shifts of x can change these class probabilities only gradually.
The key theorem states that if the top class has probability pA and the runner-up has probability pB, then g is constant within an L2 radius R = sigma/2 × (Φ⁻¹(pA) − Φ⁻¹(pB)), where Φ⁻¹ is the inverse standard normal distribution function. In the common conservative form, R = sigma × Φ⁻¹(pA), using a lower confidence bound on pA. The bound is tight for linear classifiers, so no better radius can be proved from these probabilities alone.
Since pA cannot be computed exactly, it is estimated by Monte Carlo sampling. The table below outlines the standard certification procedure.
| Step | What happens | Typical setting |
|---|---|---|
| Selection | Guess the top class from a small sample | About 100 noisy copies |
| Estimation | Count top-class votes on a fresh sample | 10,000 to 100,000 copies |
| Confidence bound | Compute a lower bound on pA | Clopper-Pearson, alpha 0.001 |
| Decision | Abstain if the bound is at most 0.5 | Output class and radius otherwise |
Abstention is an essential part of the method: when the votes are too close, the smoothed classifier returns no answer rather than an uncertified prediction.
Key parameters and trade-offs
The noise level sigma governs the main trade-off. Larger noise allows larger certified radii but makes the base classifier’s task harder, so clean accuracy drops. The maximum certifiable radius also grows only logarithmically with the number of samples, which makes inference cost a serious practical concern.
| Parameter | Typical range | Effect of increasing it |
|---|---|---|
| Noise sigma | 0.12 to 1.0 on inputs scaled to 0-1 | Larger radii, lower clean accuracy |
| Number of samples n | 1,000 to 100,000 | Tighter bounds, slower inference |
| Failure probability alpha | 0.001 to 0.01 | Lower value gives smaller radii |
| Training noise | Usually equal to sigma | Better base model under noise |
| Input dimension | Thousands to hundreds of thousands | Weaker guarantees for non-L2 norms |
Training matters as much as certification. A base model trained without noise performs poorly on noisy inputs, so practitioners use Gaussian data augmentation at the target sigma, or stronger variants such as adversarially trained smoothing and consistency regularization, which raise certified accuracy at a given radius.
How it compares with other robustness defenses
Randomized smoothing sits between empirical defenses, which scale well but offer no proof, and exact verification, which offers proof but rarely scales to large networks. Its model-agnostic nature is its decisive advantage: it treats the base network as a black box and works with architectures of any size.
| Defense | Guarantee | Scalability | Main drawback |
|---|---|---|---|
| Randomized smoothing | Probabilistic certificate | Large models, ImageNet scale | Costly sampling at inference |
| Adversarial training | Empirical only | High | May fail against new attacks |
| Interval bound propagation | Deterministic certificate | Small to medium networks | Loose bounds on deep models |
| Exact verification | Complete proof | Very small networks | Exponential worst-case cost |
| Defensive distillation | None | High | Broken by adaptive attacks |
Earlier defenses based on noise or randomness were often defeated because they relied on gradient masking. Randomized smoothing avoids that trap: its guarantee does not depend on hiding gradients from the attacker, which makes it far more credible under adaptive attacks.
Threat models and extensions
The original guarantee covers L2-bounded perturbations of continuous inputs such as images. Other noise distributions extend it to other threat models, although the strength of the certificate varies considerably with the norm and the input dimension.
- Laplace or uniform noise for L1-bounded perturbations.
- Discrete random substitution for certificates against word or token changes in text.
- Ablation-based smoothing for certificates against adversarial patches.
- Smoothing over training data for certified defenses against some data poisoning attacks.
- Transformation smoothing for rotations, translations and other semantic changes.
For the L-infinity norm in high dimensions, theoretical results show that smoothing-based certificates shrink with dimension, so other certified methods remain competitive there.
Limitations and common misconceptions
The certificate is only as meaningful as its threat model. A certified L2 radius of 0.5 on ImageNet protects against a precisely defined class of perturbations, not against patches, physical attacks or prompt injection. The guarantee also applies to the smoothed classifier g, never to the original base model f.
| Misconception | Correct view |
|---|---|
| Smoothing makes the model fully robust | Only within the certified radius and norm |
| The base model is certified | Only the voting classifier is certified |
| A few samples are enough | Small samples give tiny or no radii |
| Certified accuracy equals clean accuracy | Certified accuracy is usually much lower |
Operational costs are substantial. Certifying one input can require tens of thousands of forward passes, so deployments often use fewer samples for prediction and reserve full certification for audits, which weakens the per-request guarantee.
Explained without jargon
Imagine asking a hundred people to look at a slightly blurred photo and name what they see. You take the majority answer. A tiny smudge on the photo will not change what most people say, because the blur already hides small details.
Randomized smoothing does the same with an AI model. It shows the model many noisy copies of one input and takes a vote. If the vote is clearly one-sided, a mathematical rule can prove that no small change to the input can flip the answer. If the vote is too close, the system simply declines to answer.
A typical use case
A company that builds an automated document scanner for insurance claims worries that attackers could alter scanned images slightly to change how forms are classified. Its security team wraps the image classifier with randomized smoothing at sigma 0.25 and retrains the base model with Gaussian augmentation at the same level.
During audits, the team certifies a test set with 100,000 noise samples per image and a failure probability of 0.001. The report shows the share of documents with a certified L2 radius above 0.5, the clean accuracy cost, and the abstention rate. Documents on which the smoothed model abstains are routed to human review, so the deployment gains a measurable, attack-independent robustness level instead of relying on resistance to known attacks.