Abstract
Relation Extraction (RE) often benefits from syntactic information, typically incorporated via complex multi-stream architectures or graph-based modules. This paper presents Dependency Position Encoding (DPE), a method that injects syntactic "common sense" directly into a Transformer's self-attention mechanism. By treating dependency types as learnable embeddings and adding them to attention scores, DPE enables a simple one-stream architecture to achieve state-of-the-art results on major benchmarks like SemEval 2010, KBP37, and TACRED.
Problem Statement: The Complexity of Syntax
Relation Extraction involves identifying semantic links between entities in text. While large language models like BERT excel at contextual representation, they can struggle with the intricate sentence structures often found in RE tasks. Traditionally, researchers have turned to dependency trees to bridge this gap. However, existing methods often suffer from three main drawbacks:
- Architectural Complexity: Many models use a "two-stream" approach, processing text and syntax in separate modules (e.g., BERT + GCN), which increases computational overhead.
- Label Neglect: Many graph-based approaches ignore the specific types of dependencies (e.g.,
nsubjvs.obj), treating all edges as equal. - Syntactic Noise: Including a full dependency tree can introduce irrelevant information that distracts the model.
Methodology: Dependency Position Encoding (DPE)
The proposed DPE method simplifies the integration of syntax by "baking" it into the core of the Transformer. Instead of a separate graph module, DPE modifies the standard self-attention calculation.
1. Dependency Mapping and Type Embeddings
The process begins with an off-the-shelf parser (like CoreNLP) generating a dependency tree. Each dependency type is then mapped to a unique, learnable embedding.
2. Attention Injection
In a standard Transformer, attention is computed as: $$Att(x) = Softmax\left(\frac{QK^T}{\sqrt{d_k}}\right) \cdot V$$ DPE introduces a dependency embedding matrix ($DPE$) directly into the softmax term: $$Att(x) = Softmax\left(\frac{QK^T + DPE}{\sqrt{d_k}}\right) \cdot V$$ This allows the model to dynamically weigh word importance based on syntactic relationships.
3. One-Stream Efficiency
Because the syntactic information is integrated within the attention heads, the model remains a single, end-to-end Transformer. This "one-stream" design is more efficient and easier to deploy than hybrid systems.
Experimental Evaluation
The authors evaluated DPE across three major English RE benchmarks: SemEval 2010 Task 8, KBP37, and TACRED.
Key Results
The DPE-enhanced BERT models consistently outperformed previous state-of-the-art (SOTA) methods:
- SemEval 2010: Achieved an F1-score of 90.2, surpassing models like TaMM (90.0).
- KBP37: Reached an F1-score of 68.7, improving upon the BERT-EM baseline.
- TACRED: Achieved an F1-score of 68.5, providing a simpler alternative to complex graph models like DP-GCN.
Insights and Discussion
- The Value of Labels: Explicitly embedding dependency types allows the model to learn which specific syntactic structures (like a subject-verb-object path) are most indicative of certain relations.
- Strategic Pruning: The authors found that using only the Shortest Dependency Path (SDP) between entities often yielded better results than using the full tree, as it effectively filters out syntactic noise.
- Plug-and-Play Integration: DPE is highly adaptable, serving as a modular enhancement for any Transformer-based architecture without requiring fundamental structural changes.
Limitations
While effective, DPE relies on the accuracy of external dependency parsers. Errors in parsing are directly propagated into the model's attention mechanism. Additionally, while the architecture is "one-stream," the inclusion of DPE matrices in every attention head increases the parameter count and memory requirements for large-scale models like BERT-Large.
Summary updated