Encoder-Decoder Shift-Reduce Syntactic Parsing

Jiangming Liu, Yue Zhang

Abstract

Encoder-decoder neural networks have been used for many NLP tasks, such as neural machine translation. They have also been applied to constituent parsing by using bracketed tree structures as a target language, translating input sentences into syntactic trees. A more commonly used method to linearize syntactic trees is the shift-reduce system, which uses a sequence of transition-actions to build trees. We empirically investigate the effectiveness of applying the encoder-decoder network to transition-based parsing. On standard benchmarks, our system gives comparable results to the stack LSTM parser for dependency parsing, and significantly better results compared to the aforementioned parser for constituent parsing, which uses bracketed tree formats.

Introduction

Syntactic parsing—the process of determining the grammatical structure of a sentence—is a cornerstone of Natural Language Processing. Historically, this task has required highly specialized architectures. Two primary formalisms dominate the field: constituent parsing, which breaks sentences into nested phrases, and dependency parsing, which identifies grammatical relationships between individual words.

Comparison of constituent (a) and dependency (b) tree structures for the same sentence.

Traditional transition-based parsers use a "stack" to hold partially processed words and a "queue" for incoming words, often relying on complex structures like Stack-LSTMs to represent the parser's state. While general-purpose encoder-decoder models (Seq2Seq) are simpler, they previously struggled with parsing when tasked with outputting "bracketed" strings (e.g., (S (NP Tom) ...)). This paper investigates whether Seq2Seq models can succeed by instead "translating" sentences into sequences of shift-reduce actions.

Methodology: The Encoder-Decoder Shift-Reduce Model

The proposed architecture simplifies the parsing process by treating it as a sequence-to-sequence problem where the target language is a series of transition actions (such as SHIFT, LEFT-ARC, or REDUCE).

  1. The Encoder: A bidirectional LSTM creates a rich, context-aware representation of the input sentence.
  2. The Decoder: An LSTM generates the sequence of transition actions.
  3. Stack-Queue (SQ) Attention: The core innovation is a dual-attention mechanism. Instead of building an explicit stack data structure, the model splits the encoder's hidden states into two segments based on the current parsing position: the Stack Segment (already shifted words) and the Queue Segment (remaining words). The decoder uses separate attention mechanisms for each, allowing it to implicitly "see" the parser's state.
The general encoder-decoder architecture with attention used to generate a sequence of actions (a).

Experimental Setup

The model was evaluated on the standard Penn Treebank (PTB) benchmark using Wall Street Journal (WSJ) sections. For dependency parsing, constituent trees were converted to Stanford Dependencies (v3.3.0). To enhance performance, the authors utilized pre-trained word embeddings from the English Gigaword corpus.

Key Results and Insights

The proposed model achieved impressive results across both parsing formalisms:

  • Dependency Parsing: The model reached 93.1% UAS (Unlabeled Attachment Score), performing on par with the more complex Stack-LSTM parser.
  • Constituent Parsing: The model achieved an F1 score of 90.5%, representing a significant 2.2% improvement over previous Seq2Seq models that relied on bracketed tree formats.

Why Representation Matters

A major finding is that shift-reduce actions are a more effective output format for neural networks than bracketed trees. Actions provide a clear, incremental path that aligns naturally with how LSTMs process sequences. Furthermore, the attention mechanism proved to be a powerful substitute for explicit structural representations. By attending to the "stack" and "queue" areas of the input, the model learns necessary structural features without needing hard-coded recursive functions.

Conclusion

This research demonstrates that a standard encoder-decoder architecture, when paired with an appropriate action-based representation and a novel attention mechanism, can match or exceed the performance of specialized parsing models. By moving away from explicit stack implementations toward implicit attention-based states, the model remains conceptually simple and easily adaptable to various grammar formalisms.

Summary updated

BibTeX
@inproceedings{liu2017encoder,
  author = {Jiangming Liu and Yue Zhang},
  title = {{Encoder-Decoder Shift-Reduce Syntactic Parsing}},
  booktitle = {IWPT},
  year = {2017},
  url = {https://openreview.net/forum?id=3AP5IT2MJu},
}
Figure