Introduction
Adversarial attacks on language models (LMs) typically involve making subtle modifications to input text to trigger incorrect model predictions. While many existing attacks achieve high success rates, they often produce "loud" signals that are easily caught by anomaly detectors. DA³ (Distribution-Aware Adversarial Attack) addresses this lack of stealth by ensuring adversarial examples remain "in-distribution," making them nearly invisible to standard defenses.
The Problem: Detectable Adversarial Attacks
Current adversarial tools like BERT-Attack or TextFooler often cause a significant "distribution shift." This shift manifests in two primary ways:
- Confidence Drops: The victim model’s Maximum Softmax Probability (MSP) often decreases significantly, indicating the model is "unsure" even when it makes a wrong prediction.
- Statistical Anomalies: Adversarial text often looks statistically different from natural training data. This can be quantified using the Mahalanobis Distance (MD), which measures the distance between a sample and the distribution of the training data.
As shown in the figure below, standard adversarial examples exhibit a clear statistical separation from the original data distribution, allowing Out-of-Distribution (OOD) detectors to easily flag them.
The DA³ Framework
The authors propose a two-phase framework to bypass these detectors:
1. Fine-tuning Phase
Instead of simple synonym substitution, DA³ fine-tunes an attack model using LoRA (Low-Rank Adaptation) for efficiency. The core innovation is the Data Alignment Loss (DAL), which optimizes for two objectives:
- MSP Loss: Encourages the model to maintain high confidence in its (incorrect) adversarial prediction.
- MD Loss: Minimizes the statistical distance between adversarial examples and the original training distribution.
2. Inference Phase
The fine-tuned model generates token replacements that are statistically indistinguishable from natural text. To evaluate this, the researchers introduced the Non-detectable Attack Success Rate (NASR), a metric that only counts an attack as successful if it both fools the victim model and evades detection.
Key Results and Insights
DA³ was evaluated across multiple benchmarks (SST-2, CoLA, RTE, MRPC) against both white-box models (BERT, RoBERTa) and black-box LLMs (Llama 2, Mistral).
- Superior Stealth: On the MRPC dataset, DA³ achieved a 74.86% NASR (MSP), significantly outperforming BERT-Attack, which dropped to 55.31%.
- Cross-Model Transferability: Attacks optimized for stealth on smaller models transferred remarkably well to large-scale models like Llama2-7B. This suggests that "naturalness" is a universal property that helps bypass safety filters across different architectures.
- Human Evaluation: Human raters found DA³'s adversarial examples to have better grammar and semantic preservation than traditional baselines, confirming that the mathematical "in-distribution" optimization translates to more natural-sounding text.
Conclusion
DA³ represents a shift in adversarial research from simply maximizing error rates to prioritizing stealth. By formalizing adversarial examples as a specific type of Out-of-Distribution data and optimizing to minimize that gap, DA³ creates a more potent and harder-to-detect threat. Future defense mechanisms must evolve beyond simple statistical checks to address these increasingly sophisticated, distribution-aware attacks.
Summary updated