What do you learn from context? Probing for sentence structure in contextualized word representations

Ian Tenney, Patrick Xia, Berlin Chen, Alex Wang, Adam Poliak, R. Thomas McCoy, Najoung Kim, Benjamin Van Durme, Samuel R. Bowman, Dipanjan Das, Ellie Pavlick

In the late 2010s, natural language processing (NLP) was revolutionized by the introduction of "contextualized" word embeddings. Unlike older models like GloVe—which assigned the word "bank" the exact same vector regardless of whether it referred to a river bank or a financial institution—models like BERT and ELMo process the entire sentence to generate a unique, context-aware vector for every token.

While these models shattered leaderboards across a wide array of NLP tasks, researchers struggled to understand why they worked so well. Were they actually learning the underlying "rules" of grammar and meaning, or were they simply acting as highly sophisticated pattern matchers? This paper introduces a standardized framework called edge probing to diagnose exactly what linguistic information is captured by these contextualized representations.

The Edge Probing Methodology

To understand what a model has learned without conflating it with the learning capacity of the testing mechanism itself, the authors developed the edge probing framework. The core idea is to treat the pretrained model (like BERT or ELMo) strictly as a fixed feature extractor.

Here is how the probing works:

  1. Span Selection: The model is given one or two spans of text within a sentence (e.g., "the red apple").
  2. Pooling: A self-attention mechanism collapses the contextualized vectors within those spans into a single "span representation."
  3. Classification: A very small, simple classifier (a Multi-Layer Perceptron, or MLP) is trained on top of these representations to predict a specific linguistic label (e.g., "Is this span a Noun Phrase?" or "Is 'apple' the object of 'ate'?").
Edge Probing Architecture

Crucially, the weights of the underlying contextual model are "frozen." By keeping the probe simple and the backbone model static, the authors ensure that any high performance on the task comes directly from the representations themselves, rather than the probe's ability to learn the task from scratch.

Tasks and Datasets

The study evaluates these representations across a comprehensive suite of eight tasks derived from established NLP benchmarks, spanning from basic syntax to complex semantics:

  • Syntax: Part-of-Speech (POS) tagging, Constituent labeling, and Dependency labeling (using OntoNotes 5.0 and the English Web Treebank).
  • Entities and Roles: Named Entity Recognition (NER) and Semantic Role Labeling (SRL).
  • Semantics and Coreference: Relation Classification (SemEval 2010 Task 8), Semantic Proto-Roles (SPR1 & SPR2), and Coreference resolution (OntoNotes and the difficult Winograd Schema challenge).

Key Insights: Syntax vs. Semantics

The "Syntactic" Sweet Spot

The most striking finding is that contextualized models show massive gains in encoding syntactic structure. For tasks like identifying constituents or dependency relations, models like BERT-large reduce the error rate by over 40% compared to non-contextual baselines. For instance, on constituent labeling, ELMo improved the F1 score from a lexical baseline of 69.1 to 84.6.

The Semantic Ceiling

However, improvements in high-level semantics—such as tracking who did what to whom in a complex sentence—are surprisingly modest. While the models outperform static embeddings like GloVe, the "gap" between context-independent and contextualized models narrows significantly on semantic tasks. On the Winograd coreference task, which requires "common sense" reasoning, even the best models struggled, often scoring in the low 60s (where 50 represents random guessing).

Local vs. Long-Range Context

By comparing the full models to a simple Convolutional Neural Network (CNN) baseline that only looks at a window of ±2 words, the authors discovered that a massive chunk of "contextual" information is actually highly local.

Performance across baselines and full models

Despite this heavy reliance on local context, the full models (especially ELMo and BERT) still significantly outperform the CNN baselines on long-distance dependencies, proving they do capture broader sentence structure when necessary.

Architecture and Layer Mixing

The study also revealed nuances in how these models should be used:

  • Scalar Mixing: Taking a weighted average of all internal layers performs better than just extracting the final output layer. This indicates that different layers of the network specialize in different linguistic phenomena.
  • Inductive Bias: Even a "randomized" ELMo (using random weights but retaining the LSTM architecture) performs better than a simple lexical baseline. This suggests that the sequential architecture itself possesses an inductive bias well-suited for human language.

Limitations and Future Directions

While edge probing sheds light on the internal representations of these powerful models, the authors note a few limitations. First, the study focuses on labeling known spans, not discovering them (e.g., it doesn't test if the model knows where a noun phrase starts and ends). Second, because the models were frozen, the framework doesn't account for how task-specific "fine-tuning" might alter these internal representations.

Ultimately, while we now know that models like BERT and ELMo are exceptionally good at internalizing the rules of syntax, the "why" behind their struggles with deeper semantics remains an open question. Future work will need to explore whether this semantic ceiling is due to a lack of appropriate training data, or if the standard language modeling objective (predicting the next word) is simply insufficient to teach true "meaning."

Summary updated

BibTeX
@inproceedings{tenney2019what,
  author = {Ian Tenney and Patrick Xia and Berlin Chen and Alex Wang and Adam Poliak and R. Thomas McCoy and Najoung Kim and Benjamin Van Durme and Samuel R. Bowman and Dipanjan Das and Ellie Pavlick},
  title = {{What do you learn from context? Probing for sentence structure in contextualized word representations}},
  booktitle = {International Conference on Learning Representations},
  year = {2019},
  url = {https://openreview.net/forum?id=qnsxzXANpO},
}
Figure