TL;DR
Researchers are developing more sophisticated ways to attack NLP models, but these attacks are becoming computationally expensive. This paper introduces "Hybrid Select" and "Dynamic Select," novel algorithms that significantly reduce the number of queries needed for black-box adversarial text attacks without sacrificing effectiveness, making robust model evaluation more accessible.
What Problem Does This Paper Address?
Evaluating the robustness of Natural Language Processing (NLP) models, especially large transformer-based ones, against adversarial attacks is crucial. However, current black-box attack methods often require a massive number of queries to the model. This high computational cost, particularly the need for extensive GPU resources, makes it difficult for many researchers to thoroughly test their models. Existing methods like GreedySelect are effective but inefficient, while BinarySelect is faster but can reduce attack effectiveness. This paper aims to bridge this gap by developing more efficient selection strategies that maintain high attack success rates.
Methods
The paper proposes two main algorithmic contributions:
- Hybrid Select: This approach combines the strengths of N-nary Select (a generalization of Binary Select that partitions text into N segments) and Greedy Select. It uses N-nary partitioning until the text segment size falls below a predefined threshold, at which point it switches to a word-level Greedy Select strategy. This allows for efficient exploration of larger segments and precise identification of influential words in smaller ones. A special case, Sentence-Level Hybrid Select, partitions the text at the sentence level before applying the hybrid strategy.
- Dynamic Select: This method dynamically determines the optimal N-nary split factor (N) based on the input text's length. It learns optimal N values for different text length bins from a validation set, allowing the algorithm to adapt its partitioning strategy for better efficiency.
The paper also introduces Hybrid + Dynamic Select, which combines both approaches by using Dynamic Select to determine the optimal N for Hybrid Select. For the replacement stage, they use a standard WordNet-based synonym replacement strategy.
Datasets
The authors evaluate their methods on four standard adversarial attack classification datasets:
- IMDB
- Yelp Polarity
- AG News
- Rotten Tomatoes
Key Insights and Ideas
- The trade-off between efficiency and effectiveness is not inherent: Previous methods often forced a choice between query efficiency (like BinarySelect) and attack effectiveness (like GreedySelect). The proposed Hybrid and Dynamic Select algorithms demonstrate that it's possible to achieve both simultaneously.
- Text length matters: The effectiveness of different selection strategies varies with text length. Dynamic Select leverages this by learning optimal N values for different length bins, showing that a one-size-fits-all approach is suboptimal.
- Sentence-level partitioning can be powerful: The Sentence-Level Hybrid Select variant shows particular promise, especially for longer documents, suggesting that leveraging natural linguistic boundaries can improve efficiency.
- Smarter search, not just heavier rewrites: The efficiency gains come from more intelligent selection of words to modify, rather than needing to perform more or more complex word replacements.
Key Results
- The best performing method, Sentence-Level Hybrid Select, reduced the number of required queries by up to 25.82% on average across four datasets and six target models (including encoder models like DistilBERT and LLMs like GPT-2, GPT-Neo, T5, and Llama3).
- These query reductions were achieved without losing attack effectiveness (measured by Attack Success Rate - ASR) and with minimal impact on semantic similarity and perturbation amount.
- For example, on the IMDB dataset, Sentence-Level Hybrid with N=3 reduced queries from 425 to 362 while maintaining a 98% success rate.
- The methods consistently showed improvements across various model architectures and dataset lengths, outperforming baselines like BinarySelect and GreedySelect in terms of query efficiency.
Limitations and Future Work
- Lack of Human Validation: The study did not incorporate human evaluation to assess the semantic quality or relevance of the replaced words/phrases. Future work could explore this to gain deeper insights into interpretability.
- Focus on Selection Efficiency: The algorithms prioritize selection efficiency over exploring diverse replacement options. Future research could investigate balancing these aspects to maximize model degradation.
- Responsible Use: The authors acknowledge that adversarial attack methods can be misused but emphasize their value in understanding vulnerabilities and guiding defense development. They advocate for responsible use and have made their code publicly available.
Summary updated