SensePOLAR: Word sense aware interpretability for pre-trained contextual word embeddings

Jan Engler, Sandipan Sikdar, Marlene Lutz, Markus Strohmaier

Introduction

Modern Natural Language Processing (NLP) relies on contextual word embeddings—mathematical representations where the vector for a word changes based on its surrounding context. While powerful, these embeddings are "black boxes"; a high-dimensional vector provides little insight into why a model interpreted a word in a specific way.

Previous interpretability efforts, such as the original POLAR framework, utilized "polar dimensions" based on word-level antonyms (e.g., Good vs. Bad). However, these methods often failed to account for polysemy—the phenomenon where a single word possesses multiple meanings. For instance, "right" can denote a direction (opposite of "left") or correctness (opposite of "wrong"). Static polar scales conflate these meanings, leading to ambiguous interpretations. SensePOLAR addresses this by making interpretability "sense-aware," projecting embeddings into a space defined by specific word senses.

Methodology

The SensePOLAR framework extends the POLAR approach by shifting the focus from words to specific senses. The process involves several key steps:

  1. Oracle Selection: WordNet serves as an "oracle" to identify pairs of opposite senses (e.g., Right.r.04 for direction vs. Left.r.01).
  2. Sense Embedding: Representative sense embeddings are created by averaging BERT vectors from example sentences provided by WordNet.
  3. Constructing the Space: "Direction vectors" are calculated by subtracting one sense embedding from its antonym. These vectors form a change-of-basis matrix.
  4. Transformation: Contextual embeddings are transformed into this new space using the Moore-Penrose generalized inverse. Once the polar sense space is pre-computed, the transformation is computationally efficient and can be performed on standard consumer hardware.
  5. Interpretation: In the resulting space, each dimension corresponds to a human-understandable scale. High positive or negative values indicate strong alignment with one side of a polar sense pair.
The SensePOLAR pipeline: from pretrained contextual embeddings to sense-aware interpretable outputs.

Evaluation and Datasets

The framework was evaluated across several benchmarks to ensure robustness and performance:

  • WordNet: The primary source for senses, antonym pairs, and example sentences.
  • GLUE Benchmark & SQuAD: Used to evaluate performance on general language understanding and complex question-answering tasks.
  • 20 Newsgroups: Used for feature-based text classification experiments.
  • StereoSet: Utilized to demonstrate bias detection capabilities.

Key Insights and Results

SensePOLAR demonstrates that interpretability does not require a trade-off with performance. On the GLUE benchmark, SensePOLAR-transformed embeddings performed within 1-2% of original BERT, and even slightly outperformed the base model on SQuAD 2.0 (81.06 vs 80.88 Exact Match).

Disentangling Polysemy

By utilizing senses instead of words, the model effectively distinguishes between different meanings of polysemous words. For example, the "ocean" sense of wave and the "hand-waving" sense are mapped to distinct dimensions, ensuring that dimensions relevant to one sense remain neutral for the other.

Exposing Model Bias

SensePOLAR serves as a powerful diagnostic tool for detecting social biases. The authors found that BERT associates certain terms with specific polar dimensions based on training data patterns. For instance, the word "Hispanic" was rated more strongly on dimensions like "undocumented" compared to "American." Similarly, the model's association of "doctor" with "guilty" reflects biases likely inherited from news-heavy training corpora.

Examples of SensePOLAR dimensions illustrating semantic associations and potential biases.

Human Alignment

In survey-based experiments, the dimensions identified by SensePOLAR as most significant for a given word matched human judgment approximately 87% of the time for the top-ranked dimension.

Limitations and Future Work

Despite its strengths, SensePOLAR is dependent on the quality of its oracle (WordNet). Rare senses or poor example sentences can lead to weak polar dimensions. Furthermore, the optimal number of dimensions for specific tasks remains an open question. Future research may explore extending the framework to other languages and investigating different normalization techniques to better preserve the original embedding structure.

Summary updated

BibTeX
@inproceedings{engler2022sensepolar,
  author = {Jan Engler and Sandipan Sikdar and Marlene Lutz and Markus Strohmaier},
  title = {{SensePOLAR: Word sense aware interpretability for pre-trained contextual word embeddings}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2022},
  doi = {10.18653/v1/2022.findings-emnlp.338},
}
Figure