NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Dependency Position Encoding for Relation Extraction

Qiushi Guo, Xin Wang, Dehong GaoNAACL 2022

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:

  1. Architectural Complexity: Many models use a "two-stream" approach, processing text and syntax in separate modules (e.g., BERT + GCN), which increases computational overhead.
  2. Label Neglect: Many graph-based approaches ignore the specific types of dependencies (e.g., nsubj vs. obj), treating all edges as equal.
  3. Syntactic Noise: Including a full dependency tree can introduce irrelevant information that distracts the model.
Comparison of one-stream vs. two-stream architectures.

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.

Detailed DPE architecture showing attention injection and dependency mapping.

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

BibTeX
@inproceedings{guo2022dependency,
  author = {Qiushi Guo and Xin Wang and Dehong Gao},
  title = {{Dependency Position Encoding for Relation Extraction}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2022},
  doi = {10.18653/v1/2022.findings-naacl.120},
}
Figure