Abstract
Adversarial examples are carefully constructed modifications to an input that completely change the output of a classifier but are imperceptible to humans. Despite these successful attacks for continuous data (such as image and audio samples), generating adversarial examples for discrete structures such as text has proven significantly more challenging. In this paper we formulate the attacks with discrete input on a set function as an optimization task. We prove that this set function is submodular for some popular neural network text classifiers under simplifying assumption. This finding guarantees a $1-1/e$ approximation factor for attacks that use the greedy algorithm. Meanwhile, we show how to use the gradient of the attacked classifier to guide the greedy search. Empirical studies with our proposed optimization scheme show significantly improved attack ability and efficiency, on three different text classification tasks over various baselines. We also use a joint sentence and word paraphrasing technique to maintain the original semantics and syntax of the text. This is validated by a human subject evaluation in subjective metrics on the quality and semantic coherence of our generated adversarial text.
Introduction
Adversarial attacks—intentional perturbations designed to mislead machine learning models—have been extensively studied in continuous domains like computer vision. However, text presents a unique challenge because it is discrete. Unlike pixels, which can be shifted by infinitesimal amounts, words cannot be partially changed. Swapping "dog" for "cat" is a discrete jump that standard gradient-based optimization cannot handle directly.
Existing text-based attacks often rely on heuristic word swaps that are either computationally expensive (brute force) or produce nonsensical text. This research addresses these issues by framing the attack as a structured optimization problem over a discrete search space, providing both theoretical guarantees and practical efficiency.
Methodology: Submodular Optimization and Gradient Guidance
The core innovation of this work is treating the adversarial attack as a set function optimization. The authors demonstrate that for common architectures like Convolutional Neural Networks (CNNs) and Recurrent Neural Networks (RNNs), the classifier's output behaves as a submodular function under certain conditions.
The Discrete Search Space
The attack is formulated by defining a search space of possible word and sentence transformations. Each transformation is indexed, allowing the attack to be represented as a vector of choices.
Submodularity implies a "diminishing returns" property: the impact of changing a word is generally greater when the sentence is "clean" than when it has already been heavily modified. This mathematical property is crucial because it guarantees that a simple greedy algorithm will achieve at least $(1 - 1/e)$ (approximately 63%) of the optimal attack's effectiveness.
Attacking Neural Architectures
The paper specifically analyzes how these attacks interact with standard text classification pipelines. For instance, in a Word-CNN, the embedding layer maps discrete tokens to continuous vectors, which are then processed by convolutional and pooling layers.
To optimize the search, the authors introduce Gradient-Guided Greedy (GGG). Instead of evaluating every possible word swap, the algorithm uses the model's gradients at the embedding layer to identify the most "sensitive" words. This guidance makes the attack 3x to 5x faster than standard greedy methods.
Maintaining Semantic Integrity
To ensure the adversarial text remains readable and semantically similar to the original, the framework employs Joint Paraphrasing. This involves sentence-level paraphrasing followed by word-level swaps using specialized embeddings (Paragram-SL999) and Word Mover’s Distance (WMD) to ensure the new text is semantically identical to the original.
Experimental Evaluation
The proposed method (ADV) was tested across three tasks: Fake/Real News detection, Spam filtering (Trec07p), and Sentiment Analysis (Yelp Reviews).
Key Results
- Effectiveness: The attack significantly degraded model performance. For the News classifier, accuracy plummeted from 93.1% to 35.4%.
- Efficiency: On the Yelp dataset, the GGG algorithm achieved a 55.9% success rate, vastly outperforming traditional gradient methods (9.1%).
- Human Evaluation: In blind tests, human subjects rated the adversarial text as being as coherent and "human-crafted" as the original inputs.
- Robustness: The authors demonstrated that "adversarial training"—incorporating these generated examples back into the training set—nearly doubled the model's accuracy against subsequent attacks.
Conclusion and Future Work
By proving the submodularity of neural text classifiers, this research moves adversarial text attacks from heuristic-based approaches to provable algorithms. While the current proofs require some simplifying assumptions (e.g., specific RNN hidden unit dimensions), the empirical results suggest the theory holds for complex, real-world models. Future research will focus on extending this framework to "black-box" scenarios where internal model gradients are unavailable.
Summary updated