Syntax Representation in Word Embeddings and Neural Networks - A Survey

Tomasz Limisiewicz, David Marecek

Modern Natural Language Processing (NLP) models, such as BERT and GPT, are typically trained on simple, self-supervised objectives like predicting a masked word or translating a sentence. Despite never being explicitly taught the rules of grammar, these models perform incredibly well on complex language tasks. This survey explores a fundamental question: Do these models actually learn human language syntax, or are they just performing shallow statistical pattern matching? By aggregating research on "probing" and attention analysis, this paper identifies where and how syntactic knowledge is stored within neural architectures.

Methodology

Researchers primarily use two methodologies to uncover the latent syntax in neural networks:

  1. Probing Classifiers: This involves freezing a pre-trained model's weights and training a small, shallow neural network on top of its hidden states. If this shallow network can accurately predict syntactic properties—such as Part-of-Speech tags or the distance between words in a dependency tree—it proves the frozen representations already encode that information.
  2. Attention Analysis: Specific to Transformer architectures, this method directly examines self-attention matrices. Researchers look for "Dependency Alignment" (e.g., checking if a verb attends heavily to its subject) and use algorithms like Maximum Spanning Tree (MST) to extract full dependency trees directly from attention weights. For constituency trees, researchers look for "balustrades"—block-like attention patterns that overlap with syntactic phrases.
Figure 1: Visualization of the self-attention mechanism (q x k) used to analyze syntactic dependencies in Transformers.

Key Insights and Ideas

Context is King

One of the most consistent findings is that contextual models (RNNs and Transformers) vastly outperform static embeddings like Word2Vec or GloVe on syntactic tasks. Context is crucial for resolving grammatical ambiguities, such as homographs that act as different parts of speech depending on the sentence structure.

Figure 4: Performance comparison showing that contextual RNN representations consistently outperform static word embeddings across multiple syntactic benchmarks.

The "Middle Layer" Phenomenon

In Transformer language models like BERT and GPT-2, syntactic information is not distributed uniformly. The middle layers are the most syntactic. While early layers focus on local context and surface features, and final layers become specialized for the specific pre-training task (like next-word prediction), the intermediate layers capture complex grammar and dependency structures.

Training Objectives Matter

Pre-training a model on language modeling (LM) yields better syntactic representations than machine translation (MT). This is largely because LM can leverage massive monolingual corpora, whereas translation models are bottlenecked by the availability of parallel texts. Auto-encoding is found to be the least effective objective for learning syntax.

Distributed and Universal Grammar

In Transformers, no single attention head captures all grammar. Instead, specific syntactic relations (like noun-subject or adjective-modifier) are distributed across different heads. Furthermore, multilingual models (like mBERT) cluster syntactic relations similarly across typologically related languages, allowing for effective zero-shot cross-lingual transfer for syntactic parsing.

Key Results

  • Dependency Parsing: Probing the 15th layer of BERT-large can induce dependency trees with an 82.5% Unlabeled Attachment Score (UAS) on the Penn Treebank. Extracting trees directly from attention weights (without supervised probing) yields up to 77% UAS.
  • Constituency Parsing: Using attention "balustrades" to induce constituency trees achieves up to a 40.1% F1 score on the Penn Treebank using XLNet-base.
  • Head Pruning: Studies show that while 75% of a Transformer's attention heads can be pruned with negligible performance loss, the proportion of "syntactic" heads rises from 17% to 40% during this process, proving that syntax-aware heads perform the heavy lifting for the model.

Limitations and Future Work

Because this is a survey aggregating results from various papers, direct 1-to-1 comparisons are sometimes difficult due to differing datasets and metrics. Additionally, unsupervised structure induction directly from attention still lags significantly behind supervised probing methods. A major open question remains: can we improve downstream NLP performance by providing models with explicit syntactic information during training, rather than relying solely on implicit learning?

Summary updated

BibTeX
@inproceedings{limisiewicz2020syntax,
  author = {Tomasz Limisiewicz and David Marecek},
  title = {{Syntax Representation in Word Embeddings and Neural Networks - A Survey}},
  booktitle = {ITAT},
  year = {2020},
  url = {https://openreview.net/forum?id=RCSxC5Qf_9},
}
Figure