Knowledge Graph (KG) embedding has emerged as a very active area of research over the last few years, resulting in the development of several embedding methods. These KG embedding methods represent KG entities and relations as vectors in a high-dimensional space. Despite this popularity and effectiveness of KG embeddings in various tasks (e.g., link prediction), geometric understanding of such embeddings (i.e., arrangement of entity and relation vectors in vector space) is unexplored -we fill this gap in the paper. We initiate a study to analyze the geometry of KG embeddings and correlate it with task performance and other hyperparameters. To the best of our knowledge, this is the first study of its kind. Through extensive experiments on real-world datasets, we discover several insights. For example, we find that there are sharp differences between the geometry of embeddings learnt by different classes of KG embeddings methods. We hope that this initial study will inspire other follow-up research on this important but unexplored problem.
Introduction Knowledge Graphs (KGs) are multi-relational graphs where nodes represent entities and typededges represent relationships among entities. Recent research in this area has resulted in the development of several large KGs, such as NELL (Mitchell et al., 2015) , YAGO (Suchanek et al., 2007) , and Freebase (Bollacker et al., 2008) , among others. These KGs contain thousands of predicates (e.g., person, city, mayorOf(person, city), etc. ), and millions of triples involving such predicates, e.g., (Bill de Blasio, mayorOf, New York City) . The problem of learning embeddings for Knowledge Graphs has received significant attention in recent years, with several methods being proposed (Bordes et al., 2013; Lin et al., 2015; Nguyen et al., 2016; Nickel et al., 2016; Trouillon et al., 2016) . These methods represent entities and relations in a KG as vectors in high dimensional space. These vectors can then be used for various tasks, such as, link prediction, entity classification etc. Starting with TransE (Bordes et al., 2013) , there have been many KG embedding methods such as TransH (Wang et al., 2014) , TransR (Lin et al., 2015) and STransE (Nguyen et al., 2016) which represent relations as translation vectors from head entities to tail entities. These are additive models, as the vectors interact via addition and subtraction. Other KG embedding models, such as, DistMult (Yang et al., 2014) , HolE (Nickel et al., 2016) , and ComplEx (Trouillon et al., 2016) are multiplicative where entityrelation-entity triple likelihood is quantified by a multiplicative score function. All these methods employ a score function for distinguishing correct triples from incorrect ones. In spite of the existence of many KG embedding methods, our understanding of the geometry and structure of such embeddings is very shallow. A recent work (Mimno and Thompson, 2017) analyzed the geometry of word embeddings. However, the problem of analyzing geometry of KG embeddings is still unexplored -we fill this important gap. In this paper, we analyze the geometry of such vectors in terms of their lengths and conicity, which, as defined in Section 4, describes their positions and orientations in the vector space. We later study the effects of model type and training hyperparameters on the geometry of KG embeddings and correlate geometry with performance. We make the following contributions: • We initiate a study to analyze the geometry of various Knowledge Graph (KG) embeddings. To the best of our knowledge, this is the first study of its kind. We also formalize various metrics which can be used to study geometry of a set of vectors. • Through extensive analysis, we discover several interesting insights about the geometry of KG embeddings. For example, we find systematic differences between the geometries of embeddings learned by additive and multiplicative KG embedding methods. • We also study the relationship between geometric attributes and predictive performance of the embeddings, resulting in several new insights. For example, in case of multiplicative models, we observe that for entity vectors generated with a fixed number of negative samples, lower conicity (as defined in Section 4) or higher average vector length lead to higher performance. Source code of all the analysis tools developed as part of this paper is available at https://github.com/malllabiisc/ kg-geometry. We are hoping that these resources will enable one to quickly analyze the geometry of any KG embedding, and potentially other embeddings as well. Related Work In spite of the extensive and growing literature on both KG and non-KG embedding methods, very little attention has been paid towards understanding the geometry of the learned embeddings. A recent work (Mimno and Thompson, 2017) is an exception to this which addresses this problem in the context of word vectors. This work revealed a surprising correlation between word vector geometry and the number of negative samples used during training. Instead of word vectors, in this paper we focus on understanding the geometry of KG embeddings. In spite of this difference, the insights we discover in this paper generalizes some of the observations in the work of (Mimno and Thompson, 2017) . Please see Section 6.2 for more details. Since KGs contain only positive triples, negative sampling has been used for training KG embeddings. Effect of the number of negative samples in KG embedding performance was studied by (Toutanova et al., 2015) . In this paper, we study the effect of the number of negative samples on KG embedding geometry as well as performance. In addition to the additive and multiplicative KG embedding methods already mentioned in Section 1, there is another set of methods where the entity and relation vectors interact via a neural network. Examples of methods in this category include NTN (Socher et al., 2013) , CONV (Toutanova et al., 2015) , ConvE (Dettmers et al., 2017) , R-GCN (Schlichtkrull et al., 2017) , ER-MLP (Dong et al., 2014) and ER-MLP-2n (Ravishankar et al., 2017) . Due to space limitations, in this paper we restrict our scope to the analysis of the geometry of additive and multiplicative KG embedding models only, and leave the analysis of the geometry of neural network-based methods as part of future work. Overview of KG Embedding Methods For our analysis, we consider six representative KG embedding methods: TransE (Bordes et al., 2013) , TransR (Lin et al., 2015) , STransE (Nguyen et al., 2016) , DistMult (Yang et al., 2014) , HolE (Nickel et al., 2016) and ComplEx (Trouillon et al., 2016) . We refer to TransE, TransR and STransE as additive methods because they learn embeddings by modeling relations as translation vectors from one entity to another, which results in vectors interacting via the addition operation during training. On the other hand, we refer to Dist-Mult, HolE and ComplEx as multiplicative methods as they quantify the likelihood of a triple belonging to the KG through a multiplicative score function. The score functions optimized by these methods are summarized in Table 1 . Notation: Let G = (E, R, T ) be a Knowledge Graph (KG) where E is the set of entities, R is the set of relations and T ⊂ E × R × E is the set of triples stored in the graph. Most of the KG embedding methods learn vectors e ∈ R de for e ∈ E, and r ∈ R dr for r ∈ R. Some methods also learn projection matrices M r ∈ R dr×de for relations. The correctness of a triple is evaluated using a model specific score function σ : E × R × E → R. For learning the embeddings, a loss function L(T , T ; θ), defined over a set of positive triples T , set of (sampled) negative triples T , and the parameters θ is optimized. We use small italics characters (e.g., h, r) to represent entities and relations, and correspond-Type Model Score Function σ(h, r, t) Additive TransE (Bordes et al., 2013) − h + r − t 1 TransR (Lin et al., 2015) − Mrh + r − Mrt 1 STransE (Nguyen et al., 2016) − M 1 r h + r − M 2 r t 1 Multiplicative DistMult (Yang et al., 2014) r (h t) HolE (Nickel et al., 2016) r (h t) ComplEx (Trouillon et al., 2016) Re(r (h t )) Table 1 : Summary of various Knowledge Graph (KG) embedding methods used in the paper. Please see Section 3 for more details. ing bold characters to represent their vector embeddings (e.g., h, r). We use bold capitalization (e.g., V) to represent a set of vectors. Matrices are represented by capital italics characters (e.g., M ). Additive KG Embedding Methods This is the set of methods where entity and relation vectors interact via additive operations. The score function for these models can be expressed as below σ(h, r, t) = − M 1 r h + r − M 2 r t 1 (1) where h, t ∈ R de and r ∈ R dr are vectors for head entity, tail entity and relation respectively. M 1 r , M 2 r ∈ R dr×de are projection matrices from entity space R de to relation space R dr . TransE (Bordes et al., 2013) is the simplest additive model where the entity and relation vectors lie in same d−dimensional space, i.e., d e = d r = d. The projection matrices M 1 r = M 2 r = I d are identity matrices. The relation vectors are modeled as translation vectors from head entity vectors to tail entity vectors. Pairwise ranking loss is then used to learn these vectors. Since the model is simple, it has limited capability in capturing many-to-one, one-to-many and many-to-many relations. TransR (Lin et al., 2015) is another translationbased model which uses separate spaces for entity and relation vectors allowing it to address the shortcomings of TransE. Entity vectors are projected into a relation specific space using the corresponding projection matrix M 1 r = M 2 r = M r . The training is similar to TransE. STransE (Nguyen et al., 2016) is a generalization of TransR and uses different projection matrices for head and tail entity vectors. The training is similar to TransE. STransE achieves better performance than the previous methods but at the cost of more number of parameters. Equation 1 is the score function used in STransE. TransE and TransR are special cases of STransE with M 1 r = M 2 r = I d and M 1 r = M 2 r = M r , respectively. Multiplicative KG Embedding Methods This is the set of methods where the vectors interact via multiplicative operations (usually dot product). The score function for these models can be expressed as σ(h, r, t) = r f (h, t) (2) where h, t, r ∈ F d are vectors for head entity, tail entity and relation respectively. f (h, t) ∈ F d measures compatibility of head and tail entities and is specific to the model. F is either real space R or complex space C. Detailed descriptions of the models we consider are as follows. DistMult (Yang et al., 2014 ) models entities and relations as vectors in R d . It uses an entry-wise product ( ) to measure compatibility between head and tail entities, while using logistic loss for training the model. σ DistM ult (h, r, t) = r (h t) (3) Since the entry-wise product in (3) is symmetric, DistMult is not suitable for asymmetric and antisymmetric relations. HolE (Nickel et al., 2016) also models entities and relations as vectors in R d . It uses circular correlation operator ( ) as compatibility function defined as [h t] k = d−1 i=0 h i t (k+i) mod d The score function is given as σ HolE (h, r, t) = r (h t) (4) The circular correlation operator being asymmetric, can capture asymmetric and anti-symmetric relations, but at the cost of higher time complexity The points are sampled from 3d Spherical Gaussian with mean (1,1,1) and standard deviation 0.1 (left) and 1.3 (right). Please refer to Section 4 for more details. (O (d log d) ). For training, we use pairwise ranking loss. ComplEx (Trouillon et al., 2016) represents entities and relations as vectors in C d . The compatibility of entity pairs is measured using entry-wise product between head and complex conjugate of tail entity vectors. σ ComplEx (h, r, t) = Re(r (h t )) (5) In contrast to (3), using complex vectors in (5) allows ComplEx to handle symmetric, asymmetric and anti-symmetric relations using the same score function. Similar to DistMult, logistic loss is used for training the model. Metrics For our geometrical analysis, we first define a term 'alignment to mean' (ATM) of a vector v belonging to a set of vectors V, as the cosine similarity 1 between v and the mean of all vectors in V. ATM(v, V) = cosine v, 1 |V| x∈V x We also define 'conicity' of a set V as the mean ATM of all vectors in V.  By this definition, a high value of Conicity(V) would imply that the vectors in V lie in a narrow cone centered at origin. In other words, the vectors in the set V are highly aligned with each other. In addition to that, we define the variance of ATM across all vectors in V, as the 'vector spread'(VS) of set V, For each method, a plot averaged across entity frequency bins is shown. From these plots, we conclude that entity embeddings from additive models tend to have low (positive as well as negative) ATM and thereby low Conicity and high vector spread. Interestingly, this is reversed in case of multiplicative methods. Please see Section 6.1 for more details. Conicity(V) = 1 |V| v∈V ATM(v, V) 1 cosine(u, v) = u v u v Dataset VS(V) = 1 |V| v∈V ATM(v, V)−Conicity(V) Experimental Setup Datasets: We run our experiments on subsets of two widely used datasets, viz., Freebase (Bollacker et al., 2008) and WordNet (Miller, 1995) , called FB15k and WN18 (Bordes et al., 2013) , respectively. We detail the characteristics of these datasets in Table 2 . Please note that while the results presented in Section 6 are on the FB15K dataset, we reach the same conclusions on WN18. The plots for our experiments on WN18 can be found in the Supplementary Section. Hyperparameters: We experiment with multiple values of hyperparameters to understand their effect on the geometry of KG embeddings. Specifically, we vary the dimension of the generated vectors between {50, 100, 200} and the number of negative samples used during training between {1, 50, 100}. For more details on algorithm specific hyperparameters, we refer the reader to the Supplementary Section. 2 2 For training, we used codes from https://github. Frequency Bins: We follow (Mimno and Thompson, 2017) for entity and relation samples used in the analysis. Multiple bins of entities and relations are created based on their frequencies and 100 randomly sampled vectors are taken from each bin. These set of sampled vectors are then used for our analysis. For more information about sampling vectors, please refer to (Mimno and Thompson, 2017) . Results and Analysis In this section, we evaluate the following questions. • Does model type (e.g., additive vs multiplicative) have any effect on the geometry of embeddings? (Section 6. For each method, a plot averaged across entity frequency bins is shown. Trends in these plots are similar to those in Figure 2 . Main findings from these plots are summarized in Section 6.1. • Does negative sampling have any effect on the embedding geometry? (Section 6.2) • Does the dimension of embedding have any effect on its geometry? (Section 6.3) • How is task performance related to embedding geometry? (Section 6.4) In each subsection, we summarize the main findings at the beginning, followed by evidence supporting those findings. Effect of Model Type on Geometry Summary of Findings: Additive: Low conicity and high vector spread. Multiplicative: High conicity and low vector spread. In this section, we explore whether the type of the score function optimized during the training has any effect on the geometry of the resulting embedding. For this experiment, we set the number of negative samples to 1 and the vector dimension to 100 (we got similar results for 50-dimensional vectors). Figure 2 and Figure 3 show the distribution of ATMs of these sampled entity and relation vectors, respectively. 3 Entity Embeddings: As seen in Figure 2 , there is a stark difference between the geometries of entity vectors produced by additive and multiplicative models. The ATMs of all entity vectors produced by multiplicative models are positive with very low vector spread. Their high conicity suggests that they are not uniformly dispersed in the vector space, but lie in a narrow cone along the mean vector. This is in contrast to the entity vectors obtained from additive models which are both positive and negative with higher vector spread. From the lower values of conicity, we conclude that entity vectors from additive models are evenly dispersed in the vector space. This observation is also reinforced by looking at the high vector spread of additive models in comparison to that of multiplicative models. We also observed that additive models are sensitive to the frequency of entities, with high frequency bins having higher conicity than low frequency bins. However, no such pattern was observed for multiplicative models and In each bar group, first three models are additive, while the last three are multiplicative. Main findings from these plots are summarized in Section 6.2 conicity was consistently similar across frequency bins. For clarity, we have not shown different plots for individual frequency bins. Relation Embeddings: As in entity embeddings, we observe a similar trend when we look at the distribution of ATMs for relation vectors in Figure 3 . The conicity of relation vectors generated using additive models is almost zero across frequency bands. This coupled with the high vector spread observed, suggests that these vectors are scattered throughout the vector space. Relation vectors from multiplicative models exhibit high conicity and low vector spread, suggesting that they lie in a narrow cone centered at origin, like their entity counterparts. Effect of Number of Negative Samples on Geometry Summary of Findings: Additive: Conicity and average length are invariant to changes in #NegativeSamples for both entities and relations. Multiplicative: Conicity increases while average vector length decrease with increasing #NegativeSamples for entities. Conicity decreases, while average vector length remains constant (except HolE) for relations. For experiments in this section, we keep the vector dimension constant at 100. Entity Embeddings: As seen in Figure 4 (left) , the conicity of entity vectors increases as the number of negative samples is increased for multiplicative models. In contrast, conicity of the entity vectors generated by additive models is unaffected by change in number of negative samples and they continue to be dispersed throughout the vector space. From Figure 4 (right), we observe that the average length of entity vectors produced by additive models is also invariant of any changes in number of negative samples. On the other hand, increase in negative sampling decreases the average entity vector length for all multiplicative models except HolE. The average entity vector length for HolE is nearly 1 for any number of negative samples, which is understandable considering it constrains the entity vectors to lie inside a unit ball (Nickel et al., 2016) . This constraint is also enforced by the additive models: TransE, TransR, and STransE. Relation Embeddings: Similar to entity embeddings, in case of relation vectors trained using additive models, the average length and conicity do not change while varying the number of negative samples. However, the conicity of relation vectors from multiplicative models decreases with increase in negative sampling. The average relation vector length is invariant for all multiplicative methods, except for HolE. We see a surprisingly big jump in average relation vector length for HolE going from 1 to 50 negative samples, but it does not change after that. Due to space constraints in the paper, we refer the reader to the Supplementary Section for plots discussing the effect of number of negative samples on geometry of relation vectors. We note that the multiplicative score between two vectors may be increased by either increasing the alignment between the two vectors (i.e., increasing Conicity and reducing vector spread between them), or by increasing their lengths. It is interesting to note that we see exactly these effects in the geometry of multiplicative methods In each bar group, first three models are additive, while the last three are multiplicative. Main findings from these plots are summarized in Section 6.3. analyzed above. Correlation with Geometry of Word Embeddings Our conclusions from the geometrical analysis of entity vectors produced by multiplicative models are similar to the results in (Mimno and Thompson, 2017) , where increase in negative sampling leads to increased conicity of word vectors trained using the skip-gram with negative sampling (SGNS) method. On the other hand, additive models remain unaffected by these changes. SGNS tries to maximize a score function of the form w T · c for positive word context pairs, where w is the word vector and c is the context vector (Mikolov et al., 2013) . This is very similar to the score function of multiplicative models as seen in Table 1 . Hence, SGNS can be considered as a multiplicative model in the word domain. Hence, we argue that our result on the increase in negative samples increasing the conicity of vectors trained using a multiplicative score function can be considered as a generalization of the one in (Mimno and Thompson, 2017) . Effect of Vector Dimension on Geometry Summary of Findings: Additive: Conicity and average length are invariant to changes in dimension for both entities and relations. Multiplicative: Conicity decreases for both entities and relations with increasing dimension. Average vector length increases for both entities and relations, except for HolE entities. Entity Embeddings: To study the effect of vec-tor dimension on conicity and length, we set the number of negative samples to 1, while varying the vector dimension. From Figure 5 (left), we observe that the conicity for entity vectors generated by any additive model is almost invariant of increase in dimension, though STransE exhibits a slight decrease. In contrast, entity vector from multiplicative models show a clear decreasing pattern with increasing dimension. As seen in Figure 5 (right) , the average lengths of entity vectors from multiplicative models increase sharply with increasing vector dimension, except for HolE. In case of HolE, the average vector length remains constant at one. Deviation involving HolE is expected as it enforces entity vectors to fall within a unit ball. Similar constraints are enforced on entity vectors for additive models as well. Thus, the average entity vector lengths are not affected by increasing vector dimension for all additive models. Relation Embeddings: We reach similar conclusion when analyzing against increasing dimension the change in geometry of relation vectors produced using these KG embedding methods. In this setting, the average length of relation vectors learned by HolE also increases as dimension is increased. This is consistent with the other methods in the multiplicative family. This is because, unlike entity vectors, the lengths of relation vectors of HolE are not constrained to be less than unit length. Due to lack of space, we are unable to show plots for relation vectors here, but the same can be found in the Supplementary Section. Relating Geometry to Performance Summary of Findings: Additive: Neither entites nor relations exhibit correlation between geometry and performance. Multiplicative: Keeping negative samples fixed, lower conicity or higher average vector length for entities leads to improved performance. No relationship for relations. In this section, we analyze the relationship between geometry and performance on the Link prediction task, using the same setting as in (Bordes et al., 2013) . Figure 6 (left) presents the effects of conicity of entity vectors on performance, while Figure 6 (right) shows the effects of average entity vector length. 4 As we see from Figure 6 (left), for fixed number of negative samples, the multiplicative model with lower conicity of entity vectors achieves better performance. This performance gain is larger for higher numbers of negative samples (N). Additive models don't exhibit any relationship between performance and conicity, as they are all clustered around zero conicity, which is in-line with our observations in previous sections. In Figure 6 (right) , for all multiplicative models except HolE, a higher average entity vector length translates to better performance, while the number of negative samples is kept fixed. Additive models and HolE don't exhibit any such patterns, as they are all clustered just below unit average entity vector length. The above two observations for multiplicative models make intuitive sense, as lower conicity and higher average vector length would both translate to vectors being more dispersed in the space. We see another interesting observation regarding the high sensitivity of HolE to the number of negative samples used during training. Using a large number of negative examples (e.g., N = 50 or 100) leads to very high conicity in case of HolE. Figure 6 (right) shows that average entity vector length of HolE is always one. These two observations point towards HolE's entity vectors lying in a tiny part of the space. This translates to HolE performing poorer than all other models in case of high numbers of negative sampling. We also did a similar study for relation vectors, but did not see any discernible patterns. Conclusion In this paper, we have initiated a systematic study into the important but unexplored problem of analyzing geometry of various Knowledge Graph (KG) embedding methods. To the best of our knowledge, this is the first study of its kind. Through extensive experiments on multiple realworld datasets, we are able to identify several insights into the geometry of KG embeddings. We have also explored the relationship between KG embedding geometry and its task performance. We have shared all our source code to foster further research in this area.
1 2 3 3.1 3.2 4 5 6 6.2 6.2.1 7
Introduction Related Work Overview of KG Embedding Methods Additive KG Embedding Methods Multiplicative KG Embedding Methods Metrics Experimental Setup Results and Analysis Effect of Number of Negative Samples on Geometry Correlation with Geometry of Word Embeddings Conclusion
Correlation b w Geometry and Performance
No correlation between geometry and performance.
For fixed number of negative samples,
Conicity has negative correlation with performance
AVL has positive correlation with performance
No correlation between geometry and performance.
For fixed number of negative samples,
Conicity has negative correlation with performance
AVL has positive correlation with performance