Papers › BAE: BERT-based Adversarial Examples for Text Classification

BAE: BERT-based Adversarial Examples for Text Classification

4 Apr 2020EMNLP 2020 11arXiv:2004.01970archive 2025-07-28

Siddhant Garg, Goutham Ramakrishnan

Modern text classification models are susceptible to adversarial examples, perturbed versions of the original text indiscernible by humans which get misclassified by the model. Recent works in NLP use rule-based synonym replacement strategies to generate adversarial examples. These strategies can lead to out-of-context and unnaturally complex token replacements, which are easily identifiable by humans. We present BAE, a black box attack for generating adversarial examples using contextual perturbations from a BERT masked language model. BAE replaces and inserts tokens in the original text by masking a portion of the text and leveraging the BERT-MLM to generate alternatives for the masked tokens. Through automatic and human evaluations, we show that BAE performs a stronger attack, in addition to generating adversarial examples with improved grammaticality and semantic coherence as compared to prior work.

PaperPDFConference PDFCode

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

Code

QData/TextAttack officialmentioned in papermentioned on GitHubtfMIT report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

Not run by Syntology. Nothing on this page verifies that the listed code works.

Tasks

Adversarial AttackAdversarial TextClassificationGeneral ClassificationLanguage ModelingText Classificationtext-classification

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

AdamBERTLinear LayerMulti-Head Attention

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections