How Contextual are Contextualized Word Representations? Comparing the Geometry of BERT, ELMo, and GPT-2 Embeddings

9503

Authors

nan

Abstract

AbstractReplacing static word embeddings with contextualized word representations has yielded significant improvements on many NLP tasks. However, just how contextual are the contextualized representations produced by models such as ELMo and BERT? Are there infinitely many context-specific representations for each word, or are words essentially assigned one of a finite number of word-sense representations? For one, we find that the contextualized representations of all words are not isotropic in any layer of the contextualizing model. While representations of the same word in different contexts still have a greater cosine similarity than those of two different words, this self-similarity is much lower in upper layers. This suggests that upper layers of contextualizing models produce more context-specific representations, much like how upper layers of LSTMs produce more task-specific representations. In all layers of ELMo, BERT, and GPT-2, on average, less than 5% of the variance in a word’s contextualized representations can be explained by a static embedding for that word, providing some justification for the success of contextualized representations.

Keywords

nan

Full Content

Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, pages 55–65, Hong Kong, China, November 3–7, 2019. c⃝2019 Association for Computational Linguistics 55 How Contextual are Contextualized Word Representations? Comparing the Geometry of BERT, ELMo, and GPT-2 Embeddings Kawin Ethayarajh∗ Stanford University kawin@stanford.edu Abstract Replacing static word embeddings with con- textualized word representations has yielded significant improvements on many NLP tasks. However, just how contextual are the contex- tualized representations produced by models such as ELMo and BERT? Are there infinitely many context-specific representations for each word, or are words essentially assigned one of a finite number of word-sense representations? For one, we find that the contextualized rep- resentations of all words are not isotropic in any layer of the contextualizing model. While representations of the same word in differ- ent contexts still have a greater cosine simi- larity than those of two different words, this self-similarity is much lower in upper layers. This suggests that upper layers of contextu- alizing models produce more context-specific representations, much like how upper layers of LSTMs produce more task-specific repre- sentations. In all layers of ELMo, BERT, and GPT-2, on average, less than 5% of the vari- ance in a word’s contextualized representa- tions can be explained by a static embedding for that word, providing some justification for the success of contextualized representations. 1 Introduction The application of deep learning methods to NLP is made possible by representing words as vec- tors in a low-dimensional continuous space. Tradi- tionally, these word embeddings were static: each word had a single vector, regardless of context (Mikolov et al., 2013a; Pennington et al., 2014). This posed several problems, most notably that all senses of a polysemous word had to share the same representation. More recent work, namely deep neural language models such as ELMo (Pe- ters et al., 2018) and BERT (Devlin et al., 2018), ∗Work partly done at the University of Toronto. have successfully created contextualized word rep- resentations, word vectors that are sensitive to the context in which they appear. Replacing static embeddings with contextualized representa- tions has yielded significant improvements on a di- verse array of NLP tasks, ranging from question- answering to coreference resolution. The success of contextualized word represen- tations suggests that despite being trained with only a language modelling task, they learn highly transferable and task-agnostic properties of lan- guage. In fact, linear probing models trained on frozen contextualized representations can predict linguistic properties of words (e.g., part-of-speech tags) almost as well as state-of-the-art models (Liu et al., 2019a; Hewitt and Manning, 2019). Still, these representations remain poorly understood. For one, just how contextual are these contextu- alized word representations? Are there infinitely many context-specific representations that BERT and ELMo can assign to each word, or are words essentially assigned one of a finite number of word-sense representations? We answer this question by studying the geom- etry of the representation space for each layer of ELMo, BERT, …

Content truncated to 500 words

Labeled Text

AbstractReplacing static word embeddings with contextualized word representations has yielded significant improvements on many NLP tasks. However, just how contextual are the contextualized representations produced by models such as ELMo and BERT? Are there infinitely many context-specific representations for each word, or are words essentially assigned one of a finite number of word-sense representations? For one, we find that the contextualized representations of all words are not isotropic in any layer of the contextualizing model. While representations of the same word in different contexts still have a greater cosine similarity than those of two different words, this self-similarity is much lower in upper layers. This suggests that upper layers of contextualizing models produce more context-specific representations, much like how upper layers of LSTMs produce more task-specific representations. In all layers of ELMo, BERT, and GPT-2, on average, less than 5% of the variance in a word’s contextualized representations can be explained by a static embedding for that word, providing some justification for the success of contextualized representations.

Publication Details

Paper ID:
9503
Year:
2019
Publication:
TIPSTER
Publication Type:
conf
DOI:
nan