Abstract
Deep learning models for Natural Language Processing (NLP) are notoriously brittle, often failing when faced with minor, meaning-preserving synonym swaps. This paper investigates methods to enhance model robustness through "online" adversarial training, where perturbations adapt to the model's evolving weaknesses. We introduce BFF (Best-First search over a Factorized graph), a more efficient search algorithm for generating these adversarial examples. Our results demonstrate that while online training provides the highest robustness gains, simple random synonym sampling serves as a surprisingly effective, low-cost alternative.
Introduction
In NLP, discrete adversarial attacks—such as changing "amazing" to "extraordinary" in a movie review—can easily flip a model's prediction. While researchers have used these attacks to evaluate model weaknesses, using them for training has been difficult due to the computational cost of searching for discrete word swaps. Most prior work relied on "offline" augmentation, which fails to adapt as the model learns. This paper bridges that gap by introducing efficient search and training strategies for online adversarial augmentation.
Methodology
The authors propose three primary contributions to improve the efficiency and effectiveness of adversarial training:
BFF: Best-First Search over a Factorized Graph
Finding the optimal word to swap is a complex search problem. Traditional greedy methods often get stuck in local optima. BFF improves this through:
- Factorization: Breaking the search into two steps—choosing the word, then the synonym—to reduce model evaluations.
- Best-First Search: Utilizing a priority queue to allow backtracking, enabling the algorithm to explore more promising paths if a current one fails.
Training Strategies
- Online Augmentation (AdvOn): Generating new adversarial examples during every training batch to constantly challenge the model's current state.
- Random Sampling (RandOff/RandOn): A baseline method that picks synonyms randomly without complex search, serving as a high-speed alternative.
- Label Preservation: Implementing strict filtering (POS tagging and semantic similarity) to ensure perturbations do not accidentally change the sentence's actual meaning.
Key Results and Insights
The study evaluated robustness across SST-2, IMDB, and BoolQ datasets, revealing several critical insights:
- Online Training Superiority: Online adversarial training (AdvOn) consistently produced the most robust models. On the IMDB dataset, robust accuracy increased from a baseline of 41.2% to 78.9%.
- The Efficiency Trade-off: The primary hurdle for online training is computational cost, with AdvOn being 20x to 270x slower than standard training. However, the random online version (RandOn) provides a significant middle ground.
- Effectiveness of Randomness: One of the most surprising findings was that random synonym sampling (RandOff) is a highly effective baseline, often outperforming popular offline search methods while being roughly 10x faster.
Conclusion
Achieving robustness in NLP requires training against adaptive adversaries. While the BFF algorithm makes online search more effective, the high computational cost remains a challenge for scaling. Future work may involve coupling attack strategies more closely with the model, perhaps using secondary language models to generate natural adversarial examples more rapidly than traditional graph searches.
Summary updated