MoKGR (Mixture of Length and Pruning Experts for Knowledge-Graph Reasoning) is a relation-centric framework that personalizes path exploration to deliver state-of-the-art KG reasoning in both transductive and inductive settings.
- Adaptive Length Experts β query-aware gating selects the most relevant hop distances and stops early with a Gumbel-Sigmoid binary gate.
- Complementary Pruning Experts β score-, attention- and semantic-based experts collaboratively retain the most informative entities.
- Unified Pipeline β handles fully inductive, transductive and cross-domain KGs with a single codebase.
- Scalable β tested on large KGs (e.g. YAGO3-10) without GPU out-of-memory errors.
- Plug-and-Play β lightweight implementation; a single modern GPU is sufficient for all benchmarks.
cd MoKGR
pip install -r requirements.txt cd transductive
# Family (small-scale)
python train.py \
--data_path data/family --gpu 0 \
--max_hop 8 --min_hop 2 \
--num_experts 4 --num_pruning_experts 2 \
--active_PPR --sampling_percentage 0.85 \
--active_gate --gate_threshold 0.25
# YAGO3-10 (large-scale)
python train.py \
--data_path data/YAGO --gpu 0 \
--max_hop 8 --min_hop 1 \
--num_experts 6 --num_pruning_experts 2 \
--active_PPR --sampling_percentage 0.475
π Tip: Encounter OOM? Increase --sampling_percentage or disable --active_PPR to reduce subgraph size.
cd inductive
python train.py \
--data_path ./data/WN18RR_v2 --gpu 0 \
--max_hop 8 --min_hop 2 --num_experts 5 \
--active_gate --gate_threshold 0.05
| Dataset | MRR | Hit@1 | Hit@10 |
|---|---|---|---|
| WN18RR | 0.611 | 0.539 | 0.702 |
| FB15k-237 | 0.443 | 0.368 | 0.607 |
| YAGO3-10 | 0.657 | 0.577 | 0.758 |
Full benchmark tables & ablation studies can be found in our paperβs Appendix BβD.
MoKGR/
ββ transductive/ # training & evaluation scripts (fixed entity set)
ββ inductive/ # inductive split loader + training scripts
ββ images/ # logo of MoKGR
ββ requirements.txt
If you find our paper useful, please cite our paper:
@inproceedings{du2025mokgr,
title = {Mixture of Length and Pruning Experts for Knowledge Graphs Reasoning},
author = {Du, Enjun and Liu, Siyi and Zhang, Yongqi},
booktitle = {Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing (EMNLP)},
year = {2025},
publisher = {Association for Computational Linguistics},
url = {https://aclanthology.org/2025.emnlp-main.23}
}
