TL;DR
This paper introduces a semi-supervised adversarial text generation framework (SSAT) that uses pseudo-labeled in-domain data to train a Seq2Seq model. SSAT generates more natural and relevant adversarial text samples than existing methods, significantly improving the robustness of Natural Language Understanding (NLU) models, especially for less frequent user requests.
What Problem Does This Paper Address?
Deep learning models, particularly in Natural Language Understanding (NLU), are highly susceptible to adversarial attacks. While adversarial training has been successful in computer vision, applying it to text is challenging due to the discrete nature of language. Existing text adversarial generation methods often produce unnatural or semantically incorrect samples, which can harm NLU performance in real-world applications. This paper tackles the problem of generating high-quality, in-domain adversarial text samples that preserve meaning and sound natural, thereby enabling more robust NLU systems.
Methods
The core of the proposed SSAT framework involves three key components:
- Adversarial Candidate Extraction (Pseudo-labeling): The system leverages unlabeled, in-domain "live traffic" data. It first uses the target NLU model to pseudo-label this data. Then, it employs a multi-step funnel:
- Similarity Search: For each utterance, it finds its k-nearest neighbors in an embedding space (using S-BERT).
- Pseudo-label Filtering: It creates pairs of utterances that are semantically similar but have different pseudo-labels from the target model.
- Paraphrase Detection: A crucial step to ensure semantic preservation. A BERT model is fine-tuned to act as a paraphrase detector. This model is trained on labeled data, defining paraphrases based on shared labels and, when available, named entities. Only pairs classified as paraphrases by this detector are kept.
- Seq2Seq-based Text Perturbation (T5 Model): A pre-trained Text-to-Text Transfer Transformer (T5) model is fine-tuned on the filtered paraphrase data. This fine-tuned T5 model then generates adversarial text candidates for a given input utterance. The generation process uses beam search with a cosine similarity heuristic to encourage high similarity to the original text. A successful perturbation is one that fools the target NLU model (switches its predicted class) while still being classified as a paraphrase by the detector.
The paper also explores Gradient-based Targeted Adversarial Generation using Integrated Gradients to re-rank token probabilities during decoding, aiming to guide the generation towards class-switching tokens.
Datasets
The authors experimented with four datasets:
- Two commercial datasets from virtual assistants (German and French).
- The SNIPS dataset.
- The MASSIVE dataset.
These datasets included both unannotated (live traffic) and annotated training/test data. For the SNIPS dataset, they simulated live traffic by removing labels from a portion of the training data. For MASSIVE, the training portion served as live traffic.
Key Insights and Ideas
- Pseudo-labeling is Key: Leveraging unlabeled, in-domain data is crucial for adapting adversarial generation to specific NLU tasks and making the generated samples more relevant and natural.
- Paraphrase Constraint is Essential: Simply fooling a classifier isn't enough; the adversarial text must also preserve the original meaning. The paraphrase detector acts as a vital filter, significantly improving the quality of generated adversarial samples.
- Seq2Seq Models Excel at Naturalness: Using a T5 model fine-tuned on relevant data allows for more fluent and semantically coherent adversarial text generation compared to simpler character or word manipulation methods.
- Adversarial Training Boosts Robustness: Incorporating these high-quality adversarial samples into the training process significantly improves the NLU model's robustness, especially for tail-end cases, without substantial degradation on standard test sets.
- Gradient-based methods can be tricky: While intuitive, using gradient information for targeted adversarial generation in discrete text spaces can lead to poorer results, suggesting that local changes in embeddings don't always translate well to word replacements.
Key Results
- Adversarial Sample Generation: SSAT achieves comparable success rates to other methods in fooling the target model (around 50%). However, when the paraphrase constraint is applied, SSAT significantly outperforms other methods.
- Sample Quality: SSAT-generated samples exhibit lower perplexity and fewer grammatical issues compared to baselines, indicating higher relevance and naturalness.
- Adversarial Training Effectiveness: Adversarially trained models using SSAT showed a substantial gain in adversarial test set performance (up to 70% improvement in accuracy for the German Commercial dataset) with only a minimal loss on the standard test set. This is a significant improvement over FGSM-based adversarial training, which still left models vulnerable in 75% of adversarial examples.
Limitations and Future Work
- Post-filtering Limitations: The approach relies on post-filtering, which might miss some semantically incorrect or grammatically flawed adversarial samples.
- Realism of Variations: The authors acknowledge the challenge of ensuring generated variations truly reflect what real customers might say.
- Future Work: The authors plan to investigate further by testing models trained on generated perturbations on general data and exploring other combinations of SSAT with white-box perturbation methods. They also aim to address the potential for bias if models overfit to dominant user groups and the need to keep the generation model current.
Summary updated