[Paper Review] Tree Transformer: Integrating Tree Structures into Self-Attention
This paper proposes Tree Transformer, a novel method that integrates hierarchical tree structures into the self-attention mechanism of the Transformer by introducing a 'Constituent Attention' module that induces constituency trees from raw text via self-attention. The approach improves language modeling perplexity and produces more interpretable, human-intuitive attention patterns compared to standard BERT-style Transformers.
Pre-training Transformer from large-scale raw texts and fine-tuning on the desired task have achieved state-of-the-art results on diverse NLP tasks. However, it is unclear what the learned attention captures. The attention computed by attention heads seems not to match human intuitions about hierarchical structures. This paper proposes Tree Transformer, which adds an extra constraint to attention heads of the bidirectional Transformer encoder in order to encourage the attention heads to follow tree structures. The tree structures can be automatically induced from raw texts by our proposed "Constituent Attention" module, which is simply implemented by self-attention between two adjacent words. With the same training procedure identical to BERT, the experiments demonstrate the effectiveness of Tree Transformer in terms of inducing tree structures, better language modeling, and further learning more explainable attention scores.
Motivation & Objective
- To address the lack of hierarchical structure awareness in standard Transformer self-attention, which does not align with human intuition about syntactic hierarchies.
- To develop a method that automatically induces constituency tree structures from raw, unannotated text without requiring supervised parse trees.
- To improve the interpretability and performance of self-attention mechanisms by constraining attention heads to attend within syntactic constituents.
- To evaluate whether tree-structured attention leads to better language modeling and more explainable attention patterns compared to standard Transformers.
Proposed method
- Introduces a 'Constituent Attention' module that uses self-attention to connect adjacent words and build hierarchical constituents from bottom-up.
- Applies a tree-structure constraint to attention heads in each Transformer layer, forcing them to attend only within the same syntactic constituent.
- Uses the same pre-training and fine-tuning procedure as BERT, with only the addition of the Constituent Attention module.
- Employs a differentiable, end-to-end training process that jointly learns tree structures and contextual representations.
- Leverages both positional encoding and induced tree structure to provide hierarchical positional information to the model.
- Utilizes a multi-head attention mechanism where each head is constrained to attend only within the same constituent, as defined by the induced tree.
Experimental results
Research questions
- RQ1Can self-attention mechanisms in Transformers be guided to follow hierarchical syntactic structures without relying on human-annotated parse trees?
- RQ2Does integrating induced tree structures into attention improve language modeling performance compared to standard Transformers?
- RQ3To what extent do attention heads in Tree Transformer exhibit more interpretable, human-intuitive attention patterns than those in standard BERT-style models?
- RQ4Can the Constituent Attention module effectively induce coherent, human-annotated-like constituency trees from raw text in a weakly supervised manner?
- RQ5How does the performance of Tree Transformer compare to standard Transformers when controlling for model size and training procedure?
Key findings
- Tree Transformer achieves a test perplexity of 45.6 on the WSJ test set with 12 layers and 58M parameters, outperforming standard Transformer models with similar or higher parameter counts.
- Even with 10% more parameters than standard Transformer, Tree Transformer achieves better perplexity (45.6 vs. 48.1) on the same task, indicating performance gain from structural inductive bias.
- The model induces constituency trees that are coherent with human-annotated parses, as validated by unsupervised parsing evaluation.
- Attention matrices in Tree Transformer show more structured, hierarchical patterns that align better with human intuition about syntactic composition than standard Transformers.
- The model maintains performance even when initialized from pre-trained BERT, but the induced tree structures are less coherent, suggesting BERT's attention heads learn different inductive biases.
- The addition of the Constituent Attention module increases computational cost by 20% and parameters by ~10%, but leads to significant gains in interpretability and modeling quality.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.