[Paper Review] How Contextual are Contextualized Word Representations? Comparing the Geometry of BERT, ELMo, and GPT-2 Embeddings
This paper investigates the contextual sensitivity of word representations in BERT, ELMo, and GPT-2 by analyzing the geometry of their hidden states. It finds that while representations are highly anisotropic and upper layers are more context-specific, less than 5% of variance in contextualized representations is explained by static embeddings—even after adjusting for anisotropy—indicating that contextualized representations are not reducible to a finite set of word-sense vectors.
Replacing 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.
Motivation & Objective
- To determine how context-specific the representations of contextualized word models like BERT, ELMo, and GPT-2 truly are.
- To investigate whether contextualized representations correspond to a finite number of word-sense embeddings or infinitely many context-specific vectors.
- To compare the geometric properties—especially anisotropy and similarity structure—across layers and models.
- To evaluate the effectiveness of static embeddings derived from the first principal component of contextualized representations.
- To understand how context-specificity varies across ELMo, BERT, and GPT-2, and how it affects downstream performance.
Proposed method
- Computed cosine similarity between contextualized representations of the same word in different contexts to measure context-specificity.
- Analyzed the anisotropy of representation spaces by measuring the concentration of word vectors within a narrow cone in vector space.
- Used principal component analysis (PCA) to extract the first principal component of each word’s contextualized representations across layers.
- Measured the proportion of variance in contextualized representations explained by the first principal component (MEV) to assess reducibility to static embeddings.
- Adjusted similarity scores for anisotropy to isolate true context-specificity from directional bias in the representation space.
- Evaluated static embeddings derived from PCA on standard word vector benchmarks (e.g., SimLex, MEN, WordSim, Google analogy).
Experimental results
Research questions
- RQ1To what extent are contextualized word representations in BERT, ELMo, and GPT-2 truly context-specific, rather than assigning a finite number of word-sense vectors?
- RQ2How does the anisotropy of representation spaces affect the interpretation and performance of contextualized embeddings?
- RQ3How does context-specificity vary across layers and models—particularly between ELMo, BERT, and GPT-2?
- RQ4Can static word embeddings derived from the first principal component of contextualized representations outperform traditional static embeddings like GloVe and FastText?
- RQ5What is the proportion of variance in contextualized representations that can be explained by a single static vector, after accounting for anisotropy?
Key findings
- In all layers of ELMo, BERT, and GPT-2, contextualized word representations are anisotropic, with vectors concentrated in a narrow cone; GPT-2’s last layer is so anisotropic that random word pairs have near-perfect cosine similarity.
- Representations of the same word in different contexts are not identical, and their cosine similarity decreases in upper layers, indicating increased context-specificity.
- After adjusting for anisotropy, on average less than 5% of the variance in a word’s contextualized representations can be explained by its first principal component across all layers and models.
- Despite high context-specificity in upper layers, the first principal component of lower-layer representations (especially BERT’s first layer) outperforms GloVe and FastText on word vector benchmarks.
- Context-specificity manifests differently: ELMo shows increased similarity between words in the same sentence in upper layers, BERT shows moderate increase in dissimilarity, and GPT-2 shows no such increase—words in the same sentence are no more similar than random pairs.
- The principal component of GPT-2 representations performs markedly worse than those from ELMo and BERT, suggesting that highly context-specific representations yield less effective static approximations.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.