Skip to main content
QUICK REVIEW

[Paper Review] Defense of Word-level Adversarial Attacks via Random Substitution Encoding

Zhaoyang Wang, Hongtao Wang|arXiv (Cornell University)|May 1, 2020
Adversarial Robustness in Machine LearningComputer Science17 references5 citations
TL;DR

This paper proposes Random Substitution Encoding (RSE), a defense framework that integrates dynamic random synonym substitution into the training process of text classification models to enhance robustness against word-level adversarial attacks. By encoding inputs with randomly selected synonyms during both training and inference, RSE significantly reduces attack success rates and maintains high accuracy under various attack models, outperforming prior methods like Synonym Encoding Method (SEM) in robustness and generalization.

ABSTRACT

The adversarial attacks against deep neural networks on computer vision tasks have spawned many new technologies that help protect models from avoiding false predictions. Recently, word-level adversarial attacks on deep models of Natural Language Processing (NLP) tasks have also demonstrated strong power, e.g., fooling a sentiment classification neural network to make wrong decisions. Unfortunately, few previous literatures have discussed the defense of such word-level synonym substitution based attacks since they are hard to be perceived and detected. In this paper, we shed light on this problem and propose a novel defense framework called Random Substitution Encoding (RSE), which introduces a random substitution encoder into the training process of original neural networks. Extensive experiments on text classification tasks demonstrate the effectiveness of our framework on defense of word-level adversarial attacks, under various base and attack models.

Motivation & Objective

  • To address the lack of effective defenses against word-level adversarial attacks in NLP, particularly those based on synonym substitution that preserve semantic coherence.
  • To overcome the limitations of existing defenses like Synonym Encoding Method (SEM), which are restricted by fixed synonym mappings and poor generalization to unseen adversarial examples.
  • To develop a dynamic, trainable defense mechanism that enhances model robustness without requiring prior knowledge of attack patterns.
  • To evaluate the effectiveness of the proposed defense across diverse text classification tasks, base models, and attack methods.
  • To demonstrate that randomization in synonym substitution during training improves generalization and resilience to adversarial perturbations.

Proposed method

  • Introduces a Random Substitution Encoder (RSE) that dynamically replaces words in input sequences with randomly selected synonyms during both training and inference.
  • Applies a Random Synonym Substitution Algorithm during model training to generate diverse, labeled neighborhood examples for robust learning.
  • Fuses the RSE module between the input layer and the embedding layer, functioning as a trainable, adaptive defense layer.
  • Trains deep neural networks (e.g., Word-CNN, LSTM, Bi-LSTM) with RSE-processed data to improve generalization to adversarial inputs.
  • Uses substitution rate as a metric to evaluate attack cost, measuring the number of word substitutions required for successful attacks.
  • Employs a two-stage evaluation: first, assesses model accuracy before and after adversarial attacks; second, compares attack success rates and substitution rates across defense methods.

Experimental results

Research questions

  • RQ1Can a dynamic, random synonym substitution mechanism during training improve model robustness against word-level adversarial attacks?
  • RQ2How does RSE compare to static synonym encoding methods like SEM in terms of defense effectiveness and generalization?
  • RQ3To what extent does RSE reduce the attack success rate and increase the substitution rate required by attackers?
  • RQ4Does RSE maintain high performance on benign inputs while significantly improving robustness under adversarial conditions?
  • RQ5How does RSE perform across different base models (e.g., LSTM, Bi-LSTM, Word-CNN) and datasets (e.g., IMDB, AG’s News, Yahoo! Answers)?

Key findings

  • Under the PWWS attack, RSE achieved an average after-attack accuracy of 82.2% on LSTM, 88.3% on Bi-LSTM, and 89.9% on Word-CNN, significantly outperforming SEM.
  • The average accuracy shift (drop under attack) for RSE was only 5–7.5%, compared to 10–21.1% for SEM, indicating superior robustness.
  • RSE reduced the attack success rate by 50% or more in most settings, with the lowest rate observed at 5.17% under Word-CNN on Yahoo! Answers.
  • The substitution rate under RSE exceeded 20% in most cases—significantly higher than baseline (NT) and adversarial training (AT)—indicating increased attack cost.
  • On AG’s News with Word-CNN, RSE reduced the accuracy shift from 21.1% (SEM) to 7.5%, demonstrating improved generalization.
  • RSE maintained high performance on clean inputs, with only minor drops in accuracy (e.g., 4.8% shift on LSTM with IMDB), showing minimal impact on benign accuracy.

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.