Introduction
Dependency parsing is a fundamental task in Natural Language Processing (NLP) that involves mapping grammatical relationships between words in a sentence. Transition-based parsers achieve this by incrementally building a dependency tree using a stack and a buffer. While Transformers have become the standard for sequence modeling, they often struggle to incorporate the dynamic, evolving graph structure of a partial parse. The Graph2Graph Transformer (G2GTr) addresses this by integrating relation embeddings directly into the self-attention mechanism, allowing the model to "see" and "build" graph structures naturally.
The Challenge of Graph-Aware Parsing
Traditional transition-based parsers often rely on rigid, discrete constraints or separate recursive neural networks to represent sub-trees. These methods can be computationally expensive and lack the flexibility of continuous embeddings. The authors of G2GTr sought a way to let the Transformer naturally condition its attention on arbitrary graph relations, maintaining the power of global context while respecting the linguistic structure of the partial parse.
The G2GTr Architecture
The G2GTr modifies the standard Transformer architecture in two key ways:
- Graph Conditioning (Input): The self-attention mechanism is augmented with relation embeddings. For any pair of tokens, the model identifies the existing dependency relation (e.g., leftward, rightward, or none) and incorporates a learned vector into the Query, Key, and Value calculations. This introduces a "linguistic bias" that guides the model's focus without imposing hard constraints.
- Graph Prediction (Output): The model leverages output embeddings from the stack and buffer to predict the next parsing action and dependency labels via MLP classifiers.
The researchers implemented G2GTr within two baseline architectures: the State Transformer (StateTr), which processes the entire parser state as a sequence, and the Sentence Transformer (SentTr), which encodes the full sentence first.
Experimental Results
The G2GTr models were evaluated on the English Penn Treebank (WSJ) and the Universal Dependencies (UD) v2.3 benchmarks, the latter covering 13 diverse languages.
Performance on English WSJ
On the English WSJ dataset, BERT-initialized G2GTr models achieved state-of-the-art performance, outperforming previous transition-based and Seq2Seq parsers.
Multilingual Robustness
The model demonstrated significant gains across 13 languages in the UD v2.3 benchmark. The SentTr+G2GTr model achieved an average Labelled Attachment Score (LAS) of 88.06, a substantial improvement over the previous state-of-the-art baseline of 84.87.
Key Insights
- BERT Compatibility: Initializing G2GTr with pre-trained BERT weights led to a massive 27.6% relative error reduction in LAS, showing that BERT is highly compatible with graph-aware modifications.
- Continuous Representations: By using continuous embeddings for graph edges, the model effectively passes information along the tree structure, proving more powerful than traditional recursive composition models.
- Complex Structure Handling: Error analysis revealed that G2GTr excels in handling long-distance dependencies and complex clausal complements, where a global view of the partial graph is most critical.
Conclusion
The Graph2Graph Transformer represents a significant step forward in integrating structural graph information into the Transformer architecture. By treating partial parses as continuous graph inputs, it achieves superior performance in dependency parsing across multiple languages. Future work may extend this general architecture to other graph-heavy tasks such as semantic parsing or molecular modeling.
Summary updated