DASFAA 2025: Diffusion-based Hierarchical Negative Sampling for Multimodal Knowledge Graph Completion
This is the PyTorch implementation of DHNS framework. We propose a novel Diffusion-based Hierarchical Negative Sampling (DHNS) scheme tailored for multimodal knowledge graph completion (MMKGC) tasks, which tackles the challenge of generating high-quality negative triples by leveraging a Diffusion-based Hierarchical Embedding Generation (DiffHEG) that progressively conditions on entities and relations as well as multimodal semantics. Furthermore, we develop a Negative Triple-Adaptive Training (NTAT) strategy that dynamically adjusts training margins associated with the hardness level of the synthesized negative triples, facilitating a more robust and effective learning procedure to distinguish between positive and negative triples.
Create a conda environment with pytorch:
conda create --name dhns_env python=3.8
source activate dhns_env
pip install -r requirements.txt
We reuse three multimodal knowledge graph datasets namely DB15K, MKG-W and MKG-Y in the folder ./benchmarks/ along with MMRNS.
The visual and textual embeddings of the MMKGs could be downloaded from this Google Drive. You can kindly put all the files of format .pth in the folder ./embeddings/.
In order to reproduce the results of DHNS model on the datasets, you can kindly run the following command with DistMult+DHNS on MKG-Y for an instance:
python train_dhns.py
If you use the codes, please cite the following paper:
@misc{niu2025dhns,
author = {Guanglin Niu and
Xiaowei Zhang},
title = {Diffusion-based Hierarchical Negative Sampling for Multimodal Knowledge Graph Completion},
archivePrefix = {arXiv},
year = {2025},
eprint = {2501.15393},
primaryClass = {cs.AI}
}
