Human Aligned Compression for Robust Models

Samuel Räber, Andreas Plesner, Till Aczel, Roger Wattenhofer · DOI

Introduction

Deep learning vision models are notoriously vulnerable to adversarial attacks—carefully crafted, invisible perturbations that cause models to misclassify images with high confidence. A common defense strategy involves preprocessing images to remove this noise before they reach the classifier. This paper investigates whether modern learned lossy image compression, optimized to preserve human-perceptual features while discarding imperceptible details, can filter out adversarial noise without degrading the task-relevant information the model relies on.

Methodology

The authors implement compression as a preprocessing step, where an image is compressed and decompressed before classification. They compared traditional JPEG against two state-of-the-art learned compression models: HiFiC (GAN-based) and ELIC (optimized for efficiency). These defenses were evaluated on ResNet50 and Vision Transformer (ViT-B/16) architectures using the Imagenette and ImageNet datasets.

Visual comparison of different compression methods and qualities, illustrating how learned models preserve semantic features.

Results and Analysis

Learned compression models like HiFiC and ELIC successfully discard adversarial noise—which often manifests as high-frequency artifacts—while keeping the semantic core of the image intact. This keeps the image "in-distribution" for the classifier, maintaining high clean accuracy while stripping away perturbations.

Accuracy vs. Epsilon for ResNet50 and ViT under FGSM, iFGSM, and PGD attacks, showing the superior robustness provided by learned compression.

Key findings from the experimental evaluation include:

  • ViT Robustness: Vision Transformers, while initially less robust to baseline attacks than ResNet50, received a massive defensive boost from learned compression, vastly outperforming JPEG.
  • Black-Box Performance: Against strong iterative attacks (iFGSM/PGD) in a black-box setting, learned compression restored ViT accuracy to >90%, compared to <1% without defense.
  • Sequential Compression: While single-pass compression can be vulnerable to white-box attacks (where the attacker knows the defense), passing the image through the compression pipeline multiple times (5-7 iterations) acts as a compounding filter, significantly recovering accuracy against adaptive noise.

Conclusion

Human-aligned compression is a practical and effective defense for real-world vision pipelines, adding minimal computational overhead (increasing inference time from 5ms to approximately 14ms). While sequential compression helps mitigate white-box vulnerabilities, future work should explore robustness against gradient-free attacks and the combination of compression with adversarial training for a more comprehensive, multi-layered defense system.

Summary updated

BibTeX
@misc{raber2025human,
  author = {Samuel Räber and Andreas Plesner and Till Aczel and Roger Wattenhofer},
  title = {{Human Aligned Compression for Robust Models}},
  year = {2025},
  eprint = {2504.12255},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.12255},
}
Figure