NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

What Does BERT Learn about the Structure of Language?

Ganesh Jawahar, Benoît Sagot, Djamé Seddah

Introduction

Since its inception, BERT has set new standards across NLP benchmarks. However, the nature of its success remains debated: does it truly "understand" linguistic structure, or is it simply a high-dimensional pattern matcher? This research investigates BERT’s internal representations to determine if it captures the hierarchical nature of language—from surface features to complex syntax and abstract semantics.

Experimental Framework

The authors employed three distinct methodologies to probe the 12-layer BERT-base model:

  1. Span Representation Analysis: Phrase embeddings were extracted and analyzed using t-SNE and k-means clustering to see if BERT naturally groups similar linguistic constituents (e.g., Noun Phrases, Verb Phrases).
  2. Probing Tasks: Ten diagnostic tasks from the SentEval suite were used to test specific properties, such as sentence length, tree depth, and word order sensitivity.
  3. Tensor Product Decomposition Networks (TPDN): BERT’s representations were compared against TPDNs—models that use explicit compositional rules—to identify which structural logic (e.g., linear vs. tree-based) BERT most closely mimics.
t-SNE visualizations of phrase embeddings across layers. Clustering is most distinct in Layer 1 and 2, indicating that phrase-level information is prioritized early in the network.

The Hierarchical "Layer Cake"

The study reveals that BERT’s layers function like a classical linguistic pipeline. Surface-level features, such as sentence length, peak in layers 1–3. Syntactic features, including tree depth, are most prominent in the middle layers (4–9). Finally, semantic features, such as tense and object number, reach their peak in the top layers (9–12).

A key finding is that phrase-level information is strongest in the initial layers. In the first layer, BERT achieved a Normalized Mutual Information (NMI) score of 0.38 for phrase clustering. As shown in the t-SNE visualizations above, phrase types are clearly clustered at the start of the network but become increasingly "diluted" as information is transformed into higher-level syntactic and semantic representations in the upper layers.

Depth and Complexity

The necessity of BERT’s depth becomes apparent when handling complex grammatical dependencies. While lower layers can manage simple subject-verb agreement, they struggle when "attractor" nouns (nouns that might mislead the model) are introduced.

Accuracy on subject-verb agreement tasks with varying numbers of intervening "attractor" nouns. Performance on the most difficult cases (4 attractors) improves significantly in deeper layers.

As the number of attractors increases, the model relies more heavily on its middle and upper layers to resolve long-distance dependencies. For instance, in cases with four attractors, accuracy jumps from 20% in Layer 1 to nearly 49% in Layer 9, highlighting the functional importance of the model's depth for complex grammar.

Conclusion: Implicit Linguistic Trees

Despite being built on the non-hierarchical attention mechanism, BERT’s internal logic fundamentally resembles a tree-based compositional scheme. The TPDN experiments confirmed that a "Tree" role scheme consistently provided the best fit for BERT’s representations. This suggests that BERT effectively constructs an internal "parse tree" to process language.

While these results are compelling, they are currently limited to English and standard grammatical structures. Future research is needed to explore how these hierarchies manifest in morphologically rich languages or in the presence of noisy, non-standard text.

Summary updated

BibTeX
@inproceedings{jawahar2019what,
  author = {Ganesh Jawahar and Benoît Sagot and Djamé Seddah},
  title = {{What Does BERT Learn about the Structure of Language?}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2019},
  doi = {10.18653/v1/p19-1356},
}
Figure