Abstract
In this paper, we study the problem of generating obstinate (over-stability) adversarial examples by word substitution in NLP, where input text is meaningfully changed but the model's prediction does not, even though it should. Previous word substitution approaches have predominantly focused on manually designed antonym-based strategies for generating obstinate adversarial examples, which hinders its application as these strategies can only find a subset of obstinate adversarial examples and require human efforts. To address this issue, we introduce a novel word substitution method named GradObstinate, a gradient-based approach that automatically generates obstinate adversarial examples without any constraints on the search space or the need for manual design principles. To empirically evaluate the efficacy of GradObstinate, we conduct comprehensive experiments on five representative models (Electra, ALBERT, Roberta, DistillBERT, and CLIP) finetuned on four NLP benchmarks (SST-2, MRPC, SNLI, and SQuAD) and a language-grounding benchmark (MSCOCO). Extensive experiments show that our proposed GradObstinate generates more powerful obstinate adversarial examples, exhibiting a higher attack success rate compared to antonym-based methods. Furthermore, obstinate substitutions exhibit a high success rate when transferred to other models in black-box settings, including even GPT-3 and ChatGPT.
Introduction: Fickleness vs. Obstinacy
Most adversarial research in Natural Language Processing (NLP) focuses on fickleness (over-sensitivity): small, meaningless changes, such as swapping "film" for "movie," that cause a model to flip its prediction incorrectly.
This paper tackles the opposite problem: obstinacy (over-stability). An obstinate adversarial example occurs when the input is changed in a way that should change the output, but the model's prediction remains stubbornly the same. For example, in a Natural Language Inference (NLI) task, changing a hypothesis from "The women are doing yoga" to "The women are doing burg" (where "burg" is a nonsense word or semantically distinct) should change the relationship from entailment to neutral or contradiction. If the model does not update its prediction, it is being "obstinate."
Previously, finding these examples required manual effort or rigid rules, such as replacing words with their antonyms. These methods are limited in scope and fail to capture the full range of a model's vulnerabilities. GradObstinate aims to automate this discovery process using model gradients.
The GradObstinate Framework
The authors propose GradObstinate, an automated, gradient-based approach to find these "stubborn" substitutions through a three-stage pipeline:
- Target Selection: The method uses Integrated Gradients (IG) to identify which words are most "important" to the model's current decision. These words are the primary targets for substitution.
- Gradient-Based Search: Instead of searching through a fixed dictionary, words are mapped to one-hot vectors with added continuous noise. Gradient descent is used to update this noise, specifically looking for perturbations that keep the model's output probability high for the original (now incorrect) label. The perturbed vector is then mapped back to the nearest word in the vocabulary.
- Semantic Filtration: To ensure the new sentence actually has a different meaning (and isn't just a synonym), a two-step filter is applied. First, WordNet ensures the new word isn't a known synonym. Second, a GPT-2 "Human Oracle" is prompted to determine if the original and modified sentences are semantically similar. If the oracle says "No," the adversarial example is considered valid.
Experimental Results
The method was evaluated across five diverse models (Electra, ALBERT, Roberta, DistillBERT, and CLIP) using benchmarks including SST-2 (sentiment), MRPC (paraphrase), SNLI (inference), SQuAD (QA), and MSCOCO (image-text retrieval).
- Performance Gains: On the MRPC paraphrase task, previous antonym-based methods had a success rate of less than 1%. GradObstinate achieved over 95%.
- Cross-Modal Vulnerability: The CLIP model, used for matching images to text, was found to be 100% vulnerable to these attacks on the MSCOCO dataset.
- Black-Box Transferability: Substitutions found by GradObstinate transferred to GPT-3 and ChatGPT with high frequency. For example, replacing "program" with "Mand" in a SQuAD question caused GPT-3 to fail to understand the question entirely, even though a human would still recognize the intent.
Discussion and Ethical Implications
The success of these attacks suggests that models are often "lazy" learners, relying on keyword spotting rather than true semantic understanding. If a model sees "women" and "yoga," it might predict "entailment" regardless of other words in the sentence. Furthermore, some substitutions are "universal"; a word found to be an obstinate substitution for one context often works across many others, suggesting systemic weaknesses in how models represent certain concepts.
The search also revealed disturbing ethical red flags. Models sometimes treated "Asian" as semantically equivalent to "worst," or "China" as equivalent to "bats," highlighting how obstinacy can mask underlying dataset biases.
Conclusion
GradObstinate demonstrates that current language models frequently ignore critical semantic shifts, revealing a significant blind spot in NLP robustness. While the paper focuses on generation, the authors note that future work is needed to determine if training on these obstinate examples can make models more robust without hurting their general performance.
Summary updated