Certified Defenses: Randomized Smoothing
What You'll Learn
You'll learn how randomized smoothing provides provable robustness guarantees against adversarial attacks by transforming any classifier into a certifiably robust one.
The Core Idea
Unlike adversarial training (which empirically hardens models) or detection methods (which try to catch attacks), randomized smoothing offers mathematical guarantees that no adversarial perturbation within a certain radius can fool your model.
Here's how it works:
- Add Gaussian noise to the input image multiple times
- Run your base classifier on each noisy version
- Majority vote on the results
- The most frequent prediction becomes your final answer
Think of it like asking a committee of experts who each view a slightly blurry version of the same evidence—if they overwhelmingly agree despite the blur, you can be confident their consensus is robust to small changes in the original.
Why This Provides Guarantees
The mathematical beauty: if your smoothed classifier returns a prediction with high confidence (say, 95% of noisy samples vote for "cat"), you can certify that any perturbation within a calculable L2 radius cannot change the prediction. This isn't a probabilistic defense—it's a mathematical proof per input.
The noise acts as a buffer. An adversary trying to flip your prediction must overcome the averaging effect of many noisy samples, and the theory tells you exactly how large a perturbation they'd need (spoiler: larger than your certified radius means you're safe).
Trade-offs
More noise = larger certified radius but potentially lower accuracy on clean inputs. The certification also requires many forward passes (often 100+), making inference slower.
Key Takeaway: Randomized smoothing transforms any classifier into one with provable robustness guarantees by averaging predictions over Gaussian-noise-perturbed inputs, trading computational cost for mathematical certainty about adversarial robustness.