Input Transformation Defenses
What you'll learn: You'll discover how preprocessing techniques can cleanse adversarial perturbations from inputs before they reach your ML model.
The Core Idea
Input transformation defenses work like a "sanitization layer" that sits between untrusted input and your neural network. The philosophy is simple: adversarial perturbations are often fragile, high-frequency modifications that exploit pixel-perfect precision. By applying lossy transformations to inputs—like compressing images, reducing color depth, or applying denoising filters—you can disrupt these carefully crafted perturbations while preserving the core semantic content that matters for classification.
Think of it like washing a lightly soiled document through a photocopier: the important text survives, but fingerprint smudges and pencil marks may disappear.
Common Transformation Techniques
JPEG Compression reduces image quality by discarding high-frequency components. Since adversarial noise often lives in these frequencies, compression can "smooth out" the attack while maintaining recognizable features.
Bit-depth reduction quantizes pixel values to fewer bits (e.g., from 8-bit to 4-bit color). This coarse-graining eliminates subtle perturbations that adversaries painstakingly optimized at full precision.
Denoising filters (like median filters or deep learning denoisers) explicitly remove patterns that look like noise—which adversarial perturbations essentially are, from a signal-processing perspective.
Limitations
These defenses aren't silver bullets. Attackers can adapt by crafting perturbations robust to specific transformations, or by attacking the transformation itself. They also introduce computational overhead and may degrade legitimate inputs.
Key Takeaway: Input transformation defenses leverage lossy preprocessing—JPEG compression, bit-depth reduction, and denoising—to disrupt adversarial perturbations by eliminating high-frequency artifacts while preserving semantic content, though adaptive attackers can sometimes circumvent these protections.