Abstract
This work focuses on analyzing the form and extent of syntactic abstraction captured by BERT by extracting labeled dependency trees from self-attentions. Previous work showed that individual BERT heads tend to encode particular dependency relation types. We extend these findings by explicitly comparing BERT relations to Universal Dependencies (UD) annotations, showing that they often do not match one-to-one. We suggest a method for relation identification and syntactic tree construction. Our approach produces significantly more consistent dependency trees than previous work, showing that it better explains the syntactic abstractions in BERT. At the same time, it can be successfully applied with only a minimal amount of supervision and generalizes well across languages.
Introduction
Large Language Models like BERT are known to capture syntactic information, such as subject-verb relationships, within their self-attention layers. However, extracting full, human-interpretable "syntax trees" from these models remains a challenge. A primary hurdle is the "representation gap": standard linguistic frameworks like Universal Dependencies (UD) do not always align with the internal logic of a transformer. For instance, while a linguist might view a copula (e.g., "is") as a helper, BERT often treats it as the structural root of a clause. This paper investigates how to bridge this gap to extract accurate, labeled dependency trees with minimal supervision.
Methods
The researchers developed a three-pronged approach to decipher BERT’s internal grammar:
1. Adapting UD to BERT
Instead of forcing BERT to adhere to strict UD rules, the authors modified ground-truth labels for specific phenomena—copulas, expletives, and coordinations—to better reflect BERT’s observed attention patterns. This "BERT-native" version of UD acknowledges that the model's structural intuition may differ from traditional linguistic conventions.
2. Head Ensembling
Analysis revealed that different attention heads specialize in distinct "sub-types" of the same relation. For example, one head might identify adjectival modifiers when they are adjacent to a noun, while another handles long-distance modifiers. The authors developed an algorithm to select an ensemble of the most accurate heads (up to $N=4$) for each relation type.
3. Dependency Tree Construction
To build a full tree, a Maximum Spanning Tree (MST) algorithm (Chu-Liu-Edmond’s) was applied to the averaged attention matrices. The process included "direction averaging"—combining dependent-to-parent and parent-to-dependent views—to improve structural robustness.
Key Insights and Results
BERT’s Granular and Universal Syntax
BERT's internal syntax is both more specific and more general than UD labels. A single label like nsubj (nominal subject) is often distributed across multiple heads, each specializing in different contexts (e.g., short-range vs. complex nested clauses). Conversely, some "multipurpose" heads are incredibly versatile, identifying parents for various modifiers simultaneously across different languages.
Performance and Generalization
- Ensembling Gains: Moving from a single head to a 4-head ensemble improved nominal subject identification accuracy by 13.3 percentage points.
- State-of-the-Art Extraction: On the English PUD treebank, the method achieved an Unlabeled Attachment Score (UAS) of 52.0, significantly outperforming previous zero-shot methods.
- Minimal Supervision: The method is highly efficient, requiring as few as 10 to 20 annotated sentences to select the optimal attention heads.
- Cross-Lingual Consistency: In multilingual BERT (mBERT), the same heads often perform identical syntactic functions across different languages, suggesting a "universal" internal representation of grammar, particularly in Subject-Verb-Object (SVO) languages.
Conclusion
While BERT demonstrates a sophisticated internal grammar, its performance is less consistent in Subject-Object-Verb (SOV) languages like Japanese or Korean, likely due to their lower representation in the original pre-training data. Despite this, the ability to extract "BERT-native" trees with minimal data offers a promising path for initializing parsers in low-resource settings where human-annotated data is scarce.
Summary updated