TransG : A Generative Model for Knowledge Graph Embedding

Recently, knowledge graph embedding, which projects symbolic entities and relations into continuous vector space, has become a new, hot topic in artiﬁcial intelligence. This paper proposes a novel generative model ( TransG ) to address the issue of multiple relation semantics that a relation may have multiple meanings revealed by the entity pairs associated with the corresponding triples. The new model can discover latent semantics for a relation and leverage a mixture of relation-speciﬁc component vectors to embed a fact triple. To the best of our knowledge, this is the ﬁrst generative model for knowledge graph embedding, and at the ﬁrst time, the issue of multiple relation semantics is formally discussed. Extensive experiments show that the proposed model achieves substantial improvements against the state-of-the-art baselines. All of the related poster, slides, datasets and codes have been published in http://www.ibookman. net/conference.html .


Introduction
Abstract or real-world knowledge is always a major topic in Artificial Intelligence.Knowledge bases such as Wordnet (Miller, 1995) and Freebase (Bollacker et al., 2008) have been shown very useful to AI tasks including question answering, knowledge inference, and so on.However, traditional knowledge bases are symbolic and logic, thus numerical machine learning methods cannot be leveraged to support the computation over the knowledge bases.To this end, knowledge graph embedding has been proposed to project en-tities and relations into continuous vector spaces.Among various embedding models, there is a line of translation-based models such as TransE (Bordes et al., 2013), TransH (Wang et al., 2014), TransR (Lin et al., 2015b), and other related models (He et al., 2015) (Lin et al., 2015a).A dot denotes a triple and its position is decided by the difference vector between tail and head entity (t − h).Since TransE adopts the principle of t − h ≈ r, there is supposed to be only one cluster whose centre is the relation vector r.However, results show that there exist multiple clusters, which justifies our multiple relation semantics assumption.
A fact of knowledge base can usually be represented by a triple (h, r, t) where h, r, t indicate a head entity, a relation, and a tail entity, respec- tively.All translation-based models almost follow the same principle h r + r ≈ t r where h r , r, t r indicate the embedding vectors of triple (h, r, t), with the head and tail entity vector projected with respect to the relation space.
In spite of the success of these models, none of the previous models has formally discussed the issue of multiple relation semantics that a relation may have multiple meanings revealed by the entity pairs associated with the corresponding triples.As can be seen from Fig. 1, visualization results on embedding vectors obtained from TransE (Bordes et al., 2013) show that, there are different clusters for a specific relation, and different clusters indicate different latent semantics.For example, the relation HasPart has at least two latent semantics: composition-related as (Table, HasPart, Leg) and location-related as (Atlantics, HasPart, NewYorkBay).As one more example, in Freebase, (Jon Snow, birth place, Winter Fall) and (George R. R. Martin, birth place, U.S.) are mapped to schema /fictional universe/fictional character/place of birth and /people/person/place of birth respectively, indicating that birth place has different meanings.This phenomenon is quite common in knowledge bases for two reasons: artificial simplification and nature of knowledge.On one hand, knowledge base curators could not involve too many similar relations, so abstracting multiple similar relations into one specific relation is a common trick.On the other hand, both language and knowledge representations often involve ambiguous information.The ambiguity of knowledge means a semantic mixture.For example, when we mention "Expert", we may refer to scientist, businessman or writer, so the concept "Expert" may be ambiguous in a specific situation, or generally a semantic mixture of these cases.
However, since previous translation-based models adopt h r + r ≈ t r , they assign only one translation vector for one relation, and these models are not able to deal with the issue of multiple relation semantics.To illustrate more clearly, as showed in Fig. 2, there is only one unique representation for relation HasPart in traditional models, thus the models made more errors when embedding the triples of the relation.Instead, in our proposed model, we leverage a Bayesian non-parametric infinite mixture model to handle multiple relation semantics by generating multiple translation components for a relation.Thus, different semantics are characterized by different components in our embedding model.For example, we can distinguish the two clusters HasPart.1 or HasPart.2,where the relation semantics are automatically clustered to represent the meaning of associated entity pairs.
To summarize, our contributions are as follows: • • Extensive experiments show that our proposed model obtains substantial improvements against the state-of-the-art baselines.

Related Work
Prior studies are classified into two branches: translation-based embedding methods and the others.

Translation-Based Embedding Methods
Existing translation-based embedding methods share the same translation principle h + r ≈ t and the score function is designed as:

Pioneering Embedding Methods
There list the pioneering embedding approaches: Structured Embedding (SE).The SE model (Bordes et al., 2011) transforms the entity space with the head-specific and tail-specific matrices.
The score function is defined as f r (h, t) = ||M h,r h − M t,r t||.According to (Socher et al., 2013), this model cannot capture the relationship between entities.Semantic Matching Energy (SME).The SME model (Bordes et al., 2012) (Bordes et al., 2014) can handle the correlations between entities and relations by matrix product and Hadamard product.In some recent work (Bordes et al., 2014), the score function is re-defined with 3-way tensors instead of matrices.Single Layer Model (SLM).SLM applies neural network to knowledge graph embedding.The score function is defined as f r (h, t) = u r g(M r,1 h + M r,2 t) where M r,1 , M r,2 are relation-specific weight matrices.Collobert had applied a similar method into the language model, (Collobert and Weston, 2008).Latent Factor Model (LFM).The LFM (Jenatton et al., 2012), (Sutskever et al., 2009) attempts to capture the second-order correlations between entities by a quadratic form.The score function is as f r (h, t) = h W r t.Neural Tensor Network (NTN).The NTN model (Socher et al., 2013) defines a very expressive score function to combine the SLM and LFM: Unstructured Model (UM).The UM (Bordes et al., 2012) may be a simplified version of TransE without considering any relation-related information.The score function is directly defined as f r (h, t) = ||h − t|| 2 2 .RESCAL.This is a collective matrix factorization model which is also a common method in knowledge base embedding (Nickel et al., 2011), (Nickel et al., 2012).
Semantically Smooth Embedding (SSE).(Guo et al., 2015) aims at further discovering the geometric structure of the embedding space to make it semantically smooth.(Wang et al., 2014) focuses on bridging the gap between knowledge and texts, with a joint loss function for knowledge graph and text corpus.(Wang et al., 2015) incorporates the rules that are related with relation types such as 1-N and N-1.PTransE.(Lin et al., 2015a) is a path-based embedding model, simultaneously considering the information and confidence level of the path in knowledge graph.

TransG: A Generative Model for Embedding
As just mentioned, only one single translation vector for a relation may be insufficient to model multiple relation semantics.In this paper, we propose to use Bayesian non-parametric infinite mixture embedding model (Griffiths and Ghahramani, 2011).The generative process of the model is as follows: 1.For an entity e ∈ E: (a) Draw each entity embedding mean vector from a standard normal distribution as a prior: u e N (0, 1).

For a triple
where π r,m is the mixing factor, indicating the weight of i-th component and M r is the number of semantic components for the relation r, which is learned from the data automatically by the CRP.
Inspired by Fig. 1, TransG leverages a mixture of relation component vectors for a specific relation.Each component represents a specific latent meaning.By this way, TransG could distinguish multiple relation semantics.Notably, the CRP could generate multiple semantic components when it is necessary and the relation semantic component number M r is learned adaptively from the data.

Explanation from the Geometry Perspective
Similar to previous studies, TransG has geometric explanations.In the previous methods, when the relation r of triple (h, r, t) is given, the geometric representations are fixed, as h + r ≈ t.However, TransG generalizes this geometric principle to: where m * (h,r,t) is the index of primary component.Though all the components contribute to the model, the primary one contributes the most due to the exponential effect (exp(•)).When a triple (h, r, t) is given, TransG works out the index of primary component then translates the head entity to the tail one with the primary translation vector.
For most triples, there should be only one component that have significant non-zero value as π r,m e and the others would be small enough, due to the exponential decay.This property reduces the noise from the other semantic components to better characterize multiple relation semantics.In detail, (t − h) is almost around only one translation vector u r,m * is very large so that the exponential function value is very small.This is why the primary component could represent the corresponding semantics.
To summarize, previous studies make translation identically for all the triples of the same relation, but TransG automatically selects the best translation vector according to the specific semantics of a triple.Therefore, TransG could focus on the specific semantic embedding to avoid much noise from the other unrelated semantic components and result in promising improvements than existing methods.Note that, all the components in TransG have their own contributions, but the primary one makes the most.

Training Algorithm
The maximum data likelihood principle is applied for training.As to the non-parametric part, π r,m is generated from the CRP with Gibbs Sampling, similar to (He et al., 2015) and (Griffiths and Ghahramani, 2011).A new component is sampled for a triple (h,r,t) with the below probability: where P{(h, r, t)} is the current posterior probability.As to other parts, in order to better distinguish the true triples from the false ones, we maximize the ratio of likelihood of the true triples to that of the false ones.Notably, the embedding vectors are initialized by (Glorot and Bengio, 2010).Putting all the other constraints together, the final objective function is obtained, as follows: where ∆ is the set of golden triples and ∆ is the set of false triples.C controls the scaling degree.E is the set of entities and R is the set of relations.Noted that the mixing factors π and the variances σ are also learned jointly in the optimization.SGD is applied to solve this optimization problem.In addition, we apply a trick to control the parameter updating process during training.For those very impossible triples, the update process is skipped.Hence, we introduce a similar condition as TransE (Bordes et al., 2013) adopts: the training algorithm will update the embedding vectors only if the below condition is satisfied: where (h, r, t) ∈ ∆ and (h , r , t ) ∈ ∆ .γ controls the updating condition.
As to the efficiency, in theory, the time complexity of TransG is bounded by a small constant M compared to TransE, that is where M is the number of semantic components in the model.Note that TransE is the fastest method among translationbased methods.The experiment of Link Prediction shows that TransG and TransE would converge at around 500 epochs, meaning there is also no significant difference in convergence speed.In experiment, TransG takes 4.8s for one iteration on FB15K while TransR costs 136.8s and PTransE costs 1200.0s on the same computer for the same dataset.

Experiments
Our experiments are conducted on four public benchmark datasets that are the subsets of Wordnet and Freebase, respectively.The statistics of these datasets are listed in Tab.1.Experiments are conducted on two tasks : Link Prediction and Triple Classification.To further demonstrate how the proposed model approaches multiple relation semantics, we present semantic component analysis at the end of this section.

Link Prediction
Link prediction concerns knowledge graph completion: when given an entity and a relation, the embedding models predict the other missing entity.More specifically, in this task, we predict t given (h, r, * ), or predict h given ( * , r, t).The WN18 and FB15K are two benchmark datasets for this task.Note that many AI tasks could be enhanced by Link Prediction such as relation extraction (Hoffmann et al., 2011).Table 3: Evaluation results on FB15K by mapping properties of relations(%) Tasks Predicting Head(HITS@10) Predicting Tail(HITS@10) (Bordes et al., 2011) 34.5 2.5 6.1 6.6 34.3 4.2 1.9 6.6 SE (Bordes et al., 2011) 35.6 62.6 17.2 37.5 34.9 14.6 68.3 41.3 SME(bilinear) (Bordes et al., 2012)    Evaluation Protocol.We adopt the same protocol used in previous studies.For each testing triple (h, r, t), we corrupt it by replacing the tail t (or the head h) with every entity e in the knowledge graph and calculate a probabilistic score of this corrupted triple (h, r, e) (or (e, r, t)) with the score function f r (h, e).After ranking these scores in descending order, we obtain the rank of the original triple.There are two metrics for evaluation: the averaged rank (Mean Rank) and the proportion of testing triple whose rank is not larger than 10 (HITS@10).This is called "Raw" setting.When we filter out the corrupted triples that exist in the training, validation, or test datasets, this is the"Filter" setting.If a corrupted triple exists in the knowledge graph, ranking it ahead the original triple is also acceptable.To eliminate this case, the "Filter" setting is preferred.In both settings, a lower Mean Rank and a higher HITS@10 mean better performance.
Implementation.As the datasets are the same, we directly report the experimental results of several baselines from the literature, as in (Bordes et al., 2013), (Wang et al., 2014) and (Lin et al., 2015b).We have attempted several settings on the validation dataset to get the best configuration.For example, we have tried the dimensions of 100, 200, 300, 400.Under the "bern."sampling strategy, the optimal configurations are: learning rate α = 0.001, the embedding dimension k = 100, γ = 2.5, β = 0.05 on WN18; α = 0.0015, k = 400, γ = 3.0, β = 0.1 on FB15K.Note that all the symbols are introduced in "Methods".We train the model until it converges in previous version (about 10,000 rounds), but we provide the results of 2,000 rounds for comparison in current version.

Triple Classification
In order to testify the discriminative capability between true and false facts, triple classification is conducted.This is a classical task in knowledge base embedding, which aims at predicting whether a given triple (h, r, t) is correct or not.WN11 and FB13 are the benchmark datasets for this task.Note that evaluation of classification needs negative samples, and the datasets have already provided negative triples.Evaluation Protocol.The decision process is very simple as follows: for a triple (h, r, t), if f r (h, t) is below a threshold σ r , then positive; otherwise negative.The thresholds {σ r } are determined on the validation dataset.Implementation.As all methods use the same datasets, we directly re-use the results of different methods from the literature.We have attempted several settings on the validation dataset to find the best configuration.The optimal configurations of TransG are as follows: "bern" sampling, learning rate α = 0.001, k = 50, γ = 6.0, β = 0.1 on WN11, and "bern" sampling, α = 0.002, k = 400, γ = 3.0, β = 0.1 on FB13.
Results.Accuracies are reported in Tab.5 and Fig. 4. The following are our observations: 1. TransG outperforms all the baselines remarkably.Compared to TransR, TransG improves by 1.7% on WN11 and 5.8% on FB13, and the averaged semantic component number on WN11 is 2.63 and that on FB13 is 4.53.This result shows the benefit of capturing multiple relation semantics for a relation.
2. The relations, such as "Synset Domain" and "Type Of", which hold more semantic components, are improved much more.In comparison, the relation "Similar" holds only one semantic component and is almost not promoted.This further demonstrates that capturing multiple relation semantics can benefit embedding.

Semantic Component Analysis
In this subsection, we analyse the number of semantic components for different relations and list the component number on the dataset WN18 and FB13 in Fig. 3.
Results.As Fig. 3 and Tab. 4 show, we have the following observations: 1. Multiple semantic components are indeed necessary for most relations.Except for relations such as "Also See", "Synset Usage" and "Gender", all other relations have more than one semantic component.

WN11 and WN18 are different subsets of
Wordnet.As we know, the semantic component number is decided on the triples in the dataset.Therefore, It's reasonable that similar relations, such as "Synset Domain" and "Synset Usage" may hold different semantic numbers for WN11 and WN18.
In 6 Code Tricks 1.The class "TransG" is the experimental version, rather than "TransG Hierarchical".Note that, for numerical stabilization, we fix the variance σ as a constant.
2. When generating the new cluster, we assign the CRP factor as the mixture factor, which is required by CRP theoretically.But as to the center of new we assign a random vector rather than t − h.Because in big data scenario, theoretical center is far away from the ground-truth.
3. Regarding the learning methodology of parameter π and σ, we applied the stochastic gradient ascent (SGD) for efficiency, rather than likelihood counting, which is naturally suitable for CRP but inefficient.We suggest the reader to implement both for experiments.
4. Due to the slow convergence rate, in previous version, we train the model until convergence, almost around 10,000 epos.But in current version, we conduct the same rounds with other baselines 2,000 rounds).

Figure 1 :
Figure 1: Visualization of TransE embedding vectors with PCA dimension reduction.Four relations (a ∼ d) are chosen from Freebase and Wordnet.A dot denotes a triple and its position is decided by the difference vector between tail and head entity (t − h).Since TransE adopts the principle of t − h ≈ r, there is supposed to be only one cluster whose centre is the relation vector r.However, results show that there exist multiple clusters, which justifies our multiple relation semantics assumption.

Figure 2 :
Figure 2: Visualization of multiple relation semantics.The data are selected from Wordnet.The dots are correct triples that belong to HasPart relation, while the circles are incorrect ones.The point coordinate is the difference vector between tail and head entity, which should be near to the centre.(a) The correct triples are hard to be distinguished from the incorrect ones.(b) By applying multiple semantic components, our proposed model could discriminate the correct triples from the wrong ones.

Figure 4 :
Figure 4: Accuracies of each relations in WN11 for triple classification.The right y-axis is the number of semantic components, corresponding to the lines.

Table 1 :
Statistics of datasets

Table 2 :
Evaluation results on link prediction
. Evaluation results on WN18 and FB15K are reported in Tab.2 and Tab.3.We ob-
this paper, we propose a generative Bayesian non-parametric infinite mixture embedding model, TransG, to address a new issue, multiple relation semantics, which can be commonly seen in knowledge graph.TransG can discover the latent semantics of a relation automatically and leverage a mixture of relation components for embedding.Extensive experiments show our method achieves substantial improvements against the state-of-theart baselines.Support Materials.All of the related poster, slides, datasets and codes HAVE BEEN ALREADY published in http://www.ibookman.net/conference.html.