Tokenization, Fusion and Decoupling: Bridging the Granularity Mismatch Between Large Language Models and Knowledge Graphs
Organizations: Beihang University
Abstract
Leveraging Large Language Models (LLMs) for Knowledge Graph Completion (KGC) is promising but hindered by a fundamental granularity mismatch. LLMs operate on fragmented token sequences, whereas entities are the fundamental units in knowledge graphs (KGs) scenarios. Existing approaches typically constrain predictions to limited candidate sets or align entities with the LLM's vocabulary by pooling multiple tokens or decomposing entities into fixed-length token sequences, which fail to capture both the semantic meaning of the text and the structural integrity of the graph. To address this, we propose KGT, a novel framework that uses dedicated entity tokens to enable efficient, full-space prediction. Specifically, we first introduce specialized tokenization to construct feature representations at the level of dedicated entity tokens. We then fuse pre-trained structural and textual features into these unified embeddings via a relation-guided gating mechanism, avoiding training from scratch. Finally, we implement decoupled prediction by leveraging independent heads to separate and combine semantic and structural reasoning. Experimental results show that KGT consistently outperforms state-of-the-art methods across multiple benchmarks.
Figures & tables
| Methods | MKG-W | MKG-Y | DB15K | |||||
| MRR | H@1 | MRR | H@1 | MRR | H@1 | H@3 | H@10 | |
| TransE | 29.19 | 21.06 | 30.73 | 23.45 | 24.86 | 12.78 | 31.48 | 47.07 |
| DistMult | 20.99 | 15.93 | 25.04 | 19.33 | 23.03 | 14.78 | 26.28 | 39.59 |
| RotatE | 33.67 | 26.80 | 34.95 | 29.10 | 29.28 | 17.87 | 36.12 | 49.66 |
| TuckER | 30.39 | 24.44 | 37.05 | 34.59 | 33.86 | 25.33 | 37.91 | 50.38 |
| IKRL | 32.36 | 26.11 | 33.22 | 30.37 | 26.82 | 14.09 | 34.93 | 49.09 |
| Setting | MKG-W | MKG-Y | DB15K | ||||
| MRR | H@1 | MRR | H@1 | MRR | H@1 | ||
| Full Model | 43.27 | 36.02 | 43.61 | 37.68 | 42.16 | 34.06 | |
| Modality Contribution | (1.1). Structure Modality | 32.73 | 27.16 | 36.12 | 33.39 | 37.62 | 28.85 |
| (1.2). Text Modality | 40.69 | 32.44 | 40.86 | 34.36 | 38.08 | 30.14 | |
| Model Design | (2.1). w/o structural input | 41.43 | 33.31 | 42.15 | 35.91 | 41.57 | 33.47 |
| (2.2). w/o textual input | 39.90 | 32.78 | 39.10 | 33.78 | 41.74 | 33.53 | |
| Case 1: ( ? , composer , Adaptation_(film) ) | |
| Textual | Rank of the head entity “ Carter Burwell ” : 179 |
| Structural | Rank of the head entity “ Carter Burwell ” : 1 |
| KGT | Rank of the head entity “ Carter Burwell ” : 1 |
| Case 2: ( ? , distributingCompany , Warner_Music_Group ) | |
| Textual | Rank of the head entity “ Atlantic_Records ” : 1 |
| Structural | Rank of the head entity “ Atlantic_Records ” : 29 |
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
| Dataset | LLM | text dim | struct dim | LoRA | LoRA | LORA target modules | logits scaling ratio |
| MKG-W | Llama-2-7b | 1536 | 256 | 8 | 16 | query, value | 1.4 |
| MKG-Y | Llama-2-7b | 1536 | 256 | 8 | 16 | query, value | 1.6 |
| DB15K | Llama-2-7b | 1536 | 256 | 8 | 16 | query, value | 1.5 |
| Dataset | epoch | batch size per device | gradient accumulation steps | learning rate | optimizer | text dropout | struct dropout |
| MKG-W | 8 | 32 | 1 | 2e-4 | Adamw_8bit | 0.2 | 0.4 |
| MKG-Y | 8 | 32 | 1 | 2e-4 | Adamw_8bit | 0.1 | 0.3 |
| Suppose that you are an excellent linguist studying a new three-word language for knowledge graph. Given the following dictionary: |
| Input Type Description kgl: Mainz Head entity Mainz kgl: capital of Relation capital of |
| Please complete the last word (?) of the sentence: kgl: Mainz kgl: capital of ? |
| Table 5: The prompt of KGT. Note that we take entity "Mainz" and relation "capital of" as a example. |
| Dataset | #Entity | #Relation | #Train | #Valid | #Test | Text |
| MKG-W | 15000 | 169 | 34196 | 4276 | 4274 | 14123 |
| MKG-Y | 15000 | 28 | 21310 | 2665 | 2663 | 12305 |
| DB15K | 12842 | 279 | 79222 | 9902 | 9904 | 9078 |
| Methods | MKG-W | MKG-Y | ||||||
| MRR | H@1 | H@3 | H@10 | MRR | H@1 | H@3 | H@10 | |
| TransE | 29.19 | 21.06 | 33.20 | 44.23 | 30.73 | 23.45 | 35.18 | 43.37 |
| RotatE | 33.67 | 26.80 | 36.68 | 46.76 | 34.95 | 29.10 | 38.35 | 45.30 |
| TuckER | 30.39 | 24.44 | 32.91 | 41.25 | 37.05 | 34.59 | 38.43 | 41.45 |
| IKRL | 32.36 | 26.11 | 34.75 | 44.07 | 33.22 | 30.37 | 34.28 | 38.60 |
| TransAE | 30.00 | 21.23 | 34.91 | 44.72 | 28.10 | 25.31 | 29.10 | 33.03 |
| Methods | WN18RR | |||
| MRR | Hits@1 | Hits@3 | Hits@10 | |
| TransE | .232 | .061 | .366 | .522 |
| RotatE | .476 | .428 | .492 | .571 |
| TuckER | .470 | .443 | .526 | .526 |
| KG-BERT | .216 | .041 | .302 | .524 |
| StAR | .401 | .243 | .491 | .709 |
KG Completion
Knowledge graph completion (KGC) predicts missing entities, relations, or facts from structured graphs and supporting evidence.
See all 76 papers