Abstract
Tree structures are commonly used in the tasks of semantic analysis and understanding over the data of different modalities, such as natural language, 2D or 3D graphics and images, or Web pages. Previous studies model the structures in a bottom-up manner, where the leaf nodes (given in advance) are merged into internal nodes until they reach the root node. However, these models are not applicable when the leaf nodes are not explicitly specified ahead of prediction. Here, we introduce a neural machine for top-down generation of structures that aims to infer such structures without the specified leaf nodes. In this model, the history memories from ancestors are fed to a node to generate its (ordered) children in a recursive manner. This model can be utilized as a tree-structured decoder in the framework of X2Tree learning, where X stands for any structure (e.g. chain, etc.) that can be represented as a latent vector. By transforming the dialogue generation problem into a sequence-to-tree task, we demonstrate the proposed X2Tree framework achieves a 11.15% increase of response acceptance ratio over the baseline methods.
Introduction
Most modern conversational AI models treat language as a simple sequence of tokens—a "chain." While effective, this ignores the inherent hierarchical structure of human language defined by grammar. Chain-structured decoders often struggle with long-distance dependencies and can produce grammatically "plausible" but semantically shallow or irrelevant responses.
Existing tree-based models usually work bottom-up, requiring the leaf nodes (the words) to be known in advance to build the tree. This is unsuitable for generating a new sentence from scratch. The X2Tree framework addresses this by implementing top-down tree generation, where the model decides which "core" words to generate first and then recursively fills in modifiers while maintaining grammatical integrity.
The X2Tree Framework
Top-Down Tree Decoder
Unlike a standard RNN that moves left-to-right, the X2Tree decoder starts at the root of a dependency tree. Each node generates its children based on hidden states inherited from both its ancestors (vertical context) and its siblings (horizontal context). This approach forces the model to generate "influential" words, such as the main verb, first. This mimics human cognition, where a core concept is often established before descriptive details are added.
Furthermore, the tree structure provides shorter paths for gradient flow. In a linear sequence of 20 words, the first and last words are 19 steps apart. In a dependency tree, the average distance from any word to the root is significantly reduced, alleviating the "vanishing gradient" problem and helping the model maintain long-range coherence.
Tree Canonicalization: The Ternary Trick
Real-world dependency trees have a variable number of children per node, which presents challenges for GPU parallelization. To solve this, the authors propose transforming any sequence-preserved tree into a full ternary tree. In this structure, every internal node has exactly three children: left, middle, and right.
This ternary structure is the minimum complexity required to perfectly reconstruct the original word order while maintaining a fixed branching factor suitable for efficient computation.
Evaluation and Results
The model was evaluated on a dialogue dataset from Tencent Weibo, consisting of 815,852 post-response pairs. The Language Technology Platform (LTP) was used as an external dependency parser to create ground-truth trees for training. X2Tree was compared against major baselines including SEQ2SEQ, Attention-based models (ATT), and the Neural Responding Machine (NRM).
- Human Evaluation: X2Tree reached a 65.53% "Level-3" (Acceptable) rating, a significant jump from the best baseline (NRM) at 54.38%.
- Grammaticality: X2Tree tied for the lowest percentage of ungrammatical responses (0.44%), suggesting that the tree structure acts as a natural constraint.
- BLEU Scores: X2Tree achieved a score of 15.87, outperforming all baselines (the next best was ATT at 13.89).
Conclusion
The X2Tree framework demonstrates that incorporating linguistic hierarchy into neural generation significantly improves the quality and coherence of dialogue responses. While the model currently relies on external parsers for training data, it shows remarkable robustness to parser errors. Future work involves extending this to a "tree-to-tree" architecture and applying it to multi-round dialogues where context is inherently hierarchical.
Summary updated