sented by TransE (Bordes et al.,2013), there is a
restriction on the direction of the representation of
entities and relations direction, fixing it from entity
to relation or vice versa. As a consequence,
cer-
tain interactions between neighbor entities and
relations are ignored
. Also, to predict more com-
plex types, CET directly adds and averages the
neighbor representations,
weakening the contri-
bution of different neighbors
, since it ignores that
the contribution of different neighbors to differ-
ent types might not be the same. For example,
as shown in Figure 1, the inference of the type
20th-century American writer involves multiple se-
mantic aspects of Barack Obama, it requires to
jointly consider the neighbors
write
−−→
A Promised
Land,
was_born_in
−−−−−−−→
1961, and
is_leader_of
−−−−−−→
U.S, but
the neighbor
degree_award
−−−−−−−→
Juris Doctor should get
less attention. On the other hand, GCN frame-
works for KGET use expressive representations
for entities and relations based on their neighbor
entities and relations (Jin et al.,2019;Zhao et al.,
2022;Zou et al.,2022;Vashishth et al.,2020;Pan
et al.,2021). However, a common problem of
GCN-based models is that they aggregate informa-
tion only along the paths starting from neighbors
of the target entity,
limiting the representation of
interdependence between neighbors that are not
directly connected.
For example, in Figure 1the
entities Juris Doctor and U.S are not connected,
but combining their information could help to infer
that American Legal Scholars is a type of Barack
Obama. This could be fixed by increasing the num-
ber of layers, but with an additional computational
cost.
The main objective of this paper is to introduce
a transformer-based approach to KGET that ad-
dresses the highlighted challenges. The transformer
architecture (Vaswani et al.,2017) has been essen-
tial for NLP, e.g., in pre-trained language mod-
els (Devlin et al.,2019;Reimers and Gurevych,
2019;Lan et al.,2020;Wu et al.,2021a), docu-
ment modeling (Wu et al.,2021b), and link pre-
diction (Wang et al.,2019;Chen et al.,2021).
Transformers are well-suited for KGET as enti-
ties and relations in a KG can be regarded as to-
kens, and using the transformer as encoder, one can
thus achieve bidirectional deep interaction between
entities and relations. Specifically, we propose
TET
, a
T
ransformer-based
E
ntity
T
yping model
for KGET, composed of the following three infer-
ence modules. A
local transformer
that indepen-
dently encodes the relational and type neighbors of
an entity into a sequence, facilitating bidirectional
interaction between elements within the sequence,
addressing the first problem. A
global transformer
that aggregates all neighbors of an entity into a sin-
gle long sequence to simultaneously consider mul-
tiple attributes of an entity, allowing to infer more
‘complex’ types, thus addressing the third problem.
A
context transformer
that aggregates neighbors
of an entity in a differentiated manner according
to their contribution while preserving the graph
structure, thus addressing the second problem. Fur-
thermore, we use semantic knowledge about the
known types in a KG. In particular, we find out that
types are normally clustered in classes. For exam-
ple, the types medicine/disease,medicine/symptom,
and medicine/drug belong to the class medicine.
We use this class membership information for re-
placing the ‘generic’ relation has_type with a more
fine-grained relation that captures to which class a
type belongs to, enriching the semantic content of
connections between entities and types. To sum up,
our contributions are:
•
We propose a novel transformer-based frame-
work for inferring missing entity types in KGs,
encoding knowledge about entity neighbors
from three different perspectives.
•
We use class membership of types to replace the
single has_type relation with class-membership
relations providing fine-grained semantic infor-
mation.
•
We conduct empirical and ablation experiments
on two real-world datasets, demonstrating the
superiority of TET over existing SoTA models.
Data, code, and an extended version with
appendix are available at
https://github.
com/zhiweihu1103/ET-TET.
2 Related Work
The knowledge graph completion (KGC) task is
usually concerned with predicting the missing head
or tail entities of a triple. KGET can thus be seen as
a specialization of KGC. Existing KGET methods
can be classified in embedding- and GNC-based.
Embedding-based Methods.
ETE (Moon et al.,
2017) learns entity embeddings for KGs by a stan-
dard representation learning method (Bordes et al.,
2013), and further builds a mechanism for infor-
mation exchange between entities and their types.