How does BERT capture semantics? A closer look at polysemous words (2020)

Abstract: The recent paradigm shift to contextual word embeddings has seen tremendous success across a wide range of down-stream tasks. However, little is known on how the emergent relation of context and semantics manifests geometrically. We investigate polysemous words as one particularly prominent instance of semantic organization. Our rigorous quantitative analysis of linear separability and cluster organization in embedding vectors produced by BERT shows that semantics do not surface as isolated clusters but form seamless structures, tightly coupled with sentiment and syntax.

## introduction word embeddings have not only proven to be excellent representations in standalone tasks @xcite @xcite but have revolutionized the way modern nlp architectures are built @xcite , and by now encode text input for virtually every task available. recently, this approach has been paired with the transformer architecture @xcite and a selection of pre-training tasks to bootstrap more powerful contextual word embeddings such as the ones produced by bert @xcite . s the paradigm of encoding a word in its context has elevated the embedding methodology once more and from several perspectives. first, performance improvements on down-stream tasks are extraordinary across a wide range of tasks @xcite @xcite . second, the embedding space now must incorporate a vastly larger number of vectors, and its organization becomes an interesting research question on its own, especially given the largely unattributed performance gains. in this work, we investigate the important concept of polysemy as one prominent example of semantic sub-space organization. given that a word such as 'bank' can have several meanings, how are the corresponding vectors arranged in a contextual embedding space? we investigate the organization of polysemous words in bert embeddings through the concepts of separability and clusterability using the word-net annotations in semcor @xcite . our particular focus is a rigorous quantitative rather than purely qualitative analysis. ## related work work connecting polysemy and word vector representations is often limited to static word embeddings where context has to be re-introduced through graph-based approaches @xcite , auxiliary corpora @xcite , or even image data @xcite . usually, word sense disambiguation (wsd) performance is then chosen as a proxy to semantic disambiguation (pilehvar and camacho-collados, 2019), yet no insights into the organization of the vector space are obtained. in a similar spirit, kageback and salomonsson (2016) add context through a recurrent encoder, yet do not analyze the geometry of these encodings. in the meantime, the wsd task has been tackled successfully with bert embeddings and @xcite show that even a non-parametric approach suffices, which confirms that bert must arrange word vectors according to semantic properties and suggests that no additional semantic pretraining is necessary @xcite . when bert embeddings of a polysemous word are analyzed, the findings are often summarized as a silhouette score @xcite or custom variance measures @xcite . while this allows to compare the average displacement due to semantic change across words, it does not give us a good sense of the overall structure of word vectors. in addition, the embedding space produced by bert has been analyzed in terms of syntactic features, such as parse-trees @xcite , part-of-speech, verbs and arguments @xcite . it is clear that bert distinguishes polysemous words at least locally by nearest neighbors (schmidt and hofmann, 2020). however, the extent to which clusters are formed and how they are connected has only been addressed qualitatively @xcite @xcite , and no agreed-upon answer has emerged. this can be partly attributed to their qualitative methodology. ## method how can we verify a hypothesis about the organization of polysemous words without manually inspecting the geometry for each word? given a set of sentences with annotated polysemy, two strategies emerge: first, we can inspect the embedding space through the lens of a classifier with a clearly defined hypothesis set and take its accuracy as a signifier for the corresponding organization. second, we can use an unsupervised approach to detect sub-space organization and compare its result to the wordnet labels using an appropriate similarity metric. we will proceed by analyzing both questions. in our experiments, we consider the output of the last layer of bert as the contextual word embeddings since this layer is most commonly used for downstream tasks, as depicted in figure 1 . to work with a discrete formalization of semantics, we use the wordnet 3.0 annotations in the semcor 3.0 sentence dataset @xcite . this allows us to retrieve embeddings that are annotated with a ground-truth semantic class label. semcor is one of the largest sense-annotated corpora with 37, 176 sentences, enabling us to quantify semantics and sample labelled word embeddings. ## experiments we proceed with a discussion of the experimental results. ## conclusion in this paper, we investigated how contextual word embeddings produced by bert capture semantic concepts with a strong focus on polysemy. our findings show that bert creates closed semantic regions that are not clearly distinguishable from each other, seamlessly transitioning from one into another. we have shown that subspace organization is not purely determined by semantics. instead, it is also intertwined with concepts such as syntax and sentiment. finally, the repeated limitations of hard distinctions between senses as given via wordnet also open up the question to what extent bert adds a more flexible notion of semantics, compared to the hard-coded examples formed by linguists. a better understanding of these relations will be key to developing more interpretable and expressive word embeddings, as well as linguistic knowledge representations.