RotatE: Knowledge Graph Embedding by Relational Rotation in Complex Space
Zhiqing Sun Zhi-Hong Deng Jian-Yun Nie Jian Tang


Adaptive Robust Energy Management Strategy for Campus-Based Commercial Buildings Considering Comprehensive Comfort Levels

    Zheming Liang24,
Desong Bian2,
Dawei Su3,
Ruisheng Diao2,
Di Shi21,
Zhiwei Wang2 and
Wencong Su4

2GEIRI North America, San Jose, CA, USA
3State Grid Jiangsu Electric Power Company, Nanjing, China
4Department of Electrical and Computer Engineering, University of Michigan-Dearborn, Dearborn, MI, USA
This work is funded by SGCC Hybrid Energy Storage Management Platform for Integrated Energy System.

Di Shi is the corresponding author. (Email: di.shi@geirina.net)


    December 30, 2023
======================================================================================================================================================================================================================================================================================================================================================================================================================================================================================





We study the problem of learning representations of entities and relations in knowledge graphs for predicting missing links. The success of such a task heavily relies on the ability of modeling and inferring the patterns of (or between) the relations. In this paper, we present a new approach for knowledge graph embedding called RotatE, which is able to model and infer various relation patterns including: symmetry/antisymmetry, inversion, and composition.

Specifically, the RotatE model defines each relation as a rotation from the source entity to the target entity in the complex vector space. In addition, we propose a novel self-adversarial negative sampling technique for efficiently and effectively training the RotatE model. Experimental results on multiple benchmark knowledge graphs show that the proposed RotatE model is not only scalable, but also able to infer and model various relation patterns and significantly outperform existing state-of-the-art models for link prediction.




§ INTRODUCTION


Knowledge graphs are collections of factual triplets, where each triplet (, , ) represents a relation  between a head entity  and a tail entity . Examples of real-world knowledge graphs include Freebase <cit.>, Yago <cit.>, and WordNet <cit.>. Knowledge graphs are potentially useful to a variety of applications such as question-answering <cit.>, information retrieval <cit.>, recommender systems <cit.>, and natural language processing <cit.>. Research on knowledge graphs is attracting growing interests in both academia and industry communities. 

Since knowledge graphs are usually incomplete, a fundamental problem for knowledge graph is predicting the missing links. Recently, extensive studies have been done on learning low-dimensional representations of entities and relations for missing link prediction (a.k.a., knowledge graph embedding) <cit.>.
These methods have been shown to be scalable and effective. The general intuition of these methods is to model and infer the connectivity patterns in knowledge graphs according to the observed knowledge facts. For example, some relations are symmetric (e.g., marriage) while others are antisymmetric (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 mother's husband is my father). It is critical to find ways to model and infer these patterns, i.e., symmetry/antisymmetry, inversion, and composition, from the observed facts in order to predict missing links. 





Indeed, many existing approaches have been trying to either implicitly or explicitly model one or a few of the above relation patterns <cit.>. 

For example, the TransE model <cit.>, which represents relations as translations, aims to model the inversion and composition patterns; the DisMult model <cit.>, which models the three-way interactions between head entities, relations, and tail entities, aims to model the symmetry pattern. However, none of existing models is capable of modeling and inferring all the above patterns. Therefore, we are looking for an approach that is able to model and infer all the three types of relation patterns. 



In this paper, we propose such an approach called  for knowledge graph embedding.
Our motivation is from Euler's identity e^iθ = cosθ + i sinθ, which indicates that a unitary complex number can be regarded as a rotation in the complex plane.
Specifically, the  model maps the entities and relations to the complex vector space and defines each relation as a rotation from the source entity to the target entity. Given a triplet (,,), we expect that = ∘, where , , ∈ℂ^k are the embeddings, the modulus |r_i| =1 and ∘ denotes the Hadamard (element-wise) product. Specifically, for each dimension in the complex space, we expect that:

    t_i = h_i r_i,   where h_i, r_i, t_i ∈ℂ and  |r_i| =1.









It turns out that such a simple operation can effectively model all the three relation patterns: symmetric/antisymmetric, inversion, and composition. For example, a relation  is symmetric if and only if each element of its embedding , i.e. r_i, satisfies r_i = e^0 / iπ = ± 1; two relations _1 and _2 are inverse if and only if their embeddings are conjugates: _2=_1; a relation _3 = e^iθ_3 is a combination of other two relations _1 = e^iθ_1 and _2 = e^iθ_2 if and only if _3 = _1 ∘_2 (i.e. θ_3 = θ_1 + θ_2). Moreover, the  model is scalable to large knowledge graphs as it remains linear in both time and memory. 

To effectively optimizing the , we further propose a novel self-adversarial negative sampling technique, which generates negative samples according to the current entity and relation embeddings. The proposed technique is very general and can be applied to many existing knowledge graph embedding models. We evaluate the  on four large knowledge graph benchmark datasets including FB15k <cit.>, WN18 <cit.>, FB15k-237 <cit.> and WN18RR <cit.>. Experimental results show that the  model significantly outperforms existing state-of-the-art approaches. In addition,  also outperforms state-of-the-art models on Countries <cit.>, a benchmark explicitly designed for composition pattern inference and modeling. To the best of our knowledge,  is the first model that achieves state-of-the-art performance on all the benchmarks.[The codes of our paper are available online: <https://github.com/DeepGraphLearning/KnowledgeGraphEmbedding>.]










§ RELATED WORK




The p-norm of a complex vector  is defined as _p = √(∑ |_i|^p). We use L1-norm for all distance-based models in this paper and drop the subscript of ·_1 for brevity.

Predicting missing links with knowledge graph embedding (KGE) methods has been extensively investigated in recent years. The general methodology is to define a score function for the triplets. Formally, let ℰ denote the set of entities and ℛ denote the set of relations, then a knowledge graph is a collection of factual triplets (, , ), where , ∈ℰ and ∈ℛ. Since entity embeddings are usually represented as vectors, the score function usually takes the form f_r(, ), where  and  are head and tail entity embeddings. The score function f_r(, ) measures the salience of a candidate triplet (, , ). The goal of the optimization is usually to score true triplet (, , ) higher than the corrupted false triplets (', , ) or (, , '). Table <ref> summarizes different score functions f_r(, ) in previous state-of-the-art methods as well as the model proposed in this paper. 
These models generally capture only a portion of the relation patterns. For example, TransE represents each relation as a bijection between source entities and target entities, and thus implicitly models inversion and composition of relations, but it cannot model symmetric relations; ComplEx extends DistMult by introducing complex embeddings so as to better model asymmetric relations, but it cannot infer the composition pattern.
The proposed  model leverages the advantages of both.



A relevant and concurrent work to our work is the TorusE <cit.> model, which defines knowledge graph embedding as translations on a compact Lie group. The TorusE model can be regarded as a special case of RotatE, where the modulus of embeddings are set fixed; our RotatE is defined on the entire complex space, which has much more representation capacity. Our experiments show that this is very critical for modeling and inferring the composition patterns. Moreover, TorusE focuses on the problem of regularization in TransE while this paper focuses on modeling and inferring multiple types of relation patterns.


There are also a large body of relational approaches for modeling the relational patterns on knowledge graphs <cit.>. However, these approaches mainly focus on explicitly modeling the relational paths while our proposed RotatE model implicitly learns the relation patterns, which is not only much more scalable but also provides meaningful embeddings for both entities and relations. 



Another related problem is how to effectively draw negative samples for training knowledge graph embeddings. This problem has been explicitly studied by <cit.>, which proposed a generative adversarial learning framework to draw negative samples. However, such a framework requires simultaneously training the embedding model and a discrete negative sample generator, which are difficult to optimize and also computationally expensive. We propose a self-adversarial sampling scheme which only relies on the current model. It does require any additional optimization component, which make it much more efficient.



§ : RELATIONAL ROTATION IN COMPLEX VECTOR SPACE

In this section, we introduce our proposed  model. We first introduce three important relation patterns that are widely studied in the literature of link prediction on knowledge graphs. Afterwards, we introduce our proposed  model, which defines relations as rotations in complex vector space. We also show that the  model is able to model and infer all three relation patterns. 





 §.§ Modeling and Inferring Relation Patterns




The key of link prediction in knowledge graph

is to infer the connection patterns, e.g., relation patterns, with observed facts. According to the existing literature <cit.>, three types of relation patterns are very important and widely spread in knowledge graphs: symmetry, inversion and composition. We give their formal definition here:


A relation  is symmetric (antisymmetric) if ∀,

    (, ) ⇒(, ) ( (, ) ⇒(,)  )

A clause with such form is a symmetry (antisymmetry) pattern.





Relation _1 is inverse to relation _2 if ∀,

    _2 (, ) ⇒_1 (, )

A clause with such form is a inversion pattern.





Relation _1 is composed of relation _2 and relation _3 if ∀, ,

    _2 (, ) ∧_3 (, ) ⇒_1 (, )

A clause with such form is a composition pattern.




According to the definition of the above three types of relation patterns, we provide an analysis of existing models on their abilities in inferring and modeling these patterns. Specifically, we provide an analysis on TransE, TransX, DistMult, and ComplEx.[See discussion at Appendix <ref>] We did not include the analysis on HolE and ConvE since HolE is equivalent to ComplEx  <cit.>, and ConvE is a black box that involves two-layer neural networks and convolution operations, which are hard to analyze. The results are summarized into Table <ref>.
We can see that no existing approaches are capable of modeling all the three relation patterns. 



 §.§ Modeling Relations as Rotations in Complex Vector Space




In this part, we introduce our proposed model that is able to model and infer all the three types of relation patterns. Inspired by Euler's identity, we map the head and tail entities , to the complex embeddings, i.e., , ∈ℂ^k;
then we define the functional mapping induced by each relation  as  an element-wise rotation from the head entity  to the tail entity . In other words, given a triple (, , ), we expect that:




    = ∘
    ,    where  |r_i| = 1,


and ∘ is the Hadmard (or element-wise) product. Specifically, for each element in the embeddings, we have t_i = h_i r_i.

Here, we constrain the modulus of each element of ∈ℂ^k, i.e., r_i∈ℂ, to be |r_i|=1. By doing this, r_i is of the form e^iθ_r,i, which corresponds to a counterclockwise rotation by θ_r, i radians about the origin of the complex plane, and only affects the phases of the entity embeddings in the complex vector space.
We refer to the proposed model as  due to its rotational nature. According to the above definition, for each triple (, , ), we define the distance function of  as:

    d_r(, ) = ∘ -


By defining each relation as a rotation in the complex vector spaces,  can model and infer all the three types of relation patterns introduced above. Formally, we have following results[We relegate all proofs to the appendix.]:

 can infer the symmetry/antisymmetry pattern. (See proof in Appendix <ref>)


 can infer the inversion pattern. (See proof in Appendix <ref>)


 can infer the composition pattern. (See proof in Appendix <ref>)


These results are also summarized into Table <ref>.
We can see that the  model is  the only model that can model and infer all the three types of relation patterns.



  
Connection to TransE. From Table <ref>, we can see that TransE is able to infer and model all the other relation patterns except the symmetry pattern. The reason is that in TransE, any symmetric relation will be represented by a 0 translation vector. As a result, this will push the entities with symmetric relations to be close to each other in the embedding space.  solves this problem and is a able to model and infer the symmetry pattern. An arbitrary vector  that satisfies r_i = ± 1 can be used for representing a symmetric relation in , and thus the entities having symmetric relations can be distinguished. Different symmetric relations can be also represented with different embedding vectors.  Figure <ref> provides illustrations of TransE and  with only 1-dimensional embedding and shows how  models a symmetric relation.








 §.§ Optimization






Negative sampling has been proved quite effective for both learning knowledge graph embedding <cit.> and word embedding <cit.>. Here we use a loss function similar to the negative sampling loss <cit.> for effectively optimizing distance-based models:

    L = - logσ(γ - d_r(, )) - ∑_i=1^n 1/klogσ(d_r('_i, '_i) - γ),

where γ is a fixed margin, σ is the sigmoid function, and (_i', , _i') is the i-th negative triplet.

We also propose a new approach for drawing negative samples. The negative sampling loss samples the negative triplets in a uniform way. Such a uniform negative sampling suffers the problem of inefficiency since many samples are obviously false as training goes on, which does not provide any meaningful information. Therefore, we propose an approach called self-adversarial negative sampling, which samples negative triples according to the current embedding model. Specifically, we sample negative triples from the following distribution:

    p(h'_j, r, t'_j | {(h_i, r_i, t_i)}) = expα f_r('_j, '_j)/∑_i expα f_r('_i, '_i)

where α is the temperature of sampling. Moreover, since the sampling procedure may be costly, we treat the above probability as the weight of the negative sample. Therefore, the final negative sampling loss with self-adversarial training takes the following form:

    L = - logσ(γ - d_r(, )) - ∑_i=1^n p(h'_i, r, t'_i) logσ(d_r('_i, '_i) - γ)







In the experiments, we will compare different approaches for negative sampling.



§ EXPERIMENTS



 §.§ Experimental Setting




We evaluate our proposed model on four widely used knowledge graphs. The statistics of these knowledge graphs are summarized into Table <ref>.


  * FB15k  <cit.> is a subset of Freebase  <cit.>, a large-scale knowledge graph containing general knowledge facts. <cit.> showed that almost 81%  of the test triplets (𝚡, 𝚛, 𝚢) can be inferred via a directly linked triplet (𝚡, 𝚛', 𝚢) or (𝚢, 𝚛', 𝚡). Therefore, the key of link prediction on FB15k is to model and infer the symmetry/antisymmetry and inversion patterns.


  * WN18  <cit.> is a subset of WordNet  <cit.>, a database featuring lexical relations between words. This dataset also has many inverse relations. So the main relation patterns in WN18 are also symmetry/antisymmetry and inversion.


  * FB15k-237  <cit.> is a subset of FB15k, where inverse relations are deleted. Therefore, the key of link prediction on FB15k-237 boils down to model and infer the symmetry/antisymmetry and composition patterns.


  * WN18RR  <cit.> is a subset of WN18. The inverse relations are deleted, and the main relation patterns are symmetry/antisymmetry and composition.






  
Hyperparameter Settings. We use Adam  <cit.> as the optimizer and fine-tune the hyperparameters on the validation dataset. The ranges of the hyperparameters for the grid search are set as follows: embedding dimension[Following <cit.>, we treat complex number as the same as real number with regard to the embedding dimension. If the same number of dimension is used for both the real and imaginary parts of the complex number as the real number, the number of parameters for the complex embedding would be twice the number of parameters for the embeddings in the real space.] k ∈{125, 250, 500, 1000}, batch size b ∈{512, 1024, 2048}, self-adversarial sampling temperature α∈{0.5, 1.0}, and fixed margin γ∈{3, 6, 9, 12, 18, 24, 30}. Both the real and imaginary parts of the entity embeddings are uniformly initialized, and the phases of the relation embeddings are uniformly initialized between 0 and 2π. No regularization is used since we find that the fixed margin γ could prevent our model from over-fitting. 



  
Evaluation Settings. We evaluate the performance of link prediction in the filtered setting: we rank test triples against all other candidate triples not appearing in the training, validation, or test set, where candidates are generated by corrupting subjects or objects: (', , ) or (, , '). Mean Rank (MR), Mean Reciprocal Rank (MRR) and Hits at N (H@N) are standard evaluation measures for these datasets and are evaluated in our experiments.



  
Baseline. Apart from , we propose a variant of  as baseline, where the modulus of the entity embeddings are also constrained: |h_i| = |t_i| = C, and the distance function is thus 2Csinθ_h+θ_r-θ_t/2 (See Equation <ref> at Appendix <ref> for a detailed derivation). In this way, we can investigate how  works without modulus information and with only phase information. We refer to the baseline as . It is obvious to see that  can also model and infer all the three relation patterns.







 §.§ Main Results


We compare  to several state-of-the-art models, including TransE  <cit.>, DistMult  <cit.>, ComplEx  <cit.>, HolE  <cit.>,

and ConvE  <cit.>, as well as our baseline model , to empirically show  the importance of modeling and inferring the relation patterns for the task of predicting missing links.

Table <ref> summarizes our results on FB15k and WN18. We can see that RotatE outperforms all the state-of-the-art models. The performance of  and  are similar on these two datasets. Table <ref> summarizes our results on FB15k-237 and WN18RR, where 

the improvement is much more significant. The difference between  and  is much larger on FB15k-237 and WN18RR, where there are a lot of composition patterns. This indicates that modulus is very important for modeling and inferring the composition pattern.

Moreover, the performance of these models on different datasets is consistent with our analysis on the three relation patterns (Table <ref>):



  * On FB15K, the main relation patterns are symmetry/antisymmetry and inversion. We can see that ComplEx performs well while TransE does not perform well since ComplEx can infer both symmetry/antisymmetry and inversion patterns while TransE cannot infer symmetry pattern. Surprisingly, DistMult achieves good performance on this dataset although it cannot model the antisymmetry and inversion patterns. The reason is that for most of the relations in FB15K, the types of head entities and tail entities are different. Although DistMult gives the same score to a true triplet (𝚑,𝚛,𝚝) and its opposition triplet (𝚝,𝚛,𝚑), (𝚝,𝚛,𝚑) is usually impossible to be valid since the entity type of t does not match the head entity type of . For example, DistMult assigns the same score to (𝙾𝚋𝚊𝚖𝚊,𝚗𝚊𝚝𝚒𝚘𝚗𝚊𝚕𝚒𝚝𝚢, 𝚄𝚂𝙰) and (𝚄𝚂𝙰, 𝚗𝚊𝚝𝚒𝚘𝚗𝚊𝚕𝚒𝚝𝚢, 𝙾𝚋𝚊𝚖𝚊). But (𝚄𝚂𝙰, 𝚗𝚊𝚝𝚒𝚘𝚗𝚊𝚕𝚒𝚝𝚢, 𝙾𝚋𝚊𝚖𝚊) can be simply predicted as false since 𝚄𝚂𝙰 cannot be the head entity of the relation 𝚗𝚊𝚝𝚒𝚘𝚗𝚊𝚕𝚒𝚝𝚢. 






  * On WN18, the main relation patterns are also symmetry/antisymmetry and inversion. As expected, ComplEx still performs very well on this dataset. However, different from the results on FB15K, the performance of DistMult significantly decreases on WN18. The reason is that DistMult cannot model antisymmetry and inversion patterns, and almost all the entities in WN18 are words and belong to the same entity type, which do not have the same problem as FB15K. 






  * On FB15k-237, the main relation pattern is composition. We can see that TransE performs really well while ComplEx does not perform well. The reason is that, as discussed before, TransE is able to infer the composition pattern while ComplEx cannot infer the composition pattern.


  * On WN18RR, one of the main relation patterns is the symmetry pattern since almost each word has a symmetric relation in WN18RR, e.g., also_see and similar_to. TransE does not well on this dataset since it is not able to model the symmetric relations. 










 §.§ Inferring Relation Patterns on Countries DataSet

We also evaluate our model on the Countries dataset <cit.>, which is carefully designed to explicitly test the capabilities of the link prediction models for composition pattern modeling and inferring. It contains 2 relations and 272 entities (244 countries, 5 regions and 23 subregions). Unlike link prediction on general knowledge graphs, the queries in Countries are of the form 𝚕𝚘𝚌𝚊𝚝𝚎𝚍𝙸𝚗(𝚌, ?), and the answer is one of the five regions. The Countries dataset has 3 tasks, each requiring inferring a composition pattern with increasing length and difficulty.
For example, task S2 requires inferring a relatively simpler composition pattern:

    𝚗𝚎𝚒𝚐𝚑𝚋𝚘𝚛𝙾𝚏(𝚌_1, 𝚌_2) ∧ 𝚕𝚘𝚌𝚊𝚝𝚎𝚍𝙸𝚗(𝚌_2, 𝚛) ⇒ 𝚕𝚘𝚌𝚊𝚝𝚎𝚍𝙸𝚗(𝚌_1, 𝚛),


while task S3 requires inferring the most complex composition pattern:

    𝚗𝚎𝚒𝚐𝚑𝚋𝚘𝚛𝙾𝚏(𝚌_1, 𝚌_2) ∧ 𝚕𝚘𝚌𝚊𝚝𝚎𝚍𝙸𝚗(𝚌_2, 𝚜) ∧ 𝚕𝚘𝚌𝚊𝚝𝚎𝚍𝙸𝚗(𝚜, 𝚛) ⇒ 𝚕𝚘𝚌𝚊𝚝𝚎𝚍𝙸𝚗(𝚌_1, 𝚛).


In Table <ref>, we report the results with respect to the AUC-PR metric, which is commonly used in the literature. We can see that  outperforms all the previous models. The performance of   is significantly better than other methods on S3, which is the most difficult task.





 §.§ Implicit Relation Pattern Inference


In this section, we verify whether the relation patterns are implicitly represented by  relation embeddings. We ignore the specific positions in the relation embedding θ_r and plot the histogram of the phase of each element in the relation embedding, i.e., {θ_r, i}.

Symmetry pattern requires the symmetric relations to have property ∘ = 1, and the solution is r_i = ± 1. We investigate the relation embeddings from a 500-dimensional  trained on WN18. Figure <ref> gives the histogram of the embedding phases of a symmetric relation similar_to. We can find that the embedding phases are either π (r_i = -1) or 0,2π (r_i = 1). It indicates that the  model does infer and model the symmetry pattern. Figure <ref> is the histogram of relation 𝚑𝚢𝚙𝚎𝚛𝚗𝚢𝚖, which shows that the embedding of a general relation does not have such a ± 1 pattern.

Inversion pattern requires the embeddings of a pair of inverse relations to be conjugate. We use the same  model trained on WN18 for an analysis. Figure <ref> illustrates the element-wise addition of the embedding phases from relation _1 = 𝚑𝚢𝚙𝚎𝚛𝚗𝚢𝚖 and its inversed relation _2 = 𝚑𝚢𝚙𝚘𝚗𝚢𝚖. All the additive embedding phases are 0 or 2π, which represents that _1 = _2^-1. This case shows that the inversion pattern is also inferred and modeled in the  model.

Composition pattern requires the embedding phases of the composed relation to be the addition of the other two relations. Since there is no significant composition pattern in WN18, we study the inference of the composition patterns on FB15k-237, where a 1000-dimensional  is trained. Figure <ref> - <ref> illustrate such a _1 = _2 ∘_3 case, where θ_2,i + θ_3,i = θ_1,i or  θ_2,i + θ_3,i = θ_1,i + 2π. 

More results of implicitly inferring basic patterns are presented in the appendix.



 §.§ Comparing different negative sampling techniques

In this part, we compare different negative sampling  techniques including uniform sampling, our proposed self-adversarial technique, and the KBGAN model <cit.>, which aims to
optimize a generative adversarial network to generate the negative samples. We re-implement a 50-dimension TransE model with the margin-based ranking criterion that was used in <cit.>, and evaluate its performance on FB15k-237, WN18RR and WN18 with self-adversarial negative sampling. Table <ref> summarizes our results. We can see that self-adversarial sampling is the most effective negative sampling technique.







 §.§ Further Experiments on TransE and ComplEx

One may argue that the contribution of RotatE comes from the self-adversarial negative sampling technique. In this part, we conduct further experiments on TransE and ComplEx in the same setting as RotatE to make a fair comparison among the three models. Table <ref> shows the results of TransE and ComplEx trained with the self-adversarial negative sampling technique on FB15k and FB15k-237 datasets, where a large number of relations are available. In addition, we evaluate these three models on the Countries dataset, which explicitly requires inferring the composition pattern. We also provide a detailed ablation study on TransE and RotatE in the appendix.


From Table <ref>, we can see that similar results are observed as Table 4 and 5. The RotatE model achieves the best performance on both FB15k and FB15k-237, as it is able to model all the three relation patterns. The TransE model does not work well on the FB15k datasets, which requires modeling the symmetric pattern; the ComplEx model does not work well on FB15k-237, which requires modeling the composition pattern. The results on the Countries dataset are a little bit different, where the TransE model slightly outperforms RoateE on the S3 task. The reason is that the Countries datasets do not have the symmetric relation between different regions, and all the three tasks in the Countries datasets only require inferring the region for a given city. Therefore, the TransE model does not suffer from its inability of modeling symmetric relations. For ComplEx, we can see that it does not perform well on Countries since it cannot infer the composition pattern.





 §.§ Experimental results on FB15k by relation category






We also did some further investigation on the performance of RotatE on different relation categories: one-to-many, many-to-one, and many-to-many relations[Following <cit.>, for each relation , we compute the average number of tails per head (tphr) and the average number of head per tail (hptr). If tphr < 1.5 and hptr < 1.5,  is treated as one-to-one; if tphr ≥ 1.5 and hptr ≥ 1.5,  is treated as a many-to-many; if tphr < 1.5 and hptr ≥ 1.5,  is treated as one-to-many.]. 
The results of RotatE on different relation categories on the data set FB15k are summarized into Table <ref>. We also compare an additional approach KG2E_KL <cit.>, which is a probabilistic framework for knowledge graph embedding methods and aims to model the uncertainties of the entities and relations in knowledge graphs with the TransE model. We also summarize the statistics of different relation categories into Table <ref> in the appendix.

We can see that besides the one-to-one relation, the RotatE model also performs quite well on the non-injective relations, especially on many-to-many relations. We also notice that the probabilistic framework KG2E_KL(bern) <cit.> is quite powerful, which consistently outperforms its corresponding knowledge graph embedding model, showing the importance of modeling the uncertainties in knowledge graphs. We leave the work of modeling the uncertainties in knowledge graphs with RotatE as our future work.  






§ CONCLUSION

We have proposed a new knowledge graph embedding method called , which represents entities as complex vectors and relations as rotations in complex vector space. In addition, we propose a novel self-adversarial negative sampling technique for efficiently and effectively training the RotatE model. Our experimental results show that the  model outperforms all existing state-of-the-art models on four large-scale benchmarks. Moreover,  also achieves state-of-the-art results on a benchmark that is explicitly designed for composition pattern inference and modeling. A deep investigation into  relation embeddings shows that the three relation patterns are implicitly represented in the relation embeddings. In the future, we plan to evaluate the  model on more datasets and leverage a probabilistic framework to model the uncertainties of entities and relations.


iclr2019_conference





§ APPENDIX




§ DISCUSSION ON THE ABILITY OF PATTERN MODELING AND INFERENCE
 
No existing models are capable of modeling all the three relation patterns. For example, TransE cannot model the symmetry pattern because it would yield = 0 for symmetric relations; TransX can infer and model the symmetry/antisymmetry pattern when g_r, 1 = g_r, 2, e.g. in TransH  <cit.>, but cannot infer inversion and composition as g_r, 1 and g_r, 2 are invertible matrix multiplications; due to its symmetric nature, DistMult is difficult to model the asymmetric and inversion pattern; ComplEx addresses the problem of DisMult and is able to infer both the symmetry and asymmetric patterns with complex embeddings. Moreover, it can infer inversion rules because the complex conjugate of the solution to _(⟨, , ⟩) is exactly the solution to _(⟨, , ⟩). However, ComplEx cannot infer composition rules, since it does not model a bijection mapping from  to  via relation . These concerns are summarized in Table <ref>.



§ PROOF OF LEMMA <REF>
 

if (, ) and (, ) hold, we have

    = ∘∧ = ∘⇒∘ = 1

Otherwise, if (, ) and (, ) hold, we have

    = ∘∧∘⇒∘1




§ PROOF OF LEMMA <REF>
 

if _1(, ) and _2(, ) hold, we have

    = _1 ∘∧ = _2 ∘⇒_1 = _2^-1




§ PROOF OF LEMMA <REF>
 

if _1(, ), _2(, ) and _3(, ) hold, we have

    = _1 ∘∧ = _2 ∘∧ = _3 ∘⇒_1 = _2 ∘_3





§ PROPERTIES OF 
 A useful property for  is that the inverse of a relation can be easily acquired by complex conjugate. In this way, the  model treats head and tail entities in a uniform way, which is potentially useful for efficient 1-N scoring <cit.>:

    ∘ -  = (∘ - ) ∘ = ∘ -


Moreover, considering the embeddings in the polar form, i.e., h_i = m_h, i e^i θ_h, i, r_i = e^i θ_r, i, t_i = m_t, i e^i θ_t, i, we can rewrite the  distance function as:

    ∘ -  = ∑_i=1^k √( (m_h, i - m_t, i)^2 + 4 m_h, im_t, isin^2 θ_h, i +  θ_r, i -  θ_t, i/2)


This equation provides two interesting views of the model:

(1) When we constrain the modulus m_h, i = m_t, i = C, the distance function is reduced to 2Csinθ_h + θ_r - θ_t/2. We can see that this is very similar to the distance function of TransE: +-. Based on this intuition, we can show that:

 can degenerate into TransE. (See proof at Appendix <ref>)

which indicates that  is able to simulate TransE.

(2) The modulus provides the lower bound of the distance function, which is _h - _t.



§ PROOF OF THEOREM <REF>
  

By further restricting |h_i| = |t_i| = C, we can rewrite , , by

    = Ce^iθ_h = Ccosθ_h + i Csinθ_h
       = e^iθ_r = cosθ_r + i sinθ_r
       = Ce^iθ_t = Ccosθ_t + i Csinθ_t

Therefore, we have

    ∘ -    = Ce^i(θ_h +θ_r) - e^iθ_t = C e^i(θ_h +θ_r - θ_t) - 1
       = Ccos (θ_h +θ_r - θ_t) - 1 + i sin (θ_h +θ_r - θ_t)
       = C√((cos (θ_h +θ_r - θ_t) - 1)^2 + sin^2 (θ_h +θ_r - θ_t))
       = C√(2 - 2cos (θ_h +θ_r - θ_t))
    
       = 2Csinθ_h +θ_r - θ_t/2

If the embedding of (, , ) in TransE is ', ', ', let θ_h = c', θ_r = c', θ_t = c' and C = 1/c , we have

    lim_c → 0∘ -  = ' + ' - '




















§ LINK PREDICTION ON YAGO3-10

YAGO3-10 is a subset of YAGO3 <cit.>, which consists of entities that have a minimum of 10 relations each. It has 123,182 entities and 37 relations. Most of the triples deal with descriptive attributes of people, such as citizenship, gender, profession and marital status.

Table <ref> shows that the  model also outperforms state-of-the-art models on YAGO3-10.





§ HYPERPARAMETERS

We list the best hyperparameter setting of  w.r.t the validation dataset on several benchmarks in Table <ref>.























































§ ABLATION STUDY

Table <ref> shows our ablation study of self-adversarial sampling and negative sampling loss on FB15k-237. We also re-implement a 1000-dimension TransE and do ablation study on it. From the table, We can find that self-adversarial sampling boosts the performance for both models, while negative sampling loss is only effective on ; in addition, our re-implementation of TransE also outperforms all the state-of-the-art models on FB15k-237.







§ VARIANCE OF THE RESULTS


In Table <ref>, We provide the average and variance of the MRR results on FB15k, WN18, FB15k-237 and WN18RR. Both the average and the variance is calculated by three runs of RotatE with difference random seeds. We can find that the performance of RotatE is quite stable for different random initialization.



§ MORE RESULTS OF IMPLICIT BASIC PATTERN INFERENCE


We provide more histograms of embedding phases in Figure <ref> - <ref>.









