Improving Knowledge Graph Representation Learning by Structure Contextual Pre-training

Ganqiang Ye, Wen Zhang, Zhen Bi, Chi Man Wong, Hui Chen, Huajun Chen

Introduction

The "pre-train then fine-tune" paradigm has revolutionized Natural Language Processing (NLP), with models like BERT and GPT setting new benchmarks across diverse tasks. However, Knowledge Graph Embedding (KGE) models have largely remained in the era of task-specific architectures and static representations. SCoP (Structure Contextual Pre-training) aims to bridge this gap by bringing deep structural contextualization to Knowledge Graphs (KGs).

The Problem: Static Embeddings and Task Specificity

Traditional KGE models, such as TransE or RotatE, represent entities and relations as static vectors in a continuous vector space. While computationally efficient, these approaches face two significant hurdles:

  1. Lack of Generality: Most models are optimized for specific objectives (e.g., link prediction). Adapting them for different tasks like entity alignment often requires significant architectural modifications.
  2. Contextual Blindness: Standard KGEs typically evaluate a triple $(h, r, t)$ in isolation. In reality, the semantic meaning of an entity is heavily influenced by its "neighborhood"—the set of other facts and relations it participates in. Without capturing this structural context, models struggle with ambiguity and complex graph patterns.

The SCoP Framework

To address these limitations, the authors propose SCoP, a general-purpose encoder designed to capture deep structural context. The model architecture is divided into two main components: the Contextual Module and the Aggregation Module.

Detailed architecture of SCoP showing the Contextual and Aggregation Modules.

Contextual Module (C-Mod)

For any target triple $(h, r, t)$, the C-Mod identifies "contextual triples"—neighboring facts in the graph that involve the head, relation, or tail. These neighbors are transformed into initial vector representations using a single-layer feed-forward neural network. This step ensures that the model considers the local graph topology surrounding the fact of interest.

Aggregation Module (A-Mod)

The A-Mod is the core of the system, utilizing a multi-layer bidirectional Transformer encoder. To adapt the Transformer (originally designed for sequences) to graph data, SCoP introduces special tokens: [HEA], [REL], and [TAI]. These tokens mark which component of the target triple a specific neighbor belongs to, effectively flattening the local graph structure into a sequence. The Transformer allows all contextual triples to interact through self-attention, producing a unified vector that captures the integrated structural information of the neighborhood.

Task Adaptation and Fine-tuning

SCoP follows a two-stage training process. It is first pre-trained on a general "triple classification" task (determining if a triple is a valid fact) using a large-scale dataset. This pre-training allows the model to learn fundamental structural patterns. Subsequently, the model is fine-tuned for specific downstream applications.

Adaptation of the SCoP architecture for various downstream tasks.

As shown above, the same underlying architecture can be adapted for:

  • Entity Type Prediction: Inferring missing types (e.g., hypernyms) for entities.
  • Entity Alignment: Identifying identical concepts across different KGs by comparing their structural contexts.
  • Triple Classification: The base task used for pre-training to distinguish real facts from noise.

Key Results and Insights

The researchers evaluated SCoP on several benchmarks, including a new comprehensive WordNet dataset (WN-all). The results demonstrate the superiority of contextual pre-training:

  • State-of-the-Art Performance: In Entity Type Prediction, SCoP achieved a 91.98% Hit@1, a 3.8% improvement over RotatE. In Entity Alignment, it reached 93.15% Hit@1, outperforming previous methods by 3.3%.
  • Sharp Decision Boundaries: Analysis of prediction scores revealed that SCoP creates much clearer separation between positive and negative samples compared to traditional models, which often suffer from overlapping score distributions.
  • Transferability: Features learned during the simple triple classification pre-training stage proved highly effective for complex downstream tasks, validating the robustness of the structural representations.

Conclusion and Future Work

SCoP demonstrates that structural context is a powerful signal for KG representation learning. By leveraging Transformer-based aggregation, the model moves beyond static embeddings toward dynamic, context-aware representations. While the computational cost of Transformers is higher than simple vector arithmetic, the significant gains in accuracy and generality suggest this is a promising direction for the field. Future research will focus on scaling SCoP to even larger, noisier graphs like Wikidata and exploring more efficient attention mechanisms for graph data.

Summary updated

BibTeX
@inproceedings{ye2021improving,
  author = {Ganqiang Ye and Wen Zhang and Zhen Bi and Chi Man Wong and Hui Chen and Huajun Chen},
  title = {{Improving Knowledge Graph Representation Learning by Structure Contextual Pre-training}},
  booktitle = {IJCKG},
  year = {2021},
  url = {https://openreview.net/forum?id=Ov2ZRWV9itn},
}
Figure