Finding Syntactic Representations in Neural Stacks

William Merrill, Lenny Khazan, Noah Amsel, Yiding Hao, Simon Mendelsohn, Robert Frank

Introduction

While standard neural networks process language as a sequence, human language is fundamentally hierarchical. Standard sequential models like LSTMs often fail when sentences become deeply nested or complex, struggling with "structural sensitivity." For example, in the sentence "The keys to the cabinet are on the table," a model must realize that "are" agrees with "keys," not the more recent "cabinet."

To address this, researchers have proposed stack-augmented RNNs. Stacks are the natural data structure for processing context-free grammars, providing a better inductive bias for language. This paper investigates whether stack RNNs can truly "discover" the hidden tree structures of natural language in an unsupervised way.

Methods: The Differentiable Stack

The authors implement a stack-augmented RNN where a "controller" (an LSTM) manages a differentiable stack. Unlike a discrete stack, this version uses continuous values for "push" and "pop" strengths, allowing the model to be trained via backpropagation.

Architecture of the stack-augmented RNN controller and its interaction with the differentiable stack.

The model introduces variable strength operations, allowing it to push or pop multiple items (or fractions of items) at once. Crucially, the authors use the push strength at each word as a proxy for "syntactic distance." High push strength signals the start of a new, complex constituent, allowing for the algorithmic extraction of tree structures without human-labeled data.

Key Insights and Results

The most striking insight is that the model’s "pushing" behavior correlates with linguistic subcategorization. When the model sees a transitive verb or a preposition, it assigns a high push strength, effectively "opening" a mental bracket to be closed later.

Histograms showing the distribution of push strengths. The model distinguishes between nouns and verbs, and specifically between transitive and intransitive verbs, reflecting emergent syntactic knowledge.

Performance on Grammatical Tasks

On complex subject-verb agreement tasks with multiple "attractors," the Stack RNN achieved 77.99% accuracy, significantly outperforming the LSTM baseline of 74.21%. This suggests the stack provides a genuine structural advantage for long-distance dependencies.

Unsupervised Parsing

The trees extracted from the Stack RNN achieved an F1 score of 31.2 on the Penn Treebank. While not beating state-of-the-art specialized parsers, it vastly outperforms baseline "branching" strategies (7.3–13.1 F1), proving the stack contains meaningful syntactic information discovered purely from the objective of next-word prediction.

Conclusion

This research demonstrates that RNNs augmented with a differentiable stack don't just use that stack as extra memory—they learn to represent the hierarchical, phrasal structure of natural language. While the model still struggles to utilize "pop" operations perfectly and lags behind specialized parsing models, it represents a significant step toward interpretable, structurally-aware neural language models. Future work may explore scaling these hierarchical biases to larger Transformer-based architectures.

Summary updated

BibTeX
@inproceedings{merrill2019finding,
  author = {William Merrill and Lenny Khazan and Noah Amsel and Yiding Hao and Simon Mendelsohn and Robert Frank},
  title = {{Finding Syntactic Representations in Neural Stacks}},
  booktitle = {BlackboxNLP @ ACL},
  year = {2019},
  url = {https://openreview.net/forum?id=lOmwhfut7UN},
}
Figure