# Utilizing Entity-Based Gated Convolution and Multilevel Sentence Attention to Improve Distantly Supervised Relation Extraction

Authors: Qian Yi; Guixuan Zhang; Shuwu Zhang
Journal: Computational Intelligence and Neuroscience
 (2021)

---

## Abstract

Distant supervision is an effective method to automatically collect large-scale datasets for relation extraction (RE). Automatically constructed datasets usually comprise two types of noise: the intrasentence noise and the wrongly labeled noisy sentence. To address issues caused by the above two types of noise and improve distantly supervised relation extraction, this paper proposes a novel distantly supervised relation extraction model, which consists of an entity-based gated convolution sentence encoder and a multilevel sentence selective attention (Matt) module. Specifically, we first apply an entity-based gated convolution operation to force the sentence encoder to extract entity-pair-related features and filter out useless intrasentence noise information. Furthermore, the multilevel attention schema fuses the bag information to obtain a fine-grained bag-specific query vector, which can better identify valid sentences and reduce the influence of wrongly labeled sentences. Experimental results on a large-scale benchmark dataset show that our model can effectively reduce the influence of the above two types of noise and achieves state-of-the-art performance in relation extraction.


---

## Body

## 1. Introduction

The goal of relation extraction is to identify the relationship between two given entities in a sentence. Conventional RE models are trained in a supervised manner with manually labeled data. However, as it is labor intensive to build large-scale manually labeled dataset, the size of the data will limit the effectiveness of the model. So, distant supervision was proposed to solve this problem, in which large-scale labeled data are automatically generated [1].In distant supervision, a fact tripleh,t,r of a given knowledge graph (KG) contains the two entities h and t, where h, t, and r denote head entity, tail entity, and relation, respectively. Distant supervision will label all sentences containing the two entities handt with the relation r. Although distant supervision can effectively construct a large-scale relation extraction dataset, it suffers from the inevitable problem of incorrect labeling. This is because not all sentences that contain the entity pair can correctly express the relations in the given KG. For example, given a triple (Bill Gates, Microsoft, and business/company/founders) in a KG and a sentence “Bill Gates retired from Microsoft,” distant supervision will label the sentence with “business/company/founders,” which is clearly an incorrect label.In addition to the incorrect labeling issue, distant supervision also suffers from the problem of low-quality sentence, which is caused as a result of the dataset being automatically constructed by crawling web pages. We illustrate this issue using the example below. Given the sentence “The problem might have been that the family was in NBC’s suite, but Dick Ebersol, the chairman of NBC Universal Sports, said by telephone that…,” we find that the part which expresses the relationship contained in the triple (“Dick Ebersol,” “NBC Universal Sports,” and “/business/person/company”) is the subsentence “but Dick Ebersol, the chairman of NBC Universal Sports.” The other parts of the sentence are meaningless for the relation extraction and may even hinder the performance of the model.To address these issues, we need to work on the following two fronts: (1) filter out the useless intrasentence noise information when learning sentence representations and (2) reduce the influence of wrongly labeled noisy sentences. For the first aspect, word-level attention has been leveraged to emphasize relational words [2]; however, the effect of useless words cannot be significantly reduced as the proportion of useless words is usually large. Liu et al. [3] proposed the subtree parse (STP) method which intercepts the subtree of each sentence under the lowest common ancestor of the parent entities to remove the useless parts. However, an extraparser is required to preprocess the sentence; hence, the effectiveness of the model will be affected by the performance of the parser. For the second aspect, recent works employed the multi-instance learning (MIL) schema to solve this problem [4, 5]. In these studies, researchers divided sentences into different bag. In each bag, all the sentences contain the same entity pair. And relation extraction proceeds at the bag-level. Furthermore, various extensions of sentence selective attention were proposed to reduce the influence of noise sentences under MIL schema [6–8]. Nevertheless, the semantic information of the whole entity-pair bag is rarely considered in most existing attention-based models. Even for the same relation, different entity pairs express them in different ways. So, the semantic information of the whole entity-pair bag can help to better identify the valid sentences.In this paper, we propose a novel model for relation extraction to tackle the two types of noise problems introduced by distant supervision. The model is composed of two main modules. One is an entity-based gated convolution sentence encoder. The entity-based gate of the encoder forces the convolution operation to focus on extracting the features related to the entity pair, and the intrasentence noise is filtered out through the pooling operation. After obtaining sentence representations, we apply the second component, the Matt module, to address the problem of wrongly labeled sentences. The Matt module first adopts the original attention mechanism to obtain a first-level bag representation and then fuses it with the query vector through the gated recurrent unit (GRU) to obtain a bag-specific query vector that is aware of the semantic information of the entity-pair bag. Finally, we use the bag-specific query vector to calculate the attention weights and obtain the final bag representation.The contributions of this paper are summarized as follows:(i)
To get rid of the influence of the intrasentence noise, we propose an entity-based gated convolution to filter out the useless information and extract entity-pair-related relational features from a sentence(ii)
To address the problem of incorrect labeling, we design a Matt module that generates a bag-specific query vector to assign lower attention scores to those noise sentences(iii)
Experimental results on a large-scale benchmark dataset show that our model can effectively reduce the influence of the above two types of noise and achieve state-of-the-art performance in relation extraction.The remainder of this paper is organized as follows. In Section2, we present some related work for open domain relation extraction. In Section 3, we present our proposed relation extraction model. Next, in Section 4, we present experimental results of our model and then analyze the results. Finally, in Section 5, we make a conclusion of our paper and propose our future work.


## 2. Related Work

RE is a fundamental task in natural language processing (NLP). The purpose of relation e-traction is to identify the relationship between two given entities in a sentence. And it can be seen as a kind of text classification task. In text classification, there are two kinds of common methods: the traditional machine learning-based methods [9] and the neural network-based methods [10].Similarly, RE models can also be divided into above two kinds. Traditional RE methods used manually constructed features and adopted kernel-based classifier to classify the relationship [11, 12]. Recently, neural network-based RE methods have attracted increasing attention. These methods can automatically extract relational features for relation classification and have been found to achieve good performance [2, 13–16]. Some models enhanced the performance of the model by reducing intrasentence noise. Zhou et al. [2] and Jat et al. [17] adopted word-level attention to emphasize relational words and attenuate useless words, but the effect of useless words cannot be significantly reduced for the proportion of useless words that is usually large. Liu et al. [3] built STP to remove noisy words and constructed a neural network inputting the subtree. However, its performance would be affected by the accuracy of the parser.Like most neural network models, the lack of annotation data limits the performance of these neural relation extraction models. To tackle this problem, distant supervision was proposed to automatically generate large-scale training data for relation extraction [1]. However, this results in the inevitable problem of incorrect labeling. To address this issue, recent works employed MIL schema, in which the relation classification proceeds on bag-level [4, 5, 14, 18]. Moreover, sentence-level attention and its extensions are widely used to reduce the impact of wrong labeled sentences [6, 8, 19]. Apart from these methods, some other selector-based models have also been adapted for RE recently. Reinforcement learning (RL) also was applied to train a binary sentence classifier to remove noise instances [20, 21]. Qin et al. [22] designed a delicate generative adversarial network (GAN), and the classification part is used as a sentence selector. The above methods have alleviated the problem of incorrect labeling to varying degrees.In this paper, we propose a distantly supervised relation extraction model which is aimed at reducing both intrasentence noise and wrongly labeled noisy sentence. Different from the existing word-level noise reduction models, our model can extract entity-pair-related features and directly filter out the intrasentence noise without the help of any extraparser. As compared with the widely used sentence-level attention model, our Matt module further exploits the bag’s semantic information when calculating the attention scores and can better identify valid sentences.


## 3. Method

In this section, we will introduce our distantly supervised relation extraction model in detail. The architecture of our model is shown in Figure1. The notations and definitions are given as follows.Figure 1
Architecture of our model. The overall structure of our model is in the left, the details of sentence encoder and Matt are in the middle, and details of the entity-based gated convolution operation are on the right.


### 3.1. Notation

Given a KGG=E,R,F, we use E, R, and F to denote entities sets, relations sets, and facts sets. The fact in the knowledge graph refers to the relational triple h,t,r, indicating that there exists a relation r∈ℛ between a head entity h∈E and a tail entity t∈E. Following the MIL setting, we divided all sentences into several entity-pair bags Sh1,t1,Sh2,t2,…. Each bag Shi,ti contains several sentences s1,s2,…, in which all the sentences contain the same entity pair hi,ti. The distant supervision labels the entity-pair bag Shi,ti with the corresponding relation ri in the fact triple hi,ri,ti. Each sentence s is composed of a sequence of words s=w1,w2,….


### 3.2. Overall Framework

Given an entity pairhi,ti and its corresponding entity-pair bag Shi,ti, the relation extractor aims to obtain the probability Pr|hi,ti,Shi,ti of each relation r∈ℛ existing between hi and ti.As shown in Figure1, our relation extractor is composed of two modules: an entity-based gated convolution sentence encoder and a Matt module. First, the entity-based gated convolution sentence encoder encodes each sentence si in the entity-pair bag Shi,ti into a low-dimensional, fixed-length vector si. Then, to reduce the impact of wrongly labeled sentences in each bag, we adopt a Matt module to assign an attention weight αi for each sentence si. After obtaining the sentence representations and their corresponding attention weights, we calculate the weighted sum of sentence representations as the bag representation rhi,ti for the entity-pair bag:(1)rhi,ti=∑αjsj.Finally, we feed the bag representation to the linear projection and softmax function to obtain the conditional probabilityPr|hi,ti,Shi,ti for each relation r:(2)o=W⋅rhi,ti,Pr|hi,ti,Shi,ti=expor∑k=1nrexpok,where W is the weight matrix and nr is the relation number.


### 3.3. Entity-Based Gated Convolution Sentence Encoder

Given a sentences=w1,w2,… and the entity pair h,t, we employ the entity-based gated convolution sentence encoder to extract relational features for relation classification.


#### 3.3.1. Input Layer

Firstly, we feed the given sentences into the input layer to embed s into a matrix, which contains both semantic and positional information of each word.(1) Word Embedding. Word embeddings are low-dimensional, continuous, and real-valued vectors, which can capture semantic meanings of words. They can embed each word in the vocabulary into a vector vw∈Rdw. In this paper, we use the New York Times (NYT) corpus to train the word embedding with the Skip-Gram [23] algorithm.(2) Position Embedding. Position embeddings can capture the positional information of each word. We utilize the relative position between each token and the two target entities to indicate the position of the token. For example, in the sentence “Yao Ming was born in Shanghai,” the relative position from the word born to the target entity Yao Ming is 2 and to Shanghai −2. Position embeddings embed each relative position value into a vector vp∈Rdp.We concatenate the word embeddingvw and two position embeddings (each corresponds to one target entity) vpen1 and vpen2 to get the word representation v∈Rdw+dp∗2. Given a sentence s=w1,…,wn with n words, we concatenate all words representations to obtain an embedding matrix C=v1;…;vn.


#### 3.3.2. Entity-Based Gated Convolution

The entity-based gated convolution is composed of a gated convolution layer and a pooling layer.(1) Gated Convolution Layer. The gated convolution layer consists of two convolution units. One of them is a plain convolution unit; the other is an entity-based convolution operation. In the plain convolution, a convolution kernel Ws∈ℛdv×m×k slides through the embedding matrix C, where dv=dw+dp∗2 is the dimension of the word representation, m is the size of convolution kernel, and k is the dimension of the output. The k-dimensional hidden features are calculated as follows:(3)his=ReLUvi−m−1/2,…,vi+m−1/2⊗Ws+bs,where ⊗ denotes the convolution operation.Regarding the entity-based convolution, an entity-related componentWen⋅venT is added to the original convolution operation. Wen∈Rk×2∗dv is a weight matrix, and ven=wen1wen2∈R2∗dv is the concatenation of the embedding vectors of two entities wen1 and wen2. The entity-related hidden features are calculated as follows:(4)hien=σvi−m−1/2,...,vi+m−1/2⊗Wg+Wen⋅ven+bg,where σ represents the sigmod function, Wg∈Rdv×m×k is the convolution kernel, and bg∈Rk is a bias. Then, the entity-based gated convolution feature vector is obtained by computing an element-wise multiplication between hs and hen:(5)hig=his⊙hien,where ⊙ denotes element-wise multiplication. Through the operation in equation (5), the entity-related features hen function as a controlling gate to force the gated convolution operation to extract relational features that relate to a given entity pair. Then, an entity-based gated convolution feature map Hg=h1g;h2g;… is fed to the pooling layer.(2) Pooling Layer. For the pooling layer, two alternatives are adopted: the traditional max-pooling and the piecewise max-pooling. In the following sections, we will abbreviate entity-based gated convolution with max-pooling and piecewise max-pooling as entity-based gated convolution network (EGCNN) and entity-based gated piecewise convolution network (EGPCNN), respectively. The traditional max-pooling operation selects the maximum value of each row of the feature map Hg to obtain the final feature vector:(6)qj=max1≤j≤nhi,j.Piecewise max-pooling is a variant of the traditional max-pooling operation:(7)qj1=max1≤j＜ien1hi,j,qj2=maxien1≤j＜ien2hi,j,qj3=maxien2＜j≤nhi,j,in which the subscript j denotes the j-th element of a vector and ien1 and ien2 are the positions of two entities. Then, three pooling vectors are concatenated to get the final sentence representation as follows:(8)qj=qj1,qj2,qj3.


### 3.4. Multilevel Sentence Selective Attention

After encoding sentences with the sentence encoder, we obtain the sentence representationss1,s2,… for each entity-pair bag Sh,t=s1,s2,…. We adopt a multilevel sentence selective attention to generate attention weight for each sentence.We first obtain the first-level bag embedding via the original sentence-level attention mechanism. The attention weightβ for each sentence is calculated as follows:(9)ei=qrTWasi,βi=expei∑jNexpej,where Wa∈Rdv×dv is the weight matrix, N is the number of sentences, and qr is the query vector assigned for the relation r. Accordingly, we obtain the bag embedding r by calculating the weighted sum of sentence representations as in equation (1). To simplify the notion, we abbreviate the operations for calculating the attention weight in equation (9) as follows:(10)ATTqr,s,where the first element qr denotes the query vector and the second element s denotes the sentence representations.After obtaining the first-level bag embedding, we adopt a nonlinear operation to fuse the semantic information in the bag embeddingr into the original query vector qr to obtain a bag-specific query vector.In particular, we employ GRU to update the original query vector. Given the original query vectorqr and the first-level bag embedding r, the bag-specific query vector qrb is calculated as follows:(11)r=σWrr+Urqr,(12)z=σWzr+Uzqr,(13)q˜rb=tanhWxr+Wgr⊙qr,(14)qrb=1−z⊙qr+z⊙q˜rb,where Wr, Wz, Ur, Uz, and Wx∈ℛdv×dv. As we can see from equations (13) and (14), the state of the bag-specific query vector qrb is the interpolation of the original query vector qr and the bag embedding r. Thus, the bag-specific query vector contains both the relational information and the whole bag’s semantic information, which can be adopted to provide more fine-grained sentence selection.Then, we calculate the bag-specific attention scoreαi for sentence si as follows:(15)αi=ATTqrb,si.Accordingly, with the bag-specific attention scoresα1,α2,… and the sentence representations s1,s2,…, we can compute the final bag embedding rh,t using equation (1). The bag embedding rh,t is fed to the linear projection, and the softmax function is used to calculate the conditional probability Pr|h,t,Sh,t following equation (2).


### 3.5. Training

We employ the negative log likelihood as loss for our model. Given a collection of sentence bagsΩ=Sh1,t1,Sh2,t2,… and corresponding labeling relation ri,r2,…, the loss is defined as follows:(16)ℒ=−1Ω∑i=1Ωlogpri|hi,ti,Shi,ti,θ,where Ω is the number of bags. To optimize our model, we apply Adam optimizer [24] to minimize the loss in equation (16).


## 3.1. Notation

Given a KGG=E,R,F, we use E, R, and F to denote entities sets, relations sets, and facts sets. The fact in the knowledge graph refers to the relational triple h,t,r, indicating that there exists a relation r∈ℛ between a head entity h∈E and a tail entity t∈E. Following the MIL setting, we divided all sentences into several entity-pair bags Sh1,t1,Sh2,t2,…. Each bag Shi,ti contains several sentences s1,s2,…, in which all the sentences contain the same entity pair hi,ti. The distant supervision labels the entity-pair bag Shi,ti with the corresponding relation ri in the fact triple hi,ri,ti. Each sentence s is composed of a sequence of words s=w1,w2,….


## 3.2. Overall Framework

Given an entity pairhi,ti and its corresponding entity-pair bag Shi,ti, the relation extractor aims to obtain the probability Pr|hi,ti,Shi,ti of each relation r∈ℛ existing between hi and ti.As shown in Figure1, our relation extractor is composed of two modules: an entity-based gated convolution sentence encoder and a Matt module. First, the entity-based gated convolution sentence encoder encodes each sentence si in the entity-pair bag Shi,ti into a low-dimensional, fixed-length vector si. Then, to reduce the impact of wrongly labeled sentences in each bag, we adopt a Matt module to assign an attention weight αi for each sentence si. After obtaining the sentence representations and their corresponding attention weights, we calculate the weighted sum of sentence representations as the bag representation rhi,ti for the entity-pair bag:(1)rhi,ti=∑αjsj.Finally, we feed the bag representation to the linear projection and softmax function to obtain the conditional probabilityPr|hi,ti,Shi,ti for each relation r:(2)o=W⋅rhi,ti,Pr|hi,ti,Shi,ti=expor∑k=1nrexpok,where W is the weight matrix and nr is the relation number.


## 3.3. Entity-Based Gated Convolution Sentence Encoder

Given a sentences=w1,w2,… and the entity pair h,t, we employ the entity-based gated convolution sentence encoder to extract relational features for relation classification.


### 3.3.1. Input Layer

Firstly, we feed the given sentences into the input layer to embed s into a matrix, which contains both semantic and positional information of each word.(1) Word Embedding. Word embeddings are low-dimensional, continuous, and real-valued vectors, which can capture semantic meanings of words. They can embed each word in the vocabulary into a vector vw∈Rdw. In this paper, we use the New York Times (NYT) corpus to train the word embedding with the Skip-Gram [23] algorithm.(2) Position Embedding. Position embeddings can capture the positional information of each word. We utilize the relative position between each token and the two target entities to indicate the position of the token. For example, in the sentence “Yao Ming was born in Shanghai,” the relative position from the word born to the target entity Yao Ming is 2 and to Shanghai −2. Position embeddings embed each relative position value into a vector vp∈Rdp.We concatenate the word embeddingvw and two position embeddings (each corresponds to one target entity) vpen1 and vpen2 to get the word representation v∈Rdw+dp∗2. Given a sentence s=w1,…,wn with n words, we concatenate all words representations to obtain an embedding matrix C=v1;…;vn.


### 3.3.2. Entity-Based Gated Convolution

The entity-based gated convolution is composed of a gated convolution layer and a pooling layer.(1) Gated Convolution Layer. The gated convolution layer consists of two convolution units. One of them is a plain convolution unit; the other is an entity-based convolution operation. In the plain convolution, a convolution kernel Ws∈ℛdv×m×k slides through the embedding matrix C, where dv=dw+dp∗2 is the dimension of the word representation, m is the size of convolution kernel, and k is the dimension of the output. The k-dimensional hidden features are calculated as follows:(3)his=ReLUvi−m−1/2,…,vi+m−1/2⊗Ws+bs,where ⊗ denotes the convolution operation.Regarding the entity-based convolution, an entity-related componentWen⋅venT is added to the original convolution operation. Wen∈Rk×2∗dv is a weight matrix, and ven=wen1wen2∈R2∗dv is the concatenation of the embedding vectors of two entities wen1 and wen2. The entity-related hidden features are calculated as follows:(4)hien=σvi−m−1/2,...,vi+m−1/2⊗Wg+Wen⋅ven+bg,where σ represents the sigmod function, Wg∈Rdv×m×k is the convolution kernel, and bg∈Rk is a bias. Then, the entity-based gated convolution feature vector is obtained by computing an element-wise multiplication between hs and hen:(5)hig=his⊙hien,where ⊙ denotes element-wise multiplication. Through the operation in equation (5), the entity-related features hen function as a controlling gate to force the gated convolution operation to extract relational features that relate to a given entity pair. Then, an entity-based gated convolution feature map Hg=h1g;h2g;… is fed to the pooling layer.(2) Pooling Layer. For the pooling layer, two alternatives are adopted: the traditional max-pooling and the piecewise max-pooling. In the following sections, we will abbreviate entity-based gated convolution with max-pooling and piecewise max-pooling as entity-based gated convolution network (EGCNN) and entity-based gated piecewise convolution network (EGPCNN), respectively. The traditional max-pooling operation selects the maximum value of each row of the feature map Hg to obtain the final feature vector:(6)qj=max1≤j≤nhi,j.Piecewise max-pooling is a variant of the traditional max-pooling operation:(7)qj1=max1≤j＜ien1hi,j,qj2=maxien1≤j＜ien2hi,j,qj3=maxien2＜j≤nhi,j,in which the subscript j denotes the j-th element of a vector and ien1 and ien2 are the positions of two entities. Then, three pooling vectors are concatenated to get the final sentence representation as follows:(8)qj=qj1,qj2,qj3.


## 3.3.1. Input Layer

Firstly, we feed the given sentences into the input layer to embed s into a matrix, which contains both semantic and positional information of each word.(1) Word Embedding. Word embeddings are low-dimensional, continuous, and real-valued vectors, which can capture semantic meanings of words. They can embed each word in the vocabulary into a vector vw∈Rdw. In this paper, we use the New York Times (NYT) corpus to train the word embedding with the Skip-Gram [23] algorithm.(2) Position Embedding. Position embeddings can capture the positional information of each word. We utilize the relative position between each token and the two target entities to indicate the position of the token. For example, in the sentence “Yao Ming was born in Shanghai,” the relative position from the word born to the target entity Yao Ming is 2 and to Shanghai −2. Position embeddings embed each relative position value into a vector vp∈Rdp.We concatenate the word embeddingvw and two position embeddings (each corresponds to one target entity) vpen1 and vpen2 to get the word representation v∈Rdw+dp∗2. Given a sentence s=w1,…,wn with n words, we concatenate all words representations to obtain an embedding matrix C=v1;…;vn.


## 3.3.2. Entity-Based Gated Convolution

The entity-based gated convolution is composed of a gated convolution layer and a pooling layer.(1) Gated Convolution Layer. The gated convolution layer consists of two convolution units. One of them is a plain convolution unit; the other is an entity-based convolution operation. In the plain convolution, a convolution kernel Ws∈ℛdv×m×k slides through the embedding matrix C, where dv=dw+dp∗2 is the dimension of the word representation, m is the size of convolution kernel, and k is the dimension of the output. The k-dimensional hidden features are calculated as follows:(3)his=ReLUvi−m−1/2,…,vi+m−1/2⊗Ws+bs,where ⊗ denotes the convolution operation.Regarding the entity-based convolution, an entity-related componentWen⋅venT is added to the original convolution operation. Wen∈Rk×2∗dv is a weight matrix, and ven=wen1wen2∈R2∗dv is the concatenation of the embedding vectors of two entities wen1 and wen2. The entity-related hidden features are calculated as follows:(4)hien=σvi−m−1/2,...,vi+m−1/2⊗Wg+Wen⋅ven+bg,where σ represents the sigmod function, Wg∈Rdv×m×k is the convolution kernel, and bg∈Rk is a bias. Then, the entity-based gated convolution feature vector is obtained by computing an element-wise multiplication between hs and hen:(5)hig=his⊙hien,where ⊙ denotes element-wise multiplication. Through the operation in equation (5), the entity-related features hen function as a controlling gate to force the gated convolution operation to extract relational features that relate to a given entity pair. Then, an entity-based gated convolution feature map Hg=h1g;h2g;… is fed to the pooling layer.(2) Pooling Layer. For the pooling layer, two alternatives are adopted: the traditional max-pooling and the piecewise max-pooling. In the following sections, we will abbreviate entity-based gated convolution with max-pooling and piecewise max-pooling as entity-based gated convolution network (EGCNN) and entity-based gated piecewise convolution network (EGPCNN), respectively. The traditional max-pooling operation selects the maximum value of each row of the feature map Hg to obtain the final feature vector:(6)qj=max1≤j≤nhi,j.Piecewise max-pooling is a variant of the traditional max-pooling operation:(7)qj1=max1≤j＜ien1hi,j,qj2=maxien1≤j＜ien2hi,j,qj3=maxien2＜j≤nhi,j,in which the subscript j denotes the j-th element of a vector and ien1 and ien2 are the positions of two entities. Then, three pooling vectors are concatenated to get the final sentence representation as follows:(8)qj=qj1,qj2,qj3.


## 3.4. Multilevel Sentence Selective Attention

After encoding sentences with the sentence encoder, we obtain the sentence representationss1,s2,… for each entity-pair bag Sh,t=s1,s2,…. We adopt a multilevel sentence selective attention to generate attention weight for each sentence.We first obtain the first-level bag embedding via the original sentence-level attention mechanism. The attention weightβ for each sentence is calculated as follows:(9)ei=qrTWasi,βi=expei∑jNexpej,where Wa∈Rdv×dv is the weight matrix, N is the number of sentences, and qr is the query vector assigned for the relation r. Accordingly, we obtain the bag embedding r by calculating the weighted sum of sentence representations as in equation (1). To simplify the notion, we abbreviate the operations for calculating the attention weight in equation (9) as follows:(10)ATTqr,s,where the first element qr denotes the query vector and the second element s denotes the sentence representations.After obtaining the first-level bag embedding, we adopt a nonlinear operation to fuse the semantic information in the bag embeddingr into the original query vector qr to obtain a bag-specific query vector.In particular, we employ GRU to update the original query vector. Given the original query vectorqr and the first-level bag embedding r, the bag-specific query vector qrb is calculated as follows:(11)r=σWrr+Urqr,(12)z=σWzr+Uzqr,(13)q˜rb=tanhWxr+Wgr⊙qr,(14)qrb=1−z⊙qr+z⊙q˜rb,where Wr, Wz, Ur, Uz, and Wx∈ℛdv×dv. As we can see from equations (13) and (14), the state of the bag-specific query vector qrb is the interpolation of the original query vector qr and the bag embedding r. Thus, the bag-specific query vector contains both the relational information and the whole bag’s semantic information, which can be adopted to provide more fine-grained sentence selection.Then, we calculate the bag-specific attention scoreαi for sentence si as follows:(15)αi=ATTqrb,si.Accordingly, with the bag-specific attention scoresα1,α2,… and the sentence representations s1,s2,…, we can compute the final bag embedding rh,t using equation (1). The bag embedding rh,t is fed to the linear projection, and the softmax function is used to calculate the conditional probability Pr|h,t,Sh,t following equation (2).


## 3.5. Training

We employ the negative log likelihood as loss for our model. Given a collection of sentence bagsΩ=Sh1,t1,Sh2,t2,… and corresponding labeling relation ri,r2,…, the loss is defined as follows:(16)ℒ=−1Ω∑i=1Ωlogpri|hi,ti,Shi,ti,θ,where Ω is the number of bags. To optimize our model, we apply Adam optimizer [24] to minimize the loss in equation (16).


## 4. Result and Discussion

### 4.1. Dataset and Evaluation

Following the existing literature, we evaluate our model on the New York Times (NYT) dataset developed by Riedel et al. [4]. The NYT dataset is constructed by aligning Freebase with NYT corpus through distant supervision. The training set and the test set contain 522611 and 172448 sentences, separately. These sentences are divided into 53 candidate categories. There is a label “NA” in these 53 relations, indicating that there is no relationship between two target entities. During training, we randomly select 10% of the sentences from the training data as the validation data.We evaluate all methods via the held-out evaluation, which compares the relational facts extracted from the test set by the models with all the facts existing in the test set. For evaluation, we present precision-recall curves for all models. Furthermore, we also report the Precision@N results of all models .Table 1
Experimental parameter settings.
Batch sizeLearning rateMaximum sentence lengthHidden layer dimension for CNNsWord dimensionPosition dimensionConvolution kernel sizeDropout rate500.00112023050530.5


### 4.2. Implementation Detail

(1)
In the experiment, we set most of the experimental parameters according to Lin et al. [6]. We also utilize dropout on the fully connected layers in our model to avoid overfitting. The detailed experimental parameter value settings used in our experiments are summarized in Table 1. For model training, we adopt Adam optimizer to update the model. We conduct experiments on two NVIDIA GTX K40. The algorithm is written in python in Ubuntu 16.04 system.


### 4.3. Comparison with Previous Models

In order to evaluate the effectiveness of our relation extraction model, we compare it with five recent representative models:PCNN + MIL. This work [18] proposed piecewise convolution network (PCNN) to obtain sentence representations and utilized the MIL framework to solve the noise problemPCNN + ATT. This work [6] used piecewise convolution network to obtain sentence vectors and adopted the attention mechanism to alleviate the impact of noise sentenceSTP. This work [3] built a subtree parse method to reduce intrasentence noise and constructed a neural network inputting the subtree while applying entity-wise attention to identify the important semantic featuresPCNN + PU. This work [25] applied RL to construct positive and unlabeled bag and improve the distantly supervised relation extraction model with positive and unlabeled (PU) learning.JOINT_PCNN + RL. This work [26] introduced a RL framework to jointly train a sentence-level relation extraction modelWe evaluate all the competing models and our proposed models (EGPCNN + Matt and EGPCNN + ATT) via held-out evaluation and report their performances with the precision-recall curve in Figure2.Figure 2
Comparison with representative models.From the results, we can observe the following :(1)
When compared with the two baseline models: PCNN + MIL and PCNN + ATT, our models exhibit a significant improvement. It indicates that the two well-designed components in our model can assist in extracting a more delicate bag representation and improve the performance of relation extraction. Furthermore, we will discuss the effects of each component in Section4.4.(2)
Our EGPCNN + ATT model steadily outperforms STP, which takes measures to reduce the influence of the intrasentence noise, in precision-recall curve. This result indicates that, as compared with models which removes noise words with extraparser, our entity-based gated convolution operation can improve the extraction of effective features and directly filter out intrasentence noise.(3)
EGPCNN + Matt also outperforms the PCNN + PU and JOINT_PCNN + RL model. PCNN + PU is a novel work that adopts RL and makes full use of positive and unlabeled bags. JOINT_PCNN + RL also utilizes reinforced learning but to train the sentence encoder. This demonstrates the effectiveness of our model, which can eliminate the noise in both word and sentence level.(4)
Table2 shows P@N for relation extraction using variable number of sentences in bags (with more than one sentence). Here, one, two, and all represent the number of sentences randomly selected from a bag. We can observe that the EGPCNN + Matt model achieves the best result among all models. Especially in the experiment of all sentence situation, the EGPCNN + Matt model shows apparent advantage, which indicates our model can better filter out noise information when there are large amounts of instances and retain more useful information.Table 2
P@N for relation extraction using variable number of sentences in bags (with more than one sentence).
P@NOneTwoAll100200300Mean100200300Mean100200300MeanPCNN + MIL0.730.650.570.6500.700.670.630.6670.720.700.640.687PCNN + ATT0.730.690.610.6770.770.720.660.7170.760.730.670.720STP0.830.760.670.7520.850.810.720.7940.870.830.780.827PCNN + PU0.870.760.700.7770.890.790.720.7990.900.820.770.828JOINT_RL0.860.750.710.7730.870.800.740.8030.880.830.760.830EGPCNN + ATT0.850.780.690.7730.860.810.730.8000.890.830.780.833EGPCNN + Matt0.880.780.730.7970.880.830.750.8200.900.850.800.850


### 4.4. Effect of Various Model Components

In this section, we conduct more experiments to further evaluate the effects of different components in our model.


#### 4.4.1. Effect of the Entity-Based Gated Convolution

To evaluate the effect of the entity-based gated convolution, we compare the performances of the following three models: (1) PCNN with sentence-level attention (PCNN + ATT), (2) gated PCNN with sentence-level attention (GPCNN + ATT), and (3) entity-based gated PCNN with sentence-level attention (EGPCNN + ATT). The difference between the second and the third models is that the second model removes the entity-related componentWen⋅venT from equation (4).We display the performances of above models with precision-recall curves in Figure3. From Figure 3, we can obtain the following: (1) EGPCNN + ATT significantly outperforms the other two models, which indicates that the entity-based gated convolution operation is effective at extracting entity-pair-related features and can help improve the relation extraction performance; (2) GPCNN + ATT, which removes the entity-related component, has no improvement when compared with the PCNN + ATT. It demonstrates that the entity-related component Wen⋅venT is a crucial part to the gated convolution operation. Without the entity information in the entity-related component, the convolution gate cannot filter out the intrasentence noisy information.Figure 3
Comparison between PCNN + ATT, GPCNN + ATT, and EGPCNN + ATT.To further verify that the entity-based gated convolution can extract better sentence representations, we conduct experiments on the sentence-level relation classification task. We randomly chose 300 sentences and manually labeled the relation type for each sentence to construct a test set. We consider each sentence as an entity-pair bag with only one sentence; the attention weight for the sentence is 1, and the bag representation is identical to the sentence representation. We adopt CNN + ATT and PCNN + ATT as baseline models and compare their performances with EGCNN + ATT and EGPCNN + ATT, both of which add an entity-based gated convolution component on the basis of the two baseline models. We adopted accuracy and macroaveraged F1 as the evaluation metric.As shown in Table3, EGCNN + ATT and EGPCNN + ATT outperform CNN + ATT and PCNN + ATT by 0.16 and 0.07 in macroaveraged F1 and 0.06 and 0.07 in accuracy, respectively. These results further verify that the entity-based gated convolution operation can eliminate the influence of useless words and extract sentence representations better than the convolution operation without entity-based gate.Table 3
Performance comparison of different sentence encoders on the sentence-level relation extraction task.
MethodMacro F1AccuracyCNN + ATT0.300.58EGCNN + ATT0.460.64PCNN + ATT0.450.66EGPCNN + ATT0.520.73


#### 4.4.2. Effect of the Multilevel Sentence Selective Attention

To evaluate the effect of the multilevel sentence selective attention in our model, we adopt PCNN + ATT and EGPCNN + ATT as baseline. We combine the two baseline models with the Matt module and utilize the PR curve to evaluate the performances of four models: PCNN + ATT, EGPCNN + ATT, PCNN + Matt, and EGPCNN + Matt.Figure4 shows that PCNN + Matt and PECNN + Matt outperform PCNN + ATT and PECNN + ATT separately. This result demonstrates that multilevel sentence selective attention can eliminate the effects of noisy sentences more effectively than the original attention, and the multilevel attention mechanism will not be influenced by the structure of the sentence encoder.Figure 4
Comparison between PCNN + ATT, EGPCNN + ATT, PCNN + Matt, and EGPCNN + Matt.Figure5 shows the effect of different layer number for the PCNN + Matt model. From the results, we can find out that the two-layer structure achieves the best performance. When the layer number continues to increase, the performance of model declines.Figure 5
Performance comparison between different number of attention layers.


## 4.1. Dataset and Evaluation

Following the existing literature, we evaluate our model on the New York Times (NYT) dataset developed by Riedel et al. [4]. The NYT dataset is constructed by aligning Freebase with NYT corpus through distant supervision. The training set and the test set contain 522611 and 172448 sentences, separately. These sentences are divided into 53 candidate categories. There is a label “NA” in these 53 relations, indicating that there is no relationship between two target entities. During training, we randomly select 10% of the sentences from the training data as the validation data.We evaluate all methods via the held-out evaluation, which compares the relational facts extracted from the test set by the models with all the facts existing in the test set. For evaluation, we present precision-recall curves for all models. Furthermore, we also report the Precision@N results of all models .Table 1
Experimental parameter settings.
Batch sizeLearning rateMaximum sentence lengthHidden layer dimension for CNNsWord dimensionPosition dimensionConvolution kernel sizeDropout rate500.00112023050530.5


## 4.2. Implementation Detail

(1)
In the experiment, we set most of the experimental parameters according to Lin et al. [6]. We also utilize dropout on the fully connected layers in our model to avoid overfitting. The detailed experimental parameter value settings used in our experiments are summarized in Table 1. For model training, we adopt Adam optimizer to update the model. We conduct experiments on two NVIDIA GTX K40. The algorithm is written in python in Ubuntu 16.04 system.


## 4.3. Comparison with Previous Models

In order to evaluate the effectiveness of our relation extraction model, we compare it with five recent representative models:PCNN + MIL. This work [18] proposed piecewise convolution network (PCNN) to obtain sentence representations and utilized the MIL framework to solve the noise problemPCNN + ATT. This work [6] used piecewise convolution network to obtain sentence vectors and adopted the attention mechanism to alleviate the impact of noise sentenceSTP. This work [3] built a subtree parse method to reduce intrasentence noise and constructed a neural network inputting the subtree while applying entity-wise attention to identify the important semantic featuresPCNN + PU. This work [25] applied RL to construct positive and unlabeled bag and improve the distantly supervised relation extraction model with positive and unlabeled (PU) learning.JOINT_PCNN + RL. This work [26] introduced a RL framework to jointly train a sentence-level relation extraction modelWe evaluate all the competing models and our proposed models (EGPCNN + Matt and EGPCNN + ATT) via held-out evaluation and report their performances with the precision-recall curve in Figure2.Figure 2
Comparison with representative models.From the results, we can observe the following :(1)
When compared with the two baseline models: PCNN + MIL and PCNN + ATT, our models exhibit a significant improvement. It indicates that the two well-designed components in our model can assist in extracting a more delicate bag representation and improve the performance of relation extraction. Furthermore, we will discuss the effects of each component in Section4.4.(2)
Our EGPCNN + ATT model steadily outperforms STP, which takes measures to reduce the influence of the intrasentence noise, in precision-recall curve. This result indicates that, as compared with models which removes noise words with extraparser, our entity-based gated convolution operation can improve the extraction of effective features and directly filter out intrasentence noise.(3)
EGPCNN + Matt also outperforms the PCNN + PU and JOINT_PCNN + RL model. PCNN + PU is a novel work that adopts RL and makes full use of positive and unlabeled bags. JOINT_PCNN + RL also utilizes reinforced learning but to train the sentence encoder. This demonstrates the effectiveness of our model, which can eliminate the noise in both word and sentence level.(4)
Table2 shows P@N for relation extraction using variable number of sentences in bags (with more than one sentence). Here, one, two, and all represent the number of sentences randomly selected from a bag. We can observe that the EGPCNN + Matt model achieves the best result among all models. Especially in the experiment of all sentence situation, the EGPCNN + Matt model shows apparent advantage, which indicates our model can better filter out noise information when there are large amounts of instances and retain more useful information.Table 2
P@N for relation extraction using variable number of sentences in bags (with more than one sentence).
P@NOneTwoAll100200300Mean100200300Mean100200300MeanPCNN + MIL0.730.650.570.6500.700.670.630.6670.720.700.640.687PCNN + ATT0.730.690.610.6770.770.720.660.7170.760.730.670.720STP0.830.760.670.7520.850.810.720.7940.870.830.780.827PCNN + PU0.870.760.700.7770.890.790.720.7990.900.820.770.828JOINT_RL0.860.750.710.7730.870.800.740.8030.880.830.760.830EGPCNN + ATT0.850.780.690.7730.860.810.730.8000.890.830.780.833EGPCNN + Matt0.880.780.730.7970.880.830.750.8200.900.850.800.850


## 4.4. Effect of Various Model Components

In this section, we conduct more experiments to further evaluate the effects of different components in our model.


### 4.4.1. Effect of the Entity-Based Gated Convolution

To evaluate the effect of the entity-based gated convolution, we compare the performances of the following three models: (1) PCNN with sentence-level attention (PCNN + ATT), (2) gated PCNN with sentence-level attention (GPCNN + ATT), and (3) entity-based gated PCNN with sentence-level attention (EGPCNN + ATT). The difference between the second and the third models is that the second model removes the entity-related componentWen⋅venT from equation (4).We display the performances of above models with precision-recall curves in Figure3. From Figure 3, we can obtain the following: (1) EGPCNN + ATT significantly outperforms the other two models, which indicates that the entity-based gated convolution operation is effective at extracting entity-pair-related features and can help improve the relation extraction performance; (2) GPCNN + ATT, which removes the entity-related component, has no improvement when compared with the PCNN + ATT. It demonstrates that the entity-related component Wen⋅venT is a crucial part to the gated convolution operation. Without the entity information in the entity-related component, the convolution gate cannot filter out the intrasentence noisy information.Figure 3
Comparison between PCNN + ATT, GPCNN + ATT, and EGPCNN + ATT.To further verify that the entity-based gated convolution can extract better sentence representations, we conduct experiments on the sentence-level relation classification task. We randomly chose 300 sentences and manually labeled the relation type for each sentence to construct a test set. We consider each sentence as an entity-pair bag with only one sentence; the attention weight for the sentence is 1, and the bag representation is identical to the sentence representation. We adopt CNN + ATT and PCNN + ATT as baseline models and compare their performances with EGCNN + ATT and EGPCNN + ATT, both of which add an entity-based gated convolution component on the basis of the two baseline models. We adopted accuracy and macroaveraged F1 as the evaluation metric.As shown in Table3, EGCNN + ATT and EGPCNN + ATT outperform CNN + ATT and PCNN + ATT by 0.16 and 0.07 in macroaveraged F1 and 0.06 and 0.07 in accuracy, respectively. These results further verify that the entity-based gated convolution operation can eliminate the influence of useless words and extract sentence representations better than the convolution operation without entity-based gate.Table 3
Performance comparison of different sentence encoders on the sentence-level relation extraction task.
MethodMacro F1AccuracyCNN + ATT0.300.58EGCNN + ATT0.460.64PCNN + ATT0.450.66EGPCNN + ATT0.520.73


### 4.4.2. Effect of the Multilevel Sentence Selective Attention

To evaluate the effect of the multilevel sentence selective attention in our model, we adopt PCNN + ATT and EGPCNN + ATT as baseline. We combine the two baseline models with the Matt module and utilize the PR curve to evaluate the performances of four models: PCNN + ATT, EGPCNN + ATT, PCNN + Matt, and EGPCNN + Matt.Figure4 shows that PCNN + Matt and PECNN + Matt outperform PCNN + ATT and PECNN + ATT separately. This result demonstrates that multilevel sentence selective attention can eliminate the effects of noisy sentences more effectively than the original attention, and the multilevel attention mechanism will not be influenced by the structure of the sentence encoder.Figure 4
Comparison between PCNN + ATT, EGPCNN + ATT, PCNN + Matt, and EGPCNN + Matt.Figure5 shows the effect of different layer number for the PCNN + Matt model. From the results, we can find out that the two-layer structure achieves the best performance. When the layer number continues to increase, the performance of model declines.Figure 5
Performance comparison between different number of attention layers.


## 4.4.1. Effect of the Entity-Based Gated Convolution

To evaluate the effect of the entity-based gated convolution, we compare the performances of the following three models: (1) PCNN with sentence-level attention (PCNN + ATT), (2) gated PCNN with sentence-level attention (GPCNN + ATT), and (3) entity-based gated PCNN with sentence-level attention (EGPCNN + ATT). The difference between the second and the third models is that the second model removes the entity-related componentWen⋅venT from equation (4).We display the performances of above models with precision-recall curves in Figure3. From Figure 3, we can obtain the following: (1) EGPCNN + ATT significantly outperforms the other two models, which indicates that the entity-based gated convolution operation is effective at extracting entity-pair-related features and can help improve the relation extraction performance; (2) GPCNN + ATT, which removes the entity-related component, has no improvement when compared with the PCNN + ATT. It demonstrates that the entity-related component Wen⋅venT is a crucial part to the gated convolution operation. Without the entity information in the entity-related component, the convolution gate cannot filter out the intrasentence noisy information.Figure 3
Comparison between PCNN + ATT, GPCNN + ATT, and EGPCNN + ATT.To further verify that the entity-based gated convolution can extract better sentence representations, we conduct experiments on the sentence-level relation classification task. We randomly chose 300 sentences and manually labeled the relation type for each sentence to construct a test set. We consider each sentence as an entity-pair bag with only one sentence; the attention weight for the sentence is 1, and the bag representation is identical to the sentence representation. We adopt CNN + ATT and PCNN + ATT as baseline models and compare their performances with EGCNN + ATT and EGPCNN + ATT, both of which add an entity-based gated convolution component on the basis of the two baseline models. We adopted accuracy and macroaveraged F1 as the evaluation metric.As shown in Table3, EGCNN + ATT and EGPCNN + ATT outperform CNN + ATT and PCNN + ATT by 0.16 and 0.07 in macroaveraged F1 and 0.06 and 0.07 in accuracy, respectively. These results further verify that the entity-based gated convolution operation can eliminate the influence of useless words and extract sentence representations better than the convolution operation without entity-based gate.Table 3
Performance comparison of different sentence encoders on the sentence-level relation extraction task.
MethodMacro F1AccuracyCNN + ATT0.300.58EGCNN + ATT0.460.64PCNN + ATT0.450.66EGPCNN + ATT0.520.73


## 4.4.2. Effect of the Multilevel Sentence Selective Attention

To evaluate the effect of the multilevel sentence selective attention in our model, we adopt PCNN + ATT and EGPCNN + ATT as baseline. We combine the two baseline models with the Matt module and utilize the PR curve to evaluate the performances of four models: PCNN + ATT, EGPCNN + ATT, PCNN + Matt, and EGPCNN + Matt.Figure4 shows that PCNN + Matt and PECNN + Matt outperform PCNN + ATT and PECNN + ATT separately. This result demonstrates that multilevel sentence selective attention can eliminate the effects of noisy sentences more effectively than the original attention, and the multilevel attention mechanism will not be influenced by the structure of the sentence encoder.Figure 4
Comparison between PCNN + ATT, EGPCNN + ATT, PCNN + Matt, and EGPCNN + Matt.Figure5 shows the effect of different layer number for the PCNN + Matt model. From the results, we can find out that the two-layer structure achieves the best performance. When the layer number continues to increase, the performance of model declines.Figure 5
Performance comparison between different number of attention layers.


## 5. Conclusion and Future Work

In this paper, we propose a novel distantly supervised relation extraction model. It can effectively address the problems of the intrasentence noise and the wrongly labeled sentence. The entire model contains an entity-based gated convolution sentence encoder and a Matt module. The entity-based gated convolution operation forces the sentence encoder to pay more attention to the entity-pair-related parts of the sentence and filters out the useless information. The multilevel sentence selective attention considers information of the whole bag when generating the attention weights and helps in producing improved bag representation. We conduct the experiments on a widely used dataset. Experimental results verify the effectiveness of the two modules, and our model achieves state-of-the-art results.Except the methods used in the paper, some of the most representative computational intelligence algorithms can also be used to solve the problem, like Slime mould algorithm (SMA) [27] and Harris hawks optimization (НHO) [28]. Different from these models, our model proposes the Matt to reduce the sentence-level noise and the EGPCNN to reduce the inner-sentence noise and improve the performance of RE.In the future, we plan to adopt extra information like entity description and sentence syntax information to help extract more precise entity-pair-related relational features. Furthermore, we will combine our attention model with recent selector-based denoising methods to address the problem of wrongly labeled sentence. These selector-based denoising methods train a sentence classifier to further remove the wrongly labeled sentence and can further improve our model.



---

*Source: 6110885-2021-11-01.xml*