Learning to Generate Multiple Style Transfer Outputs for an Input Sentence (2020)

Abstract: Text style transfer refers to the task of rephrasing a given text in a different style. While various methods have been proposed to advance the state of the art, they often assume the transfer output follows a delta distribution, and thus their models cannot generate different style transfer results for a given input text. To address the limitation, we propose a one-to-many text style transfer framework. In contrast to prior works that learn a one-to-one mapping that converts an input sentence to one output sentence, our approach learns a one-to-many mapping that can convert an input sentence to multiple different output sentences, while preserving the input content. This is achieved by applying adversarial training with a latent decomposition scheme. Specifically, we decompose the latent representation of the input sentence to a style code that captures the language style variation and a content code that encodes the language style-independent content. We then combine the content code with the style code for generating a style transfer output. By combining the same content code with a different style code, we generate a different style transfer output. Extensive experimental results with comparisons to several text style transfer approaches on multiple public datasets using a diverse set of performance metrics validate effectiveness of the proposed approach.

## introduction text style transfer aims at changing the language style of an input sentence to a target style with the constraint that the style-independent content should remain the same across the transfer. while several methods are proposed for the task @xcite @xcite @xcite @xcite , they commonly model the distribution of the transfer outputs as a delta distribution, which implies a one-to-one mapping mechanism that converts an input sentence in one language style to a single corresponding sentence in the target language style. we argue a multimodal mapping is better suited for the text style transfer task. for examples, the following two reviews: 1. "this lightweight vacuum is simply effective.", 2. "this easy-to-carry vacuum picks up dust and trash amazingly well." would both be considered correct negative-topositive transfer results for the input sentence, "this heavy vacuum sucks". furthermore, a one-tomany mapping allows a user to pick the preferred text style transfer outputs in the inference time. in this paper, we propose a one-to-many text style transfer framework that can be trained using non-parallel text. that is, we assume the training data consists of two corpora of different styles, and no paired input and output sentences are available. the core of our framework is a latent decomposition scheme learned via adversarial training. we decompose the latent representation of a sentence into two parts where one encodes the style of a sentence, while the other encodes the styleindependent content of the sentence. in the test time, for changing the style of an input sentence, we first extract its content code. we then sample a sentence from the training dataset of the target style corpus and extract its style code. the two codes are combined to generate an output sentence, which would carry the same content but in the target style. as sampling a different style sentence, we have a different style code and have a different style transfer output. we conduct experiments with comparison to several state-of-the-art approaches on multiple public datasets, including yelp (yel) and amazon @xcite . the results, evaluated using various performance metrics, including content preservation, style accuracy, output diversity, and user preference, show that the model trained with our framework performs consistently better than the competing approaches. ## methodology let x 1 and x 2 be two spaces of sentences of two different language styles. let z 1 and z 2 be their corresponding latent spaces. we further assume z 1 and z 2 can be decomposed into two latent spaces z 1 = s 1 × c 1 and z 2 = s 2 × c 2 where s 1 and s 2 are the latent spaces that control the style variations in x 1 and x 2 and c 1 and c 2 are the latent spaces that control the style-independent content information. since c 1 and c 2 are style-independent content representation, we have c ≡ c 1 ≡ c 2 . for example, x 1 and x 2 may denote the spaces of negative and positive product reviews where the elements in c encode the product and its features reviewed in a sentence, the elements in s 1 represent variations in negative styles such as the degree of preferences and the exact phrasing, and the elements in s 2 represent the corresponding variations in positive styles. the above modeling implies 1. a sentence x 1 ∈ x 1 can be decomposed to a content code c 1 ∈ c and a style code s 1 ∈ s 1 . 2. a sentence x 1 ∈ x 1 can be reconstructed by fusing its content code c 1 and its style code s 1 . 3. to transfer a sentence in x 1 to a corresponding sentence in x 2 , one can simply fuse the content code c 1 with a style code s 2 where s 2 ∈ s 2 . figure 1 provides a visualization of the modeling. under this formulation, the text style transfer mechanism is given by a conditional distribution p(x 1→2 |x 1 ), where x 1→2 is the sentence generated by transferring sentence x 1 to the target domain x 2 . note that existing works @xcite formulate the text style transfer mechanism to be a one-to-one mapping that converts an input sentence to only a single corresponding output sentence. that is p(x 1→2 |x 1 ) = δ(x 1 ) where δ is the dirac delta function. as a results, they figure 2 : overview of the proposed one-to-many style transfer approach. we show an example of transferring a negative restaurant review sentence x 1 to multiple different positive ones y 1→2 . to transfer the sentence, we first randomly sample a sentence x 2 from the space of positive reviews x 2 and extract its style code s 2 using e s 2 . we then compute z 1→2 by combining c 1 with s 2 and convert it to the transfer output y 1→2 using g 2 . we note that by sampling a different x 2 and hence a different s 2 , we have a different style transfer output y 1→2 . ## related works language modeling is a core problem in natural language processing. it has a wide range of applications including machine translation @xcite , image captioning @xcite , and dialogue systems @xcite . recent studies @xcite @xcite @xcite proposed to train deep neural networks using maximum-likelihood estimation (mle) for computing the lexical translation probabilities in parallel corpus. though effective, acquiring parallel corpus is difficult for many language tasks. text style transfer has a longstanding history @xcite . early studies utilize strongly supervision on parallel corpus @xcite @xcite . however, the lack of parallel training data renders existing methods non-applicable to many text style transfer tasks. instead of training with paired sentences, recent studies @xcite @xcite addressed this problem by using adversarial learning techniques. recent studies further improve the performance by leveraging domain adaptation @xcite or contextual information @xcite . in this paper, we argue while the existing methods address the parallel data acquisition difficulty, they do not address the diversity problem in the translated outputs. we address the issue by formulating text style transfer as a one-to-many mapping problem and demonstrate one-to-many style transfer results. generative adversarial network (gans) @xcite @xcite have achieved great success on image generation @xcite . several attempts are made to applying gan for the text generation task @xcite @xcite . however, these methods are based on unconditional gans and tend to generate contextfree sentences. our method is different in that our model is conditioned on the content and style codes, and our method allows a more controllable style transfer. ## conclusion we have presented a novel framework for generating different style transfer outputs for an input sentence. this was achieved by modeling the style transfer as a one-to-many mapping problem with a novel latent decomposition scheme. experimental results showed that the proposed method achieves better performance than the baselines in terms of the diversity and the overall quality.