Abstract
Contextualized representation models such as ELMo and BERT have recently achieved state-of-the-art results on a diverse array of downstream NLP tasks. Building on recent token-level probing work, we introduce a novel edge probing task design and construct a broad suite of sub-sentence tasks derived from the traditional structured NLP pipeline. We probe word-level contextual representations from four recent models and investigate how they encode sentence structure across a range of syntactic, semantic, local, and long-range phenomena. We find that existing models trained on language modeling and translation produce strong representations for syntactic phenomena, but only offer comparably small improvements on semantic tasks over a non-contextual baseline.
Introduction
The emergence of contextualized word representations, such as ELMo and BERT, marked a paradigm shift in natural language processing. Unlike static embeddings like GloVe, these models generate vectors that vary based on the surrounding context, effectively disambiguating words based on their usage. While these models have significantly improved performance on benchmark tasks, the underlying linguistic knowledge they capture remains a subject of intense research. This paper introduces a standardized "edge probing" framework to diagnose the specific structural properties encoded within these embeddings.
The Edge Probing Framework
To investigate internal representations without fine-tuning models for specific tasks, we employ a probing approach. We treat the pretrained model as a fixed feature extractor, freezing its weights and training a simple, low-capacity classifier—a small Multi-Layer Perceptron (MLP)—on top of the generated vectors.
The framework relies on several key technical components:
- Span Representations: We use a self-attention mechanism to pool word-level vectors into a single representation for a given span of text.
- Scalar Mixing: Rather than relying solely on the final layer, we learn a weighted average of all internal layers, allowing the probe to access information that might be concentrated in intermediate representations.
- Controlled Baselines: We compare performance against lexical baselines (non-contextual) and randomized versions of the models to isolate the contribution of the pretraining process.
Probing Tasks and Datasets
We evaluate models across a comprehensive suite of tasks representing the traditional NLP pipeline:
- Syntactic Tasks: Part-of-Speech (POS) tagging, Constituent labeling (OntoNotes), and Dependency labeling (English Web Treebank).
- Semantic Tasks: Named Entity labeling, Semantic Role Labeling (SRL), and Relation Classification (SemEval 2010).
- Knowledge-Intensive Tasks: Coreference resolution (OntoNotes and Winograd Schema) and Semantic Proto-Roles (SPR).
Key Insights and Results
Our analysis reveals several critical properties of contextualized representations:
The Syntax-Semantics Gap
Contextualized models demonstrate substantial improvements over non-contextual baselines in syntactic tasks. For instance, BERT-Large achieves near-perfect scores in POS tagging. However, the gains are notably more modest for semantic tasks, such as understanding fine-grained entity relations or semantic proto-roles.
Local vs. Global Context
A surprising finding is the efficacy of local context. A simple CNN baseline looking at a window of only ±2 words can recover a large portion (80-90%) of the syntactic performance of sophisticated models like ELMo. This suggests that much of the "structural" knowledge captured by these models is rooted in local patterns. The full pretrained models primarily distinguish themselves in tasks requiring long-range dependencies, such as coreference resolution, where BERT-Large showed an improvement of 7.4 F1 points over ELMo.
Layer-wise Information Distribution
For Transformer-based models, the most useful information for these probing tasks is often found in the intermediate layers. The final layers may become overly specialized for the model's pretraining objective (e.g., masked language modeling), potentially losing some of the general structural information found earlier in the network.
Conclusion
Edge probing provides a powerful lens into the "black box" of contextualized embeddings. While these models excel at capturing the syntactic scaffolding of language, their ability to represent high-level semantics is less pronounced. Future research should explore whether fine-tuning—rather than the frozen-weight probing used here—enables these models to better leverage their internal representations for complex semantic reasoning.
Summary updated