Abstract
Traditional autoregressive decoders generate tree structures by linearizing them into sequences, resulting in linear time complexity and potential structural invalidity. This paper introduces the Tree-based Insertion Transformer, a non-autoregressive decoder that "grows" trees through parallel insertion operations. By utilizing tree-based relative positioning and a training strategy based on closeness centrality, the model achieves a significant reduction in decoding steps—from an average of 38.9 to 6.4—while maintaining competitive accuracy on semantic parsing tasks.
Introduction
Most sequence-to-sequence models generate output tokens autoregressively, one at a time from left to right. For structured outputs like computer code or logical forms, which are naturally represented as trees, this process is often inefficient. Standard approaches linearize trees using parentheses (e.g., (A (B C))), which increases sequence length and forces the model to manage structural tokens. Furthermore, non-autoregressive (NAR) sequence models may produce invalid tree strings during intermediate decoding steps. To address these challenges, we propose a model that operates directly on tree structures through insertion.
Methodology
Tree-based Insertion Operations
The core of the proposed model is the ability to expand a tree by inserting nodes into specific "slots." Unlike sequence-based insertion, every intermediate state in this process remains a valid, well-formed tree. The model identifies three primary types of insertion slots:
- Ancestor ($\wedge$): A new node is inserted above an existing node, making the existing node its child.
- Descendant ($\vee$): A new node is inserted below an existing node.
- Sibling ($-1$): A new node is inserted between two existing sibling nodes.
Tree-based Relative Positioning
To capture structural relationships without absolute coordinates, the model employs a tree-based relative positioning mechanism. It uses "movement patterns" (e.g., "up 1 hop, right 2 hops, down 2 hops") to describe node relationships. This allows the Transformer to inherently understand the tree topology without processing structural tokens like brackets, reducing the effective sequence length and computational overhead.
Optimal Trajectories via Closeness Centrality
To maximize parallelization, the model is trained to follow an optimal insertion trajectory. Using a closeness centrality heuristic, the model learns to predict the "most central" node of a missing subtree first. Similar to binary search, inserting the middle node allows subsequent children and siblings to be inserted in parallel in the next step, reducing the total number of decoding steps to sub-linear complexity.
Evaluation and Results
The model was evaluated on the OVERNIGHT semantic parsing dataset, which contains natural language questions paired with logical queries across eight domains. Logical forms were preprocessed to remove nesting bias, ensuring the evaluation focused on semantic accuracy rather than structural artifacts.
Performance and Speed
The Tree-Insert model demonstrated a substantial theoretical speedup. While a standard autoregressive Transformer required an average of 38.9 steps to generate a full tree, the proposed model required only 6.4 steps—a nearly 6x improvement.
In terms of accuracy, the model remained highly competitive, achieving an average logical form accuracy of 74.4%, compared to the 75.0% baseline of the slower autoregressive model. It also outperformed sequence-based insertion baselines in both efficiency and theoretical best-case complexity.
Conclusion and Future Work
Insertion-based tree decoding offers a promising path toward efficient structured prediction. By operating directly on tree slots, the model ensures structural integrity and enables massive parallelism. Future work includes extending the model with deletion or relocation operations (similar to Levenshtein-style editing) to improve robustness against early-stage errors and optimizing relative position encodings for constant-time complexity.
Summary updated