Syntax Representation in Word Embeddings and Neural Networks - A Survey

Tomasz Limisiewicz, David Marecek

TL;DR

This survey paper explores how well neural networks, particularly those trained for tasks like language modeling and machine translation, learn and represent syntactic information about language, even when not explicitly trained for it. It highlights that contextual embeddings and attention mechanisms in models like Transformers are crucial for capturing syntax, with middle layers often showing the most syntactic understanding.

What Problem Does This Paper Address?

Modern Natural Language Processing (NLP) heavily relies on neural networks that represent words and sentences as vectors in a high-dimensional space. While these representations have proven incredibly effective, a key question remains: do these networks understand the underlying grammatical structure (syntax) of language, or are they just good at pattern matching? This paper addresses this by surveying research that evaluates the syntactic capabilities of various neural network architectures, from traditional word embeddings to sophisticated Transformer models. Understanding this is vital because syntactic analysis is fundamental to true language comprehension, and if these models learn it implicitly, it has significant implications for their ability to generalize and perform complex linguistic tasks.

Methods

The paper surveys research that uses several methods to evaluate syntactic information:

  • Syntactic Analogies: This involves checking if word embeddings can capture relationships like "king - man + woman = queen." While early methods showed some success, the focus has shifted to more complex syntactic structures.
  • Probing Tasks: This is a common technique where a pre-trained neural network's representations are "frozen," and a simple linear classifier is trained on top to predict a specific linguistic property (like Part-of-Speech tags). The accuracy of this classifier indicates how much of that property is encoded in the network's representations.
  • Syntactic Structure Prediction: This is a more challenging task that aims to directly predict syntactic structures like dependency trees or constituency trees from the neural network's outputs. This often involves techniques like inducing trees from attention weights or using specialized probing methods.
  • Attention Analysis: For Transformer models, researchers analyze the self-attention weights, which represent how much attention each word pays to every other word. Certain patterns in these attention weights can reveal syntactic relationships.

Datasets

The paper references various datasets used for training and evaluation, including:

  • Google Analogy Test Set: Used for evaluating syntactic analogies.
  • Penn Treebank: A widely used corpus for syntactic parsing, particularly for English.
  • Wikipedia: Used for training and evaluating multilingual models.
  • OpenSubtitles: A large parallel corpus for machine translation.
  • WMT (Workshop on Machine Translation) datasets: Used for evaluating machine translation systems.
  • PUD (Universal Dependencies): A dataset for evaluating dependency parsing across multiple languages.

No new datasets are introduced in this survey paper; it focuses on analyzing existing research.

Key Insights and Ideas

  • Context is King: Static word embeddings (like Word2Vec, GloVe) struggle to capture syntax effectively because they assign a single vector to each word, ignoring its context. Contextual embeddings from RNNs and Transformers are significantly better at encoding syntactic information.
  • Transformers Excel: Transformer architectures, with their self-attention mechanisms, are particularly adept at learning syntactic structures. The paper highlights that these models can capture complex syntactic relationships even when not explicitly trained for them.
  • Middle Layers Matter Most: For Transformer-based models, the middle layers of the network tend to contain the most syntactic information. This suggests a hierarchical learning process where initial layers capture simpler relationships, and deeper layers build upon them to understand more complex syntax.
  • Language Modeling is a Strong Pre-training Task: Pre-training models on language modeling tasks (predicting the next word) appears to be more effective for learning syntax than pre-training on auto-encoding tasks. This is likely due to the availability of larger corpora for language modeling.
  • Attention Heads are Specialized: Within Transformer models, individual attention heads can specialize in capturing specific types of syntactic relationships (e.g., subject-verb agreement, adjective modifiers). However, no single head captures all syntactic information.
  • Implicit Learning is Powerful: The fact that models trained for tasks like machine translation or language modeling implicitly learn syntax is a significant finding. This suggests that these models are developing a deeper understanding of language structure than might be immediately apparent from their primary task performance.

Key Results

  • Syntactic Analogies: Word2Vec achieved around 68.9% accuracy on syntactic analogy tasks, with GloVe slightly improving to 69.3%.
  • POS Tagging: Probing experiments show that contextual embeddings from RNNs and Transformers significantly outperform static word embeddings for Part-of-Speech tagging. For instance, Figure 4 shows RNN representations achieving accuracies above 90% compared to static embeddings.
  • Syntactic Structure Induction: For dependency tree induction, BERT large models, when probed, achieved UAS scores as high as 82.5% on the Penn Treebank. For constituency trees, some methods achieved F1 scores up to 44.2% on French data.
  • Multilingual Transfer: Research on multilingual BERT (mBERT) shows that syntactic probes can be effectively transferred across languages, demonstrating that these models learn universal syntactic patterns.
  • Syntactic Heads: Studies found that a significant percentage of attention heads in Transformer models can be identified as "syntactic," meaning they contribute to extracting meaningful syntactic structures. For example, some studies found 15%-19% of heads to be syntactic in NMT models.

Limitations and Future Work

  • Evaluation Challenges: Directly evaluating syntactic understanding is complex. Metrics like UAS and LAS for dependency parsing, or F1 scores for constituency parsing, are proxies and don't always capture the full picture of linguistic competence.
  • Layer Specificity: While middle layers are often most syntactic, the optimal layer can vary depending on the model architecture (e.g., NMT encoders vs. language models) and the specific task.
  • Head Specialization vs. Generalization: While some heads specialize, the paper notes that there isn't a single head that captures all relations, and sometimes information is spread across many heads.
  • Future Work: The paper poses a crucial question for future research: "whether providing explicit syntactic information to the model can improve its performance on other NLP tasks." This suggests exploring ways to leverage the learned syntactic knowledge more directly. Further research could also focus on developing more robust methods for evaluating syntactic understanding and exploring the interplay between syntax and semantics in these models.

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