DiffuseDef: Improved Robustness to Adversarial Attacks via Iterative Denoising

Zhenhao Li, Huichi Zhou, Marek Rei, Lucia Specia
6/28/2024
cs.CL

No official code found. Best implementation: Nickeilf/DiffuseDef (4 stars, MIT, last commit 2024-07-08).

Abstract

Pretrained language models have significantly advanced performance across various natural language processing tasks. However, adversarial attacks continue to pose a critical challenge to systems built using these models, as they can be exploited with carefully crafted adversarial texts. Inspired by the ability of diffusion models to predict and reduce noise in computer vision, we propose a novel and flexible adversarial defense method for language classification tasks, DiffuseDef, which incorporates a diffusion layer as a denoiser between the encoder and the classifier. The diffusion layer is trained on top of the existing classifier, ensuring seamless integration with any model in a plug-and-play manner. During inference, the adversarial hidden state is first combined with sampled noise, then denoised iteratively and finally ensembled to produce a robust text representation. By integrating adversarial training, denoising, and ensembling techniques, we show that DiffuseDef improves over existing adversarial defense methods and achieves state-of-the-art performance against common black-box and white-box adversarial attacks.

View on arXivView PDF

Code Implementations(1)

Nickeilf/DiffuseDefCommunity100%
MIT

Code for paper "DiffuseDef: Improved Robustness to Adversarial Attacks"

40PythonJun 23, 20242 years agoMIT

Similar Papers

Cite this paper

@article{li2024diffusedef,
  title  = {DiffuseDef: Improved Robustness to Adversarial Attacks via Iterative Denoising},
  author = {Zhenhao Li and Huichi Zhou and Marek Rei and Lucia Specia},
  year   = {2024},
  eprint = {2407.00248},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2407.00248v2}
}

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/2407.00248.svg)](https://codeofpaper.com/paper/2407.00248)

Discussion