Knowledge graphs (KGs) are constructed to represent relationships between entities in the form of triples (head, relation, tail) denoted as (h, r, t) . A typical problem in KGs is the lack of many valid triples (West et al., 2014) ; therefore, research approaches have been proposed to predict whether a new triple missed in KGs is likely valid (Bordes et al., 2011; Socher et al., 2013) . These approaches often utilize embedding models to compute a score for each triple, such that valid triples have higher scores than invalid ones. For example, the score of the triple (Boris Johnson, has positive test, is higher than the score of (Donald Trump, has positive test, .
The well-known embedding model TransE (Bordes et al., 2013) uses translations within a latent space to capture relationships between the head and tail entities, so that the embedding v h of the head entity plus the embedding v r of the relation is close to the embedding v t of the tail entity, i.e., v h + v r ≈ v t , where v h , v r , and v t ∈ R n . This view has formed the foundation for several early successful model such as TransH (Wang et al., 2014) , TransR (Lin et al., 2015) , TransD (Ji et al., 2015) , STransE (Nguyen et al., 2016) , DistMult , and up-to-date approaches, which has been reviewed in Nguyen (2017) . Recently, deep neural network-based models have been applied for the knowledge graph-related tasks. For example, ConvE (Dettmers et al., 2018) and ConvKB (Nguyen et al., 2018) are based on convolutional neural networks to score the triples for knowledge graph completion. We note that most of the aforementioned existing models focus on embedding entities and relations within the real-valued vector space.
Moving beyond real-valued vector space, ComplEx (Trouillon et al., 2016) is an extension of Dist-Mult within the complex vector space to produce the score. In addition, RotatE (Sun et al., 2019) considers each relation as a rotation-based translation from the head entity to the tail entity in the complex vector space as: v h • v r ≈ v t , where v h , v r , v t ∈ C n and • denotes the element-wise product.
More recently, QuatE utilizes the Quaternion space H with Hamilton product to embed entities and relations. In particular, a quaternion q ∈ H is a hyper-complex number consisting of a real and three separate imaginary components defined as: q = q r + q i i + q j j + q k k, where q r , q i , q j , q k ∈ R, and i, j, k are imaginary units. QuatE uses the Hamilton product ⊗ to rotate the quaternion embedding v h of the head entity by the normalized quaternion embedding v r of the relation, followed by a quaternion-inner product • with the quaternion embedding v t of the tail entity. Mathematically, QuatE computes the score of the triple (h, r, t) as:
Although QuatE is one of recent state-of-the-art models for the knowledge graph completion task which has shown to outperform up-to-date strong baselines , directly using the quaternion embeddings v h , v r , v t to obtain the triple score might lead to the problem of struggling to strengthen the relation-aware correlations between the head and tail entities. For example, given a relation "has positive test", QuatE does not much consider the correlations between the attributes (e.g., age, gender, and medical record) of the head entity (e.g., "Boris Johnson") and the attributes (e.g., transmission rate and clinical characteristics) of the tail entity (e.g., "COVID-19"). Thus, arguably this could lower the performance of QuatE.
Addressing the problem, we propose an effective embedding model, named QuatRE, to learn the quaternion embeddings for entities and relations. Our QuatRE further uses two relation-aware quaternion vectors v r,1 and v r,2 given a relation r. QuatRE then uses the Hamilton product to rotate the quaternion embeddings v h and v t by the normalized vectors v r,1 and v r,2 , respectively. After that, QuatRE computes the score of (h, r, t) as:
The Quaternion space provides highly expressive computations through the Hamilton product compared to the Euclidean and complex spaces, by sharing the input vectors' quaternion components during multiplication. As a result, QuatRE increases the correlations between the head and tail entities. To summarize, our main contributions are as follows:
• We present a simple and effective embedding model QuatRE to embed entities and relations within the Quaternion space with the Hamilton product. QuatRE further utilizes two relation-aware quaternion vectors for each relation to strengthen the correlations between the head and tail entities.
• Experimental results show that our QuatRE obtains state-of-the-art performances on four benchmarks including WN18, WN18RR, FB15K, and FB15k237 for the knowledge graph completion task; thus, it can act as a new strong baseline for future works.
Existing embedding models (Bordes et al., 2013; Wang et al., 2014) have been proposed to learn the vector representations of entities and relations for the knowledge graph completion task, where the goal is to score valid triples higher than invalid triples.
Early translation-based approaches exploit a translational characteristic so that the embedding of tail entity t should be close to the embedding of head entity h plus the embedding of relation t. For example, TransE (Bordes et al., 2013 ) defines a score function:
where v h , v r , and v t ∈ R n are vector embeddings of h, r and t respectively; and v p denotes the p-norm of vector v. As a result, TransE is suitable for 1-to-1 relationships, but not well-adapted for Many-to-1, 1-to-Many, and Many-to-Many relationships. To this end, some translation-based methods have been proposed to deal with this issue such as TransH (Wang et al., 2014) , TransR (Lin et al., 2015) , TransD (Ji et al., 2015) , and STransE (Nguyen et al., 2016) . Notably, DistMult employs a multiple-linear dot product to score the triples as: f (h, r, t) = n i v hi v ri v ti . One of the recent trends is to apply deep neural networks to measure the triples (Dettmers et al., 2018; Nguyen et al., 2018) . For example, ConvE (Dettmers et al., 2018 ) uses a convolution layer on a 2D input matrix of reshaping the embeddings of both the head entity and relation to produce feature maps that are then vectorized and computed with the embedding of the tail entity to return the score. We can see an overview of other approaches, as summarized in (Nguyen, 2017) . Note that most of the existing models have worked in the real-valued vector space.
Several works have moved beyond the real-valued vector space to the complex vector space, such as ComplEx (Trouillon et al., 2016) and RotatE (Sun et al., 2019) . ComplEx extends DistMult to use the multiple-linear dot product on the complex vector embeddings of entities and relations, while RotatE considers a rotation-based translation within the complex vector space.
Recently the use of hyper-complex vector space has considered on the Quaternion space consisting of a real and three separate imaginary axes. It provides highly expressive computations through the Hamilton product compared to the real-valued and complex vector spaces. Zhu et al. (2018) and Gaudet & Maida (2018) embed the greyscale and each of RGB channels of the image to the real and three separate imaginary axes of the Quaternion space and achieve better accuracies compared real-valued convolutional neural networks with same structures for image classification tasks. The Quaternion space has also been successfully applied to speech recognition (Parcollet et al., 2018; , and natural language processing . Regarding knowledge graph embeddings, has recently proposed QuatE, which aims to learn entity and relation embeddings within the Quaternion space with the Hamilton product. QuatE, however, has a limitation in capturing the correlations between the head and tail entities. Our key contribution is to overcome this limitation by integrating relation-aware quaternion vectors to increase the correlations between the entities.
For completeness, we briefly provide a background in quaternion, which has also similarly described in recent works (Zhu et al., 2018; Parcollet et al., 2019; . A quaternion q ∈ H is a hyper-complex number consisting of a real and three separate imaginary components (Hamilton, 1844) defined as:
where q r , q i , q j , q k ∈ R, and i, j, k are imaginary units that ijk = i 2 = j 2 = k 2 = −1, leads to noncommutative multiplication rules as ij = k, ji = −k, jk = i, kj = −i, ki = j, and ik = −j. Correspondingly, a n-dimensional quaternion vector q ∈ H n is defined as:
where q r , q i , q j , q k ∈ R n . The operations for the Quaternion algebra are defined as follows:
Conjugate. The conjugate q * of a quaternion q is defined as:
Addition. The addition of two quaternions q and p is defined as:
Scalar multiplication. The multiplication of a scalar λ and a quaternion q is defined as:
Norm. The norm q of a quaternion q is defined as:
The normalized or unit quaternion q is defined as:
And the normalized quaternion vector q of q ∈ H n is computed as:
Hamilton product. The Hamilton product ⊗ (i.e., the quaternion multiplication) of two quaternions q and p is defined as:
The Hamilton product of two quaternion vectors q and p ∈ H n is computed as:
where • denotes the element-wise product. We note that the Hamilton product is not commutative, i.e., q ⊗ p = p ⊗ q.
Quaternion-inner product. The quaternion-inner product • of two quaternion vectors q and p ∈ H n returns a scalar, which is computed as:
A knowledge graph (KG) G is a collection of valid factual triples in the form of (head, relation, tail) denoted as (h, r, t) such that h, t ∈ E and r ∈ R where E is a set of entities and R is a set of relations. KG embedding models aim to embed entities and relations to a low-dimensional vector space to define a score function f . This function is to give an implausibility score for each triple (h, r, t), such that the valid triples obtain higher scores than the invalid triples.
The proposed QuatRE. We represent the embeddings of entities and relations within the Quaternion space. Given a triple (h, r, t), the quaternion embeddings v h , v r , and v t ∈ H n of h, r, and t are represented respectively as:
where
In our proposed QuatRE, we associate each relation r with two quaternion vectors v r,1 and v r,2 ∈ H n as:
where v r,1,r , v r,1,i , v r,1,j , v r,1,k , v r,2,r , v r,2,i , v r,2,j , and v r,2,k ∈ R n . We use the Hamilton product to rotate the quaternion embeddings v h and v t by the normalized vectors v r,1 and v r,2 respectively as:
After that, we rotate v h,r,1 by the normalized quaternion embedding v r before computing the quaternion-inner product with v t,r,2 . We note that the quaternion components of input vectors are shared during multiplication in the Hamilton product, as shown in Equation 10 . Therefore, we use two rotations in Equations 17 and 18 for v h and v t to increase the correlations between the head h and tail t entities given the relation r, as illustrated in Figure 1 .
Formally, we define the QuatRE score function f for the triple (h, r, t) as: Learning process. We employ the Adagrad optimizer (Duchi et al., 2011) to train our proposed QuatRE by minimizing the following loss function (Trouillon et al., 2016) with the regularization on model parameters θ as:
in which, t (h,r,t) = 1 for (h, r, t) ∈ G −1 for (h, r, t) ∈ G where we use l 2 -norm with the regularization rate λ; and G and G are collections of valid and invalid triples, respectively. Here, G is generated by corrupting valid triples in G. We use a common strategy (Wang et al., 2014; Lin et al., 2015) when sampling invalid triples in G . More formally, for each relation r, η h denotes the averaged number of head entities per tail entity whilst η t denotes the averaged number of tail entities per head entity. Given a valid triple (h, r, t) of relation r, we then generate a new head entity h with probability ηt η h +ηt to form an invalid triple (h , r, t) and a new tail entity t with probability η h η h +ηt to form an invalid triple (h, r, t ). This negative sampling technique is commonly used in the translation-based models and some baseline models, and also implemented in both QuatE and our QuatRE for a fair comparison.
Parameter initialization. For the fairness, similar to previous works, we apply the standard Glorot initialization (Glorot & Bengio, 2010) for parameter initialization in our QuatRE instead of utilizing a specialized initialization scheme used in QuatE .
In the knowledge graph completion task (Bordes et al., 2013) , the goal is to predict a missing entity given a relation with another entity, for example, inferring a head entity h given (r, t) or inferring a tail entity t given (h, r). The results are calculated by ranking the scores produced by the score function f on triples in the test set.
We evaluate our proposed QuatRE on four benchmark datasets: WN18, FB15k (Bordes et al., 2013) , WN18RR (Dettmers et al., 2018) , and FB15k-237 (Toutanova & Chen, 2015) . WN18 and FB15k are derived from the lexical KG WordNet (Miller, 1995) and the real-world KG Freebase (Bollacker et al., 2008) respectively. As mentioned in (Toutanova & Chen, 2015) , WN18 and FB15k contains many reversible relations, which makes the prediction task become trivial and irrealistic. As shown in (Dettmers et al., 2018) , recent state-of-the-art results on WN18 are still obtained by using a simple reversal. Therefore, their subsets WN18RR and FB15k-237 are derived to eliminate the reversible relation problem to create more realistic and challenging prediction tasks.
Following Bordes et al. (2013) , for each valid test triple (h, r, t), we replace either h or t by each of other entities to create a set of corrupted triples. We use the "Filtered" setting protocol (Bordes et al., 2013) , i.e., not including any corrupted triples that appear in the KG. We rank the valid test triple and corrupted triples in descending order of their scores. We employ evaluation metrics: mean rank (MR), mean reciprocal rank (MRR), and Hits@k (the proportion of the valid triples ranking in top k predictions). The final scores on the test set are reported for the model which obtains the highest Hits@10 on the validation set. Lower MR, higher MRR, and higher Hits@k indicate better performance.
We implement our QuatRE based on Pytorch (Paszke et al., 2019) and test on a single GPU. We set 100 batches for all four datasets. We then vary the learning rate α in {0.02, 0.05, 0.1}, the number s of negative triples sampled per training triple in {1, 5, 10}, the embedding dimension n in {128, 256, 384}, and the regularization rate λ in {0.05, 0.1, 0.2, 0.5}. We train our QuatRE up to 8,000 epochs on WN18 and WN18RR, and 2,000 epochs on FB15k and FB15k-237. We monitor the Hits@10 score after each 400 epochs on on WN18 and WN18RR, and each 200 epochs on FB15k and FB15k-237. We select the hyper-parameters using grid search and early stopping on the validation set with Hits@10. We present the statistics of the datasets and the optimal hyper-parameters on the validation set for each dataset in the appendix.
We report the experimental results on the four benchmark datasets in Tables 1 and 2. Our proposed QuatRE produces competitive results compared to the up-to-date models across all metrics. We note that GC-OTE and RotatE Adv apply a self-adversarial negative sampling, which is different from the common sampling strategy. QuatE N 3Rec uses the N3 regularization and reciprocal learning (Lacroix et al., 2018) , which requires a large embedding dimension. GC-OTE, ReInceptionE, and Correlation analysis. To qualitatively demonstrate the correlations between the entities, we use t-SNE (Maaten & Hinton, 2008) to visualize the learned quaternion embeddings of the entities on WN18RR for QuatE and QuatRE. We select all entities associated with two relations consisting of "instance hypernym" and "synset domain topic of". We then vectorize each quaternion embedding using a vector concatenation across the four components; hence, we obtain a real-valued vector representation for applying t-SNE. The visualization in Figure 2 shows that the entity distribution in our QuatRE is denser than that in QuatE; hence this implies that QuatRE strengthens the correlations between the entities. Relation analysis. Following Bordes et al. (2013) , for each relation r, we calculate the averaged number η h of head entities per tail entity and the averaged number η t of tail entities per head entity. If η h <1.5 and η t <1.5, r is categorized one-to-one (1-1). If η h <1.5 and η t ≥1.5, r is categorized one-to-many (1-M). If η h ≥1.5 and η t <1.5, r is categorized manyto-one (M-1). If η h ≥1.5 and η t ≥1.5, r is categorized many-to-many (M-M). Figure 3 shows the MRR and H@10 scores for predicting the head entities and then the tail entities with respect to each relation category on FB15k-237, wherein our QuatRE outperforms QuatE on these relation categories. Furthermore, we report the MRR scores for each relation on WN18RR in Table 3 , which shows the effectiveness of QuatRE in modeling different types of relations.
If we fix the real components of both v r,1 and v r,2 to 1, and fix the imaginary components of both v r,1 and v r,2 to 0, our QuatRE is simplified to QuatE. Hence the QuatRE's derived formula might look simple as an extension of QuatE. However, to come with the extension, our original intuition is not straightforward, and this intuition has a deeper insight. We also note that given the same embedding dimension, QuatE and our QuatRE have comparable numbers of parameters. Furthermore, the direct comparisons between QuatE and QuatRE can be considered as the ablation studies as shown in Table 3 and Figures 2 and 3 , to clearly demonstrate the advantage of QuatRE. More importantly, our QuatRE outperforms up-to-date models especially on both WN18RR and FB15k-237 which are the more realistic and challenging datasets.
In this paper, we propose QuatRE -a simple and powerful knowledge graph embedding modelto learn the embeddings of entities and relations within the Quaternion space with the Hamilton product. QuatRE further associates each relation with two relation-aware quaternion vectors to increase the correlations between the head and tail entities. Experimental results show that QuatRE outperforms the up-to-date embedding models and produces the state-of-the-art performances on the four benchmark datasets including WN18, FB15k, WN18RR, and FB15k-237 for the knowledge graph completion task. A APPENDIX Table 4 presents the statistics of the four datasets. Table 5 shows the optimal hyper-parameters for each dataset. 