{'fraction_non_alphanumeric': 0.029470433048066406, 'fraction_numerical': 0.006627630139630654, 'mean_word_length': 4.7593107281823235, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Adversarial Learning for Supervised and Semi-supervised Relation Extraction in Biomedical Literature

Adversarial training is a technique of improving model performance by involving adversarial examples in the training process. In this paper, we investigate adversarial training with multiple adversarial examples to benefit the relation extraction task. We also apply adversarial training technique in semi-supervised scenarios to utilize unlabeled data. The evaluation results on protein-protein interaction and protein subcellular localization task illustrate adversarial training provides improvement on the supervised model, and is also effective on involving unlabeled data in the semi-supervised training case. In addition, our method achieves state-of-the-art performance on two benchmarking datasets.


I. INTRODUCTION
With the explosion of text in the biomedical literature, a wealth of valuable knowledge hide in the text. Applying natural language processing (NLP) technique such as relation extraction can help knowledge base curation, which is an urgent problem given that manual curation will always lags behind the fast growth of literature. Deep learning models have great power to learn the representation of the training data and have made impressive success in many domains including natural language processing [1]. Even though neural network models have achieved state-of-the-art performance on many problems, in some cases the performance is limited by the size of the training sets. Usually, the large amount of parameters in deep neural networks need large labeled dataset to train, but most new problems only have small labeled dataset available. The best way of acquiring large labeled dataset is to utilize human effort to put labels on the training data, but it is often not feasible since the labeling process could only be done by domain expertise. In this work, we will investigate to use adversarial learning to alleviate the problem of insufficient training data, specifically for relation extraction.
Adversarial method is a technique of designing malicious inputs to fool machine learning models [2]. Those malicious inputs (often called adversarial examples) are usually acquired by adding a small perturbation on the original inputs, and the process of model training using adversarial examples falls into the category of adversarial training (AT). Adversarial training in supervised learning scenario could strength the robustness and generality of the model since it involves both benign and malicious data in the training process. During the training, adversarial learning utilizes an extra loss on the adversarial examples using the same label as the corresponding example from the training data [3].
A variation of adversarial training called virtual adversarial training (VAT) was introduced in [4] to involve unlabeled data in the model training process. Other than adding adversarial examples to corresponding instances of the labeled dataset, adversarial examples are added on instances from a potentially larger unlabeled dataset. Because of the unlabeled aspect of these instances, an alternate loss function is defined. Both adversarial and virtual adversarial training can be seen as regularization method as an extra loss is added to the original loss of the model as a regularization term, which will be discussed in details later. Virtual adversarial training can also be seen as a semi-supervised learning method since it involves unlabeled data in the model training.
Adversarial training technique was first introduced in the computer vision field [5]. In recent years, adversarial training has also been applied on tasks in NLP domain such as text classification [3] and relation extraction [6], but very limited work has been done. For example, in [6], they only applied adversarial training on noisy data from MIML framework [7] and only perturbation on specific part of the input features is explored. In addition, virtual adversarial training has been only applied on text classification task in NLP field, but not on relation extraction.
In this paper, we apply adversarial training on relation extraction in the standard setting. As far as we know, this is the first work to introduce virtual adversarial training on the relation extraction tasks. To verify the effectiveness of our method, we will test it on two widely-studied relation extraction tasks in the BioNLP domain, the protein protein interaction (PPI) task [8] and the protein subcellular localization (PLOC) task [9] using three well-known benchmark datasets.
In summary, we investigate adversarial training in the stan-dard setting of relation extraction as well as apply virtual adversarial training for relation extraction. We also conduct additional experiments that might shed light on adversarial and virtual adversarial training: a). involving multiple adversarial examples during training; b). adding perturbation on all input features of the model; c). exploring the size impact of unlabeled data. In addition, we note that we obtain leading results on two benchmark datasets after application of adversarial training.

II. RELATED WORK
Relation extraction is typically seen as a classification task and current state-of-art systems on relation extraction are usually based on deep neural networks. Among all the deep learning models, two highly related network architectures are: convolutional neural networks (CNN) and recurrent neural networks (RNN). Both CNN models and RNN models have achieved notable results on relation extraction tasks [10]- [14]. Recently, many variants of them are also proposed to improve the performance by capturing more relation expression information. Piecewise-CNN (PCNN) [15] applies piecewise max pooling process after the convolutional operation to extract more structural features between the entities. Multichannel CNN model in [16] adds extra channel to capture the dependency information of the sentence syntactic structure, while the multi-channel CNN model in [17] integrates different versions of word embeddings to better represent the input words. Hua et al. [18] build a deep learning model based on shortest dependency path (SDP), which is considered to contain the most important information of the relation expression. A residual CNN model is proposed in [19] and achieves comparable performance with other deep learning models on protein protein interaction task. In this work, we will experiment with PCNN model to illustrate the effectiveness of our method.
Adversarial training is proposed by Goodfellow et al. [5] [20], which are generated by adding small adversarial perturbation on the input. This vulnerability indicates that the input-output mappings learned by deep neural networks are fairly discontinuous, which means the model will misclassify the examples after adding a small perturbation. In the NLP domain, Xie et al. [21] derive a connection between input noising (random perturbation) in neural network language models and smoothing in n-gram models. Miyato et al. [3], [4] introduce adversarial training into text classification domain by applying the perturbation to the word embedding. Wu et al. [6] apply adversarial training in relation extraction using distantly supervised data from multi-instance multi-label framework and they only perturb the word embedding part of the input to improve the robustness of the model. While this work creates adversarial examples by perturbing word embedding, we extend the work by investigating perturbing other features of the input as well. Additionally, we consider the impact of adding multiple adversarial examples at one time. Sometimes, adversarial training could be confused with the concept of generative adversarial networks (GAN) [22], which is a mechanism for training a new generative model to simulate the distribution of original data.
In order to involve unlabeled data, Miyato et al. [3], [4] extend the adversarial training to virtual adversarial training by adding a local distributional smoothness regularization term on the model loss function. This method utilizes both the labeled and unlabeled data during training, so it could also be seen as a semi-supervised method [23]. Semi-supervised learning has recently become more popular since vast quantities of unlabeled data could be collected with low cost. The most common way to utilize semi-supervised learning is to acquire labels for unlabeled data and involve them in the model training process [24].The self-training scheme [25] and the graph-based method [26], [27] belong to this kind of method. Recently, several novel methods have been proposed to involve unlabeled data for different tasks. Kingma et al. [28] demonstrates that deep generative model and approximate Bayesian inference could provide improvement on image classification task. Graph neural network [29] is also proven to be an effective semi-supervised method on classification problems. The virtual adversarial training method differs other semisupervised by employing the adversarial training technique to help smooth the model and hence makes the model perform better [4].

III. METHODOLOGY
In this section, we start with the definition of relation extraction and a set of notations. Then we describe the architecture of the deep neural network model and the input representation of the model. Next, we discuss our proposal to use multiple adversarial examples during training. The application of virtual adversarial training is introduced at the end of this section.
In this work, we detect the relation expression in a sentence. As is common, relation extraction is reduced to a binary classification problem given a sentence and the entity mentions. Hence, for a relation R, our model will predict the probability P (R|e 1 , e 2 , w 1 , w 2 , w 3 , . . . , w n ) based on two entities e 1 , e 2 within a sentence S = w 1 w 2 w 3 . . . w n where w i represent the words in a sentence.

A. PCNN Model Architecture
As mentioned before, our investigations involve the use of piecewise CNN (PCNN) [15]. Like regular CNN models for classification problem, it contains four different layers: a). convolution layer(s); b). pooling layer(s); c). fully connected layer(s) and d). a softmax layer. The function of pooling layer(s) is to summarize the local features detected from the previous convolution layer(s) and then the summarized information will be used in fully connected layer(s) and softmax layer to classify each category. PCNN model differs from the standard CNN model in its pooling operation. The pooling operation of PCNN model is applied piece-wise based on the position of the entities in the sentence, thus including more structural information. Specifically, a sentence is divided into three parts using two entities as the segment points, and pooling is operated on these three parts separately. Let us take this sentence "We demonstrate that RB PROTEIN binds directly to hTAFII250 PROTEIN in vitro and in vivo" as an example, we will do pooling on three parts: "We demonstrate that RB PROTEIN ", "binds directly to hTAFII250 PROTEIN ", and "in vitro and in vivo". At last, we concatenate these three outputs obtained from the three separate pooling operations as the final output of pooling. Fig. 1 shows the structure of the piecewise CNN model and we use different colors to illustrate three parts of pooling operation.

B. Word Representation
As discussed below, for each word in a sentence in addition to the word embedding vector, we concatenate the POS tag, entity type, entity positional information and incoming dependency relation information to form its vector representation.
Word embedding is usually learned on large corpus to represent the word better. Hence our choice in this paper is the pre-trained word embedding on the PubMed using skipgram model [30] and the dimension of word embedding vector is 200. We extract POS tag and incoming dependency information from the parse results of Bllip parser [31] and covert them to unique 10-dimension vectors. For entity positional information, we calculate the relative distance to entities (to entity 1 and entity 2). Specifically, we count the words between the target word and the entities and the distance will be marked as negative distance if a word appears at the left side of the entity. At last, we will map each distance number to unique 5-dimension vector. As for entity type, all the words in the sentence could fall into four categories: Entity1, Entity2, Entity, O, where Entity1 and Entity2 are the two interacting entities, other entities in the sentence are marked as Entity, and O stands for other words. We use one-hot vector to represent this feature.

C. Adversarial Training
The idea behind adversarial training is that similar data instances should have same label, and deep neural network models should classify them in the same category. For each training instance, adversarial example is generated by adding a small perturbation on the original instance. Due to small perturbation, the new instance is seen as a similar instance and hence shares the label with the original instance.
Formally, let D l be the manually labeled dataset used in training and θ is the parameters of the current model. If an instance x in D l has a label y, then we will denote the generated adversarial example as x + r adv , where r adv = arg max e ≤ L(x + e, y, θ) and the hyperparameter bounds the magnitude of the perturbation. In regular training, the loss on the entire labeled dataset is computed: In adversarial training, the loss is computed as follows: where (X, Y ) = D l mean the set of inputs and labels respectively and α is usually set to 1. At each training step, the adversarial perturbation r adv will be calculated first based on the current model setting, and then the perturbed example (adversarial example) will be feed into training as it is shown in Fig. 2. An extra term L(x+r adv , y, θ) is added on the original loss as is shown above, so adversarial training could also be seen as a regularization method from this perspective.
The optimization problem to calculate r adv (as defined above) is an intractable problem for deep neural networks. Goodfellow et al. [5] propose a linear (first-order Taylor) approximation method to calculate r adv : where g = ∇ x L(x, y,θ), which is easy to compute through backpropagation algorithm. We will use this approximation method in this paper.
In the adversarial training, the training data are increased by inclusion of the adversarial examples. Since the humanlabeled dataset cannot be augmented, we can only increase training data by including more adversarial examples. Thus, we propose to add multiple adversarial examples for each instance in D l . In this work, we will examine whether the addition of multiple adversarial examples can improve the generalization of model.
To generate extra adversarial examples, we just add even smaller random perturbations on the current adversarial example. Specifically, we generate a set of adversarial examples D adv by randomly generating perturbations e i and adding them on current adversarial example: where the magnitude of e i is much smaller than of r adv , i.e., e i r adv and e 0 = 0 . In the case of multiple adversarial examples, the loss function of adversarial training is: where α is set to 1 as before.

D. Virtual Adversarial Training
Semi-supervised learning is often applied when there is a small amount of labeled data but a large amount of raw (unlabeled) data are available. Note that in adversarial training, adversarial examples are generated only for instances in labeled dataset. Miyato et al. [4] propose semi-supervised inspired version of adversarial training called virtual adversarial training. We will now introduce this method in the relation extraction scenario.
Like before, let x and θ represent the input of the model and the parameters of the model respectively. We are not assuming knowledge of label of x (x may be from the unlabeled set). As before, we will generate a perturbation r vadv for x. However, since the label of x is not known, we use p(x, θ), the output distribution of predicted labels of the current model to compute the model loss.
As both labeled and unlabeled data will be included in this method, let D l denote the labeled dataset and D ul represent the set of unlabeled data. The loss function L vadv is now defined as: L vadv (x, θ) = KL(p(x, θ) p(x + r vadv , θ)) where r vadv = arg max e ≤ L vadv (x + e, θ), KL(p q) is the KL divergence of two distribution p and q, θ is the current parameter setting of the model and is the constraint of the perturbation magnitude. Hence, the loss function of virtual adversarial training is where λ is also usually set to 1. Virtual adversarial training examples can also of course be generated for instances from labeled set as well (by ignoring the label provided in the original dataset). Next we discuss an approximation method to compute the virtual adversarial perturbation r vadv to overcome the intractability of solving the maximization problem of r vadv . For simplicity, we denote KL(p(x, θ) p(x + r, θ)) by K(x, r, θ). We could utilize the same linear approximation as adversarial training before, however L vadv reaches its minimum value at r vadv = 0, which means ∇ r K(x, r, θ)| r=0 = 0. Instead of using the first-order Taylor approximation, Miyato et al. [4] suggest the use of second-order Taylor approximation: where H(x, θ) is the Hessian matrix of K(x, r, θ). Under this approximation: and r vadv will be the dominant eigenvector of H(x, θ) with magnitude since where λ d is the dominant eigenvalue. However, it is computationally expensive to calculate the eigenvector and eigenvalue of a matrix. Miyato et al. [4] utilize power iteration and finite difference method to approximate r vadv . Let us denote d is a random unit vector that is not perpendicular to the dominant eigenvector, and repeat the power method I p times as follows: where ξ is a very small positive number and · is normalization operation. Then d will be good approximation of dominant eigenvector of H(x, θ), i.e. r vadv .

IV. EXPERIMENTS
In this section, we will design experiments to evaluate the adversarial and virtual adversarial training method using human-labeled datasets from two tasks.
As discussed previously, we will introduce multiple adversarial examples in the adversarial training. Thus, the first set of experiments focus on adversarial training and the effect of adversarial example number. Specifically, we will see how the models perform by adding different number of adversarial examples in the training process. As more features are added as the input of the deep neural network, we also plan to explore the effect of adversarial perturbation not only on word embedding but also on extra features of the input. Our next set of experiments will apply virtual adversarial training on relation extraction task. Since there is no theory to guide us how much unlabeled data we should use in the virtual adversarial training, we will also considers the size effect of unlabeled dataset in the virtual adversarial training setting. Specifically, we will evaluate the models built with different size of unlabeled data and find the appropriate setting in virtual adversarial training to guide the generation of unlabeled data.
Although we propose to use virtual adversarial training on relation extraction, we have not discussed anything about the unlabeled data. Specifically, we are interested in knowing whether the similarity of the unlabeled dataset to the labeled set might impact the results. While it is a hard question to know how similar these two datasets are, we investigate a simple situation where the two sets are the same or there are no examples in common. In the former case, D ul will contain the same elements as the D l except that in D ul , the instances are seen as unlabeled (by ignoring the labels). In discussing the results, we will use VAT* for this case and utilize VAT when D ul is different with D l .

A. Labeled Datasets
AIMed [32] and BioInfer [33] are two widely used benchmark dataset for PPI task, and LocText [34] is a recently available human-labeled corpus for PLOC task. We will use them as our labeled datasets, and Table I shows the statistics of these three datasets.

B. Generation of Unlabeled Data
In order to generate unlabeled examples for our relation extraction tasks, we have to find a text source and a method to recognize all entity names in the text. The literature found in the IntAct database [35] is large enough as our text source for PPI. For entity names, we utilize the end-to-end system GNormPlus [36] to detect gene/protein names. For the subcellular location names, we use location names from UniProt [37] as a dictionary to match the mentions in the Medline text, which is the text source for PLOC task. Once we have all the entities recognized in the text, we could generate the unlabeled data by considering every possible combination of entity names in one sentence. In this way, we generate a large amount of unlabeled examples for PPI and PLOC (see Table I), but we only use part of those examples in our experiments.

C. Experimental Setup
All our experiments are implemented in Tensorflow [38] and the input sentence length is set to 100 (longer sentences are pruned and the shorter sentences are padded with zeros). For the PCNN model, we utilize filter number of 400 and convolution window size of 3. Training epoch is set to 200 in all the experiments. In the adversarial training experiments, we use learning rate of 0.001 with 0.95 decay rate and 1000 decay steps, batch size of 128 and adversarial perturbation = 0.01. For the semi-supervised learning experiment, learning rate of 0.001, batch size of 128 for labeled data and batch size of 128, 256 and 384 for unlabeled data are used in the training. For the adversarial perturbation in semi-supervised learning, we use the value of 2 for word embedding and 0.01 for the rest features. Since the purpose of this perturbation is used to promote the smoothness of the model, bigger value for word embedding is used than the one in adversarial training.
The magnitude (or norm) of word embedding is another thing we have to consider because it will affect the choice of perturbation magnitude. In order to reduce the influence of embedding norm, we normalize the pre-trained word embedding vector v i in adversarial training using a simple trick: (13) where N max is the maximum value in all pre-trained embedding vectors. In this way, we restrict the embedding norm to a relatively small range.

V. RESULTS AND DISCUSSION
We use precision, recall and F score as the measurement of model performance and 10-fold cross validation is performed in these experiments. In order to reduce the effect of random initialization of weights in the training of deep neural network, we run 3 times for each experiment and take the average of these 3 rounds as the final results.

A. Adversarial Training
Our first experiment explores the effect of adversarial training where the input is perturbed. The first row of Table II provide the results for our baseline model, i.e., with the basic PCNN with no perturbation to the input. Since the text input is decided by the words and their order, we first perturb only the word embedding part of the input. Row 'PCNN+ADV we ' of Table II gives the results showing improvement over the baseline for all three datasets.

B. One vs Multiple Adversarial Examples
As we discussed before, adding multiple adversarial examples might help the model generalize better since this training technique covers more nearby points of the original training example. Also, the current adversarial example is calculated by an approximation method, involving more examples might compensate for the approximation loss.
In our experiments, we add two or three (i.e. M = 2, 3, where M is the size of D adv from previous section) adversarial examples for each instance of D l . Please note that rows 'PCNN' and 'PCNN+ADV we ' in Table II cover the case of M = 0 and 1 respectively. Row 'PCNN+ADV multi ' of the Table II shows the results for M = 2 where we obtain the best results and this finding is the same for all three 1 PCNN is the model when we add POS tag, Entity type and dependency information besides the word embedding and positional information in the input; PCNN+ADVwe is the model when adversarial perturbation is only added on word embedding; PCNN+ADV Multi is the model when we use two adversarial examples in the training; PCNN+VAT* is the model when we involve unlabeled data from only labeled data (ignore the label) in the training; PCNN+VAT is the model when we involve unlabeled data (same size with labeled data) from D ul in the training.

C. Perturbation of Input
As is discussed previously, we first perturbed only the word embedding to modify the text input. Notice that the remaining features are all inferred from these words by taggers, namedentity recognition (NER) tools and parsers. However, it is natural to consider perturbing not only the word embedding but also the other features of the input. Compare to the performance of perturbing only the word embedding (row 2 of   Table  II) respectively. We speculate that since the length of vector to represent the other features are small, the perturbation on these features might significantly affect the relation representation in the input vector. This finding suggests that we need to be careful in deciding how the input should be perturbed when dealing with text.

D. Virtual Adversarial Training
In the virtual adversarial training setting, we utilize both the labeled and unlabeled data to train the model. The addition of unlabeled data provides possible inputs for us to better smooth the model. The results are shown in the penultimate row ('PCNN+VAT') of Table II.
Although we improve on the baseline model for AIMed and LocText, it is surprising that on BioInfer there is significant drop. We wonder whether this is due to a significant difference in the textual and distributional characteristics of the labeled and unlabeled text data. For this reason, we conducted another experiment where we wish to avoid this case. The simplest way to do this is to use the labeled data as the text for the unlabeled datasets, i.e. use the same text but drop the label. The results are shown in the last row ('PCNN+VAT*') of Table  II, and are slightly better than before. In particular, there is a significant improvement for BioInfer where once again we improve on the baseline.
In the virtual adversarial training method, there is no prescribed choice for the size of unlabeled data relative to the labeled data. In our experiment (previously described results), we used the same size for the two dataset, i.e. |D ul | = n|D l | where n = 1. To investigate the possible impact of changing unlabeled data size, we conduct two more experiments with n = 2 and n = 3. As is shown in Fig. 3b, it appears that the choice of n = 1 is the best and that bigger unlabeled data size takes away from the training to learn labels, negatively affecting the model performance.  [15] whose input only contains word embedding and entity positional information. BiLSTMour stands for our evaluation results on BiLSTM model in [12] using our parsed data on standard dataset. The results reported in [12] are based on dataset where the authors did not use the standard number of instances.

E. Comparison with Other Systems
We have shown that adversarial and virtual adversarial training method improve the performance of PCNN model. We wish to place these results in a broader context of the results on these benchmark sets reported in the literature. To the best of our knowledge, there is no machine learning model trained on the LocText dataset for PLOC task except the work [14], but they utilize external knowledge base by applying transfer learning. Thus, Table III only compare our method with previous machine learning models on PPI task.
As it is shown in Table III, our system utilizing PCNN model and adversarial training technique achieves the stateof-the-art performance on the standard AIMed and BioInfer datasets of PPI task.
In addition, we are aware that there are other deep learning models built for PPI task, but our methods are not comparable to them due to three reasons. a). different evaluation metric; DCNN model in [41], BiLSTM model in [42] and treeLSTM model in [43] employ macro F score to evaluate their model, which is usually used on multi-class classification problem. Furthermore, the unbalanced evaluation corpus (Positive:Negative=1:4.8 in AIMed and Positive:Negative=1:2.8 in BioInfer) will make the macro F score much higher than normal F score. b). non-standard evaluation set; For example, in [44], the authors delete nested entities interaction from original corpora. c). different cross validation method; The paper of McDepCNN model [16] utilizes document-level during evaluation, while the models in Table III use instancelevel evaluation 1 .

F. Applying AT/VAT with RNN
As shown in Table II that adversarial training is an effective way to boost PCNN model performance. In order to verify that our method generalize beyond CNN-based model, we also test our method on an RNN-based model. In particular, we repeat all our investigations on the BiLSTM model from [12], using the same input representation. We observe that adversarial and virtual adversarial training also improve the BiLSTM model performance. However, the BiLSTM model provides a better baseline, it does not achieve state-of-the-art performance. Due to space reasons, we do not provide the details for the BiLSTM model.

VI. CONCLUSION
In this paper, we utilize adversarial training to alleviate the problem of insufficient training data of deep learning models and promote the model generalization. We apply this technique on relation extraction tasks and extend it with multiple adversarial examples in the training process. The experiment results illustrate that adversarial training could improve the model performance and one more extra adversarial example could further boost the performance.
We also apply adversarial training technique in semisupervised learning (virtual adversarial training) to utilize unlabeled data that acquired with low cost. The performance shows improvement when only small amount of unlabeled data are used in the semi-supervised training, but drops when the large volume of unlabeled data are involved. In addition, the performance of virtual adversarial training method is not up to par with adversarial training method in supervised learning scenario.
In the future, we plan to explore the unlabeled data size effect on a larger scale to better guide its use. Also, We will continue to pursue better adversarial example generation technique to acquire more useful examples during the training to help the model generalization.