Structure-Internalized Rule Language Model for Faithful Knowledge Graph Reasoning
Organizations: Key Laboratory of Knowledge Engineering with Big Data (Hefei University of Technology), Ministry of Education, China · School of Computer Science and Information Engineering, Hefei University of Technology, China · Nanjing University of Science and Technology, China
Abstract
Knowledge Graph Reasoning (KGR) aims to discover latent facts by leveraging the structural evidence available in KGs, posing a challenge to the structural semantic understanding capability of KGR models. Recent studies have demonstrated that Large Language Models (LLMs) can achieve remarkable progress on KGR tasks via flexible in-context learning. However, the inherent representation inconsistency between KG structural context and LLM parametric knowledge remains inadequately addressed. This limitation prevents LLMs from effectively perceiving reasoning evidence that aligns with KG constraints, which undermines both the effectiveness and faithfulness of reasoning. We refer to this problem as reasoning evidence perception drift of LLMs over KGs. To address this problem, we propose a Structure-Internalized Rule Language Model (SIRLM), which centers on structural rule generation to couple the parametric learning of structural knowledge with the faithfulness evaluation of reasoning logic, enabling LLMs to anchor tightly to KG-grounded evidence. Specifically, we first design a Structure-Internalized Rule Generator (SIRG), which incorporates an in-context learning block augmented with a structural relation memory to coordinate structural and parametric knowledge. Furthermore, we equip SIRG with a KG tokenizer based on structural invariance learning and a neuro-symbolic reasoner based on rule-constrained message propagation. These components provide SIRG with learnable structural representations and faithful rule-execution feedback, respectively. Our SIRLM can be seamlessly integrated into standard LLM training paradigms, such as SFT and GRPO. Extensive experiments against 17 state-of-the-art KGR methods on 36 datasets demonstrate the significant superiority of SIRLM.
Figures & tables
| Type | Methods | FB15k237 | CoDEx-M | WN18RR | NELL995 | 12 IndE Datasets | 20 FullInd Datasets | ||||||
| MRR | Hit10 | MRR | Hit10 | MRR | Hit10 | MRR | Hit10 | MRR | Hit10 | MRR | Hit10 | ||
| Embedding methods | TransE | 0.313 | 0.495 | 0.320 | 0.481 | 0.226 | 0.501 | 0.401 | 0.501 | NA | NA | NA | NA |
| RotatE | 0.338 | 0.533 | 0.325 | 0.466 | 0.476 | 0.571 | 0.483 | 0.565 | NA | NA | NA | NA | |
| TuckER | 0.358 | 0.544 | 0.328 | 0.458 | 0.470 | 0.526 | 0.520 | 0.624 | NA | NA | NA | NA | |
| Rule-based methods | NeuralLP | 0.237 | 0.362 | 0.334 | 0.444 | 0.435 | 0.566 | 0.394 | 0.482 | 0.449 | 0.623 | NA | NA |
| DRUM | 0.343 | 0.516 | 0.312 | 0.438 | 0.486 | 0.586 | 0.532 | 0.662 | 0.458 | 0.621 | NA | NA | |
| LLM Backbone | CoDEx-M | WN18RR v1 | FB15k237-25 | NELL995-25 | ||||
| MRR | Hit10 | MRR | Hit10 | MRR | Hit10 | MRR | Hit10 | |
| Qwen2.5-0.5b | 0.351 | 0.511 | 0.692 | 0.749 | 0.382 | 0.637 | 0.389 | 0.564 |
| Qwen2.5-1.5b | 0.368 | 0.525 | 0.705 | 0.766 | 0.386 | 0.635 | 0.407 | 0.601 |
| Qwen2.5-7b | 0.369 | 0.531 | 0.708 | 0.771 | 0.387 | 0.635 | 0.408 | 0.606 |
| Llama-2-7b | 0.362 | 0.528 | 0.711 | 0.781 | 0.387 | 0.632 | 0.405 | 0.602 |
Appendix figures & tables13 assets
Supplementary material from the paper’s appendix.
Appendix
| Model | MKGL ( Guo et al., 2024 ) | KRLM ( Zhuo et al., 2026 ) | SIRLM |
| Avg. Length | 115.66 3.65 | 120.50 4.12 | 50.73 0.67 |
| Metric | Pre-training (3 transductive datasets) | Fine-tuning (FB15k237 v1) | Fine-tuning (FB15k237-25) | |||
| KRLM | KRLM | KRLM | ||||
| Avg. TFLOPs (forward propagation 100 steps) | 3.3436 0.4540 | 2.0397 0.3841 | 3.2755 0.5208 | 2.0683 0.0175 | 3.3312 0.4859 | 2.2287 0.0000 |
| Training memory | 36.12 GB / GPU | 27.58 GB / GPU | 32.57 GB / GPU | 11.38 GB / GPU | 32.67 GB / GPU | 13.12 GB / GPU |
| Wall-clock time | 3h10m / epoch | 2h38m / epoch | 7m28s / epoch | 3m39s / epoch | 12m13s / epoch | 10m45s / epoch |
| Type | Dataset | Training graph | Validation Graph | Testing Graph | ||||||||
| Entities | Relations | Triplets | Entities | Relations | Triplets | #Valid | Entities | Relations | Triplets | #Test | ||
| Transductive | FB15k237 ( Toutanova & Chen, 2015 ) | 14541 | 237 | 272115 | 14541 | 237 | 272115 | 17535 | 14541 | 237 | 272115 | 20466 |
| CoDEx-M ( Safavi & Koutra, 2020 ) | 17050 | 51 | 185584 | 17050 | 51 | 185584 | 10310 | 17050 | 51 | 185584 | 10311 | |
| WN18RR ( Dettmers et al., 2018 ) | 40943 | 11 | 86835 | 40943 | 11 | 86835 | 3034 | 40943 | 11 | 86835 | 3134 | |
| NELL995 ( Xiong et al., 2017 ) | 74536 | 200 | 149678 | 74536 | 200 | 149678 | 543 | 74536 | 200 | 149678 | 2818 | |
| IndE | FB15k237 v1 ( Teru et al., 2020 ) | 1594 | 180 | 4245 | 1594 | 180 | 4245 | 489 | 1093 | 180 | 1993 | 411 |
| Module | Component | Parameter |
| KG Tokenizer | NBFNet on | Layer number Hidden dim Message function DistMult Aggregation function Sum Updating function Motif Edge embeddings |
| NBFNet on | Layer number Hidden dim Message function DistMult Aggregation function Sum Updating function | |
| Up-scale layer | ||
| Score function | ||
| In-context Learning Module | Qwen2.5-1.5b backbone | Default configuration |
| LoRA configuration |
| Datasets | ( , , epoch, step) | ( , , epoch, step) | ( , , , epoch, step) |
| FB15k237 | (12, 5e-4, 10, all) | (12, 1e-4, 3, all) | (8, 1e-5, 8, 1, all) |
| CoDEx-M | (24, 1e-4, 10, all) | (24, 5e-5, 3, all) | (8, 1e-5, 8, 1, all) |
| WN18RR | (12, 5e-4, 10, all) | (12, 1e-4, 3, all) | (8, 1e-5, 8, 3, all) |
| NELL995 | (12, 5e-4, 10, all) | (12, 1e-4, 3, all) | (8, 1e-5, 8, 1, all) |
| FB15k237 v1 | (24, 1e-4, 10, all) | (24, 5e-5, 3, all) | (16, 1e-5, 8, 3, all) |
| FB15k237 v2 | (24, 1e-4, 10, all) | (24, 5e-5, 3, all) | (16, 1e-5, 8, 3, all) |
| Methods | FB15k237 v1 | FB15k237 v2 | FB15k237 v3 | FB15k237 v4 | ||||
| MRR | Hit10 | MRR | Hit10 | MRR | Hit10 | MRR | Hit10 | |
| NeuralLP | 0.325 | 0.468 | 0.389 | 0.586 | 0.400 | 0.571 | 0.396 | 0.593 |
| DRUM | 0.333 | 0.474 | 0.395 | 0.595 | 0.402 | 0.571 | 0.410 | 0.593 |
| NBFNet | 0.422 | 0.574 | 0.514 | 0.685 | 0.476 | 0.637 | 0.453 | 0.627 |
| RED-GNN | 0.369 | 0.483 | 0.469 | 0.629 | 0.445 | 0.603 | 0.442 | 0.621 |
| ULTRA | 0.509 | 0.670 | 0.524 | 0.710 | 0.504 | 0.663 | 0.496 | 0.684 |
| Methods | FB15k237-25 | FB15k237-50 | FB15k237-75 | FB15k237-100 | ||||
| MRR | Hit10 | MRR | Hit10 | MRR | Hit10 | MRR | Hit10 | |
| NBFNet | 0.224 | 0.410 | 0.130 | 0.259 | 0.089 | 0.166 | 0.072 | 0.154 |
| RED-GNN | 0.145 | 0.284 | 0.129 | 0.251 | 0.107 | 0.201 | 0.121 | 0.263 |
| ULTRA | 0.383 | 0.635 | 0.334 | 0.538 | 0.400 | 0.598 | 0.444 | 0.643 |
| MOTIF | 0.388 | 0.635 | 0.340 | 0.544 | 0.399 | 0.607 | 0.439 | 0.642 |
| ChatRule | 0.336 | 0.602 | 0.289 | 0.514 | 0.250 | 0.507 | 0.361 | 0.554 |
| Methods | FB15k237 | CodeX-M | WN18RR | NELL995 | 12 IndE Datasets | 20 FullInd Datasets | ||||||
| MRR | Hit10 | MRR | Hit10 | MRR | Hit10 | MRR | Hit10 | MRR | Hit10 | MRR | Hit10 | |
| Full Model | 0.408 | 0.593 | 0.367 | 0.522 | 0.461 | 0.556 | 0.520 | 0.638 | 0.580 | 0.738 | 0.374 | 0.538 |
| w/o MMQI | 0.389 | 0.579 | 0.360 | 0.499 | 0.458 | 0.525 | 0.514 | 0.627 | 0.570 | 0.721 | 0.364 | 0.522 |
| w/o SRM | 0.358 | 0.566 | 0.348 | 0.478 | 0.455 | 0.526 | 0.488 | 0.606 | 0.558 | 0.709 | 0.348 | 0.508 |
| w/o RCMP | 0.352 | 0.538 | 0.339 | 0.422 | 0.404 | 0.500 | 0.501 | 0.611 | 0.540 | 0.685 | 0.344 | 0.502 |
LLM Reasoning with Graphs
Large language model reasoning with graphs uses structured relationships to support multi-step inference, evidence retrieval, and planning.
See all 200 papers