Introduction
Syntax-BERT is a "plug-and-play" framework designed to enhance the performance of pre-trained Transformers—such as BERT, RoBERTa, and T5—by explicitly incorporating syntactic structures. By decomposing standard self-attention into specialized sub-networks based on syntax tree relationships (e.g., ancestors, offspring, and siblings), the model learns to leverage human-expert linguistic priors without requiring expensive pre-training from scratch.
Problem Statement
While large-scale pre-trained models have revolutionized NLP, they primarily learn linguistic rules implicitly from massive text corpora. Research indicates a significant gap between their internal representations and the "golden" syntax trees defined by linguistic experts. Existing methods to bridge this gap often require training models from scratch or are difficult to integrate into high-performing checkpoints. Given the resource-intensive nature of pre-training, the authors sought an efficient way to "ingest" syntactic knowledge into existing models during fine-tuning.
Methodology
The authors introduce a novel architecture that modifies information flow within the Transformer's self-attention layers through three primary components:
- Syntax Mask Generation: Using a syntax parser, the model generates constituency or dependency trees for input sentences. These trees are converted into sparse masks defining relationships like parent-child or sibling connections.
- Decomposed Sub-networks: Instead of a single dense attention matrix, Syntax-BERT utilizes multiple sub-networks, each governed by a syntactic mask. These sub-networks share parameters with the original pre-trained model, allowing them to refine existing knowledge.
- Topical Attention: A "topical attention" layer acts as a smart aggregator, learning task-specific query vectors to determine which syntactic relationships are most relevant for a given problem (e.g., sentiment analysis vs. logical inference).
Experimental Setup
Syntax-BERT was evaluated across a diverse range of standard NLP benchmarks, including:
- Sentiment Analysis: SST-1 (fine-grained) and SST-2 (binary).
- Natural Language Inference: SNLI and MNLI.
- GLUE Benchmark: Including CoLA, MRPC, and STS-B.
Results and Discussion
Syntax-BERT consistently outperformed vanilla baselines across all tasks. On the SST-2 dataset, the Syntax-Transformer achieved 91.1% accuracy, a substantial improvement over the 86.2% achieved by the standard Transformer.
Key insights from the results include:
- Syntax as a Sparsity Prior: Forcing attention heads to focus on syntactically related words helps the model avoid overfitting to noise, particularly in low-data scenarios.
- Complementary Strengths: Syntax-BERT can be combined with methods like LISA. While LISA focuses on parent relationships, Syntax-BERT’s multi-aspect approach provides a more holistic structural view.
- Explainability: The topical attention layer provides a window into the model's reasoning; for instance, in grammar-checking, it might prioritize the "sibling" sub-network to identify errors in word-pair relationships.
Limitations and Future Work
The framework relies on external syntax parsers, which introduces preprocessing latency. Additionally, while sub-networks are sparse, the current implementation involves multiple attention passes. Future work will explore more optimized sparse implementations, the incorporation of specific dependency relation types, and applying this method during the initial pre-training phase.
Summary updated