Abstract
Standard adversarial training in NLP improves robustness against "fickle" errors (unintended prediction flips) but often induces "obstinacy" (failure to flip when the ground truth changes). We present Balanced Adversarial Training (BAT), a contrastive learning framework that aligns model representations with semantic boundaries. BAT effectively mitigates both fickle and obstinate vulnerabilities simultaneously across multiple NLP benchmarks without sacrificing clean accuracy.
Introduction: The Robustness Tradeoff
In NLP, adversarial examples are typically categorized as "fickle": an attacker swaps a word for a synonym, and the model's prediction flips despite the meaning remaining constant. Adversarial training is the standard defense, pushing models to be invariant to these small perturbations.
However, this invariance comes with a hidden cost: obstinacy. An obstinate model is over-stabilized; if an attacker swaps a word for its antonym (e.g., changing "happy" to "sad"), the ground-truth label changes, but the model stubbornly maintains its original prediction. This misalignment between the model's distance metric and the human (oracle) decision boundary creates a fundamental robustness tradeoff.
Methodology: Balanced Adversarial Training (BAT)
To address this, the authors propose Balanced Adversarial Training (BAT). BAT uses contrastive learning to shape the model's representation space so that "distance" corresponds to "semantic change." Two implementations were explored:
- BAT-Pairwise: Employs two loss terms: one pulls synonym-swapped ("fickle") examples closer to the original input, while the other pushes antonym-swapped ("obstinate") examples away beyond a defined margin.
- BAT-Triplet: Uses a triplet loss where the original input is the anchor, the fickle example is the positive, and the obstinate example is the negative. This ensures the distance to the semantic flip is always significantly larger than the distance to the synonym swap.
Key Insights
- Distance-Oracle Misalignment: Standard training ignores all small perturbations in vector space. BAT recognizes that a single word (like "not") can flip a sentence's entire meaning, requiring the model to distinguish between semantic-preserving and semantic-flipping changes.
- Batch Size Effects: Experiments revealed that smaller batch sizes exacerbate the tradeoff, causing models to overfit to fickle examples and become more obstinate.
- Representation Alignment: t-SNE visualizations confirm that BAT successfully separates fickle and obstinate examples into distinct clusters, whereas standard models clump them together.
Experimental Results
The researchers evaluated BAT on standard benchmarks including MNLI, QQP, MRPC, and SNLI using BERT and RoBERTa architectures.
As shown in the results for MNLI, BAT-Triplet achieves a superior balance. On MNLI with BERT, standard robust training (SAFER) reduced fickle attack success to 11% but increased obstinate attack success to 63%. In contrast, BAT-Triplet reduced the obstinate (antonym) attack success rate to 34% (a 40% improvement over the baseline) while maintaining a fickle (synonym) attack success rate of 26%—significantly better than the undefended model.
Conclusion
Balanced Adversarial Training effectively bridges the gap between stability and sensitivity. By training on both types of perturbations simultaneously, models learn to respect human semantic boundaries. Future work will focus on automating the generation of obstinate examples for a wider variety of NLP tasks beyond simple word substitutions.
Summary updated