From Disjoint Sets to Parallel Data to Train S eq2 S eq Models for Sentiment Transfer (2020)

Abstract: We present a method for creating parallel data to train Seq2Seq neural networks for sentiment transfer. Most systems for this task, which can be viewed as monolingual machine translation (MT), have relied on unsupervised methods, such as Generative Adversarial Networks (GANs)-inspired approaches, for coping with the lack of parallel corpora. Given that the literature shows that Seq2Seq methods have been consistently outperforming unsupervised methods in MT-related tasks, in this work we exploit the use of semantic similarity computation for converting non-parallel data onto a parallel corpus. That allows us to train a transformer neural network for the sentiment transfer task, and compare its performance against unsupervised approaches. With experiments conducted on two well-known public datasets, i.e. Yelp and Amazon, we demonstrate that the proposed methodology outperforms existing unsupervised methods very consistently in fluency, and presents competitive results in terms of sentiment conversion and content preservation. We believe that this works opens up an opportunity for seq2seq neural networks to be better exploited in problems for which they have not been applied owing to the lack of parallel training data.

## introduction sentiment transfer can be considered as a subset of the style transfer task, the main goal of which is to convert a text that presents a style τ 1 to another style τ 2 , while keeping its original meaning µ. given the increasing number of applications that currently make use of natural language user interfaces, style transfer can be useful in many realworld applications, for instance, chatbot personality transformation for fitting chatbot language to a specific public, bias removal (such as gender and racial bias), offensive and hate speech-language filtering, and thus forth. previous studies on style transfer focused mostly on unsupervised methods, for instance generative adversarial networks (gans), owing to the lack of parallel corpora. however, given that style transfer can be viewed as a monolingual machine translation (mt) task, and that seq2seq models such as the transformer have shown to outperform unsupervised methods in multi-lingual mt when a sufficiently large parallel corpus is available @xcite @xcite , in our opinion it is expected that seq2seq would outperform unsupervised approaches if parallel data is available for style transfer. however, to the best of our knowledge, a parallel corpus for style transfer currently does not exist. but considering that semantic similarity metrics are becoming more and more effective @xcite , and that considerably large non-parallel data exist for some style transfer tasks, for instance, sentiment transfer and the yelp and amazon review datasets, one could take advantage of such metrics to build parallel corpora @xcite . given these standpoints, we propose and evaluate an approach to create parallel training data from non-parallel sets of data, on sentiment transfer datasets as a use-case for style transfer foot_0 , and compare the resulting transferred outputs of a transformer seq2seq neural network @xcite against those of state-of-the-art unsupervised methods. considering the yelp and amazon data sets for sentiment transfer, we take advantage of semantic similarity using universal sentence encoders (use) @xcite to represent sentences and the euclidean distance, which is scalable to large sets of data. our results show that our proposed method can generate more fluently-written texts than unsupervised approaches, and that is well balanced in terms of sentiment conversion and content preservation. the remainder of this work is organized as follows: section 2 introduces the related work; section 3 details the methodology for building parallel corpora, the used seq2seq model, and the evaluation metrics; section 4 presents the experiments and results. finally, the paper is concluded with some final remarks. ## related work several methods have been proposed for converting one text to another, which is usually referred to as machine translation (mt). in recent years, great progress has been made with deep learning for multi-lingual mt @xcite , where a text in a given input language needs to be converted to another text in the desired output language. much of the progress made in that field is owned to the possibility of mining large corpora of parallel sentences from the web @xcite . mono-lingual mt @xcite @xcite also has emerged in recent years, given the potential set of applications, such as the conversion of offensive language to non-offensive @xcite and the generation of customizable affective text @xcite . in this case, the input text should be converted to another one in the same language, keeping its main content, but being transformed in some aspects such as language style, tone, or sentiment. differently from multi-lingual mt, mono-lingual mt generally suffers from the lack of parallel corpora (that is, different versions of the same text rephrased in different tones) to train end-to-end deep learning methods. efforts to create corpora have been made only on limited domains, such as formality transfer for informal texts @xcite . as a consequence, both corpora and approaches proposed for the task are generally non-parallel, and unsupervised systems have emerged, mostly making use of text generation models and adversarial samples @xcite @xcite @xcite . recent work in multi-lingual mt has shown that supervised methods tend to achieve better results than unsupervised approaches when the number of parallel sentences is larger than 100,000 @xcite . considering that the non-parallel data used by unsupervised methods for mono-lingual mt tasks, in special sentiment transfer, large nonparallel set of samples are available, and that textual semantic similarity and representation methods are evolving considerably @xcite @xcite , one could build a sufficiently large corpus of parallel data to train seq2seq models for mono-lingual mt. for this reason, the main contribution of this work is to present an investigation of training seq2seq neural networks for sentiment transfer, considering as training data parallel corpora generated from non-parallel disjoint sets, by making use of state-of-the-art semantic representations. ## methodology in this section, we first describe the proposed method for building a style transfer parallel corpora, followed by the seq2seq transformer neural network and selected metrics for the evaluation methodology. ## experimental evaluation in this section we present the experiments that have been conducted to evaluate the proposed methodology. to take advantage of the reproducibility 6 and being able to compare our results with previous works, we consider two sentiment transfer data sets, i.e., the yelp dataset @xcite and the amazon dataset (he and mcauley, 2016), along with the publicly available results made available by @xcite . by evaluating our trained method on the same data sets by those authors, we can directly compare our results with theirs. ## conclusion in this paper we proposed and evaluated an approach to create parallel data sets for training seq2seq neural networks for style transfer. we demonstrate that in the sentiment transfer use-case the seq2seq model can be a viable alternative approach to unsupervised methods, achieving the best performance in the yelp dataset and showing a promising performance on amazon. in our opinion, the research presented in this paper shows that the lack of parallel data is not a definitive factor for not using seq2seq methods in text generation tasks. with proper care, a wellperforming model, such as transformer, can be applied for such cases. however, we aware that better investigation should be conducted on several fronts. among them, we can cite better investigation on the parallel set creation method, e.g. considering other similarity metrics. in addition, better evaluation of filtering samples should also be carried out, in special to improve the results with amazon. also, to better fine-tune the seq2seq neural network is also something that needs to be done, since that be also present a positive impact on the results, but this paper lacks a proper investigation in this specific aspect.