Human Aligned Compression for Robust Models
Samuel Räber, Andreas Plesner, Till Aczel, Roger Wattenhofer · 2025
Read Human Aligned Compression for Robust Models by Samuel Räber, Andreas Plesner, Till Aczel, 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-2504-12255.txt.
Introduction
Samuel Räber and co-authors test image compression as a shield against attacks that fool vision models. Their 2025 paper compares two learned compression tools with the standard JPEG method at many quality levels. The attacks add tiny changes that people cannot see but that make a model give the wrong label.
Learned compression defended better than JPEG, most of all for transformer models, because it keeps the parts of an image that carry meaning while wiping out attack noise. The defense still held when attackers knew it was there. Pressing an image through several rounds of compression helped even more, with little loss in normal accuracy. The authors offer it as a cheap, practical guard.
Catalog record
| CREATOR | Samuel Räber, Andreas Plesner, Till Aczel, Roger Wattenhofer |
|---|---|
| YEAR | 2025 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 43 KB |
| VERSION | 1.0 |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2504-12255
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Human Aligned Compression for Robust Models Samuel Räber, Andreas Plesner, Till Aczel, Roger Wattenhofer Abstract Adversarial attacks on image models threaten system robustness by introducing imperceptible perturbations that cause incorrect predictions. We investigate human-aligned learned lossy compression as a defense mechanism, comparing two learned models (HiFiC and ELIC) against traditional JPEG across various quality levels. Our experiments on ImageNet subsets demonstrate that learned compression methods outperform JPEG, particularly for Vision Transformer architectures, by preserving semantically meaningful content while removing adversarial noise. Even in white-box settings where attackers can access the defense, these methods maintain substantial effectiveness. We also show that sequential compression—applying rounds of compression/decompression—significantly enhances defense efficacy while maintaining classification performance. Our findings reveal that human-aligned compression provides an effective, computationally efficient defense that protects the image features most relevant to human and machine understanding. It offers a practical approach to improving model robustness against adversarial threats. 1 1 1 https://github.com/aplesner/Human-aligned-compression-for-robust-models . 1 Introduction Vision models have made significant improvements in recent years, achieving remarkable success in tasks like image classification He et al. 2015 , object detection Szegedy et al. 2013 ; Zou et al. 2023 and medical imaging Shen et al. 2017 . However, vision models remain highly vulnerable to adversarial attacks despite these advancements. Adversarial attacks are carefully crafted perturbations added to input images, which are often imperceptible to the human eye but can cause deep learning models to make incorrect predictions Szegedy et al. 2014 ; Madry et al. 2019 . These attacks pose a serious threat to applications that rely on the reliability of vision models, such as autonomous driving, healthcare diagnostics, and surveillance systems. One potential approach to defending against these adversarial attacks is to remove the small perturbations introduced by the attacker. Eliminating these imperceptible changes makes it possible to prevent the model from being misled. Traditional methods, such as blurring or adding random noise, can be effective at removing perturbations; however, they have significant drawbacks. While these methods reduce the adversarial impact, they distort the image, changing its distribution in a way that may cause the image to be “out of distribution” for the classifier. Moreover, they do not solely remove adversarial perturbations—they also remove information that could be important for the task. This results in a loss of critical information, degrading model performance and making the system less reliable. Ilyas et al. 2019 showed in their seminal work that image classifiers learn to use non-robust features for image classification that the adversarial examples exploit. In the area of image compression, researchers showed that human-perception-aligned learned lossy compression models can yield high compression ratios while producing images that humans prefer, for instance, over JPEG compressed images. These techniques aim to preserve an image’s most important features according to human perception while discarding less significant details. By doing so, they can remove adversarial perturbations without altering the underlying image distribution and without losing task-relevant information. Since the images remain in distribution for the classifier, the model can continue to perform effectively while being protected from adversarial attacks. Dziugaite et al. 2016 has shown that JPEG compression could be a viable defence, however, as later shown, only if the attacker does not include the JPEG compression in the attack Shin and Song 2017 . This work explores the potential of learned image compression methods to defend against adversarial attacks. We compare these methods to a traditional technique, JPEG, and evaluate their effectiveness in removing adversarial perturbations while preserving the integrity of the image distribution. Our findings show that human-perception aligned compression offers a promising strategy for defending vision models against adversarial attacks, without sacrificing classification accuracy. This approach contributes to developing more efficient and robust defense mechanisms, fostering the creation of more secure and reliable vision systems. 2 Related Work 2.1 Adversarial attacks Adversarial examples have become a critical concern in machine learning, particularly regarding the robustness and security of deep learning models. These inputs are intentionally crafted to deceive models into making incorrect predictions. Szegedy et al. 2014 first demonstrated that small, imperceptible perturbations could cause neural networks to misclassify images with high confidence. Kurakin et al. 2017 extended the study of adversarial attacks to the physical world, showing that printed images with adversarial perturbations could still deceive classifiers when captured through a camera. This work underscored the real-world implications of adversarial attacks beyond purely digital environments. In response to these challenges, various defense mechanisms have been proposed. Madry et al. 2019 introduced Projected Gradient Decent (PGD) attacks along with adversarial training, a technique in which models are trained on adversarial examples to improve their robustness. Papernot et al. 2016 proposed defensive distillation, leveraging knowledge distillation Hinton et al. 2015 —a technique that compresses an ensemble of models into a smaller model—to enhance resistance against adversarial attacks. Another approach involves preprocessing inputs to remove adversarial perturbations before classification, which can be achieved using image compression techniques Dziugaite et al. 2016 . Despite these efforts, achieving a comprehensive defense against adversarial attacks remains an open problem. 2.2 Image compression as adversarial defense Dziugaite et al. 2016 demonstrated that JPEG compression can weaken adversarial attacks by removing small perturbations. The perturbations often vanish by compressing and decompressing a potentially manipulated image, reducing the attack’s effectiveness. Even with a high quality factor of 75, JPEG compression enhanced model robustness. However, Shin and Song 2017 demonstrated that the defensive effectiveness of JPEG compression can be significantly diminished by leveraging a differentiable approximation of the algorithm. By propagating gradient information through the model and the JPEG compression process, adversarial attacks can generate perturbations that persist even after the compression and decompression steps. 2.3 Learned lossy image compression Recent advancements in image compression have moved beyond traditional methods like JPEG, which use linear transformations, to learned techniques that replace the Discrete Cosine Transform (DCT) with nonlinear transformations Liu et al. 2023 ; He et al. 2021 ; Galteri et al. 2019 ; Agustsson et al. 2019 ; Minnen et al. 2018 . Variational Autoencoder (VAE)-based models and Generative Adversarial Networks (GANs) Mentzer et al. 2020 help minimize compression artifacts, producing realistic images even at ultra-low bitrates. HiFiC Mentzer et al. 2020 leverages GANs to achieve visually appealing reconstructions while preserving perceptually significant information. A user study demonstrated HiFiC’s superiority in reconstruction quality over other methods, even at half the bits per pixel. ELIC He et al. 2022 optimizes image compression for both speed and efficiency. It outperforms previous learned methods, such as Minnen et al . Minnen et al. 2018 and Cheng et al . Cheng et al. 2020 , particularly at low bitrates. At low bitrates, learned compression methods outperform JPEG by preserving perceptual quality and reducing visual artifacts, all while maintaining the original image distribution. Thus, using learned compression as preprocessing for neural network classifiers can enhance robustness by removing small perturbations while preserving the image distribution. 3 Methods Our experiments’ objective was to evaluate the effectiveness of image compression as a defense mechanism against adversarial attacks. We also investigated the impact of varying compression quality levels and the effects of applying multiple compression steps sequentially. We implemented our defenses as an additional preprocessing step applied to the (perturbed) image before it was fed into the