Using Punctuation as an Adversarial Attack on Deep Learning-Based NLP Systems: An Empirical Study

Brian Formento, Chuan-Sheng Foo, Anh Tuan Luu, See-Kiong NgEACL (Findings) 2023 · DOI

TL;DR

This paper introduces punctuation insertions as a novel and effective adversarial attack on NLP systems. The authors demonstrate that these attacks are more stealthy and readable than traditional character or word-level attacks, posing a significant threat to the robustness of modern NLP models.

What Problem Does This Paper Address?

Deep learning-based NLP models are known to be sensitive to small input perturbations, leading to misclassifications. While character and word-level attacks have been extensively studied, they often suffer from drawbacks: they can be detected by grammar checkers, alter the meaning of the text, or make it unreadable. This paper investigates punctuation insertions as an alternative attack vector, aiming to find a method that is less detectable, preserves semantic similarity, and maintains readability.

Methods

The core of the paper lies in empirically evaluating punctuation insertions as an adversarial attack. The authors implement a gray-box attack called DeepWordBugPunc (DWBP), which is a variant of DeepWordBug that specifically focuses on punctuation insertions. DWBP uses a greedy search algorithm to identify important words and then systematically inserts punctuation marks. They also explore multi-level attacks by combining punctuation insertions with word substitutions (using TextFooler and SememePSO baselines). For black-box scenarios, they adapt the Zéroe Intrude (ZI) attack. A key novel aspect is the use of the Test of Word Reading Efficiency (TOWRE) to assess the readability of adversarial texts, alongside traditional metrics like after-attack accuracy and semantic similarity.

Datasets

The experiments were conducted on several standard NLP datasets across different tasks:

  • MR: Rotten Tomatoes movie reviews (sentiment classification)
  • MNLI: Multi-Genre Natural Language Inference (natural language inference)
  • SNLI: Stanford Natural Language Inference (natural language inference)
  • QNLI: Question Answering Natural Language Inference (question answering)
  • QQP: Quora Question Pairs (duplicate question detection)

Key Insights and Ideas

  • Punctuation is a potent attack vector: Even simple punctuation insertions (like hyphens and apostrophes) can significantly degrade NLP model performance.
  • Stealthier than alternatives: Punctuation attacks are harder for grammar checkers to detect and preserve semantic similarity better than character-level attacks.
  • Improved readability: Adversarial texts created with punctuation insertions are significantly easier and faster to read than those generated by character-level attacks.
  • Generalizable mechanism: The findings suggest that punctuation insertion is a general attack mechanism applicable across various NLP tasks and models.
  • Trade-offs in multi-level attacks: Combining punctuation with word substitutions can enhance attack effectiveness but might introduce trade-offs in sample quality and attack time.

Key Results

  • After-attack accuracy (Aaft-atk): Punctuation insertions (DWBP) achieved lower Aaft-atk than character insertions, indicating better attack success. For example, hyphen and apostrophe insertions lowered Aaft-atk more than other letter insertions.
  • Semantic Similarity: Punctuation insertions maintained high semantic similarity (0.96-1.00) with the original texts, compared to character insertions (0.87-0.90).
  • Readability: Using TOWRE, punctuation insertions increased reading speeds by up to 800% compared to character insertions.
  • Defense Evasion: Grammar checkers were found to be ineffective against punctuation insertion attacks.
  • Multi-level attacks: Incorporating punctuation into word substitution attacks (TextFooler/DWBP, SememePSO/DWBP) enhanced their effectiveness.

Limitations and Future Work

The authors acknowledge several limitations:

  • Task Specificity: The study primarily focused on classification tasks, and the generalizability of punctuation attacks to other tasks like fake news detection, offensive content detection, or seq-to-seq tasks remains an open question.
  • Language Dependence: The experiments were conducted solely in English, leaving the exploration of punctuation attacks in other languages unexplored.
  • Attack Effectiveness Variability: While generally effective, there were cases where punctuation insertions did not outperform alternatives, and the attack variance could be high depending on the dataset, symbol, and model.

Future work suggested includes exploring how punctuation attacks can augment adversarial learning schemas, investigating the generalization of these attacks to more complex prediction tasks, and further research into how NLP systems process punctuation to develop more robust defenses.

Summary updated

BibTeX
@inproceedings{formento2023using,
  author = {Brian Formento and Chuan-Sheng Foo and Anh Tuan Luu and See-Kiong Ng},
  title = {{Using Punctuation as an Adversarial Attack on Deep Learning-Based NLP Systems: An Empirical Study}},
  booktitle = {EACL (Findings)},
  year = {2023},
  doi = {10.18653/v1/2023.findings-eacl.1},
}
Figure