SlowGuess/NAACL_2021_OCR huggingface dataset:
EDGE: Enriching Knowledge Graph Embeddings with External Text
Saed Rezayi $^{1}$ , Handong Zhao $^{2}$ , Sungchul Kim $^{2}$ , Ryan A. Rossi $^{2}$ , Nedim Lipka $^{2}$ , and Sheng Li $^{1}$
$^{1}$ Department of Computer Science, University of Georgia, Athens, GA, USA
{saedr,sheng.li}@uga.edu
{hazhao,sukim,ryrossi,lipka}@adobe.com
Knowledge graphs suffer from sparsity which degrades the quality of representations generated by various methods. While there is an abundance of textual information throughout the web and many existing knowledge bases, aligning information across these diverse data sources remains a challenge in the literature. Previous work has partially addressed this issue by enriching knowledge graph entities based on "hard" co-occurrence of words present in the entities of the knowledge graphs and external text, while we achieve "soft" augmentation by proposing a knowledge graph enrichment and embedding framework named EDGE. Given an original knowledge graph, we first generate a rich but noisy augmented graph using external texts in semantic and structural level. To distill the relevant knowledge and suppress the introduced noise, we design a graph alignment term in a shared embedding space between the original and augmented graph. To enhance the embedding learning on the augmented graph, we further regularize the locality relationship of target entity based on negative sampling. Experimental results on four benchmark datasets demonstrate the robustness and effectiveness of EDGE in link prediction and node classification.
Knowledge Graph (KG) $^1$  embedding learning has been an emerging research topic in natural language processing, which aims to learn a low dimensional latent vector for every node. One major challenge is sparsity. Knowledge graphs are often incomplete, and it is a challenge to generate low-dimensional representations from a graph with many missing edges. To mitigate this issue, auxil
Figure 1: An example illustrating the original (left) and augmented knowledge graphs (right). Red nodes are knowledge graph entities and small blue nodes are textual nodes obtained from the external text. In augmentation process, a new set of keywords are discovered and attached to the original entities. To keep the augmented graph semantically close to the original graph, a backward pass of knowledge distillation is achieved by the proposed graph alignment.
ary texts that are easily accessible have been popularly exploited for enhancing the KG (as illustrated in Figure 1). More specifically, given that KG entities contain textual features, we can link them to an auxiliary source of knowledge, e.g., WordNet, and therefore enhance the existing feature space. With notable exceptions, the use of external textual properties for KG embedding has not been extensively explored before. Recently, (Kartsaklis et al., 2018) used entities of the KG to query BabelNet (Navigli and Ponzetto, 2012), added new nodes to the original KG based on co-occurrence of entities, and produced more meaningful embeddings using the enriched graph. However, this hard-coded, co-occurrence based KG enrichment strategy fails to make connections to other semantically related entities. As motivated in Figure 1, the newly added entities "wound", "arthropod" and "protective body", are semantically close to some input KG entity nodes (marked in red). However, they cannot be directly retrieved from BabelNet using co-occurrence matching.
In this paper, we aim to address the sparsity issue by integrating a learning component into the process. We propose a novel framework, EDGE, for KG enrichment and embedding. EDGE first constructs a graph using the external text based on
$^{1}$ Knowledge graph usually represents a heterogeneous multigraph whose nodes and relations can have different types. However in the work, we follow (Kartsaklis et al., 2018), consider knowledge graph enrichment problem where only one relation type (connected or not) appears.
Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 2767-2776 June 6-11, 2021. ©2021 Association for Computational Linguistics
similarity and aligns the enriched graph with the original KG in the same embedding space. It infuses learning in the knowledge distillation process by graph alignment, ensuring that similar entities remain close, and dissimilar entities get as far from each other. Consuming information from an auxiliary textual source helps improve the quality of final products, i.e., low dimensional embeddings, by introducing new features. This new feature space is effective because it is obtained from a distinct knowledge source and established based on affinity captured by the learning component of our model.
More specifically, our framework takes  $\mathcal{KG}$ , and an external source of texts,  $\mathcal{T}$ , as inputs, and generates an augmented knowledge graph,  $a\mathcal{KG}$ . In generating  $a\mathcal{KG}$  we are mindful of semantic and structural similarities among  $\mathcal{KG}$  entities, and we make sure it contains all the original entities of  $\mathcal{KG}$ . This ensures that there are common nodes in two graphs which facilitates the alignment process. To align  $\mathcal{KG}$  and  $a\mathcal{KG}$  in the embedding space, a novel multi-criteria objective function is devised. In particular, we design a cost function that minimizes the distance between the embeddings of the two graphs. As a result, textual nodes (e.g., blue nodes in Figure 1) related to each target entity are rewarded while unrelated ones get penalized in a negative sampling setting.
Extensive experimental results on four benchmark datasets demonstrate that EDGE outperforms state-of-the-art models in different tasks and scenarios, including link prediction and node classification. Evaluation results also confirm the generalizability of our model. We summarize our contributions as follows: (i) We propose EDGE, a general framework to enrich knowledge graphs and node embeddings by exploiting auxiliary knowledge sources. (ii) We introduce a procedure to generate an augmented knowledge graph from external texts, which is linked with the original knowledge graph. (iii) We propose a novel knowledge graph embedding approach that optimizes a multi-criteria objective function in an end-to-end fashion and aligns two knowledge graphs in a joint embedding space. (iv) We demonstrate the effectiveness and generalizability of EDGE by evaluating it on two tasks, namely link prediction and node classification, on four graph datasets.
The rest of the paper is organized as follows. In the next section, we try to identify the gap in the existing literature and motivate our work. Next,
in Section 3, we set up the problem definition and describe how we approach the problem by in-depth explanation of our model. We evaluate our proposed model by experimenting link prediction and node classification on four benchmark datasets and present the results and ablation study in Section 4. Finally, we conclude our work and give the future direction in Section 5.
Knowledge graph embedding learning has been studied extensively in the literature (Bordes et al., 2013; Wang et al., 2014; Yang et al., 2015; Sun et al., 2019; Zhang et al., 2019; Xian et al., 2020; Yan et al., 2020; Sheu and Li, 2020). A large number of them deal with the heterogeneous knowledge graph, where it appears different types of edges. While in this work we consider the type of knowledge graph with only one type (i.e. connected or not) of relation, and only focus on entity embedding learning. Our work is related to graph neural networks, such as the graph convolutional networks (GCN) (Kipf and Welling, 2017) and its variants (Wu et al., 2020; Jiang et al., 2019, 2020), which learn node embeddings by feature propagation. In the following, we mainly review the most relevant works in two aspects, i.e., graph embedding learning with external text and knowledge graph construction.
2.1 Graph Embedding with External Text
The most similar line of work to ours is where an external textual source is considered to enrich the graph and learn low dimensional graph embeddings using the enriched version of the knowledge graph. For instance, (Wang and Li, 2016) annotates the KG entities in text, creates a network based on entity-word co-occurrences, and then learns the enhanced KG. Similarly, (Kartsaklis et al., 2018) adds an edge  $(e,t)$  to KG per entity  $e$  based on co-occurrence and finds graph embeddings using random walks. However, there is no learning component in these approaches in constructing the new knowledge graph. And the enrichment procedure is solely based on occurrences ("hard" matching) of entities in the external text.
For graph completion task, (Malaviya et al., 2020) uses pre-trained language models to improve the representations and for Question Answering task, (Sun et al., 2018) extracts a sub-graph  $\mathcal{G}_q$  from KG and Wikipedia, which contains the an
Figure 2: Our proposed framework for aligning two graphs in the embedding space. The graph alignment component,  $\mathcal{L}_J$ , requires an additional matrix,  $\mathbf{R}$ , that selects embeddings of  $\mathcal{KG}$  entities from  $\mathbf{Z}_T$ , so the resulting matrix,  $\mathbf{RZ}_T$ , would have the same dimension as  $\mathbf{Z}_K$ . Furthermore,  $\mathcal{L}_N$  penalizes additional entities that are unrelated to the target entity, while rewards the related ones. We omit the graph reconstruction loss for simplicity.
swer to the question with a high probability and apply GCN on  $\mathcal{G}_q$  which is limited to a specific task. We emphasize that the main difference between our model and previous work is that we first create an augmented knowledge graph from an external source, and improve the quality of node representation by jointly mapping two graphs to an embedding space. To the best of our knowledge, this is the first time that a learning component is incorporated to enriching knowledge graphs.
Knowledge graph construction methods are broadly classified into two main groups: 1) Curated approaches where facts are generated manually by experts, e.g., WordNet (Fellbaum, 1998) and UMLS (Bodenreider, 2004), or volunteers such as Wikipedia, and 2) Automated approaches where facts are extracted from semi-structured text like DBpedia (Auer et al., 2007), or unstructured text (Carlson et al., 2010). The latter approach can be defined as extracting structured information from unstructured text. In this work, we do not intend to construct a knowledge base from scratch, instead we aim to generate an augmented knowledge graph using side information. Hence, we employ existing tools to acquire a set of new facts from external text and link them to an existing KG.
We formulate the knowledge graph enrichment and embedding problem as follows: given a knowledge graph  $\mathcal{KG} = (\mathcal{E},\mathcal{R},X)$  with  $|\mathcal{E}|$  nodes (or entities),  $|\mathcal{R}|$  edges (or relations) and  $X\in \mathbb{R}^{|\mathcal{E}|\times D}$  as feature matrix, where  $D$  is the number of features per entity, also given an external textual source,  $\mathcal{T}$
the goal is to generate an augmented knowledge graph and jointly learn  $d$  ( $d < | \mathcal{E} |$ ) dimensional embeddings for knowledge graph entities, which preserve structural and semantic properties of the knowledge graph. The learned representations are then used for the tasks of link prediction and node classification. Link prediction is defined as a binary classification whose goal is to predict whether or not an edge exists in KG, and node classification is the task of determining node labels in labelled graphs.
To address the problem of knowledge graph enrichment and embedding, we propose EDGE, a framework that contains two major components, i.e., augmented knowledge graph construction, and knowledge graph alignment in a joint embedding space.
3.2 Augmented Knowledge Graph Construction
Given the entities of  $\mathcal{KG}$  and an external source of textual data,  $\mathcal{T}$ , we aim to generate an augmented graph,  $a\mathcal{KG}$ , which is a supergraph of  $\mathcal{KG}$  (i.e.,  $\mathcal{KG}$  is a subgraph of  $a\mathcal{KG}$ ). Augmentation is the process of adding new entities to  $\mathcal{KG}$ . These newly added entities are called textual entities or textual nodes. A crucial property of  $a\mathcal{KG}$  is that it contains entities of  $\mathcal{KG}$ . The presence of these entities establishes a relationship between the two graphs, and such a relationship will be leveraged to learn the shared graph embeddings. To construct  $a\mathcal{KG}$ , we need to find a set of keywords to query an external source. To obtain high quality keywords and acquire new textual entities, we design the following procedure per target entity  $e_t$  (For every step of this process refer to Table 1 for a real example from SNOMED dataset).
First, we find a set of semantically and struc
Table 1: We employ representation learning algorithms to find a set of semantically and structurally similar entities to each target entity (column 2). We then find a set of keywords,  $K$ , that are representative of the target entity (column 3) and use them to query an external text and obtain a set of sentences,  $S$  (column 4). Finally, we extract textual entities (column 5), and connect them to the target entity.
Target Entity	semantically and structurally Similar Entities	Most definitive keywords	Sentences obtained from auxiliary text	Entities obtained from information extraction
Nonvenomous insect bite of hip without infection	semantic	1. Nonvenomous insect bite of foot with infection2. Crushing injury of hip and/or thigh3. Superficial injury of lip with infection4. Infected insect bite of hand	1. bite2. insect3. nonvenomous4. infect	1. a wound resulting from biting by an animal or a person2. small air-breathing arthropod3. not producing or resulting from poison4. contaminate with a disease or microorganism	1. wound2. arthropod3. poison4. microorganism
structural	1. Insect bite, nonvenomous, of back2. Tick bite3. Animal bite of calf4. Insect bite, nonvenomous, of foot and toe
Insect bite, nonvenomous, of foot and toe infected	semantic	1. Insect bite, nonvenomous, of lower limb, infected2. Infected insect bite of hand3. Insect bite, nonvenomous, of hip4. Insect bite granuloma	1. bite2. insect3. lower4. skin	1. a wound resulting from biting by an animal or a person2. small air-breathing arthropod3. move something or somebody to a lower position4. a natural protective body	1. wound2. arthropod3. position4. protective body
structural	1. Nonvenomous insect bite of hip without infection2. Insect bite, nonvenomous, of back3. Recurrent infection of skin4. Skin structure of lower leg
turally similar entities to  $e_t$  denoted by  $\mathcal{E}_{e_t}$ . This set creates a textual context around  $e_t$  which we use to find keywords to query an external text, e.g., WordNet or Wikipedia. Here by query we mean using the API of the external text to find related sentences,  $S$  (for instance for a given keyword "bite" we can capture several sentences from the wikipedia page for the entry "biting" or find several Synsets<sup>2</sup> from WordNet when we search for "bite").
Finally, we extract entities from  $S$  and attach them to  $e_t$ . We call these new entities, textual entities or textual features. By connecting these newly found textual entities to the  $e_t$ , we enhance  $\mathcal{KG}$  and generate the augmented knowledge graph,  $a\mathcal{KG}$ . We observed that the new textual entities are different from our initial feature space. Also, it is possible that two different target entities share one or more textual nodes, hence the distance between them in  $a\mathcal{KG}$  would decrease. The implementation details of this process is provided in Supplementary materials.
Querying an external text allows us to extend the feature space beyond the context around  $e_t$ . By finding other entities in  $\mathcal{KG}$  that are similar to the target entity and extracting keywords from the collection of them to query the external text, distant entities that are related but not connected would become closer to each other owing to the shared keywords.
Figure 1 illustrates a subset of SNOMED graph and its augmented counterpart by following the above procedure. As this figure reveals, the structure of  $a\mathcal{KG}$  is different from  $\mathcal{KG}$ , and as a result of added textual nodes, distant but similar enti
ties would become closer. Therefore, augmenting knowledge graphs would alleviate the KG sparsity issue. Although we may introduce noise by adding new entities but later in the alignment process we address this issue.
Remarks. In the above procedure, we need to obtain similar entities before looking for textual entities, and the rationality of such a strategy is discussed as follows. One naive approach is to simply use keywords included in the target entity to find new textual features. In this way, we would end up with textual features that are related to that target entity, but we cannot extend the feature space to capture similarity (i.e., dependency) among entities.
3.3 Knowledge Graph Alignment in Joint Embedding Space
With the help of augmented knowledge graph  $a\mathcal{KG}$ , we aim to enrich the graph embeddings of  $\mathcal{KG}$ . However, inevitably, a portion of newly added entities are noisy, and even potentially wrong. To mitigate this issue, we are inspired by Hinton et al. (Hinton et al., 2015), and propose a graph alignment process for knowledge distillation. In fact,  $a\mathcal{KG}$  and  $\mathcal{KG}$  share some common entities, which makes it possible to map two knowledge graphs into a joint embedding space. In particular, we propose to extract low-dimensional node embeddings of two knowledge graphs using graph auto-encoders (Kipf and Welling, 2016), and design novel constraints to align two graphs in the embedding space. The architecture of our approach is illustrated in Figure 2.
Let  $\mathbf{A}_K$  and  $\mathbf{A}_T$  denote the adjacency matrices of  $\kappa \mathcal{G}$  and  $a\kappa \mathcal{G}$ , respectively. The loss functions
2Synset is the fundamental building block of WordNet which is accompanied by a definition, example(s), etc.
of graph auto-encoders that reconstruct knowledge graphs are defined as:
$$
\mathcal {L} _ {K} = \min  _ {\mathbf {Z} _ {K}} \left\| \mathbf {A} _ {K} - \hat {\mathbf {A}} _ {K} \right\| _ {2}, \tag {1}
$$
$$
\mathcal {L} _ {T} = \min  _ {\mathbf {Z} _ {T}} | | \mathbf {A} _ {T} - \hat {\mathbf {A}} _ {T} | | _ {2}, \tag {2}
$$
where  $\hat{\mathbf{A}}_K = \sigma (\mathbf{Z}_K\mathbf{Z}_K^\top)$  is the reconstructed graph using node embeddings  $\mathbf{Z}_K$ . And  $\mathbf{Z}_K$  is the output of graph encoder that is implemented by a two-layer GCN (Kipf and Welling, 2016):
$$
\mathbf {Z} _ {K} = \operatorname {G C N} \left(\mathbf {A} _ {K}, \mathbf {X} _ {K}\right) = \tilde {\mathbf {A}} _ {K} \tanh  \left(\tilde {\mathbf {A}} _ {K} \mathbf {X} _ {K} \mathbf {W} _ {0}\right) \mathbf {W} _ {1}, \tag {3}
$$
where  $\tilde{\mathbf{A}}_K = \mathbf{D}_K^{-\frac{1}{2}}\mathbf{A}_K\mathbf{D}_K^{-\frac{1}{2}}$ .  $\mathbf{D}_K$  is the degree matrix,  $\tanh(.)$  is the Hyperbolic Tangent function that acts as the activation function of the neurons,  $\mathbf{W}_i$  are the model parameters, and  $\mathbf{X}_K$  is the feature matrix. Similarly,  $\hat{\mathbf{A}}_T = \sigma (\mathbf{Z}_T\mathbf{Z}_T^\top)$ , and  $\mathbf{Z}_T$  is learned by another two-layer GCN. Equations (1) and (2) are  $l_{2}$ -norm based loss functions that aim to minimize the distance between original graphs and the reconstructed graphs.
Furthermore, to map  $\mathcal{KG}$  and  $a\mathcal{KG}$  to a joint embedding space and align their embeddings through common entities, we define the following graph alignment loss function:
$$
\mathcal {L} _ {J} = \left| \left| \mathbf {Z} _ {K} - \mathbf {R} \mathbf {Z} _ {T} \right| \right| _ {2}, \tag {4}
$$
where  $\mathbf{R}$  is a transform matrix that selects common entities that exist in  $\kappa \mathcal{G}$  and  $a\kappa \mathcal{G}$ . Note that the two terms  $\mathbf{Z}_K$  and  $\mathbf{R}\mathbf{Z}_T$  should be of the same size in the  $L_2$  norm equation. Our motivation is to align the embeddings of common entities across two knowledge graphs. By using  $\mathbf{R}$ , the node embeddings of common entities can be selected from  $\mathbf{Z}_T$ . Note that  $\mathbf{Z}_T$  is always larger than  $\mathbf{Z}_K$ , as  $\kappa \mathcal{G}$  is a subgraph of  $a\kappa \mathcal{G}$ . Equation (4) also helps preserve local structures of the original knowledge graph  $\kappa \mathcal{G}$  in the graph embedding space. In other words, nodes that are close to each other in the original knowledge graph will be neighbors in the augmented graph as well.
Moreover, we notice that the proposed augmented knowledge graph  $a\mathcal{KG}$  involves more complicated structures than the original knowledge graph  $\mathcal{KG}$ , due to the newly added textual nodes for each target entity in  $\mathcal{KG}$ . In  $a\mathcal{KG}$ , one target entity
Algorithm 1 Training process of EDGE
Input:  $\mathbf{A}_K, \mathbf{X}_K, \mathbf{A}_T, \mathbf{X}_T, \mathrm{POS}, \mathrm{NEG}$
Input:  $\mathbf{R}\in \mathbb{R}^{|\mathcal{E}_K| \times (|\mathcal{E}_T| - |\mathcal{E}_K|)}$
1: for each epoch do
2:  $\hat{\mathbf{A}}_K = \sigma (\mathbf{Z}_K\mathbf{Z}_K^\top)$
3:  $\mathbf{Z}_K = \tilde{\mathbf{A}}_K\tanh (\tilde{\mathbf{A}}_K\mathbf{X}_K\mathbf{W}_0^K)\mathbf{W}_1^K$
4:  $\hat{\mathbf{A}}_T = \sigma (\mathbf{Z}_T\mathbf{Z}_T^\top)$
5:  $\mathbf{Z}_T = \tilde{\mathbf{A}}_T\tanh (\tilde{\mathbf{A}}_T\mathbf{X}_T\mathbf{W}_0^T)\mathbf{W}_1^T$
6: Calculate  $\mathcal{L}_K$  and  $\mathcal{L}_T$  using Equations (1) and (2).
7: Compute  $\mathcal{L}_J$  using Equation (4)
8: Find negative and positive samples and calculate  $\mathcal{L}_N$  using Equation (5)
9: Sum up all losses with their corresponding ratios using Equation (6)
10: Run Adam optimizer to minimize  $\mathcal{L}$
11: Update model parameters  $\mathbf{W}_i^K$  and  $\mathbf{W}_i^T$
12: end for
Output:  $Z_{K}$
is closely connected to its textual nodes, and their embeddings should be very close to each other in the graph embedding space. However, such local structures might be distorted in the graph embedding space. Without proper constraints, it is possible that one target entity is close to textual entities of other target entities in the embedding space, which is undesired for downstream applications. To address this issue, we design a margin-based loss function with negative sampling to preserve the locality relationship as follows:
$$
\mathcal {L} _ {N} = - \log \left(\sigma \left(\mathbf {z} _ {e} ^ {\top} \mathbf {z} _ {t}\right)\right) - \log \left(\sigma \left(- \mathbf {z} _ {e} ^ {\top} \mathbf {z} _ {t ^ {\prime}}\right)\right), \tag {5}
$$
where  $\mathbf{z}_t$  are the embeddings of the related textual nodes,  $\mathbf{z}_t^\prime$  are the embeddings of textual nodes that are not related to the target entity, and  $\sigma$  is the sigmoid function.
Finally, the overall loss function is defined as:
$$
\mathcal {L} = \min  _ {\mathbf {Z} _ {K}, \mathbf {Z} _ {T}} \underbrace {\mathcal {L} _ {K} + \alpha \mathcal {L} _ {T}} _ {\text {r e c o n s t r u c t i o n}} + \underbrace {\beta \mathcal {L} _ {J}} _ {\text {g r a p h}} + \underbrace {\gamma \mathcal {L} _ {N}} _ {\text {l o c a l i t y}}, \tag {6}
$$
where  $\alpha$ ,  $\beta$ , and  $\gamma$  are hyper-parameters. We perform full-batch gradient descent using the Adam optimizer to learn all the model parameters in an end-to-end fashion. The whole training process of our approach is summarized in Algorithm 1.
The learned low-dimensional node embeddings  $\mathbf{Z}_K$  could benefit a number of unsupervised and supervised downstream applications, such as link prediction and node classification. Link prediction is the task of inferring missing links in a graph, and node classification is the task of predicting labels to vertices of a (partially) labeled graph. Extensive evaluations on both tasks will be provided in the experiment section.