A Fast Unified Model for Parsing and Sentence Understanding

Samuel R. Bowman, Jon Gauthier, Abhinav Rastogi, Raghav Gupta, Christopher D. Manning, Christopher Potts

Abstract

SPINN (Stack-augmented Parser-Interpreter Neural Network) is a hybrid model that combines the linguistic logic of tree-structured networks with the high-speed performance of sequential RNNs. By linearizing tree construction into a shift-reduce parsing sequence, the authors achieve a 25x speedup over traditional tree models while setting a new state-of-the-art accuracy on the Stanford Natural Language Inference (SNLI) task.

Introduction

In Natural Language Processing (NLP), there has long been a tension between sequence models, such as LSTMs, and tree-structured models, like TreeRNNs. LSTMs are computationally efficient and easy to batch on GPUs, but they treat language as a flat string of words. Conversely, TreeRNNs process sentences based on their recursive hierarchical structure—a more linguistically grounded approach—but they are notoriously slow and difficult to parallelize because every sentence has a unique tree shape.

Comparison between conventional sequence-based RNNs (a) and tree-structured models (b).

The Stack-augmented Parser-Interpreter Neural Network (SPINN) aims to bridge this gap, offering the structural benefits of a TreeRNN with the computational efficiency and "on-the-fly" parsing capabilities of a sequence model.

Methods: The SPINN Architecture

The core innovation of SPINN is the integration of tree-structured interpretation into the linear flow of a shift-reduce parser.

Shift-Reduce Architecture

Instead of requiring a static tree as input, SPINN processes a sentence from left to right using a stack and a buffer. A "Shift" operation moves a word from the buffer to the stack. A "Reduce" operation takes the top two items on the stack and combines them into a single parent node using a TreeLSTM composition function.

The shift-reduce parsing sequence for the sentence "the cat sat down," showing the transition from buffer to stack over time steps.

Key Components

  • The Thin Stack: To optimize GPU performance, the authors developed a "thin stack" algorithm. Instead of storing a full stack for every timestep, it uses a single matrix and a queue of pointers to track "active" elements, significantly reducing memory overhead.
  • Tracking LSTM: Pure tree models often lack linear context. SPINN includes a "Tracking LSTM" that maintains a summary of the sentence processed so far. This state is fed into the TreeLSTM's composition function, providing the model with both recursive and sequential information.
  • Integrated Parsing: SPINN can function as its own parser. At each step, it uses the state of the Tracking LSTM to predict the next action (Shift or Reduce), allowing it to operate on raw, unparsed text.

Evaluation and Results

The model was primarily evaluated on the Stanford Natural Language Inference (SNLI) dataset, which consists of 570,000 sentence pairs labeled for entailment, contradiction, or neutral relationships.

Performance and Speed

SPINN achieved a 25x speedup over standard CPU-based TreeRNN implementations. While still slower than pure sequence-based RNNs, it is practical for large-scale training. On the SNLI test set, the SPINN-PI (parsed input) model achieved 83.2% accuracy, outperforming the 300D LSTM RNN baseline (80.6%) and previous tree-based CNN models (82.1%).

Parsing and Negation

Even when predicting its own transitions (unparsed input), SPINN maintained a high accuracy of 82.6%. A key finding was that tree structures are significantly better at handling negation. By clearly defining the scope of words like "not," SPINN identified contradictions involving negative terms more accurately than standard RNNs.

Discussion and Future Work

SPINN demonstrates that linearization is the key to making tree-structured models performant. By turning tree-building into a sequence of discrete actions, the model can leverage GPU batching effectively.

However, limitations remain. The internal transition predictor is currently a simple two-way softmax, and the model occasionally predicts invalid transition sequences at test time. Future work may involve more sophisticated parsing features, the integration of soft attention mechanisms, or the development of a "differentiable stack" to allow the model to learn parsing strategies entirely from semantic objectives.

Summary updated

BibTeX
@inproceedings{bowman2016fast,
  author = {Samuel R. Bowman and Jon Gauthier and Abhinav Rastogi and Raghav Gupta and Christopher D. Manning and Christopher Potts},
  title = {{A Fast Unified Model for Parsing and Sentence Understanding}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2016},
  doi = {10.18653/v1/p16-1139},
}
Figure