Skip to main content
QUICK REVIEW

[Paper Review] BERT is Robust! A Case Against Synonym-Based Adversarial Examples in Text Classification

Jens Hauser, Zhao Meng|arXiv (Cornell University)|Sep 15, 2021
Adversarial Robustness in Machine LearningComputer Science10 citations
TL;DR

This paper demonstrates that most synonym-based adversarial attacks on BERT do not preserve semantic meaning, with 96–99% of perturbations being semantically invalid. It proposes a two-pronged defense: data augmentation using attack-like examples during training and a post-processing step, reducing state-of-the-art attack success rates below 5% while maintaining high clean accuracy.

ABSTRACT

Deep Neural Networks have taken Natural Language Processing by storm. While this led to incredible improvements across many tasks, it also initiated a new research field, questioning the robustness of these neural networks by attacking them. In this paper, we investigate four word substitution-based attacks on BERT. We combine a human evaluation of individual word substitutions and a probabilistic analysis to show that between 96% and 99% of the analyzed attacks do not preserve semantics, indicating that their success is mainly based on feeding poor data to the model. To further confirm that, we introduce an efficient data augmentation procedure and show that many adversarial examples can be prevented by including data similar to the attacks during training. An additional post-processing step reduces the success rates of state-of-the-art attacks below 5%. Finally, by looking at more reasonable thresholds on constraints for word substitutions, we conclude that BERT is a lot more robust than research on attacks suggests.

Motivation & Objective

  • To investigate whether synonym-based adversarial attacks on BERT preserve semantic meaning, challenging the assumption that such attacks reveal model vulnerabilities.
  • To evaluate the effectiveness of data augmentation using attack-like examples as a defense mechanism against adversarial examples.
  • To propose a lightweight, scalable defense strategy that combines data augmentation and post-processing to reduce attack success rates without sacrificing clean accuracy.
  • To question the research incentive structure in adversarial NLP, where high attack success rates are prioritized over semantic validity.

Proposed method

  • Conduct a human evaluation on individual word substitutions used in four synonym-based attacks to assess semantic preservation.
  • Perform a probabilistic analysis using counter-fitted word embeddings and Universal Sentence Encoder (USE) to measure semantic similarity between original and perturbed texts.
  • Implement a data augmentation procedure that generates synthetic adversarial examples during training to improve model robustness.
  • Apply a post-processing step that detects adversarial examples based on confidence scores, reducing attack success rates.
  • Compare the proposed defense to traditional adversarial training (ADV naive and ADV on-the-fly) in terms of robustness and computational efficiency.
  • Use metrics such as cosine similarity of counter-fitted word vectors and USE sentence embeddings to quantify semantic similarity and attack validity.

Experimental results

Research questions

  • RQ1To what extent do synonym-based adversarial attacks on BERT preserve the semantic meaning of the original text?
  • RQ2Can data augmentation using attack-like examples during training significantly improve model robustness against adversarial attacks?
  • RQ3How effective is a post-processing step in detecting adversarial examples after model inference?
  • RQ4Does the proposed defense method outperform traditional adversarial training in terms of robustness and computational efficiency?
  • RQ5Why do high-success-rate attacks often produce semantically incoherent perturbations, and what implications does this have for evaluating model robustness?

Key findings

  • Between 96% and 99% of adversarial examples generated by four synonym-based attacks on BERT do not preserve semantic meaning, as confirmed by human evaluation and probabilistic similarity analysis.
  • The proposed data augmentation procedure prevents a large portion of adversarial examples by exposing the model to attack-like data during training, achieving higher robustness than traditional adversarial training on the Yelp dataset.
  • The post-processing step reduces the success rate of state-of-the-art attacks below 5%, demonstrating strong detection capability.
  • The defense method is computationally efficient, increasing training time by only around 50% despite a two-fold increase in training data, outperforming standard adversarial training in speed and scalability.
  • The study reveals that researchers often prioritize high attack success rates over semantic validity, undermining the meaningfulness of adversarial examples in NLP.
  • Even when attacks modify up to 40% of words, the resulting perturbations are often semantically incoherent, suggesting that current attack success rates are driven more by data quality than model vulnerability.

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.