mlsanityData to 14 Oct 2026

Using BERT Encoding to Tackle the Mad-lib Attack in SMS Spam Detection

arXiv 2107.06400 ↗First posted 13 Jul 2021cs.CL cs.IR cs.LGcited by 3

Not on the map. Why?

Abstract (arXiv)

One of the stratagems used to deceive spam filters is to substitute vocables with synonyms or similar words that turn the message unrecognisable by the detection algorithms. In this paper we investigate whether the recent development of language models sensitive to the semantics and context of words, such as Google's BERT, may be useful to overcome this adversarial attack (called "Mad-lib" as per the word substitution game). Using a dataset of 5572 SMS spam messages, we first established a baseline of detection performance using widely known document representation models (BoW and TFIDF) and the novel BERT model, coupled with a variety of classification algorithms (Decision Tree, kNN, SVM, Logistic Regression, Naive Bayes, Multilayer Perceptron). Then, we built a thesaurus of the vocabulary contained in these messages, and set up a Mad-lib attack experiment in which we modified each message of a held out subset of data (not used in the baseline experiment) with different rates of substitution of original words with synonyms from the thesaurus. Lastly, we evaluated the detection performance of the three representation models (BoW, TFIDF and BERT) coupled with the best classifier from the baseline experiment (SVM). We found that the classic models achieved a 94% Balanced Accuracy (BA) in the original dataset, whereas the BERT model obtained 96%. On the other hand, the Mad-lib attack experiment showed that BERT encodings manage to maintain a similar BA performance of 96% with an average substitution rate of 1.82 words per message, and 95% with 3.34 words substituted per message. In contrast, the BA performance of the BoW and TFIDF encoders dropped to chance. These results hint at the potential advantage of BERT models to combat these type of ingenious attacks, offsetting to some extent for the inappropriate use of semantic relationships in language.

Key facts. Cited by 3 papers in the map (data through 14 Oct 2026). Builds on 9 of its 27 references that are in the map. First posted on arXiv 13 Jul 2021.

Builds on

9 of 27 references.

References · 9

  1. 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
  2. 2018Threat of Adversarial Attacks on Deep Learning in Computer Vision: A Surveycited by 460
  3. 2017Wild Patterns: Ten Years After the Rise of Adversarial Machine Learningcited by 414
  4. 2019Text Classification Algorithms: A Surveycited by 163
  5. 2017Deceiving Google's Perspective API Built for Detecting Toxic Commentscited by 102
  6. 2017Google's Cloud Vision API Is Not Robust To Noisecited by 37
  7. 2020No Rumours Please! A Multi-Indic-Lingual Approach for COVID Fake-Tweet Detectioncited by 13
  8. 2020CATBERT: Context-Aware Tiny BERT for Detecting Social Engineering Emailscited by 7
  9. 2018Shielding Google's language toxicity model against adversarial attackscited by 5

Built on by

Cited by year

Citing papers per year: 2023: 1; 2024: 2.

3 papers.