Introduction
While Transformer-based models like BERT have revolutionized natural language processing, their internal mechanisms for contextualizing language remain largely opaque. This paper introduces LMExplorer, a visual analytics tool designed to probe how BERT represents words across its layers. By mapping embeddings to a "functionality continuum"—ranging from concrete content words to abstract grammatical markers—the authors reveal that BERT struggles to model the "squishy" middle ground of language, such as quantifiers and modals.
The Challenge of Contextualization
Linguistics distinguishes between content words (nouns, verbs) and function words (prepositions, articles). However, many words exist on a continuum between these two poles. Understanding how BERT navigates this space is crucial for interpreting its reasoning. The authors address a critical gap: Does BERT’s internal geometry respect these linguistic categories, and where does it fall short?
Methodology: The LMExplorer Pipeline
To analyze high-dimensional embedding spaces, the authors developed LMExplorer. The tool employs a modified version of UMAP, called AlignedUMAP, to create stable, layer-wise 2D projections of word embeddings. This allows for direct comparison across all 12 layers of BERT simultaneously by preventing the random rotations typical of standard dimensionality reduction.
A central metric in this analysis is Self-Similarity Scoring. This metric calculates the average cosine similarity of a word's embedding with itself across different contexts. A high score indicates a "static" representation (low contextualization), while a low score suggests the model is aggressively changing the word's meaning based on its neighbors (high contextualization).
Experimental Setup
The study utilized a random subset of 800 sentences from the RTE (Recognizing Textual Entailment) 1, 2, and 3 corpora. These datasets are ideal due to their complex content and news-domain origins. The authors focused on 496 unique words appearing with a frequency between 5 and 50 to ensure statistical relevance while avoiding outliers.
Results and Discussion
The analysis yielded several critical insights into BERT's internal behavior:
- The "Middle" Failure: BERT accurately models homonyms (high contextualization) and monosemous words (low contextualization). However, it fails on "semi-functional" words like modals (must, should) and quantifiers (all, every). While these are linguistically complex, BERT treats them as static entities, missing the nuanced logical roles they play.
- Structural Contextualization: Even simple function words like "the" show increased contextualization in higher layers. This suggests the model captures structural relationships and grammatical "glue" rather than just resolving semantic ambiguity.
- Spatial Stability: Content words, particularly named entities, maintain consistent spatial clusters across layers. This indicates that BERT builds stable "semantic neighborhoods" for concrete concepts.
Comparison of Expected vs. Actual Behavior
| Word Category | Expected Contextualization | BERT's Behavior | Result |
|---|---|---|---|
| Homonyms (set) | High | High | Match |
| Monosemous (tsunami) | Low | Low | Match |
| Prepositions (of, in) | High | High | Match |
| Modals/Quantifiers | High | Low | Fail |
Conclusion
The authors conclude that BERT’s learning pattern mirrors human language acquisition, prioritizing concrete concepts over complex logical operators. While BERT is a master of pure content and grammar, it lacks the sophistication to handle the "squishy" middle of the functionality continuum. Future work will extend LMExplorer to larger models to determine if increased scale allows these models to capture these elusive logical nuances.
Summary updated