Reweighting Strategy Based on Synthetic Data Identification for Sentence Similarity (2022)

Abstract: Semantically meaningful sentence embeddings are important for numerous tasks in natural language processing. To obtain such embeddings, recent studies explored the idea of utilizing synthetically generated data from pretrained language models(PLMs) as a training corpus. However, PLMs often generate sentences different from the ones written by human. We hypothesize that treating all these synthetic examples equally for training can have an adverse effect on learning semantically meaningful embeddings. To analyze this, we first train a classifier that identifies machine-written sentences and observe that the linguistic features of the sentences identified as written by a machine are significantly different from those of human-written sentences. Based on this, we propose a novel approach that first trains the classifier to measure the importance of each sentence. The distilled information from the classifier is then used to train a reliable sentence embedding model. Through extensive evaluation on four real-world datasets, we demonstrate that our model trained on synthetic data generalizes well and outperforms the baselines.

## introduction high-quality sentence embeddings are essential in diverse applications of natural language processing @xcite , including semantic textual similarity @xcite and paraphrase identification @xcite . unfortunately, obtaining a large amount of human-annotated datasets to train a sentence embedding model is difficult and expensive. to address this, @xcite recently introduced a method, dino, to train a sentence embedding model on synthetic data generated from pretrained language models (plms). despite the effectiveness and scalability of dino, however, the difference between machine-written and human-written examples has not been carefully investigated. in other words, the study on the impact of treating all these synthetic examples equally during training remains under-explored. to this end, we first conduct an in-depth analysis to demonstrate the shift of synthetic samples from the human-written sentences. in particular, we train a classifier (i.e., synthetic data identification (sdi) model) that identifies synthetic data from humanwritten sentences and observe that the linguistic features of the sentences predicted as machine-written are much different from the human-written sentences compared to the linguistic features of the sentences predicted as human-written. based on this analysis, we propose a simple method, reweighting loss based on importance of machine-written sentence (rise), which first utilizes the trained sdi model to measure the importance of each sentence in learning semantically meaningful sentence embeddings for sentence similarity tasks. we then utilize this distilled information from the sdi model to reweight the loss of each synthetic example during training. we extensively evaluate our method on multiple sentence similarity datasets and observe that our model outperforms all the baselines across diverse datasets, even when they are evaluated on other datasets from a distinct distribution with training datasets. our contributions include: ## related work synthetic data generation using pretrained language models has shown promising results in various natural language processing tasks @xcite @xcite @xcite . recently, schick and schütze (2021) proposed a new method, dino, to generate a synthetic dataset for textual semantic similarity task. another recent work, yoo et al. (2021) proposed a new data augmentation framework for sentence classification by leveraging a large-scale plm (brown @xcite . however, synthetic data can be misused in malicious usage, such as fake news generation. to prevent such a fraudulent use, recent studies @xcite @xcite aim to detect the synthetically generated text. on the contrary, we aims to identify unrealistic sentences from machine-written data and mitigate their influence to achieve accurate and robust learning. while @xcite suggested controlling weights to augmented training examples, our work mainly focuses on using only synthetic samples from plms. ## analysis on synthetic sentences this section describes the generation of the synthetic dataset, followed by training the model to identify synthetic sentences from human-written ones. then, we present a novel analysis to demonstrate the shift of synthetic samples from the human-written sentences. ## proposed method we now introduce a simple yet effective method, reweighting loss based on importance of machine-written sentence (rise), that aims to give less importance to unrealistic machine-written sentences than realistic sentences. our method consists of two stages: (1) measuring the importance of the generated sentences in learning semantically meaningful embeddings using the prediction confidence p d from the sdi model (defined in section 3); 2) utilizing the importance score to control the weight of the loss for each example during training so that the model does not deviate significantly from the distribution of the human text. other than the loss function, the training procedure is the same as standard training of a sentence embedding model based on the bi-encoder architecture @xcite . more details on training the sentence encoder are provided in appendix d. reweighting loss using importance score. we utilize the prediction confidence p d from the sdi model (section 3) to measure the importance of generated sentences. in particular, we modify the loss to make the realistic machine-written examples (i.e., examples with high scores) have more we feed an instruction i y and a human-written sentence x h to the generator g which produces a machine-written sentence x s . we then measure importance score p d using x s as input. finally, we predict the similarity score using the embedding vector of x s and x h . we compute the loss and multiply p d . ## experimental settings we evaluate each model on stsb, qqp, mrpc, and paraphrase adversaries from word scrambling of quora question pairs @xcite (paws-qqp) datasets. paws-qqp aims to evaluate the robustness of the model against adversarial attacks for the sentence similarity task. we provide more details on datasets and experimental setup in the appendix e and f. we train a model to solve the sentence similarity task as a regression problem. however, since all datasets except for stsb only contain discrete labels, we set the threshold using the validation dataset to make a binary decision. we apply our method to dino and denote it as rise. in addition to experiments with rise, we conduct experiments with the following variants: (1) filtering: we filter out the bottom 10% of the machinewritten sentences based on their sorted importance. we then use the remaining examples for training without using our modified loss. (2) random: we randomly sample a scalar value from u (0, 1) for each example and use it as its importance. dino and the variants of our method are based on the sentence-roberta-base architecture, which are fine-tuned only on synthetic datasets. besides, we further compare our model against the following sentence encoders that are fine-tuned on natural language inference (nli) dataset: universal sentence encoder(use) @xcite , infersent @xcite , sentence-bert @xcite , and sentence-roberta. we also compare with the models that are not trained on human-annotated dataset, namely: glove (pennington et al., 2014), bert-cls, sentence-bert, sentence-roberta. 6 6 results ## conclusions in this paper, we demonstrated that the linguistic features of unrealistic machine-written sentences are different from those of human-written sentences. based on this observation, we proposed a novel approach to reweight the loss based on the sentence importance from synthetic data identification (sdi) model for learning semantically meaningful embeddings. the extensive experiments show the effectiveness and robustness of rise compared to other baseline approaches. although extensive experiments demonstrate the effectiveness of our method, adjustment of the importance of each sentence may learn an unintended bias from the classifier. in future work, we plan to conduct an in-depth human analysis for machinewritten sentences to determine if our method correlates well with human judgement or not. investigating the impact of unrealistic examples in other natural language applications would also be another interesting future direction.