Perturbed Masking: Parameter-free Probing for Analyzing and Interpreting BERT

Zhiyong Wu, Yun Chen, Ben Kao, Qun Liu

Introduction

Since the introduction of BERT, researchers have sought to understand whether its performance stems from a deep linguistic understanding or sophisticated pattern matching. Traditional methods for exploring this involve probes—small, supervised neural networks trained on top of frozen BERT representations. However, these probes introduce a "capacity dilemma": it is unclear whether a high-performing probe reflects BERT's inherent knowledge or the probe's own ability to learn the task.

This paper introduces Perturbed Masking, a parameter-free technique designed to extract linguistic structures directly from BERT using only its original training objective, Masked Language Modeling (MLM). By removing the additional model, the authors can interrogate BERT's native internal representations without external bias.

Methodology: The Perturbed Masking Technique

The core of this approach is a two-stage perturbation process used to measure the impact of one word on another within a sentence. To determine how much word $x_j$ contributes to the understanding of word $x_i$:

  1. Stage 1: Mask word $x_i$ and record BERT's prediction for that position.
  2. Stage 2: Mask both $x_i$ and $x_j$ and record the change in prediction.

By calculating the difference between these states—using metrics like Euclidean distance or probability shifts—the authors generate an Impact Matrix. This matrix represents the strength of the relationship between every pair of words in a sentence.

Figure 1: Visualization of the Impact Matrix generated via Perturbed Masking. The red boxes highlight clusters of high impact corresponding to syntactic constituents.

Following the creation of the Impact Matrix, standard non-neural graph algorithms (such as the Eisner algorithm for dependency trees) are applied to induce a hierarchical structure. This process requires no additional parameters or training data.

Datasets and Evaluation

The effectiveness of Perturbed Masking was evaluated across several benchmarks:

  • Syntactic Parsing: Parallel Universal Dependencies (PUD) and WSJ10 (a subset of the Penn Treebank).
  • Constituency Parsing: The full PTB23 test set.
  • Discourse Parsing: SciDTB, focusing on scientific abstract relations.
  • Downstream Tasks: Aspect-Based Sentiment Classification (ABSC) using SemEval 2014 data.

Key Results and Insights

Syntactic Performance

On the WSJ10 dataset, the Perturbed Masking approach achieved an Unlabeled Attachment Score (UAS) of 58.6, significantly outperforming baseline models. This result demonstrates that BERT captures a robust structured hierarchy as a byproduct of its self-supervised training.

Figure 3: Comparison of parsing performance (UAS) across different models on the WSJ10-U and PUD datasets.

Functional vs. Lexical Heads

The study revealed that BERT's induced trees often prioritize functional words (like "on" in "on Sunday") as heads, whereas human linguists typically choose lexical words ("Sunday"). Despite these differences, BERT's internal syntax proved highly effective for downstream applications.

Downstream Utility

In sentiment analysis tasks, trees induced directly from BERT performed as well as, or better than, those provided by expert-designed parsers like SpaCy. For instance, on the Restaurant dataset, BERT-induced trees achieved an accuracy of 81.21%, compared to 80.98% with SpaCy. This suggests that BERT's internal representation of language may be more computationally optimized for neural networks than traditional human grammar.

Conclusion

Perturbed Masking provides a powerful, parameter-free lens into the inner workings of BERT. While the induced trees do not yet match the accuracy of gold-standard human annotations, they reveal that BERT naturally develops a sophisticated understanding of syntax and discourse. Future research may extend this technique to larger models like GPT-4 or apply it to complex linguistic phenomena such as coreference resolution.

Summary updated

BibTeX
@inproceedings{wu2020perturbed,
  author = {Zhiyong Wu and Yun Chen and Ben Kao and Qun Liu},
  title = {{Perturbed Masking: Parameter-free Probing for Analyzing and Interpreting BERT}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2020},
  doi = {10.18653/v1/2020.acl-main.383},
}
Figure