mlsanityData to 14 Oct 2026

Masked Language Model Based Textual Adversarial Example Detection

arXiv 2304.08767 ↗First posted 18 Apr 2023cs.CR cs.AIcited by 5

Not on the map. Why?

Abstract (arXiv)

Adversarial attacks are a serious threat to the reliable deployment of machine learning models in safety-critical applications. They can misguide current models to predict incorrectly by slightly modifying the inputs. Recently, substantial work has shown that adversarial examples tend to deviate from the underlying data manifold of normal examples, whereas pre-trained masked language models can fit the manifold of normal NLP data. To explore how to use the masked language model in adversarial detection, we propose a novel textual adversarial example detection method, namely Masked Language Model-based Detection (MLMD), which can produce clearly distinguishable signals between normal examples and adversarial examples by exploring the changes in manifolds induced by the masked language model. MLMD features a plug and play usage (i.e., no need to retrain the victim model) for adversarial defense and it is agnostic to classification tasks, victim model's architectures, and to-be-defended attack methods. We evaluate MLMD on various benchmark textual datasets, widely studied machine learning models, and state-of-the-art (SOTA) adversarial attacks (in total 3*4*4 = 48 settings). Experimental results show that MLMD can achieve strong performance, with detection accuracy up to 0.984, 0.967, and 0.901 on AG-NEWS, IMDB, and SST-2 datasets, respectively. Additionally, MLMD is superior, or at least comparable to, the SOTA detection defenses in detection accuracy and F1 score. Among many defenses based on the off-manifold assumption of adversarial examples, this work offers a new angle for capturing the manifold change. The code for this work is openly accessible at urlhttps://github.com/mlmddetection/MLMDdetection.

Key facts. Cited by 5 papers in the map (data through 14 Oct 2026). Builds on 41 of its 56 references that are in the map. First posted on arXiv 18 Apr 2023.

Builds on

41 of 56 references.

References · 41

  1. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
  2. 2014Explaining and Harnessing Adversarial Examplescited by 7,364
  3. 2013Intriguing properties of neural networkscited by 5,155
  4. 2019ALBERT: A Lite BERT for Self-supervised Learning of Language Representationscited by 2,790
  5. 2015Character-level Convolutional Networks for Text Classificationcited by 2,330
  6. 2020Don't Stop Pretraining: Adapt Language Models to Domains and Taskscited by 1,565
  7. 2021Membership Inference Attacks From First Principlescited by 878
  8. 2016InfoGAN: Interpretable Representation Learning by Information Maximizing Generative Adversarial Netscited by 860
  9. 2019Is BERT Really Robust? A Strong Baseline for Natural Language Attack on Text Classification and Entailmentcited by 671
  10. 2017Adversarial Examples Are Not Easily Detected: Bypassing Ten Detection Methodscited by 546
  11. 2020BERT-ATTACK: Adversarial Attack Against BERT Using BERTcited by 491
  12. 2018Generating Natural Language Adversarial Examplescited by 424
29 more
  1. 2018TextBugger: Generating Adversarial Text Against Real-world Applicationscited by 381
  2. 2018Black-box Generation of Adversarial Text Sequences to Evade Deep Learning Classifierscited by 345
  3. 2020BAE: BERT-based Adversarial Examples for Text Classificationcited by 316
  4. 2020Pretrained Transformers Improve Out-of-Distribution Robustnesscited by 294
  5. 2018Adversarial Example Generation with Syntactically Controlled Paraphrase Networkscited by 286
  6. 2017MagNet: a Two-Pronged Defense against Adversarial Examplescited by 269
  7. 2017Generating Natural Adversarial Examplescited by 183
  8. 2019Combating Adversarial Misspellings with Robust Word Recognitioncited by 163
  9. 2020Contextualized Perturbation for Textual Adversarial Attackcited by 136
  10. 2019Text Processing Like Humans Do: Visually Attacking and Shielding NLP Systemscited by 101
  11. 2020SSMBA: Self-Supervised Manifold Based Data Augmentation for Improving Out-of-Domain Robustnesscited by 96
  12. 2020SAFER: A Structure-free Approach for Certified Robustness to Adversarial Word Substitutionscited by 73
  13. 2016A Boundary Tilting Persepective on the Phenomenon of Adversarial Examplescited by 70
  14. 2021Towards Robustness Against Natural Language Word Substitutionscited by 69
  15. 2019Learning to Discriminate Perturbations for Blocking Adversarial Attacks in Text Classificationcited by 57
  16. 2020Frequency-Guided Word Substitutions for Detecting Textual Adversarial Examplescited by 54
  17. 2020Generating Natural Language Attacks in a Hard Label Black Box Settingcited by 50
  18. 2020CAT-Gen: Improving Robustness in NLP Models via Controlled Adversarial Text Generationcited by 44
  19. 2021The Dimpled Manifold Model of Adversarial Examples in Machine Learningcited by 41
  20. 2019Natural Language Adversarial Defense through Synonym Encodingcited by 40
  21. 2021Unsupervised Out-of-Domain Detection via Pre-trained Transformerscited by 31
  22. 2020Defense against Adversarial Attacks in NLP via Dirichlet Neighborhood Ensemblecited by 28
  23. 2022"That Is a Suspicious Reaction!": Interpreting Logits Variation to Detect NLP Adversarial Attackscited by 24
  24. 2022Textual Manifold-based Defense Against Natural Language Adversarial Examplescited by 19
  25. 2021A Strong Baseline for Query Efficient Attacks in a Black Box Settingcited by 16
  26. 2021Detecting Textual Adversarial Examples through Randomized Substitution and Votecited by 8
  27. 2022Evaluating Membership Inference Through Adversarial Robustnesscited by 8
  28. 2021Self-Supervised Adversarial Example Detection by Disentangled Representationcited by 7
  29. 2022Rethinking Textual Adversarial Defense for Pre-trained Language Modelscited by 5

Built on by

Cited by year

Citing papers per year: 2023: 1; 2024: 0; 2025: 4.

5 papers.