Randomized Smoothing with Masked Inference for Adversarially Robust Text Classifications

Han Cheol Moon, Shafiq Joty, Ruochen Zhao, Megh Thakkar, Xu Chi
5/11/2023
cs.CLcs.AI

Official code: Han8931/rsmi_nlp (3 stars, last commit 2023-05-14).

Abstract

Large-scale pre-trained language models have shown outstanding performance in a variety of NLP tasks. However, they are also known to be significantly brittle against specifically crafted adversarial examples, leading to increasing interest in probing the adversarial robustness of NLP systems. We introduce RSMI, a novel two-stage framework that combines randomized smoothing (RS) with masked inference (MI) to improve the adversarial robustness of NLP systems. RS transforms a classifier into a smoothed classifier to obtain robust representations, whereas MI forces a model to exploit the surrounding context of a masked token in an input sequence. RSMI improves adversarial robustness by 2 to 3 times over existing state-of-the-art methods on benchmark datasets. We also perform in-depth qualitative analysis to validate the effectiveness of the different stages of RSMI and probe the impact of its components through extensive ablations. By empirically proving the stability of RSMI, we put it forward as a practical method to robustly train large-scale NLP models. Our code and datasets are available at https://github.com/Han8931/rsmi_nlp

View on arXivView PDF

Code Implementations(1)

Han8931/rsmi_nlpOfficial100%
30PythonMay 6, 20233 years ago

Similar Papers

Cite this paper

@article{moon2023randomized,
  title  = {Randomized Smoothing with Masked Inference for Adversarially Robust Text Classifications},
  author = {Han Cheol Moon and Shafiq Joty and Ruochen Zhao and Megh Thakkar and Xu Chi},
  year   = {2023},
  eprint = {2305.06522},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2305.06522v1}
}

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

Discussion