BufferSearch: Generating Black-Box Adversarial Texts With Lower Queries

Wenjie Lv, Zhen Wang, Yitao Zheng, Zhehua Zhong, Qi Xuan, Tianyi ChenarXiv 2023 · DOI

Abstract

Adversarial attacks on Natural Language Processing (NLP) models in black-box settings often suffer from high query complexity, making them easily detectable and computationally expensive. While previous research has focused on word selection (Stage 1), the word transformation stage (Stage 2)—where synonyms are tested—remains a significant bottleneck. We present BufferSearch, a query-efficient attack that leverages historical attack data and statistical pruning via Welch’s t-test to reduce redundant queries. Our results demonstrate an average query reduction of 32.6% across multiple benchmarks and architectures while maintaining high attack success rates and text quality.

Introduction

In the black-box setting, an attacker can only observe the outputs of a target NLP model. To generate an adversarial example, the attacker typically identifies influential words and replaces them with synonyms to flip the model's prediction. However, finding the optimal replacement often requires querying the model thousands of times. This high query complexity is problematic for two reasons: it makes attacks slow and expensive, and it allows anti-attack monitors to easily flag suspicious activity.

BufferSearch addresses this by optimizing the word transformation process. Instead of treating every attack as an isolated event, it uses a "memory" of past successes to prune the search space, significantly reducing the number of queries required to find a successful adversarial perturbation.

Methodology

BufferSearch introduces a two-stage integration that fits into standard adversarial pipelines but optimizes the second stage of word transformation.

Historical Information Table ($\mathcal{T}$)

The system maintains a global table that stores the results of previous attacks. This table tracks how specific word replacements (e.g., changing "excellent" to "superb") have affected model confidence in the past. By leveraging this history, the attacker can predict which synonyms are likely to be effective for new inputs.

Statistical Pruning with Welch’s T-Test

This is the core innovation of BufferSearch. Instead of querying the target model for every possible synonym in a candidate list, the system uses Welch’s two-sample t-test to prune the list:

  1. Pivot Selection: It identifies a "pivot" candidate—a replacement known to be effective based on historical data.
  2. Comparison: Other candidates are compared against this pivot using the historical information table.
  3. Pruning: If a candidate is statistically unlikely to perform better than the pivot, it is discarded without ever querying the target model. This avoids the "diminishing returns" of brute-force searching for the absolute best synonym.

Experimental Results

The researchers evaluated BufferSearch across three text-classification benchmarks—MR (Movie Reviews), Yelp (Business Reviews), and IMDB (Long-form reviews)—against WordCNN, WordLSTM, and BERT architectures.

Figure 1: Query reduction of BufferSearch compared to the TextFooler (TF) baseline across different models and datasets.

Query Efficiency

As shown in Figure 1, BufferSearch consistently outperforms the state-of-the-art baseline (TextFooler). On average, it achieved a 32.6% reduction in queries. In specific scenarios, such as attacking WordCNN on the MR dataset, the reduction reached as high as 42.2%. This efficiency gain is achieved without sacrificing attack lethality; for instance, it successfully reduced BERT's accuracy on the Yelp dataset from 97.0% to just 1.9%.

Human Evaluation and Naturalness

Adversarial texts generated by BufferSearch were rated by human judges for naturalness and semantic similarity. The generated texts maintained high grammatical scores (3.42 vs. 3.56 for original text) and a high semantic similarity (0.869), ensuring the attacks remain stealthy and human-readable.

Discussion and Analysis

The "Cold Start" Problem

Because BufferSearch relies on historical data, its performance is tied to the size of its "pre-information" buffer. Initially, the system must query more frequently to build its knowledge base. However, as the buffer grows, the query efficiency improves significantly.

Figure 6: Impact of pre-information size on adversarial accuracy, perturbed rate, and query number for IMDB and Yelp datasets.

Figure 6 illustrates this relationship: as the size of pre-information increases, the number of queries (red line) required to find a successful attack decreases, while the adversarial accuracy and perturbed rate remain stable. This confirms that adversarial vulnerabilities are often consistent across different inputs, allowing the model to "learn" how to attack more efficiently over time.

Conclusion

BufferSearch demonstrates that the word transformation stage is a critical area for optimization in black-box NLP attacks. By using statistical pruning and historical data, it achieves significant query reductions while maintaining high success rates. Future work may involve extending this logic to more complex tasks like machine translation and refining the "warm-up" period required to populate the historical buffer.

Summary updated

BibTeX
@misc{lv2023buffersearch,
  author = {Wenjie Lv and Zhen Wang and Yitao Zheng and Zhehua Zhong and Qi Xuan and Tianyi Chen},
  title = {{BufferSearch: Generating Black-Box Adversarial Texts With Lower Queries}},
  year = {2023},
  eprint = {2310.09652},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2310.09652},
}
Figure