World Knowledge Representation

World knowledge representation aims to represent entities and relations in the knowledge graph in low-dimensional semantic space, which have been widely used in large knowledge-driven tasks. In this chapter, we first introduce the concept of the knowledge graph. Next, we introduce the motivations and give an overview of the existing approaches for knowledge graph representation. Further, we discuss several advanced approaches that aim to deal with the current challenges of knowledge graph representation. We also review the real-world applications of knowledge graph representation, such as language modeling, question answering, information retrieval, and recommender systems.


Introduction
Knowledge Graph (KG), which is also named as Knowledge Base (KB), is a significant multi-relational dataset for modeling concrete entities and abstract concepts in the real world. It provides useful structured information and plays a crucial role in lots of real-world applications such as web search and question answering. It is not exaggerated to say that knowledge graphs teach us how to model the entities as well as the relationships among them in this complicated real world.
To encode knowledge into a real-world application, knowledge graph representation, which represents entities and relations in knowledge graphs with distributed representations, has been proposed and applied to various real-world artificial intelligence fields including question answering, information retrieval, and dialogue system. That is, knowledge graph representation learning plays a vital role as a bridge between knowledge graphs and knowledge-driven tasks.
In this section, we will introduce the concept of knowledge graph, several typical knowledge graphs, knowledge graph representation learning, and several typical knowledge-driven tasks. 7.1 Introduction Freebase contains well-structured data representing relationships between entities as well as the attributes of entities in the form of triple facts ( Fig. 7.1). Data in Freebase was mainly harvested from various sources, including Wikipedia, Fashion Model Directory, NNDB, MusicBrainz, and so on. Moreover, the community members also contributed a lot to Freebase. Freebase is an open and shared database that aims to construct a global database which encodes the world's knowledge. It announced an open API, RDF endpoint, and a database dump for its users for both commercial and noncommercial use. As described by Tim O'Reilly, Freebase is the bridge between the bottom-up vision of Web 2.0 collective intelligence and the more structured world of the Semantic Web.

DBpedia
DBpedia is a crowd-sourced community effort aiming to extract structured content from Wikipedia and make this information accessible on the web. It was started by researchers at Free University of Berlin, Leipzig University and OpenLink Software, initially released to the public in January 2007. DBpedia allows users to ask semantic queries associated with Wikipedia resources, even including links to other related datasets, which makes it easier for us to fully utilize the massive amount of information in Wikipedia in a novel and effective way. DBpedia is also an essential part of the Linked Data effort described by Tim Berners-Lee.
The English version of DBpedia describes 4.58 million entities, out of which 4.22 million are classified in a consistent ontology, including 1,445,000 persons, 735,000 places, 411,000 creative works, 251,000 species, 241,000 organizations, and 6,000 diseases. There are also localized versions of DBpedia in 125 languages, all of which contain 38.3 million entities. Besides, DBpedia also contains a great number of internal and external links, including 80.9 million links to Wikipedia categories, 41.2 million links to YAGO categories, 25.2 million links to images, and 29.8 million links to external web pages. Moreover, DBpedia maintains a hierarchical, cross-domain ontology covering overall 685 classes, which has been manually created based on the commonly used infoboxes in Wikipedia.
DBpedia has several advantages over other KGs. First, DBpedia has a close connection to Wikipedia and can automatically evolve as Wikipedia changes. It makes the update process of DBpedia more efficient. Second, DBpedia is multilingual that is convenient for users over the world with their native languages.

YAGO
YAGO, which is short for Yet Another Great Ontology, is a high-quality KG developed by Max Planck Institute for Computer Science in Saarbruücken initially released in 2008. Knowledge in YAGO is automatically extracted from Wikipedia, WordNet, and GeoNames, whose accuracy has been manually evaluated and proves a confirmed accuracy of 95%. YAGO is special not only because of the confidence value every fact possesses depending on the manual evaluation but also because that YAGO is anchored in space and time, which can provide a spatial dimension or temporal dimension to part of its entities.
Currently, YAGO has more than 10 million entities, including persons, organizations, and locations, with over 120 million facts about these entities. YAGO also combines knowledge extracted from Wikipedias of 10 different languages and classifies them into approximately 350,000 classes according to the Wikipedia category system and the taxonomy of WordNet. YAGO has also joined the linked data project and been linked to the DBpedia ontology and the SUMO ontology ( Fig. 7.2).

Knowledge Graph Representation
Knowledge Graphs provide us with a novel aspect to describe the world with entities and triple facts, which attract growing attention from researchers. Large KGs such as Freebase, DBpedia, and YAGO have been constructed and widely used in an enormous amount of applications such as question answering and Web search. However, with KG size increasing, we are facing two main challenges: data sparsity and computational inefficiency. Data sparsity is a general problem in lots of fields like social network analysis or interest mining. It is because that there are too many nodes (e.g., users, products, or entities) in a large graph, while too few edges (e.g., relationships) between these nodes, since the number of relations of a node is limited in the real world. Computational efficiency is another challenge we need to overcome with the increasing size of knowledge graphs.
To tackle these problems, representation learning is introduced to knowledge representation. Representation learning in KGs aims to project both entities and relations into a low-dimensional continuous vector space to get their distributed representations, whose performance has been confirmed in word representation and social representation. Compared with the traditional one-hot representation, distributed representation has much fewer dimensions, and thus lowers the computational complexity. What is more, distributed representation can explicitly show the similarity between entities through some distance calculated by the low-dimensional embeddings, while all embeddings in one-hot representation are orthogonal, making it difficult to tell the potential relations between entities.
With the advantages above, knowledge graph representation learning is blooming in knowledge applications, significantly improving the ability of KGs on the task of knowledge completion, knowledge fusion, and reasoning. It is considered as the bridge between knowledge construction, knowledge graphs, and knowledge-driven applications. Up till now, a high number of methods have been proposed using a distributed representation for modeling knowledge graphs, with the learned knowledge representations widely utilized in various knowledge-driven tasks like question answering, information retrieval, and dialogue system.
In summary, Knowledge graph Representation Learning (KRL) aims to construct distributed knowledge representations for entities and relations, projecting knowledge into low-dimensional semantic vector spaces. Recent years have witnessed significant advances in knowledge graph representation learning with a large amount of KRL methods proposed to construct knowledge representations, among which the translation-based methods achieve state-of-the-art performance in many KG tasks, with a right balance in both effectiveness and efficiency.
In this section, we will first describe the notations that we will use in KRL. Then, we will introduce TransE, which is the fundamental version of translation-based methods. Next, we will explore the various extension methods of TransE in detail. At last, we will take a brief look over other representation learning methods utilized in modeling knowledge graphs.

Notations
First, we introduce the general notations used in the rest of this section. We use G = (E, R, T ) to denote the whole KG, in which E = {e 1 , e 2 , . . . , e |E| } stands for the entity set, R = {r 1 , r 2 , . . . , r |R| } stands for the relation set, and T stands for the triple set. |E| and |R| are the corresponding entity and relation numbers in their overall sets. As stated above, we represent knowledge in the form of triple fact h, r, t , where h ∈ E means the head entity, t ∈ E means the tail entity, and r ∈ R means the relation between h and t.

TransE
TransE [7] is a translation-based model for learning low-dimensional embeddings of entities and relations. It projects entities as well as relations into the same semantic embedding space, and then considers relations as translations in the embedding space. First, we will start with the motivations of this method, and then discuss the details in how knowledge representations are trained under TransE. Finally, we will explore the advantages and disadvantages of TransE for a deeper understanding.

Motivation
There are three main motivations behind the translation-based knowledge graph representation learning method. The primary motivation is that it is natural to consider relationships between entities as translating operations. Through distributed representations, entities are projected to a low-dimensional vector space. Intuitively, we agree that a reasonable projection should map entities with similar semantic meanings to the same field, while entities with different meanings should belong to distinct clusters in the vector space. For example, William Shakespeare and Jane Austen may be in the same cluster of writers, Romeo, and Juliet and Pride and Prejudice may be in another cluster of books. In this case, they share the same relation works_written, and the translations between writers and books in the vector space are similar.
The secondary motivation of TransE derives from the breakthrough in word representation by Word2vec [49]. Word2vec proposes two simple models, Skip-gram and CBOW, to learn word embeddings from large-scale corpora, significantly improving the performance in word similarity and analogy. The word embeddings learned by Word2vec have some interesting phenomena: if two word-pairs share the same semantic or syntactic relationships, their subtraction embeddings in each word pair will be similar. For instance, we have w(king) − w(man) ≈ w(queen) − w(woman), (7.1) which indicates that the latent semantic relation between king and man, which is similar to the relation between queen and woman, is successfully embedded in the word representation. This approximate relation could be found not only with the semantic relations but also with the syntactic relations. We have The phenomenon found in word representation strongly implies that there may exist an explicit method to represent relationships between entities as translating operations in vector space.
The last motivation comes from the consideration of computational complexity. On the one hand, a substantial increase in model complexity will result in high computational costs and obscure model interpretability. Moreover, a complex model may lead to overfitting. On the other hand, experimental results on model complexity demonstrate that the simpler models perform almost as good as more expressive models in most KG applications, in the condition that there are sizeable multi-relational dataset and a relatively large amount of relations. As KG size increases, computational complexity becomes the primary challenge in the knowledge graph representation. The intuitive assumption of translation leads to a better trade-off between accuracy and efficiency.

Methodology
As illustrated in Fig. 7.3, TransE projects entities and relations into the same lowdimensional space. All embeddings take values in R d , where d is a hyperparameter indicating the dimension of embeddings. With the translation assumption, for each triple h, r, t in T , we want the summation embedding h + r to be the nearest neighbor of tail embedding t. The score function of TransE is then defined as follows: The architecture of TransE model [47] More specifically, to learn such embeddings of entities and relations, TransE formalizes a margin-based loss function with negative sampling as objective for training. The pair-wise function is defined as follows: (7.4) in which E (h, r, t) is the score of energy function for a positive triple (i.e., triple in T ) and E (h , r , t ) is that of a negative triple. The energy function E can be either measured by L 1 or L 2 distance. γ > 0 is a hyperparameter of margin and a bigger γ means a wider gap between positive and the corresponding negative scores. T − is the negative triple set with respect to T . Since there are no explicit negative triples in knowledge graphs, we define T − as follows: 5) which means the negative triple set T − is composed of the positive triple h, r, t with head entity, relation, or tail entity randomly replaced by any other entities or relations in KG. Note that the new triple generated after replacement will not be considered as a negative sample if it has already been in T .
TransE is optimized using mini-batch stochastic gradient descent (SGD), with entities and relations randomly initialized. Knowledge completion, which is a link prediction task aiming to predict the third element in a triple (could be either entity or relation) with the given rest two elements, is designed to evaluate the learned knowledge representations.

Disadvantages and Challenges
TransE is effective and efficient and has shown its power on link prediction. However, it still has several disadvantages and challenges to be further explored.
First, in knowledge completion, we may have multiple correct answers with the given two elements in a triple. For instance, with the given head entity William Shakespeare and the relation works_written, we will get a list of masterpieces including Romeo and Juliet, Hamlet and A Midsummer Night's Dream. These books share the same information in the writer while differing in many other fields such as theme, background, and famous roles in the book. However, with the translation assumption in TransE, every entity has only one embedding in all triples, which significantly limits the ability of TransE in knowledge graph representations. In [7], the authors categorize all relations into four classes, 1-to-1, 1-to-Many, Many-to-1, Many-to-Many, according to the cardinalities of their head and tail arguments. A relation is considered as 1-to-1 if most heads appear with one tail, 1-to-Many if a head can appear with many tails, Many-to-1 if a tail can appear with many heads, and Many-to-Many if multiple heads appear with multiple tails. Statistics demonstrate that the 1-to-Many, Many-to-1, Many-to-Many relations occupy a large proportion. TransE does well in 1-to-1, but it has issues when dealing with 1-to-Many, Many-to-1, Many-to-Many relations. Similarly, TransE may also struggle with reflexive relations.
Second, the translating operation is intuitive and effective, only considering the simple one-step translation, which may limit the ability to model KGs. Taking entities as nodes and relations as edges, we can construct a huge knowledge graph with the triple facts. However, TransE focuses on minimizing the energy function E (h, r, t) = h + r − t , which only utilize the one-step relation information in knowledge graphs, regardless of the latent relationships located in long-distance paths. For example, if we know the triple fact that The forbidden city, locate_in, Beijing and Beijing, capital_of, China , we can infer that The forbidden city locates in China. TransE can be further enhanced with the favor of multistep information.
Third, the representation and the dissimilarity function in TransE are oversimplified for the consideration of efficiency. Therefore, TransE may not be capable enough of modeling those complicated entities and relations in knowledge graphs. There still exist challenges on how to balance the effectiveness and efficiency, avoiding both overfitting and underfitting.
Besides the disadvantages and challenges stated above, multisource information such as textual information and hierarchical type/label information is of great significance, which will be further discussed in the following.

Extensions of TransE
There are lots of extension methods following TransE to address the challenges above. Specifically, TransH, TransR, TransD, and TranSparse are proposed to solve the challenges in modeling 1-to-Many, Many-to-1, and Many-to-Many relations, PTransE is proposed to encode long-distance information located in multistep paths, and CTransR, TransA, TransG, and KG2E further extend the oversimplified model of TransE. We will discuss these extension methods in detail.

TransH
With distributed representation, entities are projected to the semantic vector space, and similar entities tend to be in the same cluster. However, it seems that William Shakespeare should be in the neighborhood of Isaac Newton when talking about nationality, while it should be next to Mark Twain when talking about occupation. To accomplish this, we want entities to show different preferences in different situations, that is, to have multiple representations in different triples.
To address the issue when modeling 1-to-Many, Many-to-1, Many-to-Many, and reflexive relations, TransH [77] enables an entity to have multiple representations when involved in different relations. As illustrated in Fig. 7.4, TransH proposes a relation-specific hyperplane w r for each relation, and judge dissimilarities on the hyperplane instead of the original vector space of entities. Given a triple h, r, t , TransH first projects h and t to the corresponding hyperplane w r to get the projection h ⊥ and t ⊥ , and the translation vector r is used to connect h ⊥ and t ⊥ on the hyperplane. The score function is defined as follows: where w r is a vector and w r 2 is restricted to 1. As for training, TransH also minimizes the margin-based loss function with negative sampling which is similar to TransE, and use mini-batch SGD to learn representations.

TransR/CTransR
TransH enables entities to have multiple representations in different relations with the favor of hyperplanes, while entities and relations are still restricted in the same semantic vector space, which may limit the ability for modeling entities and relations. TransR [39] assumes that entities and relations should be arranged in distinct spaces, that is, entity space for all entities and relation space for each relation. The architecture of TransH model [47] As illustrated in Fig. 7.5, For a triple h, r, t , h, t ∈ R k and r ∈ R d , TransR first projects h and t from entity space to the corresponding relation space of r . That is to say, every entity has a relation-specific representation for each relation, and the translating operation is processed in the specific relation space. The energy function of TransR is defined as follows: where h r and t r stand for the relation-specific representation for h and t r in the corresponding relation space of r . The projection from entity space to relation space is h r = hM r , t r = tM r , (7.9) where M r ∈ R k×d is a projection matrix mapping entities from the entity space to the relation space of r . TransR also constrains the norms of the embeddings and has h 2 ≤ 1, t 2 ≤ 1, r 2 ≤ 1, h r 2 ≤ 1, t r 2 ≤ 1. As for training, TransR shares the same margin-based score function as TransE.
Furthermore, the author found that some relations in knowledge graphs could be divided into a few sub-relations that give more precise information. The differences between those sub-relations can be learned from corresponding entity pairs. For instance, the relation location_contains has head-tail patterns like city-street, country-city, and even country-university, showing different attributes in cognition. With the sub-relations being considered, entities may be projected to more precise positions in the semantic vector space.
Cluster-based TransR (CTransR), which is an enhanced version of TransR with the sub-relations into consideration, is then proposed. More specifically, for each relation r , all entity pairs (h, t) are first clustered into several groups. The clustering of entity pairs depends on the subtraction result of t − h, in which h and t are pretrained by TransE. Next, we learn a distinct sub-relation vector r c for each cluster according to the corresponding entity pairs, and the original energy function is modified as  The architecture of TransR model [47] E (h, r, t) = h r + r c − t r + α r c − r , (7.10) where r c − r wants the sub-relation vector r c not to be too distinct from the unified relation vector r.

TransD
TransH and TransR focus on the multiple representations of entities in different relations, improving the performance on knowledge completion and triple classification. However, both models only project entities according to the relations in triples, ignoring the diversity of entities. Moreover, the projection operation with matrix-vector multiplication leads to a higher computational complexity compared to TransE, which is time consuming when applied on large-scale graphs. To address this problem, TransD [32] proposes a novel projection method with a dynamic mapping matrix depending on both entity and relation, which takes the diversity of entities as well as relations into consideration. TransD defines two vectors for each entity and relation, i.e., the original vector that is also used in TransE, TransH, and TransR for distributed representation of entities and relations, and the projection vector that is used in constructing projection matrices for mapping entities from entity space to relation space. As illustrated in Fig. 7.6, TransD uses h, t, r to represent the original vectors, while h p , t p , and r p are used to represent the projection vectors. There are two projection matrices M rh , M rt ∈ R m×n used to project from entity space to relation space, and the projection matrices are dynamically constructed as follows:  The architecture of TransD model [47] which means the projection vectors of entity and relation are combined to determine the dynamic projection matrix. The score function is then defined as The projection matrices are initialized with identity matrices, and there are also some normalization constraints as in TransR.
TransD proposes a dynamic method to construct projection matrices with the consideration of diversity in both entities and relations, achieving better performance compared to existing methods in link prediction and triple classification. Moreover, it lowers both computational and spatial complexity compared to TransR.

TranSparse
The extension methods of TransE stated above focus on the multiple representations for entities in different relations and entity pairs. However, there are still two challenges ignored: (1) The heterogeneity. Relations in knowledge graphs differ in granularity. Some complex relations may link to many entity pairs, while some relatively simple relations not. (2) The unbalance. Some relations may have more links to head entities and fewer links to tail entities, and vice versa. The performance will be further improved if we consider these rather than merely treat all relations equally.
Existing methods like TransR build projection matrices for each relation, while these projection matrices have the same number of parameters, regardless of the variety in the complexity of relations. TranSparse [33] is then proposed to address the issues. The underlying assumption of TranSparse is that complex relations should have more parameters to learn while simple relations have fewer, where the complexity of a relation is judged from the number of triples or entities linked by the relation.
Inspired by TransR, TranSparse(share) builds a projection matrix M r (θ r ) for each relation r . This projection matrix is sparse, and the sparse degree θ r mainly depends on the number of entity pairs linked to r . Suppose N r is the number of linked entity pairs, N * r represents the maximum number of N r , and θ min denotes the minimum sparse degree of projection matrix M r that 0 ≤ θ min ≤ 1. The sparse degree of relation r is defined as follows: Both head and tail entities share the same sparse projection matrix M r (θ r ) in translation. The score function is (7.14) Differing from TranSparse(share), TranSparse(separate) builds two different sparse matrices M rh (θ rh ) and M rt (θ rt ) for head and tail entities. The sparse degree θ rh (or θ rt ) then depends on the number of head (or tail) entities linked by relation r . We have N rh (or N rt ) to represent the number of head (or tail) entities, as well as N * rh (or N * rt ) to represent the maximum number of N rh (or N rt ). And θ min will also be set as the minimum sparse degree of projection matrices that 0 ≤ θ min ≤ 1. We have The score function of TranSparse(separate) is Through the sparse projection matrix, TranSparse solves the heterogeneity and the unbalance simultaneously.

PTransE
The extension models of TransE stated above are mainly focused on the challenge of multiple representations of entities in different scenarios. However, those extension models only consider the simple one-step paths (i.e., relation) in translating operation, ignoring the rich global information located in the whole knowledge graphs. Considering the multistep relational path is a potential method to utilize the global information. For instance, if we notice the multistep relational path that The forbidden city, locate_in, Beijing → Beijing, capital_of, China , we can inference with confidence that the triple The forbidden city, locate_in, China may exist. The relational path provides us with a powerful way to con-struct better knowledge graph representations and even get a better understanding of knowledge reasoning.
There are two main challenges when encoding the information in multistep relational paths. First, how to select reliable and meaningful relational paths among enormous path candidates in KGs, since there are lots of relation sequence patterns which do not indicate reasonable relationships. Let us just consider the relational path The forbidden city, locate_in, Beijing → Beijing, held, 2008 Summer Olympics , it is hard to describe the relationship between The forbidden city and 2008 Summer Olympics. Second, how to model those meaningful relational paths once we get them since it is difficult to solve this composition semantic problem in relational paths.
PTransE [38] is then proposed to model the multistep relational paths. To select meaningful relational paths, the authors propose a Path-Constraint Resource Allocation (PCRA) algorithm to judge the relation path reliability. Suppose there is information (or resource) in head entity h which will flow to tail entity t through some certain relational paths. The basic assumption of PCRA is that: the reliability of path depends on the resource amount that finally flows from head to tail. Formally, we set = (r 1 , . . . , r l ) for a certain path between h and t. The resource travels from h to t and the path could be represented as For an entity m ∈ S i , the resource amount of m is defined as follows: where S i−1 (·, m) indicates all direct predecessors of entity m along with relation r i in S i−1 , and S i (n, ·) indicates all direct successors of n ∈ S i−1 with relation r . Finally, the resource amount of tail R (t) is used to measure the reliability of in the given triple h, , t . Once we have learned the reliability and select those meaningful relational path candidates, the next challenge is how to model the meaning of those multistep paths. PTransE proposes three types of composition operation, namely, Addition, Multiplication, and recurrent neural networks, to get the representation l of = (r 1 , . . . , r l ) through those relations. The score function of the path triple h, , t is defined as follows: where r indicates the golden relation between h and t. Since PTransE wants to meet the assumption in TransE that r ≈ t − h simultaneously, PTransE directly utilizes r in training. The optimization objective of PTransE is The architecture of TransA model [47] where is well considered in the overall loss function. Besides PTransE, similar ideas such as [21,22] also consider the multistep relational paths on different tasks such as knowledge completion and question answering successfully. These works demonstrate that there is plentiful information located in multi-step relational paths, which could significantly improve the performance of knowledge graph representation, and further explorations on more sophisticated models for relational paths are still promising.

TransA
TransA [78] is proposed to solve the following problems in TransE and other extensions: (1) TransE and its extensions only consider the Euclidean distance in their energy functions, which seems to be less flexible. (2) Existing methods regard each dimension in the semantic vector space identically whatever the triple is, which may bring in errors when calculating dissimilarities. To solve these problems, as illustrated in Fig. 7.7, TransA replaces the inflexible Euclidean distance with adaptive Mahalanobis distance, which is more adaptive and flexible. The energy function of TransA is as follows: (7.20) where W r is a relation-specific nonnegative symmetric matrix corresponding to the adaptive matric. Note that the |h + r − t| stands for a nonnegative vector that each dimension is the absolute value of the translating operation. We have

KG2E
Existing translation-based models usually consider entities and relations as vectors embedded in low-dimensional semantic spaces. However, as explained above, entities and relations in KGs are various with different granularities. Therefore, the margin in the margin-based score function that is used to distinguish positive triples from negative triples should be more flexible due to the diversity, and the uncertainties of entities and relations should be taken into consideration.
To solve this, KG2E [30] is proposed, introducing the multidimensional Gaussian distributions to KG representations. As illustrated in Fig. 7.8, KG2E represents each entity and relation with a Gaussian distribution. Specifically, the mean vector denotes the entity/relation's central position, and the covariance matrix denotes its uncertainties. To learn the Gaussian distributions for entities and relations, KG2E also follows the score function proposed in TransE. For a triple h, r, t , the Gaussian distributions of entity and relation are defined as follows: Note that the covariances are diagonal for the consideration of efficiency. KG2E hypothesizes that the head and tail entity are independent with specific relations, then the translation h − t could be defined as To measure the dissimilarity between e and r, KG2E proposes two methods considering both asymmetric similarity and symmetric similarity.
The asymmetric similarity is based on the KL divergence between e and r, which is a straightforward method to measure the similarity between two probability distributions. The energy function is as follows: The symmetric similarity is based on the expected likelihood or probability product kernel. KE2G takes the inner product between P e and P r as the measurement of similarity. The logarithm of energy function is The optimization objective of KG2E is also margin-based similar to TransE. Both asymmetric and symmetric similarities are constrained by some regularization to avoid overfitting:

TransG
We have discussed the problem of TransE in the session of TransR/CTransR that some relations in knowledge graphs such as location_contains or has_part may have multiple sub-meanings. These relations are more likely to be some combinations that could be divided into several more precise relations. To address this issue, CTransR is proposed with a preprocess of clustering for each relation r depending on the entity pairs (h, t). TransG [79] also focuses on this issue more elegantly by introducing a generative model. As illustrated in Fig. 7.9, it assumes that different semantic component embeddings should follow a Gaussian Mixture Model. The generative process is as follows: 1. For each entity e ∈ E, TransG sets a standard normal distribution: μ e ∼ N (0, I).
2. For a triple h, r, t , TransG uses Chinese Restaurant Process to automatically detect semantic components (i.e., sub-meanings in a relation): π r,n ∼ CRP(β). The architecture of TransG model [47] 3. Draw the head embedding to form a standard normal distribution: 4. Draw the tail embedding to form a standard normal distribution: t ∼ N (μ t , σ 2 t I). 5. Draw the relation embedding for this semantic component: . μ is the mean embedding and σ is the variance. Finally, the score function is (7.27) in which N r is the number of semantic components of r , and π r,n is the weight of ith component generated by the Chinese Restaurant Process. Figure 7.9 shows the advantages of the generative Gaussian Mixture Model.

ManifoldE
KG2E and TransG introduce Gaussian distributions to knowledge graph representation learning, improving the flexibility and diversity with the various forms of entity and relation representation. However, TransE and its most extensions view the golden triples as almost points in the low-dimensional vector space, following the assumption of translation. This point assumption may lead to two problems: being an ill-posed algebraic system and being over-strict with the geometric form. ManifoldE [80] is proposed to address this issue, considering the possible position of the golden candidate in vector space as a manifold instead of one point. The overall score function of ManifoldE is defined as follows: in which D 2 r is a relation-specific manifold parameter indicating the bias. Two kinds of manifolds are then proposed in ManifoldE. ManifoldE(Sphere) is a straightforward manifold that supposes t should be located in the sphere which has h + r to be the center and D r to be the radius. We have The second manifold utilized is the hyperplane for it is much easier for two hyperplanes to intersect. The function of ManifoldE(Hyperplane) is (7.30) in which r h and r t represent the two relation embeddings. This indicates that for a triple h, r, t , the tail entity t should locate in the hyperplane whose direction is h + r h with the bias to be D 2 r . Furthermore, ManifoldE(Hyperplane) considers absolute values in M (h, r, t) as |h + r h | |t + r t | to double the solution number of possible tails. For both manifolds, the author applies kernel forms on Reproducing Kernel Hilbert Space.

Other Models
Translation-based methods such as TransE are simple but effective, whose power has been consistently verified on various tasks like knowledge graph completion and triple classification, achieving state-of-the-art performance. However, there are also some other representation learning methods performing well on knowledge graph representation. In this part, we will take a brief look at these methods as inspiration.

Structured Embeddings
Structured Embeddings (SE) [8] is a classical representation learning method for KGs. In SE, each entity is projected to a d-dimensional vector space. SE designs two relation-specific matrices M r,1 , M r,2 ∈ R d×d for each relation r , projecting both head and tail entities with these relation-specific matrices when calculating the similarities. The score function of SE is defined as follows: in which both h and t are transformed into a relation-specific vector space with those projection matrices. The assumption of SE is that the projected head and tail embeddings should be as similar as possible according to the loss function. Different from the translation-based methods, SE models entities as embeddings and relations as projection matrices. In training, SE considers all triples in the training set and minimizes the overall loss function.

Semantic Matching Energy
Semantic Matching Energy (SME) [5,6] proposes a more complicated representation learning method. Differing from SE, SME considers both entities and relations as low-dimensional vectors. For a triple h, r, t , h and r are combined using a projection function g to get a new embedding l h,r , and the same with t and r to get l t,r . Next, a point-wise multiplication function is used on the two combined embeddings l h,r and l t,r to get the score of this triple. SME proposes two different projection functions in the second step, among which the linear form is (7.32) and the bilinear form is: where is the element-wise (Hadamard) product. M 1 , M 2 , M 3 , M 4 are weight matrices in the projection function, and b 1 and b 2 are the bias. Bordes et al. [6] is based on SME and improves the bilinear form with three-way tensors instead of matrices.

Latent Factor Model
Latent Factor Model (LFM) is proposed for modeling large multi-relational datasets. LFM is based on a bilinear structure, which models entities as embeddings and relations as matrices. It could share sparse latent factors among different relations, significantly reducing the model and computational complexity. The score function of LFM is defined as follows: (7.34) in which M r is the representation of the relation r . Moreover, [92] proposes DIST-MULT model, which restricts M r to be a diagonal matrix. This enhanced model not only reduces the parameter number of LFM and thus lowers the model's computational complexity, but also achieves better performance.

RESCAL
RESCAL is a knowledge graph representation learning method based on matrix factorization [54,55]. In RESCAL, to represent all triple facts in knowledge graphs, the authors employ a three-way tensor − → X ∈ R d×d×k in which d is the dimension of entities and k is that of relations. In the three-way tensor − → X , two modes stand for the head and tail entities while the third mode represents the relations. The entries of − → X are based on the existence of the corresponding triple facts. That is, − → X i jm = 1 if the triple ith entity, mth relation, jth entity holds in the training set, and otherwise − → X i jm = 0 if the triple is nonexisting.
To capture the inherent structure of all triples, a tensor factorization model named RESCAL is then proposed. Suppose − → X = {X 1 , . . . , X k }, for each slice X n , we have the following rank-r factorization: where A ∈ R d×r stands for the r -dimensional entity representations, and R n ∈ R r ×r represents the interactions of the r latent components for n-th relation. The assumption in this factorization is similar to LFM, while RESCAL also optimizes the nonexisting triples where − → X i jm = 0 instead of only considering the positive instances. Following this tensor factorization assumption, the loss function of RESCAL is defined as follows: in which the second term is a regularization term and λ is a hyperparameter.

HOLE
RESCAL works well with multi-relational data but suffers from high computational complexity. To leverage both effectiveness and efficiency, Holographic Embeddings (HOLE) is proposed as an enhanced version of RESCAL [53]. HOLE employs an operation named circular correlation to generate compositional representations, which is similar to those holographic models of associative memory. The circular correlation operation : R d × R d → R d between two entities h and t is as follows: (7.37) Figure 7.10a also demonstrates a simple instance of this operation. The probability of a triple h, r, t is then defined as  h t)). (7.38) Considering circular correlation brings in lots of advantages: (1) unlike other operations like multiplication or convolution, circular correlation is noncommutative (i.e., h t = t h), which is capable of modeling asymmetric relations in knowledge graphs. (2) Circular correlation has lower computational complexity compared to tensor product in RESCAL. What's more, the circular correlation could further speed up with the help of Fast Fourier Transform (FFT), which is formalized as follows: (F (h) F (b)).
(7.39) F (·) and F (·) −1 represent the FFT and its inverse, while F (·) denotes the complex conjugate in C d , and stands for the element-wise (Hadamard) product. Due to FFT, the computational complexity of circular correlation is O(d log d), which is much lower than that of tensor product.

Complex Embedding (ComplEx)
ComplEx [70] employs an eigenvalue decomposition model, which makes use of complex valued embeddings. The composition of complex embeddings can handle a large variety of binary relations, among the symmetric and antisymmetric relations. Formally, the log-odd of the probability that the fact h, r, t is true is where f r (h, t) is expected to be 1 when (h, r, t) holds, otherwise −1.
Here, X hrt is calculated as follows: where x, y, z = i x i y i z i denotes the trilinear dot product, Re(x) and Im(x) indicate the real part and the imaginary part of the number x respectively. In fact, Com-plEx can be viewed as an extension of RESCAL, which assigns complex embedding of the entities and relations. Besides, [29] has proved that HolE is mathematically equivalent to ComplEx recently.

Convolutional 2D Embeddings (ConvE)
ConvE [16] uses 2D convolution over embeddings and multiple layers of nonlinear features to model knowledge graphs. It is the first nonlinear model that significantly outperforms previous linear models.
Specifically, ConvE uses convolutional and fully connected layers to model the interactions between input entities and relationships. After that, the obtained features are flattened, transformed through a fully connected layer, and the inner product is taken with all object entity vectors to generate a score for each triple.
For each triple h, r, t , ConvE defines its score function as where * denotes the convolution operator, and vec(·) means compressing a matrix into a vector. r ∈ R k is a relation parameter depending on r ,h andr denote a 2D reshaping of h and r, respectively: if h, r ∈ R k , thenh,r ∈ R k a ×k b , where k = k a k b . ConvE can be seen as an improvement on HolE. Compared with HolE, it learns multiple layers of nonlinear features, and thus theoretically more expressive than HolE.

Rotation Embeddings (RotatE)
RotatE [67] defines each relation as a rotation from the head entity to the tail entity in the complex vector space. Thus, it is able to model and infer various relation patterns, including symmetry/antisymmetry, inversion, and composition. Formally, the score function of the fact h, r, t of RotatE is defined as where denotes the element-wise (Hadamard) product, h, r, t ∈ C k and |r i | = 1. RotatE is simple but achieves quite good performance. Compared with previous work, it is the first model that is capable of modeling and inferring all the three relation patterns above.

Neural Tensor Network
Socher et al. [65] propose Neural Tensor Network (NTN) as well as Single Layer Model (SLM), while NTN is an enhanced version of SLM. Inspired by the previous attempts in KRL, SLM represents both entities and relations as low-dimensional vectors, and also designs relation-specific projection matrices to map entities from entity space to relation space. Similar to SE, the score function of SLM is as follows: E (h, r, t) = r tanh(M r,1 h + M r,2 t), (7.44) where h, t ∈ R d represent head and tail embeddings, r ∈ R k represents relation embedding, and M r,1 , M r,2 ∈ R d×k stand for the relation-specific matrices. Although SLM has introduced relation embeddings as well as a nonlinear layer into the score function, the model representation capability is still restricted. Neural tensor network is then proposed with tensors being introduced into the SLM framework. Besides the original linear neural network layer that projects entities to the relation space, NTN also adds another tensor-based neural layer which combines head and tail embeddings with a relation-specific tensor, as illustrated in Fig. 7.11. The score function of NTN is then defined as follows:  Fig. 7.11 The architecture of NTN model [47] where − → M r ∈ R d×d×k is a 3-way relation-specific tensor, b r is the bias, and M r,1 , M r,2 ∈ R d×k is the relation-specific matrices similar to SLM. Note that SLM is the simplified version of NTN if the tensor and bias are set to zero.
Besides the improvements in score function, NTN also attempts to utilize the latent textual information located in entity names and successfully achieves significant improvements. Differing from previous RL models that provide each entity with a vector, NTN represents each entity as the average of its entity name's word embeddings. For example, the entity Bengal tiger will be represented as the average word embeddings of Bengal and tiger. It is apparent that the entity name will provide valuable information for understanding an entity, since Bengal tiger may come from Bengal and be related to other tigers. Moreover, the number of words is far less than that of entities. Therefore, using the average word embeddings of entity names will also lower the computational complexity and alleviate the issue of data sparsity.
NTN utilizes tensor-based neural networks to model triple facts and achieves excellent successes. However, the overcomplicated method will lead to higher computational complexity compared to other methods, and the vast number of parameters will limit the performance on rather sparse and large-scale KGs.

Neural Association Model (NAM)
NAM [43] adopts multilayer nonlinear activations in the deep neural network to model the conditional probabilities between head and tail entities. NAM studies two model structures Deep Neural Network (DNN) and Relation Modulated Neural Network (RMNN).
NAM-DNN feeds the head and tail entities' embeddings into an MLP with L fully connected layers, which is formalized as follows:

Multisource Knowledge Graph Representation
We are living in a complicated pluralistic real world, in which we can get information through all senses and learn knowledge not only from structured knowledge graphs but also from plain texts, categories, images, and videos. This cross-modal information is considered as multisource information. Besides the structured knowledge graph which is well utilized in previous KRL methods, we will introduce the other kinds of KRL methods utilizing multisource information: 1. Plain text is one of the most common information we deliver, receive, and analyze every day. There are vast amounts of plain texts we possess remaining to be detected, in which the significant knowledge that structured knowledge graphs may not include locates. Entity description is a special kind of textual information that describes the corresponding entity within a few sentences or a short paragraph. Usually, entity descriptions are maintained by some knowledge graphs (i.e., Freebase) or could be automatically extracted from huge databases like Wikipedia.
2. Entity type is another important structured information for building knowledge representations. To learn new objects within our prior knowledge systems, human beings tend to systemize those objects into existing categories. An entity type is usually represented with hierarchical structures, which consist of different granularities of entity subtypes. It is natural that entities in the real world usually have multiple entity types. Most of the existing famous knowledge graphs own their customized hierarchical structures of entity types.
3. Images provide intuitive visual information to describe what the entity looks like, which is confirmed to be the most significant information we receive and process every day. The latent information located in images helps a lot, especially when dealing with concrete entities. For instance, we may find out the potential relationship between Cherry and Plum (there are both plants belonging to Rosaceae) from their appearances. Images could be downloaded from websites, and there are also substantial image datasets like ImageNet.
Multisource information learning provides a novel method to learn knowledge representations not only from the internal information of structured knowledge graphs but also from the external information of plain texts, hierarchical types, and images. Moreover, the exploration in multisource information learning helps to further understand human cognition with all senses in the real world. The cross-modal representations learned based on knowledge graphs will also provide possible relationships between different kinds of information.

Knowledge Graph Representation with Texts
Textual information is one of the most common and widely used information these days. There are large plain texts generated every day on the web and easy to be extracted. Words are compressed symbols of our thoughts and can provide the connections between entities, which are of great significance in KRL.

Knowledge Graph and Text Joint Embedding
Wang et al. [76] attempt to utilize textual information by jointly embedding entities, relations, and words into the same low-dimensional continuous vector space. Their joint model contains three parts, namely, the knowledge model, the text model, and the alignment model. More specifically, the knowledge model is learned based on the triple facts in KGs by translation-based models, while the text model is learned based on the concurrences of words in the large corpus by Skip-gram. As for the alignment model, two methods are proposed utilizing Wikipedia anchors and entity names. The main idea of alignment by Wikipedia anchors is replacing the word-word pair (w, v) with the word-entity pair (w, e v ) according to the anchors in Wiki pages, while the main idea of alignment by entity names is replacing the entities in original triple h, r, t with the corresponding entity names w h , r, t , h, r, w t , and w h , r, w t .
Modeling entities and words into the same vector space are capable of encoding both information in knowledge graphs and that in plain texts, while the performance of this joint model depends on the completeness of Wikipedia anchors and may suffer from the weak interactions merely based on entity names. To address this issue, [101] proposes a new joint embedding based on [76] and improves the alignment model with entity descriptions into consideration, assuming that entities should be similar to all words in their descriptions. These joint models learn knowledge and text joint embeddings, improving evaluation performance in both word and knowledge representations.

Description-Embodied Knowledge Graph Representation
Another way of utilizing textual information is directly constructing knowledge representations from entity descriptions instead of merely considering the alignments. Xie et al. [82] proposes Description-embodied Knowledge Graph Representation Learning (DKRL) that provides two kinds of knowledge representations: the first is the structure-based representation h S and t S , which can directly represent entities widely used in previous methods, and the second is the description-based representation h D and t D which derives from entity descriptions. The energy function derives from translation-based framework: (7.50) The description-based representation is constructed via CBOW or CNN encoders that encode rich textual information from plain texts into knowledge representations. The architecture of DKRL is shown in Fig. 7.12.
Compared to conventional translation-based methods, the two types of entity representations in DKRL are constructed with both structural information and textual information, and thus could get better performance in knowledge graph completion and type classification. Besides, DKRL could represent an entity even if it is not in the training set, as long as there are a few sentences to describe the entity. As their millions of new entities come up every day, DKRL is capable of handling zero-shot learning.

Knowledge Graph Representation with Types
Entity types, which serve as a kind of category information of entities and are usually arranged with hierarchical structures, could provide structured information to understand entities in KRL better.

Type-Constraint Knowledge Graph Representation
Krompaß et al. [36] take type information as type constraints, and improves existing methods like RESCAL and TransE via type constraints. It is intuitive that in a particular relation, the head or tail entities should belong to some specific types. For example, the head entities of the relation write_books should be a human (or more precisely an author), and the tail entities should be a book.
Specifically, in RESCAL, the original factorization X r ≈ AR r A is modified to in which head r , tail r are the set of entities fitting the type constraints of head or tail and X r is a sparse adjacency matrix of shape |head r | × |tail r |. In the enhanced version, only the entities that fit type constraints will be considered during factorization. In TransE, type constraints are utilized in negative sampling. The margin-based score functions of translation-based methods need negative instances, which are generated through randomly replacing head or tail entities with another entity in triples. With type constraints, the negative samples are chosen by where E [head r ] is the subset of entities following type constraints for head in relation r , and E [tail r ] is that for tail.

Type-Embodied Knowledge Graph Representation
Considering type information as constraints is simple but effective, while the performance is still limited. Instead of merely viewing type information as type constraints, Xie et al. [83] propose Type-embodied Knowledge Graph Representation Learning (TKRL), utilizing hierarchical-type structures to instruct the construction of projection matrices. Inspired by TransR that every entity should have multiple representations in different scenarios, the energy function of TKRL is defined as follows:

Fig. 7.13
The architecture of TKRL model in which M rh and M rt are two projection matrices for h and t that depend on their corresponding hierarchical types in this triple. Two hierarchical-type encoders are proposed to learn the projection matrices, regarding all subtypes in the hierarchy as projection matrices, in which Recursive Hierarchy Encoder is based on matrix multiplication, while Weighted Hierarchy Encoder is based on matrix summation: (2) . . . M c (m) , (7.54) (7.55) where M c (i) stands for the projection matrix of the ith subtype of the hierarchical type c, β i is the corresponding weight of the subtype. Figure 7.13 demonstrates a simple illustration of TKRL. Taking RHE, for instance, given an entity William Shakespeare, it is first projected to a rather general sub-type space like human, and then sequentially projected to a more precise subtype like author or English author. Moreover, TKRL also proposes an enhanced soft-type constraint to alleviate the problems caused by type information incompleteness.

Armet
Suit of armour has part Fig. 7.14 Examples of entity images [81]

Knowledge Graph Representation with Images
Images could provide intuitive visual information of their corresponding entities' outlook, which may give significant hints suggesting some latent attributes of entities from certain aspects. For instance, Fig. 7.14 demonstrates some examples of entity images of their corresponding entities Suit of armour and Armet. The left side shows the triple facts that Suit of armour, has_a_part, Armet , and surprisingly, we can infer this knowledge directly from the images.

Image-Embodied Knowledge Graph Representation
Xie et al. [81] propose Image-embodied Knowledge Graph Representation Learning (IKRL) to take visual information into consideration when constructing knowledge representations. Inspired by the multiple entity representations in [82], IKRL also proposes the image-based representation h I and t I besides the original structurebased representation, and jointly learn both two types of entity representations simultaneously within the translation-based framework. An example of semantic regularities in word space [81] entities but also show the possibility of a joint heterogeneous semantic space. Moreover, the authors also find some interesting semantic regularities such as w(man) − w(king) ≈ w(woman) − w(queen) found in word space, which are shown in Fig. 7.15.

Knowledge Graph Representation with Logic Rules
Typical knowledge graphs store knowledge in the form of triple facts with one relation linking two entities. Most existing KRL methods only consider the information within triple facts separately, ignoring the possible interactions and correlations between different triples. Logic rules, which are certain kinds of summaries deriving from human beings' prior knowledge, could help us with knowledge inference and reasoning. For instance, if we know the triple fact that Beijing, is_capital_of, China , we can easily infer with high confidence that Beijing, located_in, China , since we know the logic rule that the relation is_capital_of ⇒ located_in. Some works are focusing on introducing logic rules to knowledge acquisition and inference, among which Markov Logic Networks are intuitively utilized to address this challenge [3,58,75]. The path-based TransE [38] stated above also implicitly considers the latent logic rules between different relations via relation paths.

KALE
KALE is a translation-based KRL method that jointly learns knowledge representations with logic rules [24]. The joint learning consists of two parts, namely, the triple modeling and the rule modeling. For triple modeling, KALE follows the translation assumption with minor alteration in scoring function as follows: (7.57) in which d stands for the dimension of knowledge embeddings. E (h, r, t) takes value in [0, 1] for the convenience of joint learning. For the newly added rule modeling, KALE uses the t-norm fuzzy logics proposed in [25] that represent the truth value of a complex formula with the truth values of its constituents. Specially, KALE focuses on two typical types of logic rules. The first is ∀h, t : h, r 1 , t ⇒ h, r 2 , t (e.g., given Beijing, is_capital_of, China , we can infer that Beijing, located_in, China ). KALE represents the scoring function of this logic rule f 1 via specific t-norm based logical connectives as follows: The second is ∀h, e, t : h, r 1 , e ∧ e, r 2 , t ⇒ h, r 3 , t (e.g., given Tsinghua, located_in, Beijing ) and Beijing, located_in, China , we can infer that Tsinghua, located_in, China ). And KALE defines the second scoring function as The joint training contains all positive formulae, including triple facts as well as logic rules. Note that for the consideration of logic rule qualities, KALE ranks all possible logic rules by their truth values with pretrained TransE and manually filters some rules ranked at the top.

Applications
Recent years have witnessed the great thrive in knowledge-driven artificial intelligence, such as QA systems and chatbot. AI agents are expected to accurately and deeply understand user demands, and then appropriately and flexibly give responses and solutions. Such kind of work cannot be done without certain forms of knowledge.
To introduce knowledge to AI agents, researchers first extract knowledge from heterogeneous information like plain texts, images, and structured knowledge bases. These various kinds of heterogeneous information are then fused and stored with certain structures like knowledge graphs. Next, the knowledge is projected to a lowdimensional semantic space following some KRL methods. And finally, these learned knowledge representations are utilized in various knowledge applications like information retrieval and dialogue system. Figure 7.16 demonstrates a brief pipeline of knowledge-driven applications from scratch.
From the illustration, we can observe that knowledge graph representation learning is the critical component in the whole knowledge-driven application's pipeline. It bridges the gap between knowledge graphs that store knowledge and knowledge  Fig. 7. 16 An illustration of knowledge-driven applications applications that use knowledge. Knowledge representations with distributed methods, compared to those with symbolic methods, are able to solve the data sparsity and modeling the similarities between entities and relations. Moreover, embedding-based methods are convenient to be used with deep learning methods and are naturally fit for the combination with heterogeneous information.
In this section, we will introduce possible applications of knowledge representations mainly from two aspects. First, we will introduce the usage of knowledge representations for knowledge-driven applications, and then we will show the power of knowledge representations for knowledge extraction and construction.

Knowledge Graph Completion
Knowledge graph completion aims to build structured knowledge bases by extracting knowledge from heterogeneous sources such as plain texts, existing knowledge bases, and images. Knowledge construction consists of several subtasks like relation extraction and information extraction, making the fundamental step in the whole knowledge-driven framework.
Recently, automatic knowledge construction has attracted considerable attention since it is incredibly time consuming and labor intensive to deal with enormous existing and new information. In the following section, we will introduce some explorations on neural relation extraction, and concentrate on the combination of knowledge representations.

Knowledge Representations for Relation Extraction
Relation extraction focuses on predicting the correct relation between two entities given a short plain text containing the two entities. Generally, all relations to predict are predefined, which is different to open information extraction. Entities are usually marked with named entity recognition systems or extracted according to anchor texts, or automatically generated via distance supervision [50]. Conventional methods for relation extraction and classification are mainly based on statistical machine learning, which strongly depends on the qualities of extracted features. Zeng et al. [96] first introduce CNN to relation classification and achieve great improvements. Lin et al. [40] further improves neural relation extraction models with attention-based models over instances.
Han et al. [27,28] propose a novel joint representation learning framework for knowledge acquisition. The key idea is that the joint model learns knowledge and text representations within a unified semantic space via KG-text alignments. Figure 7.17 shows the brief framework of the KG-text joint model. For the text part, the sentence with two entities Mark Twain and Florida is regarded as the input for a CNN encoder, and the output of CNN is considered to be the latent relation place_of_birth of this sentence. While for the KG part, entity and relation representations are learned via translation-based methods. The learned representations of KG and text parts are aligned during training. This work is the first attempt to encode knowledge representations from existing KGs to knowledge construction tasks and achieves improvements in both knowledge completion and relation extraction.

Knowledge-Guided Entity Typing
Entity typing is the task of detecting semantic types for a named entity (or entity mention) in plain text. For example, given a sentence Jordan played 15 seasons in the NBA, entity typing aims to infer that Jordan in this sentence is a person, an athlete, and even a basketball player. Entity typing is important for named entity disambiguation since it can narrow down the range of candidates for an entity mention [10]. Moreover, entity typing also benefits massive Natural Language Processing (NLP) tasks such as relation extraction [46], question answering [90], and knowledge base population [9].
Conventional named entity recognition models [69,73] typically classify entity mentions into a small set of coarse labels (e.g., person, organization, location, and others). Since these entity types are too coarse grained for many NLP tasks, a number of works [15,41,94,95] have been proposed to introduce a much larger set of fine-grained types, which are typically subtypes of those coarsegrained types. Previous fine-grained entity typing methods usually derive features using NLP tools such as POS tagging and parsing, and inevitably suffer from error propagation. Dong et al. [18] make the first attempt to explore deep learning in entity typing. The method only employs word vectors as features, discarding complicated feature engineering. Shimaoka et al. [63] further introduce the attention scheme into neural models for fine-grained entity typing.
Neural models have achieved state-of-the-art performance for fine-grained entity typing. However, these methods face the following nontrivial challenges: (1) Entity-Context Separation. Existing methods typically encode context words without utilizing crucial correlations between entity and context. However, it is intuitive that the importance of words in the context for entity typ-ing is significantly influenced by which entity mentions we concern about. For example, in a sentence In 1975, Gates and Paul Allen co-founded Microsoft, which became the world's largest PC software company, the word company is much more important for determining the type of Microsoft than for the type of Gates.
(2) Entity-Knowledge Separation. Existing methods only consider text information of entity mentions for entity typing. In fact, Knowledge Graphs (KGs) provide rich and effective additional information for determining entity types. For example, in the above sentence In 1975, Gates ... Microsoft ... company, even if we have no type information of Microsoft in KG, entities similar to Microsoft (such as IBM) will also provide supplementary information.
In order to address the issues of entity-context separation and entity-knowledge separation, we propose Knowledge-guided Attention (KNET) Neural Entity Typing. As illustrated in Fig. 7.18, KNET mainly consists of two parts. Firstly, KNET builds a neural network, including a Long Short-Term Memory (LSTM) and a fully connected layer, to generate context and named entity representations. Secondly, KNET introduces knowledge attention to emphasize those critical words and improve the quality of context representations. Here we introduce the knowledge attention in detail.
Knowledge graphs provide rich information about entities in the form of triples h, r, t , where h and t are entities and r is the relation between them. Many KRL works have been devoted to encoding entities and relations into real-valued semantic vector space based on triple information in KGs. KRL provides us with an efficient way to exploit KG information for entity typing.
KNET employs the most widely used KRL method TransE to obtain entity embedding e for each entity e. During the training scenario, it is known that the entity mention m indicates the corresponding e in KGs with embedding e, and hence, KNET can directly compute knowledge attention as follows: where W KA is a bilinear parameter matrix, and a KA i is the attention weight for the ith word.
Knowledge Attention in Testing. The challenge is that, in the testing scenario, we do not know the corresponding entity in the KG of a certain entity mention. A solution is to perform entity linking, but it will introduce linking errors. Besides, in many cases, KGs may not contain the corresponding entities for many entity mentions.
To address this challenge, we build an additional text-based representation for entities in KGs during training. Concretely, for an entity e and its context sentence s, we encode its left and right context into c l and c r using an one-directional LSTM, and further learn the text-based representationê as follows: where W is the parameter matrix, and m is the mention representation. Note that, LSTM used here is different from those in context representation in order to prevent interference. In order to bridge text-based and KG-based representations, in the training scenario, we simultaneously learnê by putting an additional component in the objective function: In this way, in the testing scenario, we can directly use Eq. 7.61 to obtain the corresponding entity representation and compute knowledge attention using Eq. 7.60.

Knowledge-Guided Information Retrieval
The emergence of large-scale knowledge graphs has motivated the development of entity-oriented search, which utilizes knowledge graphs to improve search engines. Recent progresses in entity-oriented search include better text representations with entity annotations [61,85], richer ranking features [14], entity-based connections between query and documents [45,84], and soft-match query and documents through knowledge graph relations or embeddings [19,88]. These approaches bring in entities and semantics from knowledge graphs and have greatly improved the effectiveness of feature-based search systems. Another frontier of information retrieval is the development of neural ranking models (neural-IR). Deep learning techniques have been used to learn distributed representations of queries and documents that capture their relevance relations (representation-based) [62], or to model the query-document relevancy directly from their word-level interactions (interaction-based) [13,23,87]. Neural-IR approaches, especially the interaction-based ones, have greatly improved the ranking accuracy when large-scale training data are available [13].
Entity-oriented search and neural-IR push the boundary of search engines from two different aspects. Entity-oriented search incorporates human knowledge from entities and knowledge graph semantics. It has shown promising results on featurebased ranking systems. On the other hand, neural-IR leverages distributed representations and neural networks to learn more sophisticated ranking models form large-scale training data. Entity-Duet Neural Ranking Model (EDRM), as shown in Fig. 7.19, incorporates entities in interaction-based neural ranking models. EDRM first learns the distributed representations of entities using their semantics from knowledge graphs: descriptions and types. Then it follows a recent state-of-the-art entity-oriented search framework, the word-entity duet [86], and matches documents to queries with both bag-of-words and bag-of-entities. Instead of manual features,  Fig. 7.19 The architecture of EDRM model EDRM uses interaction-based neural models [13] to match the query and documents with word-entity duet representations. As a result, EDRM combines entity-oriented search and the interaction-based neural-IR; it brings the knowledge graph semantics to neural-IR and enhances entity-oriented search with neural networks.

Interaction-Based Ranking Models
Given a query q and a document d, interaction-based models first build the wordlevel translation matrix between q and d. The translation matrix describes wordpairs similarities using word correlations, which are captured by word embedding similarities in interaction-based models. Typically, interaction-based ranking models first map each word w in q and d to an L-dimensional embedding v w . v w = Emb w (w). (7.63) It then constructs the interaction matrix M based on query and document embeddings. Each element M i j in the matrix, compares the ith word in q and the jth word in d, e.g., using the cosine similarity of word embeddings: With the translation matrix describing the term level matches between query and documents, the next step is to calculate the final ranking score from the matrix. Many approaches have been developed in interaction-based neural ranking models, but in general, that would include a feature extractor on M and then one or several ranking layers to combine the features to the ranking score.

Semantic Entity Representation
EDRM incorporates the semantic information about an entity from the knowledge graphs into its representation. The representation includes three embeddings: entity embedding, description embedding, and type embedding, all in L dimension and are combined to generate the semantic representation of the entity.
Entity Embedding uses an L-dimensional embedding layer Emb e to get the entity embedding e for e: v e = Emb e (e). (7.65) Description Embedding encodes an entity description which contains m words and explains the entity. EDRM first employs the word embedding layer Emb v to embed the description word v to v. Then it combines all embeddings in the text to an embedding matrix V. Next, it leverages convolutional filters to slide over the text and compose the l length n-gram as g α j v f j , (7.69) where α j is the attention score, calculated as: where y j is the dot product of the query or document representation and type embedding f j . We leverage bag-of-words for query or document encoding. W bow is a parameter matrix. ] + b e , (7.72) in which W e is an L × 2L matrix and b e is an L-dimensional vector.

Neural Entity-Duet Framework
Word-entity duet [86] is a recently developed framework in entity-oriented search. It utilizes the duet representation of bag-of-words and bag-of-entities to match question q and document d with handcrafted features. This work introduces it to neural-IR. They first construct bag-of-entities q e and d e with entity annotation as well as bag-of-words q w and d w for q and d. The duet utilizes a four-way interaction: query words to document words (q w -d w ), query words to documents entities (q w -d e ), query entities to document words (q e -d w ), and query entities to document entities (q e -d e ).
Instead of features, EDRM uses a translation layer that calculates the similarity between a pair of query-document terms: (v i w q or v i e q ) and (v (7.73) The final ranking feature (M) is a concatenation of four cross matches (φ(M)): (7.74) where the φ can be any function used in interaction-based neural ranking models. The entity-duet presents an effective way to crossly match query and document in entity and word spaces. In EDRM, it introduces the knowledge graph semantics representations into neural-IR models.
The duet translation matrices provided by EDRM can be plugged into any standard interaction-based neural ranking models such as K-NRM [87] and Conv-KNRM [13]. With sufficient training data, the whole model is optimized end-to-end with backpropagation. During the process, the integration of the knowledge graph semantics, entity embedding, description embeddings, type embeddings, and matching with entities is learned jointly with the ranking neural network.

Knowledge-Guided Language Models
Knowledge is an important external information for language modeling. It is because the statistical co-occurrences cannot instruct the generation of all kinds of knowledge, especially for those named entities with low frequencies. Researchers try to incorporate external knowledge into language models for better performance on generation and representation.

NKLM
Language models aim to learn the probability distribution over sequences of words, which is a classical and essential NLP task widely studied. Recently, sequence to sequence neural models (seq2seq) are blooming and widely utilized in sequential generative tasks like machine translation [68] and image caption generation [72]. However, most seq2seq models have significant limitations when modeling and using background knowledge.
To address this problem, Ahn et al. [1] propose a Neural Knowledge Language Model (NKLM) that considers knowledge provided by knowledge graphs when generating natural language sequences with RNN language models. The key idea is that NKLM has two ways to generate a word. The first is the same way as conventional seq2seq models that generate a "vocabulary word" according to the probabilities of softmax, and the second is to generate a "knowledge word" according to the external knowledge graphs.
Specifically, the NKLM model takes LSTM as the framework of generating "vocabulary word". For external knowledge graph information, NKLM denotes the topic knowledge as K = {a 1 , . . . a |K | }, in which a i represents the entities (i.e., named as "topic" in [1]) that appear in the same triple of a certain entity. At each step t, NKLM takes both "vocabulary word" w v t−1 and "knowledge word" w o t−1 as well as the fact a t−1 predicted at step t − 1 as the inputs of LSTM. Next, the hidden state of LSTM h t is combined with the knowledge context e to get the fact key k t via an MLP module. The knowledge context e k derives from the mean embeddings of all related facts of fact k. The fact key k t is then used to extract the most appropriate fact a t from the corresponding topic knowledge. And finally, the selected fact a t is combined with hidden state h t to predict (1) both "vocabulary word" w v t and "knowledge word" w o t , and (2) which word to generate at this step. The architecture of NKLM is shown in Fig. 7.20.
The NKLM model explores a novel neural model that combines the symbolic knowledge information in external knowledge graphs with seq2seq language models. However, the topic of knowledge is given when generating natural languages, which makes NKLM less practical and scalable for more general free talks. Nevertheless, we still believe that it is promising to encode knowledge into language models with such methods.

ERNIE
Pretrained language models like BERT [17] have a strong ability to represent language information from text. With rich language representation, pretrained models obtain state-of-the-art results on various NLP applications. However, the existing pretrained language models rarely consider incorporating external knowledge to provide related background information for better language understanding. For example, given a sentence Bob Dylan wrote Blowin' in the Wind and Chronicles: Volume One, without knowing Blowin' in the Wind and Chronicles: Volume One are song and book respectively, it is difficult to recognize the two occupations of Bob Dylan, i.e., songwriter and writer.
To enhance language representation models with external knowledge, Zhang et al. [100] propose an enhanced language representation model with informative entities (ERNIE). Knowledge Graphs (KGs) are important external knowledge resources, and they think informative entities in KGs can be the bridge to enhance language representation with knowledge. ERNIE considers overcoming two main challenges for incorporating external knowledge: Structured Knowledge Encoding and Heterogeneous Information Fusion.
For extracting and encoding knowledge information, ERNIE firstly recognizes named entity mentions in text and then aligns these mentions to their corresponding entities in KGs. Instead of directly using the graph-based facts in KGs, ERNIE encodes the graph structure of KGs with knowledge embedding algorithms like TransE [7], and then takes the informative entity embeddings as input. Based on the alignments between text and KGs, ERNIE integrates entity representations in the knowledge module into the underlying layers of the semantic module.  Fig. 7.21 The architecture of ERNIE model Similar to BERT, ERNIE adopts the masked language model and the next sentence prediction as the pretraining objectives. Besides, for the better fusion of textual and knowledge features, ERNIE uses a new pretraining objective (denoising entity auto-encoder) by randomly masking some of the named entity alignments in the input text and training to select appropriate entities from KGs to complete the alignments. Unlike the existing pre-trained language representation models only utilizing local context to predict tokens, these objectives require ERNIE to aggregate both context and knowledge facts for predicting both tokens and entities, and lead to a knowledgeable language representation model. Figure 7.21 is the overall architecture. The left part shows that ERNIE consists of two encoders (T-Encoder and K-Encoder), where T-Encoder is stacked by several classical transformer layers and K-Encoder is stacked by the new aggregator layers designed for knowledge integration. The right part is the detail of the aggregator layer. In the aggregator layer, the input token embeddings and entity embeddings from the preceding aggregator are fed into two multi-head self-attention, respectively. Then, the aggregator adopts an information fusion layer for the mutual integration of the token and entity sequence and computes the output embedding for each token and entity.
ERNIE explores how to incorporate knowledge information into language representation models. The experimental results demonstrate that ERNIE has more powerful abilities of both denoising distantly supervised data and fine-tuning on limited data than BERT.

KALM
Pre-trained language models can do many tasks without supervised training data, like reading comprehension, summarization, and translation [60]. However, traditional language models are unable to efficiently model entity names observed in text. To solve this problem, Liu et al. [42] propose a new language model architecture, called Knowledge-Augmented Language Model (KALM), to use the entity types of words for better language modeling.
KALM is a language model with the option to generate words from a set of entities from a knowledge database. An individual word can either come from a general word dictionary as in the traditional language model or be generated as a name of an entity from a knowledge database. The training objectives just supervise the output and ignore the decision of the word type. Entities in the knowledge database are partitioned by type and they use the database to build the types of words. According to the context observed so far, the model decides whether the word is a general term or a named entity in a given type. Thus, KALM learns to predict whether the context observed is indicative of a named entity and what tokens are likely to be entities of a given type.
With the language modeling, KALM learns a named entity recognizer without any explicit supervision by using only plain text and the potential types of words. And, it achieves a comparable performance with the state-of-the-art supervised methods.

Other Knowledge-Guided Applications
Knowledge enables AI agents to understand, infer, and address user demands, which is essential in most knowledge-driven applications like information retrieval, question answering, and dialogue system. The behavior of AI agents will be more reasonable and accurate with the favor of knowledge representations. In the following subsections, we will introduce the great improvements made by knowledge representation in question answering.

Knowledge-Guided Question Answering
Question answering aims to give correct answers according to users' questions, which needs the capabilities of both natural language understanding of questions and inference on answer selection. Therefore, combining knowledge with question answering is a straightforward application for knowledge representations. Most conventional question answering systems directly utilize knowledge graphs as certain databases, ignoring the latent relationships between entities and relations. Recently, with the thriving in deep learning, explorations have focused on neural models for understanding questions and even generating answers.
Considering the flexibility and diversity of generated answers in natural languages, Yin et al. [93] propose a neural Generative Question Answering model (GENQA), which explores on generating answers to simple factoid questions in natural languages. Figure 7.22 demonstrates the workflow of GENQA. First, a bidirectional RNN is regarded as the Interpreter to transform question q from natural language to compressed representation H q . Next, Enquirer takes H Q as the key to rank rel- Finally, Answerer combines H q and r q to generate answers in the form of natural languages. Similar to [1], at each step, Answerer first decides whether to generate common words or knowledge words according to a logistic regression model. For common words, Answerer acts in the same way as RNN decoders with H q selected by attention-based methods. As for knowledge words, Answerer directly generates entities with higher ranks. There are gradually more efforts focusing on encoding knowledge representations into knowledge-driven tasks like information retrieval and dialogue systems. However, how to flexibly and effectively combine knowledge with AI agents remains to be explored in the future.

Knowledge-Guided Recommendation System
Due to the rapid growth of web information, recommendation systems have been playing an essential role in the web application. The recommendation system aims to predict the "rating" or "preference" that users may give to items. And since KGs can provide rich information, including both structured and unstructured data, recommendation systems have utilized more and more knowledge from KGs to enrich their contexts.
Cheekula et al. [11] explore to utilize the hierarchical knowledge from the DBpedia category structure in the recommendation system and employs the spreading activation algorithm to identify entities of interest to the user. Besides, Passant [56] measures the semantic relatedness of the artist entity in a KG to build music recommendation systems. However, most of these systems mainly investigate the problem by leveraging the structure of KGs. Recently, with the development of representation learning, [98] proposes to jointly learn the latent representations in a collaborative filtering recommendation system as well as entities' representations in KGs.
Except the tasks stated above, there are gradually more efforts focusing on encoding knowledge graph representations into other tasks such as dialogue system [37,103], entity disambiguation [20,31], knowledge graph alignment [12,102], dependency parsing [35], etc. Moreover, the idea of KRL has also motivated the research on visual relation extraction [2,99] and social relation extraction [71].

Summary
In this chapter, we first introduce the concept of the knowledge graph. Knowledge graph contains both entities and the relationships among them in the form of triple facts, providing an effective way of human beings learning and understanding the real world. Next, we introduce the motivations of knowledge graph representation, which is considered as a useful and convenient method for a large amount of data and is widely explored and utilized in multiple knowledge-based tasks and significantly improves the performance. And we describe existing approaches for knowledge graph representation. Further, we discuss several advanced approaches that aim to deal with the current challenges of knowledge graph representation. We also review the real-world applications of knowledge graph representation such as language modeling, question answering, information retrieval, and recommendation systems.
For further understanding of knowledge graph representation, you can find more related papers in this paper list https://github.com/thunlp/KRLPapers. There are also some recommended surveys and books including:  [34].
In the future, for better knowledge graph representation, there are some directions requiring further efforts: (1) Utilizing More Knowledge. Current KRL approaches focus on representing triple-based knowledge from world knowledge graphs such as Freebase, Wikidata, etc. In fact, there are various kinds of knowledge in the real world such as factual knowledge, event knowledge, commonsense knowledge, etc. What's more, the knowledge is stored with different formats, such as attributions, quantifier, text, and so on. The researchers have formed a consensus that utilizing more knowledge is a potential way toward more interpretable and intelligent NLP. Some existing works [44,82] have made some preliminary attempts of utilizing more knowledge in KRL. Beyond these works, is it possible to represent different knowledge in a unified semantic space, which can be easily applied in downstream NLP tasks?
(2) Performing Deep Fusion of knowledge and language. There is no doubt that the joint learning of knowledge and language information can further benefit downstream NLP tasks. Existing works [76,89,97] have preliminarily verified the effectiveness of joint learning. Recently, ERINE [100] and KnowBERT [57] further provide us a novel perspective to fuse knowledge and language in pretraining. Soares et al. [64] learn the relational similarity in text with the guidance of KGs, which is also a pioneer of knowledge fusion. Besides designing novel pretraining objectives, we could also design novel model architectures for downstream tasks, which are more suitable to utilize KRL, such as memory-based models [48,91] and graph network-based models [66]. Nevertheless, it still remains an unsolved problem for effectively performing the deep fusion of knowledge and language.
(3) Orienting Heterogeneous Modalities. With the fast development of the World Wide Web, the data size of audios, images, and videos on the Web have become larger and larger, which are also important resources for KRL besides texts. Some pioneer works [51,81] explore to learn knowledge representations on a multi-modal knowledge graph, but are still preliminary attempts. Intuitively, audio and visual knowledge can provide complementary information, which benefits related NLP tasks. To the best of our knowledge, there still lacks research on applying multi-modal KRL in downstream tasks. How to efficiently and effectively integrate multi-modal knowledge is becoming a critical and challenging problem for KRL.
(4) Exploring Knowledge Reasoning. Most of the existing KRL methods represent knowledge information in low-dimensional semantic space, which is feasible for the computation of complex knowledge graphs in neural-based NLP models. Although benefiting from the usability of low-dimensional embeddings, KRL cannot perform explainable reasoning such as symbolic rules, which is of great importance for downstream NLP tasks. Recently, there has been increasing interest in the combination of embedding methods and symbolic reasoning methods [26,59], aiming at taking both advantages of them. Beyond these works, there remain lots of unsolved problems for developing better knowledge reasoning ability for KRL.
Open Access This chapter is licensed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license and indicate if changes were made.
The images or other third party material in this chapter are included in the chapter's Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the chapter's Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder.