RobustQA: A Framework for Adversarial Text Generation Analysis on Question Answering Systems

Yasaman Boreshban, Seyed Morteza Mirbostani, Seyedeh Fatemeh Ahmadi, Gita Shojaee, Fatemeh Kamani, Gholamreza Ghassem-Sani, Seyed Abolghasem MirroshandelEMNLP 2023

TL;DR

Question Answering (QA) systems are surprisingly vulnerable to adversarial attacks, where small text perturbations can lead to incorrect answers. This paper introduces RobustQA, a novel open-source framework designed to systematically analyze and generate these adversarial attacks specifically for QA systems, addressing a significant gap in existing NLP research tools.

What Problem Does This Paper Address?

While adversarial attacks have been extensively studied in text classification, their application to Question Answering (QA) systems has been relatively underexplored. QA systems, despite achieving human-level accuracy on many benchmarks, are susceptible to adversarial examples. These are inputs that are slightly modified from their original form but cause the model to produce incorrect outputs. This vulnerability is particularly concerning for real-world applications where robustness is paramount. Existing frameworks for adversarial attacks primarily focus on text classification and are not directly applicable to the unique structure and goal of QA tasks, which involve extracting answer spans from a given context.

Methods

The core contribution of this paper is the development of RobustQA, a comprehensive, open-source framework for analyzing adversarial text generation in QA systems. RobustQA is built upon existing attack algorithms from text classification, which the authors have modified to be compatible with QA tasks. These modifications involve adapting the attack objectives and evaluation metrics to account for the specific nature of QA, such as predicting answer spans rather than class labels.

The RobustQA framework is modular, comprising seven key components:

  • Tokenizer: Handles various tokenization approaches (word, sub-word, character) and ensures consistency.
  • Victim Model: Supports QA-based models, including HuggingFace Transformers, and allows for customization.
  • Goals: Defines what constitutes a successful adversarial attack, considering QA-specific metrics.
  • Metrics: Implements evaluation metrics relevant to QA, such as F1 score and Exact Match (EM), alongside others like edit distance and semantic similarity.
  • Attacker: Provides a base for implementing various attack algorithms.
  • Attack Selector: Facilitates easy configuration and initiation of attack scenarios by selecting models, tokenizers, datasets, and metrics.
  • Evaluator: Executes and analyzes the performance of attack algorithms, reporting on success rates, modification rates, fluency, and more.

The paper details the adaptation of the TextFooler algorithm as a prime example of how existing text classification attacks are modified for QA. This involves adjusting the importance scoring of words and the candidate generation process to target answer spans.

Datasets

The primary dataset used for evaluation in this paper is SQuAD v1.1. The authors also mention that RobustQA can be extended to support other QA datasets like TriviaQA and NewsQA. For adversarial training experiments, they augmented the SQuAD training set with an additional 10% of adversarial examples generated by the BertAttack algorithm within RobustQA.

Key Insights and Ideas

  • QA Systems are Fragile: Despite impressive accuracy, QA models are significantly impacted by adversarial perturbations, with accuracy dropping drastically when adversarial sentences are introduced.
  • Need for Specialized Tools: Existing adversarial attack frameworks are insufficient for QA tasks due to differences in input structure and output prediction (answer spans vs. class labels). RobustQA fills this critical gap.
  • Adaptability of Text Classification Attacks: Attack algorithms commonly used in text classification can be effectively adapted for QA systems with appropriate modifications to their objectives and evaluation criteria.
  • Multi-level Attack Analysis: RobustQA enables the evaluation of adversarial attacks at character, word, and sentence levels, providing a comprehensive understanding of model vulnerabilities.
  • Adversarial Training Potential: The framework supports incorporating adversarial examples into training pipelines to enhance the robustness and generalization of QA models.

Key Results

The paper presents experimental results evaluating six different adversarial attack algorithms on the BERT-large model using the SQuAD dataset.

  • Performance Degradation: Adversarial attacks significantly degrade the performance of the BERT-large model. For instance, the F1 score dropped from 72.3% to 59.1% with the TextFooler attack.
  • Varied Attack Efficacy: Different attack algorithms exhibit varying levels of success and efficiency. For example, the Genetic attack achieved a high success rate (71%) but required significantly more victim model queries (1714.90) compared to TextFooler (85.81 queries).
  • Adversarial Training Benefits: When the BERT-large model was trained with an additional 10% adversarial examples generated by RobustQA, its performance against adversarial attacks improved. For example, the Exact Match (Adversary) score increased from 38.7% to 47.8% with the TextFooler attack after adversarial training.

Limitations and Future Work

Limitations: * Resource Intensive Attacks: Some adversarial attack algorithms require substantial GPU resources and computational iterations, which can limit the scale of experiments. * Domain Specificity: Integrating all possible attack algorithms into RobustQA was challenging due to the intricate nature of the QA domain and the diverse architectures of QA systems, potentially requiring further customization for specific models.

Future Work: * Expand Attack Algorithm Support: The framework can be extended to include more adversarial attack algorithms. * Enhance Functionality: Additional tools and functions can be provided for research into both attacks and defenses in QA systems. * Broader Dataset Support: While SQuAD is supported, extending RobustQA to other QA datasets is a natural progression.

Summary updated

BibTeX
@inproceedings{boreshban2023robustqa,
  author = {Yasaman Boreshban and Seyed Morteza Mirbostani and Seyedeh Fatemeh Ahmadi and Gita Shojaee and Fatemeh Kamani and Gholamreza Ghassem-Sani and Seyed Abolghasem Mirroshandel},
  title = {{RobustQA: A Framework for Adversarial Text Generation Analysis on Question Answering Systems}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2023},
}
Figure