Keep It Real: Challenges in Attacking Compression-Based Adversarial Purification
Samuel Räber, Till Aczel, Andreas Plesner, Roger Wattenhofer · 2025
Read Keep It Real: Challenges in Attacking Compression-Based Adversarial Purification by Samuel Räber, Till Aczel, Andreas Plesner, Roger Wattenhofer (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2508-05489.txt.
Introduction
Samuel Räber and co-authors stress-test, in a 2025 paper, a proposed defense that washes adversarial tricks out of images by compressing them. Tiny crafted changes can fool image classifiers while looking harmless. Squeezing an image through lossy compression was said to strip the tricks away.
The authors built strong white-box and adaptive attacks against several compression models. Defenses whose reconstructions looked realistic proved far harder to beat. Models producing rougher images fell to the attacks. The gap was not caused by hidden gradients, the usual suspect. Staying true to natural image statistics seems to confer robustness. The lesson cuts both ways: purifiers must be judged by attackers who know them inside out.
Catalog record
| CREATOR | Samuel Räber, Till Aczel, Andreas Plesner, Roger Wattenhofer |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 68 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2508-05489
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Keep It Real: Challenges in Attacking Compression-Based Adversarial Purification Samuel Räber, Till Aczel, Andreas Plesner, Roger Wattenhofer Abstract Previous work has suggested that preprocessing images through lossy compression can defend against adversarial perturbations, but comprehensive attack evaluations have been lacking. In this paper, we construct strong white-box and adaptive attacks against various compression models and identify a critical challenge for attackers: high realism in reconstructed images significantly increases attack difficulty. Through rigorous evaluation across multiple attack scenarios, we demonstrate that compression models capable of producing realistic, high-fidelity reconstructions are substantially more resistant to our attacks. In contrast, low-realism compression models can be broken. Our analysis reveals that this is not due to gradient masking. Rather, realistic reconstructions maintaining distributional alignment with natural images seem to offer inherent robustness. This work highlights a significant obstacle for future adversarial attacks and suggests that developing more effective techniques to overcome realism represents an essential challenge for comprehensive security evaluation. The first principle is that you must not fool yourself–and you are the easiest person to fool. Richard Feynman 1 Introduction Figure 1 : Decrease in robust accuracy when employing a compression defense with reduced realism under different perturbation budgets. Incorporating realism substantially increases the difficulty of successful attacks. Adversarial attacks on image classification models involve making small perturbations to an image such that the classifier’s output changes–even though the image appears semantically unchanged to a human observer. A model can be trained to be robust against such adversarial examples, for example, by augmenting the training data with noise or showing the model adversarial examples during training. Another strategy is applying a transformation to the input image that preserves its semantic content while altering it to render the adversarial noise ineffective. This approach has the advantage of being able to be used for any classification model without requiring retraining. Lossy image compression often discards details deemed perceptually unimportant, which may include the subtle perturbations introduced by adversarial attacks. Early work argued that standard codecs like JPEG yield modest robustness gains [ 1 ] , though they often introduce compression artifacts that push images outside the classifier’s training distribution. More recently, learned compression models have promised to bridge this gap by generating visually plausible reconstructions that may also remove stronger adversarial noise [ 2 ] . However, many proposed defenses—especially preprocessing-based ones—have been criticized for relying on gradient masking; they make general gradient-based attacks harder without genuinely increasing robustness [ 3 ] . When attackers adapt to circumvent gradient obfuscation (e.g., by approximating or smoothing gradients), many defenses fail [ 4 , 5 , 6 , 7 ] . This raises two critical questions: (1) Do robustness gains from image compression persist under rigorous, adaptive attacks? (2) If so, what underlying mechanism contributes to this robustness? We argue that realism in reconstructed images is a key factor underpinning the robustness. Our results show that only compression models capable of producing high-fidelity, realistic images offer meaningful robustness against strong adaptive adversarial attacks, while other compression models can be broken. Realism aids robustness in two ways: It avoids unnatural artifacts that shift images off-distribution, and by hallucinating in semantically plausible details that obscure adversarial noise. A highly realistic compression model reconstructs images close to the original and free from perceptible signs of compression. Classifier models often perform poorly on out-of-distribution inputs; ensuring realism in reconstructed images helps keep them within the distribution of natural images. High realism can be achieved by hallucinating in plausible details. For example, while the exact texture of tree leaves may be removed during compression, a realistic model will hallucinate plausible leaf-like textures. These added details can help obscure adversarial noise, making it more difficult for an attacker to craft successful perturbations. In this paper, we systematically evaluate the robustness of compression-based defenses and isolate the role of realism. Our analysis builds on the findings in [ 2 ] , where it was argued that human-aligned compression contributes to robustness. We re-evaluate their claims under rigorous adversarial threat models and identify shortcomings in their evaluation protocol. We show that their observed robustness stemmed not merely from compression, but specifically from realism. We reinforce this conclusion through extensive evaluation across a broader and newer set of learned compression models. Figure 2 : Overview of compression-based adversarial defense. An input image (potentially containing adversarial perturbations) is first processed by the defense module, which consists of an encoder-decoder architecture that compresses and reconstructs the image. This reconstructed image is then passed to a classifier, which outputs class probabilities. The defense aims to indirectly, through the compression process, remove adversarial noise while preserving the semantic content needed for correct classification. 2 Background and Related Works Our work lies at the intersection of two big fields, and we aim to give complete overviews of both. However, due to the page limit, we had to move the complete related work to Appendix B . 2.1 Adversarial Robustness Shortly after the success of AlexNet [ 8 ] , it was found that neural networks are very susceptible to adversarial attacks [ 9 , 10 ] . Here, an adversary adds (usually) small and imperceptible perturbations to an image such that a model mislabels it. Attacks Many attacks have been developed over the years with various benefits and drawbacks. Some of the most noteworthy are FGSM (Fast Gradient Sign Method) [ 10 ] , iterated FGSM or iFGSM [ 11 ] , CW [ 12 ] , and PGD (Projected Gradient Descent) [ 13 ] . These attacks fall into two categories: FGSM, iFGSM, and PGD are l_{\infty} -bounded attacks, and CW is an l_{2} -bounded attack. We refer the reader to the original papers for specific details, but include some details in Appendix C . The TLDR is: PGD has a perturbation budget \epsilon and an iteration budget n . PGD does projected gradient descent for n iterations to find an adversarial example at most \epsilon distance in l_{\infty} from the original image. When the defense includes randomness, a common attack augmentation is EoT (Expectation over Transformation), where gradients are averaged over multiple backward passes [ 14 , 7 ] . If the defense causes gradient masking, Athalye et al. 2018a suggested Backward Pass Differentiable Approximation (BPDA), where the defense is used during the forward pass, but a differentiable approximation is used during the backward pass. The simplest is to use the identity function, while more advanced methods might train a differentiable surrogate model g^{\prime} that emulates the defense g ; i.e., g(x)\approx g^{\prime}(x) . Lastly, often the best attack results are found using adaptive attacks [ 4 , 5 , 6 , 7 ] . Here, the attacks, for instance, the optimization objective, are adjusted to the defense. This work focuses on adaptive attacks with PGD as the underlying optimization method. Defenses Given the prevalence of adversarial attacks, many researchers have explored how to defend against them. We broadly view this in three groups: Architecture improvements [ 15 , 16 , 17 ] , adversarial training [ 9 , 10 , 13 , 18 , 17 ] , and adversarial purification [ 19 , 20 , 21 , 2 ] . The architecture branch focuses on making the models