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
Figure 1: An illustration of existing two strategies of full-space LLM-based methods and KGT. (a) Pooling multiple tokens to unified representations for entities; (b) Decomposing entities into fixed-length sub-word sequences; (c) Constructing feature representations directly at the indivisible entity level.
Figure 2: Overview of the KGT framework. Part 1 illustrates the overall pipeline of KGT. The tokenizer first processes the input text containing the incomplete triple query, where entities and relations are represented as special tokens added to the original vocabulary. These special tokens obtain their embeddings via the Dual-Stream Specialized Token Embedding module. Subsequently, the LLM Backbone encodes the sequence, extracting the feature of the last token, which is then fed into the Dual-View Decoupled Predictor to generate the probability distribution over the entire entity vocabulary. Part 2 details the implementation of the Dual-Stream Specialized Token Embedding, where the dashed line indicates the assignment of the fused specialized feature to the special token representing the head entity h. Part 3 depicts the detailed architecture of the Dual-View Decoupled Predictor.
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
Table 1: The main KGC results. ♣ represents the experimental results that we reproduced through source code. The best and second-best results are boldfaced and underlined, respectively. -: unavailable entry.
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
Table 2: Ablation study of different settings on MKG-W, MKG-Y, and DB15K datasets.
Figure 3: A comprhensive comparison between several viriants of KGT on DB15K.
Figure 4: Trainable parameters of some LLM-based KGC methods based on MKG-W.
Figure 5: Results of different logits scaling.
Figure 6: KGC results using different feature extractors. We evaluate diverse textual feature extractors ( text-embedding-3-large , bge-large-en-v1.5 ) on the MKG-W dataset, and structural feature extractors (TransE, RotatE) on the DB15K dataset.
Figure 7: The comparison of model weights among various cases
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
Table 3: Case study experiments on the DB15K dataset
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
Dataset
LLM
text dim
struct dim
LoRA r
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
Appendix
Table 4: Hyper-parameter settings in the main experients.
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.
Appendix
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
Appendix
Table 6: Statistical information of the three datasets in our experiments. The entity descriptions are provided by the original datasets.
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
Appendix
Table 7: Full results on the MKG-W and MKG-Y datasets.