Adversarial Training for Machine Reading Comprehension with Virtual Embeddings

Ziqing Yang, Yiming Cui, Chenglei Si, Wanxiang Che, Ting Liu, Shijin Wang, Guoping Hu · DOI

TL;DR

This paper introduces PQAT, a novel adversarial training method for Machine Reading Comprehension (MRC) that addresses limitations of standard adversarial training by considering the unique characteristics of MRC tasks. PQAT uses virtual passage and question embedding matrices to generate role-aware perturbations, leading to improved model robustness and performance across various MRC benchmarks.

What Problem Does This Paper Address?

Neural networks, while powerful, are susceptible to adversarial examples – inputs subtly modified to cause misclassification or incorrect predictions. Adversarial training (AT) is a technique to mitigate this by training models on both clean and adversarial examples. While AT has shown success in areas like image classification and some NLP tasks (like text classification), its application to Machine Reading Comprehension (MRC) has been less explored, despite MRC's complex nature.

MRC tasks involve a model reading a passage and answering questions about it. Standard AT methods often perturb word vectors directly, but this overlooks crucial aspects of MRC:

  1. Discrete Inputs: Words are discrete tokens, unlike continuous pixel values in images.
  2. Multiple Occurrences: The same word can appear multiple times in a passage and question, and standard AT might apply different perturbations to each instance, ignoring their shared semantic meaning.
  3. Role Differentiation: Passages and questions play distinct roles. A word like "rock" in a passage might refer to a geological formation, while "rock" in a question might be part of a phrase like "rock music." Standard AT doesn't account for these different roles.

This paper aims to adapt AT to MRC by explicitly addressing these characteristics, particularly the role differentiation and multiple occurrences of words.

Methods

The authors propose PQAT (Passage/Question Adversarial Training), a novel AT method for MRC. The core idea is to create virtual Passage (P) and Question (Q) embedding matrices. These matrices are not actual word embeddings but rather containers for perturbations.

Here's how it works:

  • Virtual P/Q-Embeddings: Separate embedding spaces are created for passages and questions. When adversarial perturbations are generated, they are first gathered into these P and Q matrices.
  • Global and Role-Aware Perturbations: These virtual matrices allow for the generation of global perturbations for each word, considering all its occurrences within either the passage or the question. This ensures that multiple instances of the same word receive perturbations that are consistent within their respective roles (passage or question).
  • Combined Perturbations: The final adversarial input to the model is formed by summing the original word vectors, the global role-aware perturbations from the P/Q-embedding matrices, and the fine-grained local perturbations generated by standard AT.
  • Efficiency: PQAT is designed to be efficient, adding minimal extra time cost during training. The virtual P/Q-embedding matrices are discarded after training, so they don't increase model size or inference time.

The authors also detail the algorithm in Algorithm 1, outlining the initialization of P/Q matrices, the iterative gradient descent steps for generating perturbations, and the update mechanism. They introduce hyperparameters ($\epsilon_s, \epsilon_p, \epsilon_Q$) to control the strengths of standard AT and PQAT components.

Datasets

The paper evaluates PQAT on several standard English MRC datasets:

  • Span-based extractive RC: SQuAD 1.1, SQUAD 2.0, HotpotQA
  • Multiple-choice RC: RACE
  • Adversarial datasets for robustness testing: AddSent, AddOneSent

Key Insights and Ideas

  • Role Matters in MRC: The paper strongly emphasizes that treating words in passages and questions identically during adversarial perturbation is suboptimal for MRC. PQAT's success hinges on differentiating these roles.
  • Global Perturbations for Consistency: By using virtual embedding matrices, PQAT can generate global perturbations for a word's occurrences within a specific context (passage or question), ensuring semantic consistency.
  • Universally Effective: PQAT demonstrates consistent performance improvements across diverse MRC tasks, suggesting its broad applicability.
  • Beyond Standard AT: The results show that PQAT not only improves upon a strong baseline (RoBERTa) but also outperforms standard AT, especially on adversarial datasets.

Key Results

  • Improved Performance: PQAT consistently outperforms the baseline RoBERTa model on SQuAD 1.1, SQUAD 2.0, HotpotQA, and RACE. For instance, on HotpotQA, it improves joint EM/F1 by 1.3/1.1, and on RACE, it boosts accuracy by 1.5%.
  • Robustness: On adversarial datasets like AddSent and AddOneSent, PQAT significantly enhances model robustness. Standard AT improves F1 by about 5%, while PQAT further boosts it by an additional 1% over standard AT.
  • Comparison with Standard AT: Table 3 shows that PQAT generally outperforms standard AT on its own. Combining PQAT with standard AT yields mixed results, sometimes improving performance but occasionally degrading it on certain datasets (e.g., SQUAD 2.0).

Limitations and Future Work

  • Hyperparameter Tuning: The performance of PQAT is influenced by hyperparameters like $\epsilon_p$ and $\epsilon_Q$, which control the strength of virtual embedding perturbations. Finding optimal values might require careful tuning.
  • Combination with Standard AT: The paper notes that combining PQAT with standard AT doesn't always yield the best results, suggesting that the interaction between global role-aware perturbations and local token-wise perturbations might need further investigation.
  • Future Work: The authors suggest that their work verifies the usefulness of incorporating task-specific information into adversarial training design. Future research could explore other task-specific adaptations for different NLP problems.

Summary updated

BibTeX
@inproceedings{yang2021adversarial,
  author = {Ziqing Yang and Yiming Cui and Chenglei Si and Wanxiang Che and Ting Liu and Shijin Wang and Guoping Hu},
  title = {{Adversarial Training for Machine Reading Comprehension with Virtual Embeddings}},
  booktitle = {SEM},
  year = {2021},
  doi = {10.18653/v1/2021.starsem-1.30},
}
Figure