Top-Down Tree Structured Text Generation

Qipeng Guo, Xipeng Qiu, Xiangyang Xue, Zheng ZhangarXiv 2018

Abstract

Traditional text generation models operate sequentially, often struggling with long-range dependencies and a lack of global structural planning. This paper introduces the Top-Down Tree Decoder (TDTD), a novel architecture that generates sentences as hierarchical constituent trees in a breadth-first manner. By defining high-level structures before specific tokens, TDTD performs implicit global planning and reduces the distance between related grammatical elements. Experimental results on synthetic and real-world datasets demonstrate that TDTD produces more grammatically robust and higher-quality text compared to sequential baselines, while also achieving competitive performance as a generative parser.

Introduction

Most modern text generation models, such as LSTMs or GRUs, are inherently sequential, predicting the next word based on preceding context. While effective, this "flat" approach faces two significant challenges: long-range dependencies and a lack of global planning. In long sentences, the grammatical link between a subject and a distant verb can be obscured by intervening tokens. Furthermore, sequential models often make local, greedy decisions without a high-level "blueprint" for the overall sentence structure.

While tree-based models exist, they typically employ bottom-up or depth-first approaches that are complex to implement and may still fail to capture the full sentence structure during generation.

Methodology

The authors propose the Top-Down Tree Decoder (TDTD), which generates a constituent syntactic tree layer by layer using a breadth-first strategy. This approach acts as a form of global planning, defining the sentence's skeleton (e.g., "Sentence -> Noun Phrase + Verb Phrase") before populating specific words.

Overview of the Top-Down Tree Decoder (TDTD) generating a sentence breadth-first.

The architecture relies on several key components:

  • Tree-Stacked RNN: At each layer, a bidirectional RNN encodes the generation history, incorporating information from parent nodes (ancestors) and surrounding nodes (siblings).
  • Gen-RNN: A forward RNN summarizes the prediction history of siblings to predict specific nodes.
  • TDTD-P (The Parser): An extension of the model into a generative parser. It uses a bidirectional RNN to encode an input sentence and the TDTD architecture as a decoder, enhanced with an attention mechanism, to reconstruct the parse tree.

Key Insights

  • Structural Regularization: The top-down process forces early commitment to a global structure, preventing the model from generating ungrammatical sequences.
  • Shortened Dependency Paths: In a tree structure, related words are often separated by only a few nodes, even if they are distant in a flat sequence. This mitigates the vanishing gradient problem.
  • Contextual Summary: Breadth-first generation allows the model to maintain a summary of future context, effectively planning the entire sentence's structure from the top down.

Evaluation and Results

The model was evaluated across three tasks: synthetic data generated by a Probabilistic Context-Free Grammar (PCFG), real-world movie reviews (IMDB), and the Penn Treebank (PTB).

On synthetic data, TDTD achieved a 0% failure rate in producing valid tree structures, whereas sequential models like SeqGAN failed up to 94% of the time on long sequences. On the IMDB dataset, TDTD outperformed sequential benchmarks (LSTM, SeqGAN, LeakGAN) in BLEU-3, BLEU-4, and BLEU-5 scores, indicating superior structural quality.

A parsing result and attention visualization from the TDTD-P model.

As a parser, TDTD-P achieved an F1 score of 91.9 on the Penn Treebank, performing competitively with established models and approaching the state-of-the-art for generative parsers like RNNG.

Conclusion and Future Work

TDTD demonstrates the power of hierarchical, top-down planning for text generation. However, challenges remain, such as the "matching problem" in parsing, where ensuring leaf nodes exactly match input sequences requires re-ranking. Additionally, the model's performance is currently bounded by the quality of the external parser used for training data. Future research may explore Reinforcement Learning for optimization and the application of top-down approaches to more complex graph generation tasks.

Summary updated

BibTeX
@misc{guo2018top,
  author = {Qipeng Guo and Xipeng Qiu and Xiangyang Xue and Zheng Zhang},
  title = {{Top-Down Tree Structured Text Generation}},
  year = {2018},
  eprint = {1808.04865},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1808.04865},
}
Figure