Efficient Combinatorial Optimization for Word-Level Adversarial Textual Attack

Shengcai Liu, Ning Lu, Cheng Chen, Ke Tang

TL;DR

Researchers have developed a new Local Search (LS) algorithm that makes word-level adversarial attacks on NLP models significantly more efficient and theoretically grounded. By treating the attack as a combinatorial optimization problem, the authors achieved higher success rates with up to an order of magnitude fewer model queries while providing the first provable performance guarantees for this class of attacks.

What Problem Does This Paper Address?

Deep Neural Networks (DNNs) in NLP are notoriously vulnerable to adversarial examples—small, intentional perturbations that flip a model's prediction (e.g., changing "movie" to "film" to make a sentiment classifier fail).

Unlike image-based attacks where you can use gradients to find the best "tweak," text is discrete. You can't change 1% of a pixel; you have to swap a whole word. This turns attacking a model into a combinatorial optimization problem: out of all possible word substitutions, which combination will fool the model while still looking like a natural sentence?

Current methods fall into two camps:

  1. Population-based algorithms (GA, PSO): These are effective but "query-hungry," often requiring thousands of attempts to find one successful attack.
  2. Simple Heuristics: These are fast but often fail to find the best adversarial examples, leading to lower success rates.

Furthermore, there was almost no theoretical understanding of how "hard" this optimization problem actually is or if these algorithms could ever guarantee a "good enough" solution.

Methods

The authors formulate the attack as a Set Maximization with Partition Matroid Constraints. Essentially, for every word in a sentence, you have a "bucket" of potential substitutes, and you can pick at most one from each bucket to maximize the model's error.

They propose a Local Search (LS) algorithm that starts with an empty set of changes and iteratively improves the attack using three moves:

  • Insertion: Adding a word substitution.
  • Deletion: Removing a substitution (reverting to the original word).
  • Exchange: Swapping one substitution for another.

The "Aha!" Moment: The authors used the submodularity index to prove that their LS algorithm provides a guaranteed approximation bound. Even though the objective function (the model's confidence score) isn't perfectly "well-behaved" (submodular), they proved that LS will always find a solution within a specific range of the theoretical optimum.

Datasets

The study is impressively broad, evaluating the attack across 5 NLP tasks and 26 different models (including BERT, RoBERTa, and BiLSTMs) using 8 datasets:

  • Sentiment Analysis: IMDB, SST-2, MR.
  • Textual Entailment: SNLI.
  • News Categorization: AG’s News.
  • Question Answering: SQuAD 2.0.
  • Machine Translation: newstest2014 (English-French).

Key Insights and Ideas

  • Optimization is Decoupled from Generation: The LS algorithm is "plug-and-play." It doesn't care how you find candidate synonyms (whether via WordNet, BERT embeddings, or sememes); it just focuses on picking the best combination of what's available.
  • Theoretical Grounding Matters: This is the first work to provide a provable approximation guarantee for word-level attacks in general cases. This moves the field from "it seems to work" to "we know why it works and how well it can perform."
  • Efficiency is the Killer App: In black-box settings (like attacking a paid API), every query costs time and money. LS's ability to reduce queries by an order of magnitude makes these attacks much more practical for real-world security auditing.

Key Results

  • Higher Success, Lower Cost: Compared to Particle Swarm Optimization (PSO) and Genetic Algorithms (GA), LS achieved higher attack success rates while using significantly fewer queries. For example, on the IMDB dataset, LS reached a 99.93% success rate with ~2,200 queries, while PSO required ~3,600 queries for a lower success rate.
  • Better Quality: Adversarial examples generated by LS had lower modification rates (fewer words changed) and better fluency/grammaticality scores compared to baselines.
  • Stronger Transferability: Attacks found by LS were more likely to fool other models that the attacker hadn't seen, suggesting they uncover more fundamental vulnerabilities.
  • Robustness Gains: When these LS-crafted examples were used for "adversarial training" (teaching the model to recognize its mistakes), the resulting models became more robust than those trained on examples from other attack methods.

Limitations and Future Work

  • Sentence Length: While efficient, the query count still grows with sentence length. Attacking very long documents remains a challenge.
  • Decision-Based Attacks: The current method assumes the attacker can see the model's confidence scores (e.g., 0.85 positive). Future work is needed for "hard-label" settings where the attacker only sees the final category (e.g., "Positive").
  • Multilingual Support: The paper focuses primarily on English. Adapting this to languages like Chinese, which require word segmentation, is a noted future direction.

Summary updated

BibTeX
@article{liu2022efficient,
  author = {Shengcai Liu and Ning Lu and Cheng Chen and Ke Tang},
  title = {{Efficient Combinatorial Optimization for Word-Level Adversarial Textual Attack}},
  journal = {IEEE ACM Trans. Audio Speech Lang. Process.},
  year = {2022},
  url = {https://openreview.net/forum?id=K_dgaOPGpW},
}
Figure