[Paper Review] Searching for a Search Method: Benchmarking Search Algorithms for Generating NLP Adversarial Examples
This paper benchmarks six black-box search algorithms for generating NLP adversarial examples, holding search space and query budget constant to isolate algorithmic performance. It finds that beam search and particle swarm optimization achieve the highest attack success rates, while greedy search with word importance ranking offers the best trade-off between speed and performance under time or input-length constraints.
We study the behavior of several black-box search algorithms used for generating adversarial examples for natural language processing (NLP) tasks. We perform a fine-grained analysis of three elements relevant to search: search algorithm, search space, and search budget. When new search algorithms are proposed in past work, the attack search space is often modified alongside the search algorithm. Without ablation studies benchmarking the search algorithm change with the search space held constant, one cannot tell if an increase in attack success rate is a result of an improved search algorithm or a less restrictive search space. Additionally, many previous studies fail to properly consider the search algorithms' run-time cost, which is essential for downstream tasks like adversarial training. Our experiments provide a reproducible benchmark of search algorithms across a variety of search spaces and query budgets to guide future research in adversarial NLP. Based on our experiments, we recommend greedy attacks with word importance ranking when under a time constraint or attacking long inputs, and either beam search or particle swarm optimization otherwise. Code implementation shared via https://github.com/QData/TextAttack-Search-Benchmark
Motivation & Objective
- To isolate and evaluate the impact of search algorithms on adversarial attack success rate in NLP, independent of changes in search space or budget.
- To address the lack of reproducible benchmarks in prior work, where search algorithm improvements were confounded by concurrent changes in search space or constraints.
- To evaluate not only attack success rate but also runtime cost and perturbation quality, which are critical for downstream applications like adversarial training.
- To provide a standardized, reproducible benchmark across multiple datasets, models, and configurations to guide future research in adversarial NLP.
- To assess the real-world trade-offs between performance, efficiency, and perturbation quality across diverse search algorithms.
Proposed method
- The study evaluates six search algorithms: greedy with word importance ranking (WIR), beam search (b=8), particle swarm optimization (PSO), and variants using UNK, DEL, and RAND word replacement strategies.
- All algorithms are tested under identical search spaces defined by transformation types (e.g., synonym substitution) and linguistic constraints (e.g., semantic similarity, grammar).
- Experiments are conducted on three datasets (IMDB, SNLI, MNLI) using BERT-base and fine-tuned LSTM models, with attack success rate, query count, and perturbation quality measured.
- Perturbation quality is evaluated via semantic similarity (USE) and perplexity to assess linguistic naturalness and fluency.
- The benchmark is implemented and shared via a public GitHub repository to ensure reproducibility and standardization across future studies.
- Ablation studies are performed by fixing the search space and varying only the algorithm and query budget to isolate algorithmic effects.
Experimental results
Research questions
- RQ1How do different search algorithms compare in attack success rate when the search space and query budget are held constant?
- RQ2What is the trade-off between attack success rate and computational cost (query count) across different search algorithms?
- RQ3How does input length affect the performance and efficiency of various search algorithms?
- RQ4How do different word importance ranking strategies (e.g., PWWS, UNK, DEL) compare in terms of both success rate and query efficiency?
- RQ5What is the impact of search algorithm choice on the quality of adversarial examples, as measured by semantic similarity and perplexity?
Key findings
- Beam search and particle swarm optimization (PSO) achieve the highest attack success rates across all datasets and search spaces, outperforming other algorithms in both success rate and robustness.
- Greedy search with word importance ranking (WIR) offers the best balance of speed and performance, especially under time constraints or when attacking long inputs.
- The PWWS method, despite its high query cost, does not outperform simpler greedy methods and is outperformed by beam search and PSO in both success rate and efficiency.
- Genetic algorithms are consistently outperformed by simpler beam search (b=8), achieving lower success rates at higher query costs in 11 out of 15 scenarios.
- Beam search generates adversarial examples with the lowest percentage of word perturbations, resulting in higher semantic similarity (USE) and lower perplexity, indicating superior perturbation quality.
- The UNK and DEL word replacement methods, though slower due to per-word importance queries, outperform RAND at all but the smallest query budgets, confirming that word ordering matters in search.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.