TL;DR
This paper investigates whether BERT, a powerful contextualized language model, truly functions as a distributional semantics model (DSM). While BERT shows promise in capturing semantic similarity, its internal mechanisms, particularly sentence position encoding, introduce biases that disrupt the expected coherence of its semantic space.
What Problem Does This Paper Address?
Distributional semantics models (DSMs) represent word meaning based on their usage in context, typically by mapping words to vectors in a semantic space where similar words are close together. Contextualized word embeddings, like those produced by BERT, are seen as a natural extension of this idea, generating different vector representations for a word depending on its surrounding text. However, it's unclear if these sophisticated models fully adhere to the core properties expected of DSMs, especially regarding the consistency and structure of their semantic space. This paper aims to bridge this gap by rigorously assessing BERT's contextual embeddings against established DSM principles.
Methods
The authors employ a theory-driven lexical semantic perspective to evaluate BERT. Their approach involves:
- Word Type Cohesion: Assessing if words of the same type cluster together in BERT's embedding space, a fundamental DSM property. They use silhouette scores to measure how well each token's embedding fits its assigned word type cluster.
- Cross-Sentence Coherence: Investigating whether BERT's representations are consistent across different sentence positions within the input. This involves analyzing if tokens from even-numbered sentences are represented similarly to those from odd-numbered sentences, considering BERT's "next sentence prediction" (NSP) objective and its use of segment encodings.
- Semantic Space Structure: Examining how segment encodings affect the overall similarity structure of the semantic space by comparing pairwise cosine similarities of token embeddings within and across sentences.
- Compositional Semantics: Evaluating BERT's ability to represent sentence meaning by summing token embeddings and correlating these with human-annotated relatedness scores on semantic textual similarity (STS) benchmarks.
Datasets
- Gutenberg Corpus: Used for training and evaluating BERT's embeddings. Older texts (King John's Bible and Shakespeare) were removed.
- MEN word similarity dataset: Used to assess how well BERT captures broader notions of similarity between words.
- STS (Semantic Textual Similarity) benchmarks: Used to evaluate the compositional semantics of BERT's sentence representations.
- SICK-R benchmark: Also used for evaluating compositional semantics.
Key Insights and Ideas
- BERT's "Next Sentence Prediction" (NSP) objective is a double-edged sword: While it helps BERT understand sentence relationships, it introduces a systematic bias by marking sentences as "first" or "second." This distinction, not directly related to lexical meaning, creates separate semantic spaces for tokens based on their sentence position.
- Positional encodings matter: BERT's use of absolute positional encodings, added to word embeddings, further contributes to the observed cross-sentence incoherence. This means the same word can have different representations depending on its exact position in the input sequence.
- BERT's semantic space is not entirely coherent: Despite showing a general tendency towards semantic clustering, BERT's embeddings are demonstrably affected by sentence position, leading to a disruption of expected similarity relationships.
- Monosemous words fare better: Words with a single, clear meaning exhibit more coherent clusters than polysemous words, aligning with DSM expectations. However, even monosemous words can have negative silhouette scores, indicating they might be better assigned to other clusters.
Key Results
- Word Type Cohesion: 25.9% of tokens had negative silhouette scores, meaning they were better assigned to a different word type cluster. 10% of word types contained only tokens with negative silhouette scores.
- Cross-Sentence Coherence: A significant difference was observed in token encoding based on sentence position (first vs. second), with a stronger effect size than observed for word type cohesion. Frequent words (like punctuation and stop words) showed smaller differences, suggesting they are more robust to these positional effects.
- Semantic Space Structure: Comparing cosine scores between first and second sentences revealed a significant, albeit small, effect. BERT's performance on STS benchmarks dropped significantly when using a "two sentences input" scheme compared to a "one sentence input" scheme, highlighting the impact of cross-sentence incoherence.
- Semantic Similarity: BERT's average embeddings showed a Spearman correlation of 0.705 with human similarity ratings on the MEN dataset, outperforming a word2vec baseline (0.669).
Limitations and Future Work
- Subword Tokenization: BERT uses subword units, which don't always directly correspond to words, potentially affecting the interpretation of word type clusters.
- Polysemy and Homonymy: The inherent ambiguity of words with multiple meanings can naturally lead to variations in embeddings, making it challenging to isolate the effects of BERT's architecture.
- NSP Objective's Impact: The authors suggest that the NSP objective is a primary driver of the observed cross-sentence incoherence and that its necessity for general language understanding is debatable.
- Future Work: The authors suggest exploring other BERT models (e.g., whole-word models, models with different training objectives), investigating alternative relative positional encodings, and further refining the understanding of how Transformer architectures model linguistic structure. They also propose that treating first and second sentences as belonging to distinct distributional semantic spaces might be a way to overcome the observed coherence issues.
Summary updated