HFMRE : Constructing H uffman Tree in Bags to Find Excellent Instances for Distantly Supervised Relation Extraction (2023)

Abstract: Since the introduction of distantly supervised relation extraction methods, numerous approaches have been developed, the most representative of which is multi-instance learning (MIL). To find reliable features that are most representative of multi-instance bags, aggregation strategies such as AVG (average), ONE (at least one), and ATT (sentence-level attention) are commonly used. These strategies tend to train third-party vectors to select sentence-level features, leaving it to the third party to decide/identify what is noise, ignoring the intrinsic associations that naturally exist from sentence to sentence. In this paper, we propose the concept of circular cosine similarity, which is used to explicitly show the intrinsic associations between sentences within a bag. We also consider the previous methods to be a crude denoising process as they are interrupted and do not have a continuous noise detection procedure. Following this consideration, we implement a relation extraction framework (HFMRE) that relies on the Huffman tree, where sentences are considered as leaf nodes and circular cosine similarity are considered as node weights. HFMRE can continuously and iteratively discriminate noise and aggregated features during the construction of the Huffman tree, eventually finding an excellent instance that is representative of a bag-level feature. The experiments demonstrate the remarkable effectiveness of our method, outperforming previously advanced baselines on the popular DSRE datasets.

## introduction in natural language understanding tasks, relation extraction is an important fundamental task. its goal is to understand the contextual information of a sentence or paragraph to identify the target relationships of entities in the text. translating people's perceptions of the physical world into semantic information that a computer can understand in a structured format. traditional relation extraction methods currently rely on large-scale, high-quality datasets, which are often labor-intensive and timeconsuming. to address the difficulty of obtaining high-quality annotated samples, @xcite et al. proposed a distantly supervised relation extraction algorithm. they make an important assumption: for a triad in an existing knowledge graph, it is assumed that any sentence in an external document repository (e.g. wikipedia) that contains the pair of entities reflects this relation to some extent. based on this assumption, the distantly supervised algorithm can label sentences in an external document repository with relations based on an annotated mini-knowledge graph, which is equivalent to doing automatic annotation of samples. however, this assumption suffers from data annotation problems, since a sentence may contain only this entity pair, but does not express the relationship in freebase. to alleviate the noise problem present in the dataset, @xcite et al. first combined multi-instance learning with deep learning, which is now the dominant learning framework. given a set of multi-instance bags with categorical labels, each bag contains several sentences without categorical labels. the model builds a multi-instance classifier by learning from multi-instance bags and applies this classifier to the prediction of unknown multi-instance bags. there are three main methods used to reduce or eliminate noisy data from the bag during mil: average (avg) @xcite , at-last-one (one) @xcite and sentence-level attention (att) @xcite . as shown in figure 1 , the avg is an average representation of all sentences in the bag as a feature representation of the bag. the one is to first select the highest confidence sentence in each bag, and then use only the highest confidence sentence as a feature of the bag for subsequent training. the att uses a selective attention mechanism that enables the model to assign different weights to sentences in a bag, using a weighted average of the sentencelevel representations to produce a bag-level representation. all of the above methods have some weaknesses. the avg uses an averaging operation that treats each sentence in the bag equally and inevitably introduces noise into the bag-level feature representation, causing a degradation of model performance. the one, based on the at-least-one assumption, selects the highest scoring sentence in the bag as the bag-level feature representation, avoiding the effect of noise as much as possible, but not making full use of the data in the bag, resulting in a waste of data resources. the att uses learnable attention to selectively assign weights to sentences, and although it compensates for the shortcomings of avg and one, however, we believe that this is not an optimal aggregation strategy, as it does not take into account information about the correlation between sentences, and each sentence exists in isolation within the bag. we hold one hypothesis -the inherent association between sentences within the same bag is more helpful in discriminating noise. based on this opinion, a simple and effective baseline has been developed. first, the intrinsic association of the two sentences is visualized using cosine similarity. however, we are not the first to use cosine similarity to reduce the effect of noise, @xcite the similarity between sentences and relation vectors to capture the correlation between them, and thus reduce the number of sentence instances that are not correlated with the relation facts. this is an indirect approach, where the relation vectors are trained, and are likely to be influenced by other factors in the training process, and it is largely impossible to train a perfect relation vector. we use a more direct and effective way to identify the noise, called the circular cosine similarity method (see section 3.2). simply put, it is a loop that calculates the sum of the similarity of each sentence in the bag to other sentences. the greater the sum of the similarity of a sentence, the more relevant it is to other sentences and the more likely it is to be a positive example, and vice versa. then, to exploit this correlation information between sentences, we consider each sentence in the bag as a node needed to construct a huffman tree based on the idea of huffman trees, and use the circular cosine similarity as node weights to iteratively identify noise and aggregate sentence features by merging old nodes to generate new nodes, and finally construct an excellent instance that can represent the features of the bag. as the paper uses the huffman tree idea to solve the relation extraction problem, we name our baseline model hfmre. by constructing huffman trees to reduce noise, finding excellent instances within bags has reasonable interpretability: a huffman tree is the tree with the shortest path with weights, the higher the weight, the closer to the root node. extending to the huffman tree in the paper, the circular cosine similarity is used as the weight of the nodes, so that the positive instances in the bag are close to the root node and the negative instances are far from it. when aggregating sentence features, the negative instances are then fused one step ahead of the positive instances. since the aggregation of features is a continuous updating process, as shown in figure 2 , the positive instances express more features in the root node, and the noise impact of the negative instances is significantly reduced. to validate the effectiveness of hfmre, we evaluated our model on three mainstream dsre datasets, including nyt10d, nyt10m and wiki20m. the results showed that hfmre significantly outperformed the current state-of-the-art baseline, increasing the auc by 3.2% and boosting the p@m to 86.4. in addition, the ablation study showed the individual contribution of each module. overall, the main contributions of the paper are summarized as follows: ## methodology we treat each sentence in the bag as a node to be selected that we need to construct a huffman tree, so each bag eventually generates a huffman tree and then looks through the huffman tree to find excellent instances. the huffman tree constructed in the method has the following characteristics: the main architecture of the hfmre model is shown in figure 3 . there are four major steps: sentence encoding, constructing huffman tree nodes, constructing huffman trees and relation querying. the specific details are described below. ## experiments and analysis we conduct experiments on popular datasets from the dsre task to validate the effectiveness of our method. the experimental results were analyzed in detail and ablation experiments were performed to understand the key factors affecting the performance of the model. ## conclusion and outlook in this work, we propose a relation extraction model hfmre for distantly supervised tasks to address the shortcomings of existing aggregation strategies. moving away from the traditional mindset, hfmre innovatively treats sentences as leaf nodes and continuously identifies noise and aggregates positive example features within the bag as the sentences are used to construct huffman trees. experiments have demonstrated the effectiveness of our method, as compared to existing baseline models, our hfmre can significantly identify inbag noise and is able to find an excellent instance that represents a bag-level feature. hfmre architecture. for example, hfmre can construct different huffman trees for different relations, i.e. 53(number of relations in nyt10d dataset) huffman trees can be constructed within a bag, and then relation querying can be performed on the 53 outstanding instances. alternatively, positive pair huffman trees and negative pair huffman trees can be constructed separately to further improve model performance through contrastive learning.