Skip to main content
QUICK REVIEW

[Paper Review] Detecting Textual Adversarial Examples through Randomized Substitution and Vote

Xiaosen Wang, Yifeng Xiong|arXiv (Cornell University)|Sep 13, 2021
Adversarial Robustness in Machine LearningComputer Science7 citations
TL;DR

This paper proposes Randomized Substitution and Vote (RS&V), a novel, architecture-agnostic method for detecting textual adversarial examples generated via synonym substitution attacks. By randomly replacing words with synonyms across multiple perturbed versions and voting on predictions, RS&V detects adversarial inputs with higher accuracy than state-of-the-art methods while maintaining high robustness on clean samples, leveraging model generalization without retraining.

ABSTRACT

A line of work has shown that natural text processing models are vulnerable to adversarial examples. Correspondingly, various defense methods are proposed to mitigate the threat of textual adversarial examples, eg, adversarial training, input transformations, detection, etc. In this work, we treat the optimization process for synonym substitution based textual adversarial attacks as a specific sequence of word replacement, in which each word mutually influences other words. We identify that we could destroy such mutual interaction and eliminate the adversarial perturbation by randomly substituting a word with its synonyms. Based on this observation, we propose a novel textual adversarial example detection method, termed Randomized Substitution and Vote (RS&V), which votes the prediction label by accumulating the logits of k samples generated by randomly substituting the words in the input text with synonyms. The proposed RS&V is generally applicable to any existing neural networks without modification on the architecture or extra training, and it is orthogonal to prior work on making the classification network itself more robust. Empirical evaluations on three benchmark datasets demonstrate that our RS&V could detect the textual adversarial examples more successfully than the existing detection methods while maintaining the high classification accuracy on benign samples.

Motivation & Objective

  • To address the growing threat of synonym substitution-based textual adversarial attacks in NLP systems.
  • To develop a detection method that is universally applicable to existing neural networks without architectural changes or retraining.
  • To improve detection accuracy while preserving high classification performance on benign inputs.
  • To exploit the fragility of adversarial perturbations by disrupting word-level interactions through randomization.

Proposed method

  • Randomly substitute a subset of words in the input text with their synonyms, using a configurable substitution rate $ p $.
  • Generate $ k $ perturbed variants of the input text through independent random synonym substitutions.
  • Aggregate the model’s logits from all $ k $ perturbed samples to form a voting signal.
  • Classify the original input as adversarial if its predicted label differs from the majority vote of the $ k $ perturbed samples.
  • Exclude stop words from substitution to preserve grammatical coherence, with a configurable stopword selection portion $ s $.
  • Use the voting mechanism to reduce variance from random substitutions and stabilize detection performance.

Experimental results

Research questions

  • RQ1Can randomized synonym substitution effectively disrupt the mutual word interactions in synonym-based adversarial attacks?
  • RQ2How does the number of perturbed samples $ k $ affect detection performance and variance reduction?
  • RQ3What is the optimal substitution rate $ p $ that balances detection accuracy and robustness on clean inputs?
  • RQ4How does excluding stop words from substitution impact detection effectiveness and model generalization?
  • RQ5Can RS&V outperform existing detection methods even when the attacker has access to the detection module?

Key findings

  • RS&V achieves higher detection accuracy than state-of-the-art baselines on three benchmark datasets, including AG’s News, IMDB, and Rotten Tomatoes.
  • With $ p = 60 ext{\%} $, $ k = 25 $, and $ s = 2\text{\%} $, RS&V maintains high classification accuracy (>95%) on benign samples across all datasets.
  • Detection accuracy increases significantly with higher substitution rates up to $ p = 60\text{\%} $, after which performance stabilizes.
  • The number of votes $ k \geq 10 $ leads to stable and high detection performance, with $ k = 25 $ providing optimal balance.
  • Performance degrades when the stopword selection portion $ s $ exceeds 2\%, indicating that excluding too many words limits adversarial perturbation elimination.
  • RS&V remains effective even under black-box attack settings where the attacker knows the detection mechanism, demonstrating strong robustness.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.