Abstract
Recent research has revealed that natural language processing (NLP) models are vulnerable to adversarial examples. However, the current techniques for generating such examples rely on deterministic heuristic rules, which fail to produce optimal adversarial examples. In response, this study proposes a new method called the Fraud's Bargain Attack (FBA), which uses a randomization mechanism to expand the search space and produce high-quality adversarial examples with a higher probability of success. FBA uses the Metropolis-Hasting sampler, a type of Markov Chain Monte Carlo sampler, to improve the selection of adversarial examples from all candidates generated by a customized stochastic process called the Word Manipulation Process (WMP). The WMP method modifies individual words in a contextually-aware manner through insertion, removal, or substitution. Through extensive experiments, this study demonstrates that FBA outperforms other methods in terms of attack success rate, imperceptibility and sentence quality.
Introduction
Deep learning models for Natural Language Processing (NLP) are notoriously fragile. Small, intentional perturbations—adversarial examples—can cause a model to flip its prediction, such as changing a "Positive" movie review to "Negative" by swapping just a few words. Most existing attack methods rely on deterministic heuristics, often ranking words by "importance" and greedily substituting them with synonyms. This approach suffers from a limited search space, suboptimal selection due to rigid rankings, and semantic drift that often results in "word salad" incomprehensible to humans.
The FBA Framework
To address these limitations, the authors introduce the Fraud’s Bargain Attack (FBA), a two-part framework designed to generate more effective and natural-sounding adversarial text.
1. Word Manipulation Process (WMP)
Instead of simple substitution, WMP acts as a stochastic proposal mechanism. In each step, it randomly chooses one of three actions: Insert, Substitute, or Remove. To maintain fluency, it utilizes a Masked Language Model (MLM) like BERT to suggest contextually appropriate words and incorporates a synonym search via k-Nearest Neighbors in embedding space to ensure semantic consistency.
2. Metropolis-Hastings (MH) Sampling
FBA treats the attack as a sampling problem from a target adversarial distribution. The MH algorithm evaluates proposals from the WMP, balancing attack success (flipping the label) with semantic similarity. This allows the attack to "backtrack" out of poor modifications—a property known as aperiodicity—enabling a more thorough exploration of the search space than greedy, one-way attacks.
Experimental Results
The researchers evaluated FBA across four benchmarks: AG’s News, Emotion, SST2, and IMDB, targeting both BERT-based classifiers and TextCNN architectures.
Attack Effectiveness
FBA consistently outperformed state-of-the-art baselines like PWWS, BAE, and CLARE. As shown in the performance comparison, FBA achieved significantly higher success rates across all datasets. For instance, on the AG’s News dataset against a BERT model, FBA reached an 81.90% success rate, outperforming the next best baseline, PWWS, which stood at 76.75%.
Semantic Preservation and Quality
A key advantage of FBA is its ability to remain "imperceptible" to humans while fooling the AI. The method maintains high semantic similarity scores (measured via the Universal Sentence Encoder, USE) and low modification rates. By allowing for insertions and deletions rather than just swaps, FBA finds more efficient ways to perturb the input.
Beyond semantic similarity, FBA produces more natural-sounding text. Using Perplexity (PPL) and Grammar Error Rate (GErr) as proxies for human readability, FBA consistently generated the most fluent adversarial examples among the tested methods. This high quality also translates to better transferability; examples designed to fool BERT were often successful against TextCNN as well.
Conclusion
The Fraud’s Bargain Attack represents a significant shift from rigid heuristic attacks to a more flexible, stochastic approach. By combining the multi-action Word Manipulation Process with Metropolis-Hastings sampling, FBA generates adversarial samples that are not only more successful at deceiving models but also more semantically and grammatically sound. While the computational cost of MCMC sampling is higher than greedy methods, the resulting increase in attack quality highlights a critical vulnerability in current NLP models that future defense mechanisms must address.
Summary updated