S ense POLAR : Word sense aware interpretability for pre-trained contextual word embeddings (2022)

Abstract: Adding interpretability to word embeddings represents an area of active research in textrepresentation. Recent work has explored the potential of embedding words via so-called polardimensions (e.g. good vs. bad, correct vs. wrong). Examples of such recent approachesinclude SemAxis, POLAR, FrameAxis, and BiImp. Although these approaches provide interpretabledimensions for words, they have not been designed to deal with polysemy, i.e. they can not easily distinguish between different senses of words. To address this limitation, we present SensePOLAR, an extension of the original POLAR framework that enables wordsense aware interpretability for pre-trained contextual word embeddings. The resulting interpretable word embeddings achieve a level ofperformance that is comparable to original contextual word embeddings across a variety ofnatural language processing tasks including the GLUE and SQuAD benchmarks. Our workremoves a fundamental limitation of existing approaches by offering users sense aware interpretationsfor contextual word embeddings.

## introduction the overwhelming success of deep neural networks (dnn) in the last decade has been accompanied by increasing concerns about the lack of interpretability @xcite . this problem is amplified in the area of natural language processing (nlp) where word embeddings are used as input to machine learning models instead of more classical, understandable features. traditional (static) word embedding models like word2vec @xcite or glove @xcite , that create one embedding for each word, are currently being replaced by contextual word embedding models like bert @xcite which have achieved competitive performance in nlp * equal contribution benchmarks such as glue @xcite and squad @xcite . to improve interpretability, recent approaches such as semaxis @xcite , polar @xcite , frameaxis @xcite , and biimp @xcite have explored the potential of embedding words via polar dimensions (e.g. good vs. bad, correct vs. wrong). while these approaches have been useful for interpreting word vectors, they have not been designed to deal with polysemy, i.e. multiple senses of words. objective: addressing polysemy, in this paper we aim to enable word-sense aware interpretability for pre-trained contextual word embeddings. approach: we base our approach on the original polar framework @xcite and the idea of semantic differentials @xcite , which are psychometric scales between two antonym words, e.g. "right" ↔ "wrong". sense-polar extends polar @xcite to contextual word embeddings, and defines polar sense instead of polar word scales. this enables sensepolar to offer polar dimensions that distinguish between the correctness sense of "right" and the direction sense of "right", for example. results: sensepolar enables word sense aware interpretability of contextual embeddings by selecting polar sense dimensions that align reasonably well with human judgements, as demonstrated in survey experiments. sensepolar exhibits competitive performance on various nlp tasks where it is used as input features for a separate model (feature-based approach) as well as directly integrated in the model itself (fine-tuning approach). contributions: sensepolar introduces the notion of sense aware interpretations. to the best of our knowledge, sensepolar represents the first (semi-) supervised method that enables word sense aware interpretability for contextual word embeddings. sensepolar is publicly available foot_0 . the scores across the dimensions are representative of the strength of relationship (between word and dimension) which allows us to rank the dimensions and thereby identify the most discriminative dimensions for a word. in this example, the word "wave" is used in two senses: hand waving and ocean wave. sensepolar not only generates dimensions that are representative of individual contextual meanings, the alignment to the respective sense spaces also aligns well with human judgement. sensepolar generates neutral scores for dimensions not related to the word in the given context (e.g., "idle"↔"work", "social"↔"unsocial"). we follow the wordnet convention to represent a particular sense of a word. for example, "tide.v.01" represents the word "tide" in the sense of surge (rise or move forward). ## sensepolar the key idea of sensepolar is to transform pretrained word embeddings into an interpretable, sense aware space. in this space, each dimension represents a scale on which words are rated, inspired by the semantic differential technique @xcite . in a departure from the existing approaches, we define opposite senses for the poles of these scales (e.g. "left direction" ↔ "right direction"), as opposed to opposite words (e.g. "left" ↔ "right"), as used in @xcite . given a contextual word embedding model m, the interpretable embeddings are obtained through the following steps. 1) we use m to obtain the (non-interpretable) contextual embedding space. 2) we obtain polar senses with contextual information from an oracle. 3) we proceed with generating representative sense embeddings from which we 4) construct the interpretable polar sense space. 5) the original embedding is transformed into the polar sense space, which enables interpretation with regard to opposite sense pairs. we illustrate each step in figure 1 and elaborate them next. 1. obtaining contextual embeddings: to obtain the embedding of a particular word, we forward the word with its context, i.e. an example sentence, to the embedding model m. the embedding of the corresponding word can then be retrieved from the output of m. because most models deploy subword tokenization algorithms, such as wordpiece sensepolar @xcite , embeddings of only subword tokens, rather than entire words, are generated by the contextual embedding models. this provides for obtaining representations for out-of-vocabulary words but, at the same time, makes embeddings of even common words not directly available. following existing literature @xcite , we compute the embedding of a word by averaging over the embeddings of the constituent tokens. ## evaluation note that while sensepolar allows for deployment across any contextual word embedding model, in this work, we consider bert @xcite as our model for illustration. we consider a bert-base model which utilizes 12 transformer @xcite encoder layers and generates embeddings of size 768. the pre-trained bert-base model was downloaded from huggingface foot_1 . in addition, we use wordnet as our oracle with 1763 polar sense pairs. ## applications we discuss two potential use cases: (i) analyzing bias in contextual embeddings and (ii) explaining model decisions on downstream tasks. ## discussion next, we discuss issues pertinent to sensepolar. generalizability: sensepolar is applicable to any pre-trained contextual embedding model. it can also be deployed on top of any of the constituent transformer layers. this allows for not only comparing different contextual word embedding models in terms of interpretability or bias analysis but also performing similar analysis across transformer layers of the same embedding model. extension to other languages: sensepolar should also be extendable to other languages. the only requirement would be to be able to obtain suitable sense antonym pairs as well as example contexts via an oracle. interpretable decision-making. in section 4.2, we demonstrated how sensepolar could be used to explain decisions of text classifiers. however, the design of sensepolar allows for deployment across any other downstream task as well. this is in contrast with existing interpretability methods which are often developed with a particular downstream task in mind. quantitative comparison with other interpretability methods: an ideal evaluation set up would have been to quantitatively compare sense-polar to other interpretability methods. however, as pointed out in the existing literature @xcite , when two models provide different interpretations, it is difficult to judge if one is better than the other. involving humans makes it even harder, as one now needs to tease out a person's own subjective biases. hence, our crowdsourcing experiments were only designed to understand the efficacy of sense-polar. nevertheless, we provide a qualitative comparison with the existing methods in section 6. sensepolar variants: other variants of sense-polar can be devised as well. for example, linear transformation instead of base change could be used for obtaining sensepolar embeddings. however, we observed that linear transformation does not preserve the original structure of the embedding space, where the different senses of words are already sufficiently separated. one can also experiment with different normalization techniques, such as scaling or standardization. in this paper, we concentrated on an exhaustive evaluation setup to include more downstream tasks and crowdsourcing experiments rather than exploring other variants. we consider all the above variants promising avenues for future work. ## related work in this section, we briefly summarize previous research on enabling interpretability for both static and contextual word embeddings. ## conclusion we introduced sensepolar which enables word sense aware interpretability for contextual word embeddings. the key idea is to project word embeddings onto an interpretable space which is constructed from polar sense pairs obtained from an oracle. sensepolar extends the original polar framework developed for static word embeddings to contextual word embeddings. we demonstrated that the obtained interpretable embeddings align well with human judgement. moreover, sensepo-lar could be integrated into fine-tuned models and can be deployed to specific applications like bias analysis and explaining prediction results of classifier models.