What does BERT Learn from Arabic Machine Reading Comprehension Datasets?

Eman Albilali, Nora Al-Twairesh, Manar Ibrahim HosnyWANLP 2021 · OpenReview

TL;DR

This paper investigates what Arabic BERT (AraBERT) truly understands in machine reading comprehension (MRC) tasks. By creating adversarial examples that trick the model, the researchers found that AraBERT relies more on superficial keyword matching than deep comprehension, a vulnerability that can be detected in its early layers.

What Problem Does This Paper Address?

Large pre-trained language models (LMs) like BERT have revolutionized Natural Language Processing (NLP), achieving impressive results across various tasks. However, a critical question remains: do these models truly understand language, or are they simply adept at pattern matching? This is particularly relevant for morphologically rich languages like Arabic, where word variations can be extensive, posing unique challenges for NLP models. This paper aims to probe the understanding capabilities of an Arabic BERT model (AraBERT) in the context of Arabic Machine Reading Comprehension (MRC), a task where models must find an answer within a given text based on a question. The core problem is to determine if AraBERT's high performance on Arabic MRC datasets reflects genuine comprehension or a reliance on surface-level linguistic cues.

Methods

The researchers employed two primary methods to probe AraBERT's understanding:

  1. Adversarial Examples: They devised a novel method to create "distractor" sentences. These sentences were constructed by concatenating parts of the question, the answer, and random sentences from the passage, then shuffling the word order to make them unreadable to humans. These perturbed sentences were appended to the original passages. The goal was to see if AraBERT would be misled by this irrelevant, yet keyword-rich, information, causing a significant drop in performance. They developed three variants of this attack:
  2. Q-Sent-Shuffled: Mixes the question with a random sentence.
  3. Answer-Sent-Shuffled: Mixes the answer with a random sentence.
  4. Q-Answer-Shuffled: Mixes the shuffled question and answer. The "shuffle degree" was controlled by ensuring a minimum edit distance between the original and shuffled sequences.

  5. Layer-wise Hidden State Analysis: To understand how AraBERT makes its predictions (or errors), the researchers visualized the vector representations of tokens across different layers of the transformer model. Using Principal Component Analysis (PCA) to reduce the high-dimensional vectors to 2D, they observed how token representations transform as they move through the model. This analysis aimed to reveal which parts of the input the model focuses on and how it relates them to derive an answer.

Datasets

The study evaluated AraBERT on four Arabic Machine Reading Comprehension datasets:

  • TyDI QA (gold passage task): A multi-lingual dataset covering 11 languages, where questions are inspired by Wikipedia prompts.
  • XQuAD: A cross-lingual MRC dataset translated from SQuADv1.1 into 10 languages, including Arabic.
  • MLQA: A multilingual QA dataset where question-answer pairs were translated into multiple languages.
  • Arabic WikiReading: An automatically constructed dataset using distant supervision from Wikidata.

The researchers trained on the original training sets of these datasets and then evaluated on both the original test sets and their newly constructed adversarial variants.

Key Insights and Ideas

  • Superficial Reliance: The most striking finding is that AraBERT's performance drops significantly when faced with adversarial examples. This suggests that the model heavily relies on superficial cues like keyword matching and lexical overlap, rather than a deep semantic understanding of the text.
  • Vulnerability in Early Layers: The layer-wise analysis revealed that prediction errors can often be traced back to earlier layers of the transformer. This indicates that the model's "reasoning" process, or lack thereof, begins early in its processing pipeline.
  • Clustering and Transformation: In earlier layers, tokens with similar topics are clustered together. As information progresses through the layers, these clusters transform, with middle layers showing entity matching and later layers attempting to match question tokens with supporting facts.
  • Distractor Sentence Impact: The adversarial examples, particularly those involving question words, were highly effective in misleading AraBERT, demonstrating its susceptibility to irrelevant but keyword-rich information.

Key Results

  • Performance Drop: Adversarial attacks led to substantial performance drops across datasets. For instance, on Ar-XQuAD and Ar-MLQA, the F1 score dropped by around 45%, and for TyDI QA, it dropped by 23% for the Q-Sent-Shuffled attack.
  • EM and F1 Scores: Original F1 scores for AraBERT were high on some datasets (e.g., 81.70 for Ar-TyDI QA) but lower on others (e.g., 41.04 for Ar-XQuAD). The adversarial attacks consistently reduced these scores.
  • Layer 7 Significance: The visualization indicated that layer 7 plays a crucial role in matching question tokens with supporting facts. When this matching fails due to adversarial input, the model is more prone to errors.
  • Answer Extraction: In the final layers, the model attempts to isolate the answer, but the visualizations show that even then, incorrect answers from perturbed sentences can occupy a similar vector space, leading to misclassifications.

Limitations and Future Work

The authors acknowledge that their adversarial examples are simple yet effective. They suggest that future work could explore:

  • Tokenization Methods: Investigating how different tokenization strategies impact the model's learning of morphology and handling of infrequent words in Arabic.
  • Extending to Other LMs: Applying similar adversarial probing techniques to other Arabic pre-trained language models.
  • Connecting Layers: Exploring connections between non-adjacent layers or examining specific parts of the network based on downstream tasks.
  • Constructing Unanswerable Questions: Further research into creating unanswerable questions to probe model robustness.

Summary updated

Abstract

In machine reading comprehension tasks, a model must extract an answer from the available context given a question and a passage. Recently, transformer-based pre-trained language models have achieved state-of-the-art performance in several natural language processing tasks. However, it is unclear whether such performance reflects true language understanding. In this paper, we propose adversarial examples to probe an Arabic pre-trained language model (AraBERT), leading to a significant performance drop over four Arabic machine reading comprehension datasets. We present a layer-wise analysis for the transformer’s hidden states to offer insights into how AraBERT reasons to derive an answer. The experiments indicate that AraBERT relies on superficial cues and keyword matching rather than text understanding. Furthermore, hidden state visualization demonstrates that prediction errors can be recognized from vector representations in earlier layers.
BibTeX
@inproceedings{albilali2021what,
  author = {Eman Albilali and Nora Al-Twairesh and Manar Ibrahim Hosny},
  title = {{What does BERT Learn from Arabic Machine Reading Comprehension Datasets?}},
  booktitle = {WANLP},
  year = {2021},
  url = {https://openreview.net/forum?id=H2WJbp2pXk},
}
Figure