Skip to main content
QUICK REVIEW

[Paper Review] Natural Language Adversarial Defense through Synonym Encoding

Xiaosen Wang, Hao Jin|arXiv (Cornell University)|Sep 15, 2019
Adversarial Robustness in Machine LearningComputer Science43 references33 citations
TL;DR

SEM inserts a synonym-encoding front-end to map synonym clusters to unique codes, training on original data to defend synonym-substitution adversarial attacks without changing model architecture, preserving accuracy on benign data while improving robustness.

ABSTRACT

In the area of natural language processing, deep learning models are recently known to be vulnerable to various types of adversarial perturbations, but relatively few works are done on the defense side. Especially, there exists few effective defense method against the successful synonym substitution based attacks that preserve the syntactic structure and semantic information of the original text while fooling the deep learning models. We contribute in this direction and propose a novel adversarial defense method called Synonym Encoding Method (SEM). Specifically, SEM inserts an encoder before the input layer of the target model to map each cluster of synonyms to a unique encoding and trains the model to eliminate possible adversarial perturbations without modifying the network architecture or adding extra data. Extensive experiments demonstrate that SEM can effectively defend the current synonym substitution based attacks and block the transferability of adversarial examples. SEM is also easy and efficient to scale to large models and big datasets.

Motivation & Objective

  • Motivate robust NLP models against synonym substitution based adversaries.
  • Propose a defense that preserves model architecture and avoids extra data or large-scale retraining.
  • Develop an encoder that aggregates synonym groups to shared codes before the input layer.
  • Demonstrate scalability to large models and datasets across multiple datasets and architectures.

Proposed method

  • Construct an encoder E that maps synonyms to a common code by clustering synonyms in embedding space.
  • Insert E before the model input layer without altering architecture and train with standard data.
  • Cluster synonyms using Syn(w, delta, k) with Euclidean distance; determine k and delta experimentally.
  • Implement the encoder on GloVe vectors after counter-fitting to enforce synonym constraints.
  • Tune hyper-parameters delta and k to balance robustness and benign accuracy (delta ~ 0.5, k ~ 10).
  • Evaluate SEM against three synonym-substitution attacks (GSA, PWWS, GA) on CNN, LSTM, Bi-LSTM, and BERT across three datasets.

Experimental results

Research questions

  • RQ1Can a synonym-based encoder front-end improve robustness to synonym substitution attacks without modifying the model or requiring extra data?
  • RQ2How does SEM perform across diverse architectures (CNN, RNN, BERT) and datasets under common synonym-based perturbations?
  • RQ3What are the effects of synonym-encoding hyper-parameters (delta, k) and traversal order on robustness and benign accuracy?
  • RQ4Does SEM affect transferability of adversarial examples between models?
  • RQ5How does SEM compare to adversarial training and IBP in terms of accuracy on benign data and robustness under attack?

Key findings

  • SEM maintains near-benign accuracy close to normal training, outperforming IBP in robustness with less trade-off.
  • Under GSA, PWWS, and GA attacks, SEM significantly improves robustness across CNN, LSTM, Bi-LSTM, and BERT on IMDB, AG’s News, and Yahoo! Answers.
  • SEM markedly reduces transferability of adversarial examples, achieving higher accuracy on attacked models when adversaries are generated on other models.
  • Hyper-parameter analysis shows delta around 0.5 and k around 10 yield favorable trade-offs between robustness and benign accuracy.
  • Word-frequency-driven traversal order enhances robustness, with higher-frequency words contributing more to defense performance.

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.