Beyond Pretrained Features: Noisy Image Modeling Provides Adversarial Defense

Zunzhi You, Daochang Liu, Chang Xu
2/12/2026

No official code found. Best implementation: youzunzhi/NIM-AdvDef (8 stars, MIT, last commit 2024-06-04).

Abstract

Recent advancements in masked image modeling (MIM) have made it a prevailing framework for self-supervised visual representation learning. The MIM pretrained models, like most deep neural network methods, are still vulnerable to adversarial attacks, limiting their practical application, and this issue has received little research attention. In this paper, we investigate how this powerful self-supervised learning paradigm can provide adversarial robustness to downstream classifiers. During the exploration, we find that noisy image modeling (NIM), a simple variant of MIM that adopts denoising as the pre-text task, reconstructs noisy images surprisingly well despite severe corruption. Motivated by this observation, we propose an adversarial defense method by exploiting the pretrained decoder for denoising, referred to as De^3, through which NIM is able to enhance adversarial robustness beyond providing pretrained features. Furthermore, we incorporate a simple modification, sampling the noise scale hyperparameter from random distributions, and enable the defense to achieve a better and tunable trade-off between accuracy and robustness. Experimental results demonstrate that, in terms of adversarial robustness, NIM is superior compared to MIM thanks to its effective denoising capability. Moreover, the defense provided by NIM achieves performance on par with adversarial training while offering the extra tunability advantage. Source code and models will be made available.

View on arXivView PDF

Code Implementations(1)

MIT

Code repo for the paper "Beyond Pretrained Features: Noisy Image Modeling Provides Adversarial Defense"

80PythonOct 9, 20232 years agoMIT

Similar Papers

Cite this paper

@article{you2026beyond,
  title  = {Beyond Pretrained Features: Noisy Image Modeling Provides Adversarial Defense},
  author = {Zunzhi You and Daochang Liu and Chang Xu},
  year   = {2026},
  eprint = {2302.01056},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/pdf/2302.01056},
  journal = {NEURIPS 2023 2023}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2302.01056.svg)](https://codeofpaper.com/paper/2302.01056)

Discussion