Skip to main content
QUICK REVIEW

[Paper Review] Transformer Grammars: Augmenting Transformer Language Models with Syntactic Inductive Biases at Scale

Laurent Sartran, Samuel Barrett|arXiv (Cornell University)|Mar 1, 2022
Topic ModelingComputer Science4 citations
TL;DR

This paper introduces Transformer Grammars (TGs), a novel class of Transformer language models that integrate recursive syntactic composition via a specialized attention mask and deterministic tree linearization, significantly improving syntax-sensitive language modeling. TGs outperform strong baselines—including GPT-2-small, Gopher, and Chinchilla—on syntactic generalization and parse reranking, despite being much smaller and faster to train.

ABSTRACT

We introduce Transformer Grammars (TGs), a novel class of Transformer language models that combine (i) the expressive power, scalability, and strong performance of Transformers and (ii) recursive syntactic compositions, which here are implemented through a special attention mask and deterministic transformation of the linearized tree. We find that TGs outperform various strong baselines on sentence-level language modeling perplexity, as well as on multiple syntax-sensitive language modeling evaluation metrics. Additionally, we find that the recursive syntactic composition bottleneck which represents each sentence as a single vector harms perplexity on document-level language modeling, providing evidence that a different kind of memory mechanism -- one that is independent of composed syntactic representations -- plays an important role in current successful models of long text.

Motivation & Objective

  • To investigate whether recursive syntactic composition, a key inductive bias in smaller models like RNNGs, remains beneficial at scale in modern Transformer language models.
  • To address the scalability limitations of recurrent neural network grammars (RNNGs) by integrating syntactic inductive biases into the efficient Transformer-XL architecture.
  • To evaluate whether syntactic structure improves performance not only on sentence-level tasks but also on document-level language modeling.
  • To examine the trade-off between syntactic generalization and perplexity, particularly in relation to the model's lexical copying ability.
  • To explore whether attention mechanisms constrained by syntactic structure can enhance structural generalization without sacrificing efficiency.

Proposed method

  • Augmenting the Transformer-XL architecture with a typed, recursive attention mask that enforces syntactic composition by restricting attention to constituent boundaries in linearized parse trees.
  • Representing each phrase as a deterministic, hierarchical composition of nonterminal symbols, with duplicated closing nonterminals to enable recursive attention patterns.
  • Jointly modeling terminal words and nonterminal tree constituents during autoregressive generation, enabling the model to predict both strings and syntactic structures.
  • Training the model on joint probability distributions over strings and their corresponding phrase-structure trees, using the Penn Treebank and BLLIP-lg datasets.
  • Implementing a modified autoregressive decoding process that maintains syntactic coherence through structured attention, while preserving the efficiency of standard Transformers.
  • Using regression analysis to isolate the contribution of syntactic composition to performance on perplexity and syntactic generalization metrics.

Experimental results

Research questions

  • RQ1Does incorporating recursive syntactic composition via a structured attention mask improve language modeling performance at scale in Transformer models?
  • RQ2How does the performance of Transformer Grammars compare to syntax-free Transformers and syntax-augmented models on syntax-sensitive evaluation benchmarks?
  • RQ3To what extent does the inductive bias of recursive syntactic composition interfere with the lexical copying ability that contributes to low perplexity?
  • RQ4Does the syntactic inductive bias remain beneficial when extending modeling from single sentences to full documents?
  • RQ5Can a model with explicit syntactic composition outperform much larger, pre-trained language models on syntactic generalization tasks?

Key findings

  • Transformer Grammars achieve state-of-the-art performance on the Hu et al. (2020) syntactic generalization benchmark, outperforming GPT-2-small, Gopher, and Chinchilla despite being 250–1000× smaller and trained on far less data.
  • TGs significantly outperform the syntax-free Transformer-XL (terminals) baseline and the stronger TXL (trees) model on syntactic generalization and parse reranking tasks.
  • The TXL (trees) model, which predicts both terminals and nonterminals without attention restrictions, slightly outperforms TGs on sentence-level perplexity, indicating that attention constraints in TGs may interfere with lexical copying.
  • On document-level language modeling, TGs substantially underperform both the terminal-only TXL (terminals) and the TXL (trees) models, suggesting that a single composed syntactic representation is insufficient for long-context modeling.
  • Regression analysis confirms that recursive syntactic composition enhances syntactic generalization but at the cost of reduced lexical copying ability, revealing a partial dissociation between syntactic and lexical modeling objectives.
  • TGs are much faster to train than batched RNNGs, demonstrating that syntactic inductive biases can be efficiently scaled within the Transformer framework without sacrificing training speed.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.