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

Improving Knowledge Graph Completion with Structure-Aware Supervised Contrastive Learning

Jiashi Lin, Lifang Wang, Xinyu Lu, Zhongtian Hu, Wei Zhang, Wenxuan LuEMNLP 2024

Abstract: Knowledge Graphs (KGs) often suffer from incomplete knowledge, which restricts their utility. Recently, Contrastive Learning (CL) has been introduced to Knowledge Graph Completion (KGC), significantly improving the discriminative capabilities of KGC models and setting new benchmarks in performance. However, existing contrastive methods primarily focus on individual triples, overlooking the broader structural connectivities and topologies of KGs. This narrow focus limits a comprehensive understanding of the graph’s structural knowledge. To address this gap, we propose StructKGC, a novel contrastive learning framework designed to flexibly accommodate the diverse topologies inherent in KGs. Additionally, we introduce four contrastive tasks specifically tailored to KG data: Vertex-level CL, Neighbor-level CL, Path-level CL, and Relation composition level CL. These tasks are trained synergistically during the fine-tuning of pre-trained language models (PLMs), allowing for a more nuanced capture of subgraph semantics. The experimental results demonstrate that our approach achieves SOTA performance under standard supervised and low-resource settings.

Introduction

Knowledge Graphs (KGs) like Wikidata or Freebase are foundational to modern AI, powering search engines and recommendation systems. However, these graphs are notoriously incomplete. Knowledge Graph Completion (KGC) aims to predict missing links, such as finding the "tail" entity for a query like (Ronaldo, Play_for, ?). While Pre-trained Language Models (PLMs) and Contrastive Learning (CL) have recently set new benchmarks, most models suffer from "tunnel vision"—they focus on individual facts (triples) while ignoring the rich, interconnected web surrounding them.

Figure 1: An example of a Knowledge Graph showing entities like Ronaldo and Zidane connected by various relations such as 'Play for', 'Teammate', and 'Nationality'.

Standard CL methods treat every triple as an isolated island, failing to account for complex mappings (one-to-many relations), local context (neighboring entities), and long-range dependencies (multi-hop paths). Without "structure awareness," models struggle to understand the nuanced semantics of the graph topology.

The StructKGC Framework

To address these limitations, we introduce StructKGC, a framework that moves beyond simple instance-wise contrastive learning. StructKGC incorporates four synergistic tasks designed to capture subgraph semantics during the fine-tuning of PLMs:

  1. Vertex-level CL: Aligns a query with all valid entities sharing the same relation from a specific head, rather than just a single tail.
  2. Neighbor-level CL: Focuses on an entity's immediate surroundings, teaching the model that entities with similar neighbors likely share similar attributes.
  3. Path-level CL: Utilizes multi-hop paths as "weak positives" to help the model recognize long-range connections.
  4. Relation Composition CL: Targets the logical inference of relations from paths, helping the model understand that a sequence of relations can be equivalent to a single direct relation.
Figure 6: Comparison between standard CL architectures (SimKGC) and the proposed StructKGC, highlighting the five levels of contrastive learning tasks.

To maintain efficiency, StructKGC employs an in-batch strategy, reusing positive and negative samples within the same training batch to avoid the high computational cost of graph-wide sampling.

Experimental Results

We evaluated StructKGC on two gold-standard benchmarks: FB15k-237 (Freebase subset) and WN18RR (WordNet subset). StructKGC set new state-of-the-art (SOTA) benchmarks across the board:

  • SOTA Performance: On FB15k-237, StructKGC achieved a Mean Reciprocal Rank (MRR) of 38.3, a significant improvement over the previous best text-based model, SimKGC (33.3).
  • Low-Resource Efficiency: When trained on only 10% of the data, StructKGC significantly outperformed baselines, proving that structural awareness makes the model more data-efficient.
  • Handling Complexity: The model showed dramatic improvements in "Many-to-Many" relation predictions, where traditional models often struggle with multiple valid answers.

Conclusion

StructKGC demonstrates that teaching language models to "see" graph structure is vital for robust Knowledge Graph Completion. By treating structural similarity as a form of semantic similarity, the model learns more nuanced representations. While encoding multi-hop paths increases training time by approximately 1.2x, the performance gains—especially in complex and low-resource scenarios—justify the trade-off. Future work will explore hard negative mining to further sharpen the model's discriminative power.

Summary updated

BibTeX
@inproceedings{lin2024improving,
  author = {Jiashi Lin and Lifang Wang and Xinyu Lu and Zhongtian Hu and Wei Zhang and Wenxuan Lu},
  title = {{Improving Knowledge Graph Completion with Structure-Aware Supervised Contrastive Learning}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  url = {https://openreview.net/forum?id=jMgVaNiGHf},
}
Figure