Abstract
Capturing the composite embedding representation of a multi-hop relation path is an extremely vital task in knowledge graph completion. Recently, rotation-based relation embedding models have been widely studied to embed composite relations into complex vector space. However, these models make some over-simplified assumptions on the composite relations, resulting the relations to be commutative. To tackle this problem, this paper proposes a novel knowledge graph embedding model, named QuatGE, which can provide sufficient modeling capabilities for complex composite relations. In particular, our method models each relation as a rotation operator in quaternion group-based space. The advantages of our model are twofold: (1) Since the quaternion group is a non-commutative group (i.e., non-Abelian group), the corresponding rotation matrices of composite relations can be non-commutative; (2) The model has a more expressive setting with stronger modeling capabilities, which is flexible to model and infer the complete relation patterns, including: symmetry/anti-symmetry, inversion and commutative/non-commutative composition. Experimental results on four benchmark datasets show that the proposed method outperforms the existing state-of-the-art models for link prediction, especially on composite relations.
Introduction
Knowledge Graphs (KGs) play a vital role in solving Artificial Intelligence tasks including information retrieval [1], knowledge inference [2], question answering [3], data integration [4], recommender systems [5] and so on. Research on KGs is attracting more and more interests in academia and industry communities.
Although some large scale KGs contain millions of entities and billions of facts, they still might be far from complete due to missing links (relations) among entities. Hence, an increasing amount of recent works [6–13] have devoted to complete KGs (i.e., link prediction) by learning a set of low-dimensional representation of entities and relations. The general purpose of these works is to model and infer the connectivity patterns in the KGs according to the existing facts. For example, some relations are symmetric (e.g., classmate) while others are anti-symmetric (e.g., filiation); some relations are the inverse of other relations (e.g., hypernym and hyponym); and some relations may be composed by others (e.g., my father’s wife is my mother).
Currently, rotation-based relation embedding models, e.g., RotatE [11], QuatE [14] and our previous work [7] (i.e., CapS-QuaR), have concerned these relation patterns, symmetry/anti-symmetry, inversion, and composition. However, it is ignored that some composite relations are non-commutative (Fig. 1(b)). Intuitively, these relation patterns have natural correspondence to notions in group theory [15]. In addition, non-Abelian group is applied to introduce non-commutative nature [16]. Quaternions enable expressive rotation in the three-dimensional space and have more degrees of freedom than rotation in complex plane (e.g., RotatE) [14]. Additionally, the Hamilton product of quaternions accords with the characteristics of non-Abelian group, which is as shown Eq.11 in this paper. Therefore, we propose QuatGE (Quaternion Group-based Embedding), which models each relation as a quaternion group-based rotation operator (Fig. 2(b)). Furthermore, QuatGE focus on the modeling of composite relations, accounting for their possible non-commutative nature.

(a) A commutative composition relation; (b) A non-commutative composition relation.

(a) In complex plane (e.g., RotatE), composite relations are assumed to be commutative. In addition, the rotation axis (perpendicular to the paper) is orthogonal to the entity embeddings. (b) In QuatGE model, each relation is modeled as a rotation operator
Specifically, our contributions are summarized as the following: To the best of our knowledge, QuatGE is the first model that embeds each relation as a rotation into quaternion group-based space. The model can capture the composite embedding representation of multi-hop relations, accounting for possible non-commutative composite relations. Our method has a more expressive setting with stronger modeling capabilities, which is flexible to model and infer the complete relation patterns, including: We evaluate our model QuatGE by link prediction task on four benchmark datasets. The experimental results show QuatGE outperforms the state-of-the-art results with significant improvements over strong baselines.
The remaining sections are organized as following: Section 2 mentions some related works of modeling composite relations; in Section 3, we briefly introduce background knowledge, and propose a new approach to obtain embeddings by modeling relational rotation using quaternion group; we present experimental results and analyses in Section 4; and conclude with future directions in Section 5.
From the group theory perspective, QuatGE may be related to the TorusE [17] and NagE [16] models. To deal with the compactness problem, TorusE model defines knowledge graph embedding as translations on a compact Lie group (i.e., n-torus). Moreover, TorusE focuses on the problem of regularization in TransE while QuatGE focuses on modeling and inferring multiple types of relation patterns. NagE, a group theory-based knowledge graph embedding framework that firstly attempts to apply non-Abelian group in modeling relational rotations, and empirical results show limited performance advance over previous methods.
From the perspective of modeling multi-hop relations (i.e., a relation path composed of a series of relations), QuatGE may be related to the TransE [6], the RotatE [11] and QuatE [14] models. TransE, a well-known Knowledge Graph Embedding (KGE) model that models each relation as a pure translational transformation and uses Eucleadian distance as score function. Specifically, TransE assumes a fixed addition composition pattern between relations (i.e., r3 = r1 + r2), which is commutative and irrelevant to entity embeddings. In addition, TransE brings about r = 0 for symmetric relations, so it cannot model the symmetry relation pattern. RotatE models relations as rotational operator (rotation matrix) in the complex vector space, and it can effectively model all relation patterns (i.e., symmetry/anti-symmetry, inversion, and composition). To model a multi-hop relation path composed of multiple relations, RotatE uses Hadamard product to combine the rotation matrices of the relations i.e., r3 = r1 ∘ r2, and all relations in the relation path have the same rotation axis (Fig. 2(a)). Thus, the composite relations in RotatE are also commutative. QuatE provides a more expressive model for composite relations and represents each relation type as a rotational operator in quaternion space (an extension of complex plane). However, QuatE applies the quaternion inner product (commutative) as the scoring function. Consequently, QuatE also cannot model the non-commutative composite relation pattern. In the QuatGE model, we use Axis–Angle representation to model each relation as a rotation operation in the quaternion group-based space, and take fully advantage of the natural correspondence between relation patterns and quaternion group notions for the first time. Moreover, QuatGE applies the Hamilton product (not commutative) of quaternions as the scoring function. Thus, QuatGE is flexible to model and infer the relation patterns, including: symmetry, anti-symmetry, inversion, commutative composition and non-commutative composition. A reasonable KGE model should be designed to accommodate various relation patterns existing in real world KGs, including the atomic relation patterns (inferable within one hop, i.e., symmetry, anti-symmetry and inversion) and the complex composition patterns (inferable within multi-hop). Compared to modeling atomic relation patterns, modeling complex composition patterns poses special challenges (e.g., commutative/non-commutative composition). In addition, the complex composition patterns are not always inferable by the multi-hop relations alone. For example, given that factual triplets (y, isElderBrotherOf, x) and (z, isYoungerBrotherOf, y), we can not infer whether x is elder or younger than z from the given facts. In fact, to figure out their relationships, we need to know more about x, y and z from their own attributes and their other relationships. As a contrast, our QuatGE model leverages rotation operation for relation modeling in the quaternion group-based space for the first time, which can effectively model all relation patterns, accounting for special challenges of modeling complex composition patterns. We summarize the capability of several models for modeling relation patterns, as shown in Table 1.
Modeling capability of several models for relation patterns
Modeling capability of several models for relation patterns
In this section, we would firstly provide background knowledge, including definitions of relation patterns, the correspondence between relation patterns and group theory, problem formulation and quaternion group representation. Next, we would focus on modeling relational rotation using quaternion group. Then, score function and loss function are defined. Lastly, we would dicuss capability of our model in modeling relation patterns.
Relation pattern
To better express the relation patterns in KGs, we define them as follows:
To better comprehend the relation modeling in group space, we firstly provide interrelated definitions of group theory.
1. Closure: for ∀a, b ∈ G, we have a ★ b ∈ G.
2. Associativity: for ∀a, b, c ∈ G, we have (a ★ b) ★ c = a ★ (b ★ c).
3. Identity element: for ∀a ∈ G and ∃e ∈ G, we have e ★ a = a ★ e = a. We call e an identity of (G, ★).
4. Inverse element: for ∀a ∈ G and ∃b ∈ G, we have a ★ b = b ★ a = e. We call b an inverse of a, which is denoted a-1.
As we can see, the inversion pattern of relation (i.e., Definition 3) is similar to inverse element in the definition of the group. We summarize the correspondence between relation patterns and group theory in Table 2.
The correspondence between relation patterns and group theory
The correspondence between relation patterns and group theory
Mathematically, a KG contains an entity set
Quaternion group representation
A quaternion is a simple super complex number. The complex number consists of a real number plus an imaginary unit
To better represent quaternion group, other important operational rules for quaternions are described as follows:
As shown in Fig. 2(b), we use Axis–Angle representation to model a rotation operation in the quaternion group-based space. More specifically, a unit vector
Given an entity vector
A 3-D Euclidean vector
Considering each 3-D Euclidean vector can be denoted as a pure quaternion, we can now represent the rotation using a matrix
According to the closure property of group theory, two rotations can be combined into one equivalent rotation operation in our model. It is to say that we can define
A score function aims to measure the rationality of proposed fact candidates. For each triple (e
h
, r, e
t
), our score function is defined as follows:
To verify whether the relation patterns are implicitly represented by QuatGE relation embeddings, we discuss as follows.
Experiments
In this section, the experimental datasets and evaluation metrics would firstly be provided, and then implementation details would be described. Lastly, we would report the link prediction results and analysis.
Datasets and evaluation metrics
Since these inverse relations in WN18 and FB15k will significantly improve the experimental results. Therefore, to solve the inverse relation problem in WN18 and FB15k, WN18RR and FB15k-237 are extracted from the original dataset WN18 and FB15 by removing inverse relations. The WN18RR and FB15k-237 datasets aim to assess the model performance on composition patterns. The statistics of the four benchmark datasets are summarized into Table 3.
Statistics of the datasets used in this paper
Statistics of the datasets used in this paper
We use Adam as the optimizer and fine-tune the hyper-parameters on the validation dataset. All algorithms are implemented in Python, and all experiments are conducted on a server with 1755 MHz 23 GD6 GeForce RTX 2080 Ti GPU and 64 GB memory.
We train QuatGE for 3,000 epochs, using a grid search of hyper-parameters as follows: embedding size k ∈ {100, 200, 500, 1000}, batch size b ∈ {256, 512, 1024}, learning rate λ ∈ {0.00001, 0.00005, 0.0001, 0.0005}, fixed margin γ ∈ {3.0, 6.0, 9.0, 12.0, 18.0, 24.0}, negative sampling size n ∈ {128, 256, 512, 1024} and self-adversarial sampling temperature α ∈ {0.3, 0.5, 1.0}. Embeddings for each entity are initialized with a matrix with a size of 3 × k, and embeddings for each relation are initialized with a matrix with a size of 4 × k, and the rotation angle ψ is initialized between 0 and 2π. All parameters are randomly initialized from the interval [-
The best hyper-parameters setting of QuatGE on the four benchmark datasets
The best hyper-parameters setting of QuatGE on the four benchmark datasets
Link prediction aims to predict the missing entity given a relation and another entity, i.e, inferring a head entity e
h
given (r, e
t
) or inferring a tail entity e
t
given (e
h
, r). Link prediction results could be obtained from ranking the scores calculated by the score function f
Link prediction results on FB15K and WN18
Link prediction results on FB15K and WN18
Results of TransE are taken from [22]. Other results are taken from the corresponding original papers.
Link prediction results on FB15K-237 and WN18RR
Results of TransE are taken from [23]. Results of ComplEx are taken from [20]. Other results are taken from the corresponding original papers.
As shown in Table 5, QuatGE performs better than its closely related embedding model QuatE on the FB15k dataset except MR, especially our model obtains significant improvements of 0.821 - 0.782 = 0.039 in MRR (which is about 4.987% relative improvement), and 73.2% -71.1 = 2.1 % absolute improvement in Hits@1. RotatE achieves high value on Hit@1. In addition, QuatGE outperforms all the baselines on all metrics on the WN18 dataset. The results also show that QuatGE can effectively model the symmetry, anti-symmetry and inversion patterns since they account for a large portion of the relations in these two datasets. As shown in Table 6, on the FB15k-237 dataset in which there are a large number of composition patterns, QuatE and QuatGE achieve a large performance gain over existing state-of-the-art models. On the WN18RR dataset where a number of symmetry relations exist, our model QuatGE is the first best. To further verify the modeling ability of QuatGE, we classify the relations in the FB15k-237 test set into three categories: symmetry, anti-symmetry and composition. The results of MRR for predicting head and tail entities w.r.t each relation category on FB15k-237 are summarized into Table 7. To confirm the superior representation capability of QuatGE in modelling different types of relation, we conduct a further analysis that compares the MRR performance of QuatGE to two previous models (RotatE and QuatE) for each relation on WN18RR, as listed in Table 8.
MRR for predicting head and tail entities w.r.t relation patterns on FB15K-237
MRR comparison on each relation type of WN18RR
Results of RotatE and QuatE are taken from [14].
It can be seen from Table 7 that QuatGE can significantly improve the experimental results on the link prediction task, especially in modeling composition relations. As can be seen from Table 8, QuatGE is the best in many specific composition relations. Therefore, QuatGE is more focused on modeling the composition relations.
QuatGE outperforms the existing state-of-the-art models across most metrics. However, the uniqueness of identity in the quaternion group limits the modeling capacity of QuatGE. The reason is as follows: Modeling composition pattern, such as r1 (x, y) ∧ r1 (y, z) ⇒ r1 (x, z) would happen. In the group formulation, G r 1 ★ G r 1 = G r 1 . Therefore, G r 1 is modeled as the identity in the quaternion group. Due to the uniqueness of identity, all relations that exhibit the above pattern will be modeled as the same identity element in the quaternion group. This certainly limits the modeling capacity of all models that can be formulated under the quaternion-group action perspective.
In this paper, we propose QuatGE, a knowledge graph embedding model which operates in the quaternion group-based space. In the QuatGE model, we use Axis–Angle representation to model each relation as a rotation operation in the quaternion group-based space, the rotation operation is encoded by a unit quaternion with three degrees of freedom (i.e., θ, ϕ and ψ). We take fully advantage of the natural correspondence between relation patterns and quaternion group notions for the first time in the QuatGE model. Moreover, QuatGE applies the Hamilton product (not commutative) of quaternions as the scoring function. Therefore, QuatGE is advantageous with its capability in modelling several pivotal relation patterns, expressing with higher degrees of freedom as well as its good generalization. In our experiments, we evaluate our model QuatGE by link prediction task on four benchmark datasets. The experimental results show that QuatGE achieves consistent and significant improvements compared to the state-of-the-art baselines. In the future, we will consider overcoming the uniqueness of identity in the quaternion group to improve the modeling capacity of QuatGE.
Footnotes
Acknowledgment
This work was supported by the National Natural Science Foundation of China (No.61976032 and No.61806038), the Scientific Research Funding Project of Education Department of Liaoning Province (No.2020JYT03) and the Innovative Talents in Colleges and Universities of Liaoning Province (No.WR2019005).
