LimeAttack: Local Explainable Method for Textual Hard-Label Adversarial Attack

Hai Zhu, Qingyang Zhao, Weiwei Shang, Yuren Wu, Kai LiuAAAI 2024 · DOI

TL;DR

This paper introduces LimeAttack, a novel method for generating adversarial text attacks in a "hard-label" setting, where only the final predicted label is observable. By leveraging local explainability (LIME) to estimate word importance, LimeAttack efficiently targets critical words, achieving higher attack success rates with fewer queries compared to existing methods, even against large language models.

What Problem Does This Paper Address?

Deep Neural Networks (DNNs) are increasingly used in natural language processing, but they are vulnerable to adversarial examples – subtly modified inputs that cause misclassification. Crafting these adversarial examples for text is particularly challenging due to the discrete nature of language and constraints on fluency and semantics. Existing adversarial attack methods often rely on internal model information like gradients or confidence scores (white-box or score-based attacks), which are unavailable in real-world scenarios where models are accessed via APIs (black-box).

The paper focuses on the "hard-label" black-box setting, where the attacker can only query the model and receive a discrete prediction label. This is a more realistic but significantly harder scenario. Current hard-label attacks typically involve random word substitutions followed by complex optimization, requiring many queries and often yielding suboptimal results due to poor initializations. The core problem this paper addresses is how to efficiently and effectively generate high-quality adversarial text in this constrained hard-label setting, particularly by finding a way to estimate word importance without access to model internals.

Methods

LimeAttack introduces a two-stage approach:

  1. Word Importance Ranking: This is the core innovation. Instead of relying on gradients or confidence scores, LimeAttack uses the Local Interpretable Model-agnostic Explanations (LIME) technique. LIME works by generating neighborhood samples (by masking words in the original sentence) and training a simple linear model on these samples to approximate the importance of each word. This allows the attacker to identify words that are most influential in the model's decision-making, even without knowing the model's internal workings. The method filters out stop words and uses a weighted loss function to account for sample proximity.
  2. Perturbation Execution: After ranking word importance, LimeAttack uses this information to guide the generation of adversarial examples. It employs a beam search strategy to iteratively replace words with synonyms. The selection of synonyms is guided by both semantic similarity to the original word and the word's importance ranking. The paper proposes a specific sampling rule that balances selecting synonyms with high semantic similarity, low semantic similarity, and random choices to ensure a diverse and effective search for adversarial examples.

Datasets

The paper evaluates LimeAttack on several standard NLP datasets for text classification and textual entailment:

  • Text Classification: MR, SST-2, AG, Yahoo.
  • Textual Entailment: SNLI, MNLI (matched and mismatched versions).

These datasets are used with three victim models: CNN, LSTM, and BERT. Additionally, the authors evaluate LimeAttack on large language models (LLMs) including BART-L, DeBERTa-L, Flan-T5, GPT-3, and ChatGPT.

Key Insights and Ideas

  • Bridging Score-Based and Hard-Label Attacks: The paper successfully bridges the gap between score-based attacks (which use confidence scores) and hard-label attacks by adapting the concept of word importance estimation (inspired by score-based methods) to the hard-label setting using LIME.
  • LIME for Word Importance in Hard-Label: Demonstrating that LIME, a local explainability method, can be effectively repurposed to estimate word importance in a hard-label setting, which was previously thought to be difficult.
  • Inside-to-Outside Attack Path: The paper highlights the effectiveness of an "inside-to-outside" attack path, where the attack starts from the benign sample and iteratively modifies it towards the decision boundary, contrasting with existing "outside-to-inside" methods that start from a perturbed sample.
  • Query Efficiency: LimeAttack achieves high attack success rates with significantly fewer queries than existing hard-label methods, making it more practical for real-world black-box scenarios.
  • LLM Vulnerability: The research reinforces that even state-of-the-art large language models are susceptible to adversarial attacks, despite their impressive general performance.

Key Results

  • Attack Success Rate (ASR): LimeAttack consistently outperforms existing hard-label attacks (HLBB, TextHoaxer, LeapAttack, TextHacker) across various models and datasets, achieving higher ASRs, especially under a tight query budget of 100. For instance, on BERT-MR, LimeAttack achieves an ASR of 27.8% with a perturbation rate of 5.7%, outperforming other methods.
  • Perturbation Rate: LimeAttack generally achieves competitive or lower perturbation rates compared to other hard-label attacks, indicating that the generated adversarial examples are less modified.
  • Query Budget: LimeAttack demonstrates a stable attack success rate across different query budgets, suggesting its efficiency and robustness.
  • LLM Attacks: LimeAttack successfully attacks most large language models, including ChatGPT, indicating that LLMs are not immune to these attacks.
  • Defense Methods: LimeAttack shows effectiveness even against models enhanced with defense mechanisms like A2T and ASCC, though with slightly reduced success rates.

Limitations and Future Work

  • Limitations:
    • The paper notes that while LimeAttack achieves high semantic similarity, it might be slightly lower than some other methods that prioritize similarity more heavily.
  • The performance on LLMs, while successful, is evaluated on a limited number of samples (100 texts from MR dataset) due to API constraints.
  • Future Work:
    • The authors suggest that the insights from score-based attacks (like using word importance ranking) can provide valuable guidance for developing more effective hard-label attacks.
  • The paper implicitly suggests further exploration into optimizing the sampling rules and the LIME approximation for even greater efficiency and effectiveness.
  • The work also points to the need for further research into robust defenses against these types of attacks, especially for LLMs.

Summary updated

BibTeX
@inproceedings{zhu2024limeattack,
  author = {Hai Zhu and Qingyang Zhao and Weiwei Shang and Yuren Wu and Kai Liu},
  title = {{LimeAttack: Local Explainable Method for Textual Hard-Label Adversarial Attack}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i17.29950},
}
Figure