How Positive Are You: Text Style Transfer using Adaptive Style Embedding (2020)

Abstract: The prevalent approach for unsupervised text style transfer is disentanglement between content and style. However, it is difficult to completely separate style information from the content. Other approaches allow the latent text representation to contain style and the target style to affect the generated output more than the latent representation does. In both approaches, however, it is impossible to adjust the strength of the style in the generated output. Moreover, those previous approaches typically perform both the sentence reconstruction and style control tasks in a single model, which complicates the overall architecture. In this paper, we address these issues by separating the model into a sentence reconstruction module and a style module. We use the Transformer-based autoencoder model for sentence reconstruction and the adaptive style embedding is learned directly in the style module. Because of this separation, each module can better focus on its own task. Moreover, we can vary the style strength of the generated sentence by changing the style of the embedding expression. Therefore, our approach not only controls the strength of the style, but also simplifies the model architecture. Experimental results show that our approach achieves better style transfer performance and content preservation than previous approaches.

## introduction text style transfer is the task of modifying a text with a specified style attribute. given a source text with an attribute (e.g., positive), the text style transfer problem aims to alter this input text to achieve a different attribute (e.g., negative). the significant concern in this problem is that the generated text must meet some requirements: the text must (i) reflect the given target attribute, (ii) maintain the content that is style-irrelevant, and (iii) generate a sentence that appears natural. text style transfer has been solved by a supervised method using a parallel dataset @xcite containing pairs of source and target sentences. however, obtaining this parallel dataset that achieves a total one-to-one correspondence with a specified style is often not possible. therefore, unsupervised approaches have recently been actively researched. the first among these unsupervised approaches is disentanglement. to satisfy the first two style transfer requirements, namely, reflecting the style attributes and preserving the contents, the disentanglement approach tries to perfectly separate the style component from the content component within the input text. if the input is completely separated, the text style is transferred by substituting the style component with a new target; for this approach, a discriminator is used to separate the style from a latent representation z, a compressed representation of the input text @xcite . the discriminator can also be applied to the output text so that the output text reflects the given attribute @xcite @xcite . nevertheless, this approach has weaknesses. first, dividing a sentence representation into style and content is difficult because these two components are not mutually exclusive. furthermore, this separation induces a loss of information. another approach is to rewrite the style attribute of the input text. this approach does not perfectly disentangle the style from the text representation; rather, it uses extra style information along with a text representation. if style information is added to the generation model, the output sentence reflects the inserted style attribute @xcite . moreover, a style classifier, which determines the style of the sentence, is applied to an output sentence to enhance the transfer performance @xcite . however, these approaches assign two jobs to the generation model: the first is to reconstruct the input sentence, and the second is to transfer the style. when the sentence generation model is also in charge of style expression, the style expression cannot be properly learned. moreover, these previous approaches cannot address the style strength because the meaning of the style is not learned. therefore, ideally, we divide the architecture of the style transfer model into two modules, namely, sentence reconstruction and style representation modules. this means that the reconstruction model is no longer responsible for converting the style. as a result, the generation model can concentrate on generating sentences, while the style model can focus on learning direct style expressions. therefore, the proposed model directly learns the representations of style expressions. figure 1 presents the main differences between previous models and the proposed model. our model consists of two modules, namely, the transformer-based autoencoder and the style embedding module. in our architecture, style embedding is learned in the style embedding part, not in the autoencoder part; hence, the autoencoder part can concentrate on restoring the input. therefore, our model is more concise than previous models and uses only one reconstruction loss to train the autoencoder model. to learn the style representation, the similarities between the style embedding and the latent text representations are used as input to the style classifier. because the similarity is calculated through dot products with input latent representation, the learned style embedding also follows the expression of the input representation in the latent space. as a result, the style embedding that expresses the general representation of each style is learned. this style embedding module does not affect the autoencoder module, and the style embedding part can also concentrate on learning the style representation. in addition, the separation of the model into a style part and a reconstruction part makes it possible to control the strength of the style in the output text. the style embedding part learns the general representation of each style. with this style embedding, the degree of style modification can be adjusted. we can also generate the output with an expression stronger than the input through the same style as the input. because our model can control how much of the style is changed, it is characterized by its multimodality in summary, our main contributions are as follows. (i) we adjust the style strength of the output, which was not previously possible; therefore, the output sentences can be multimodal. (ii) the autoencoder model for latent text representation is more concise and has fewer constraints than the models in previous studies. each model can concentrate on its task (sentence generation and style representation). ultimately, our model achieves competitive performance for style accuracy and sentence retention compared to other models. text style transfer. like many other cross-domain problems, the main problem of style transfer is that parallel data are limited. the first approach to handle this issue is disentanglement. this approach uses a discriminator to extract style attributes from the text information. when the discriminator is applied to the output text and the attribute is given, the discriminator makes the output involve the given attribute. this means aligning the output text to the attribute domain @xcite @xcite . alternatively, the discriminator is applied after the latent representation. at this location, the discriminator removes the attribute information from the latent space. at the test time, the style attribute is newly inserted into the decoder, and thus, the generated output text contains the given target style attribute @xcite . additionally, the discriminator is pretrained to detect style words in the text, and these detected attribute words are eliminated from the sentence. at the inference phase, the other domain's style words are added into the non-style text @xcite @xcite . unfortunately, fully separating the style and content is difficult and often requires the pretraining phase. therefore, another approach that does not employ disentanglement has been proposed. this technique does not extract style information from latent representations but rather overwrites the transferred sentence using the style attribute corresponding to the user's intent @xcite . to reflect the style, this approach uses extra constraints, such as back-translation loss and adversarial style loss (e.g., the disentanglement approach). the back-translation loss @xcite is similar to the cycle loss in the image domain @xcite , which enhances the rewriting performance through the preservation of content. for instance, the input sentences are in two domains (x and y ), and each domain has a corresponding style s, s . the input text x in the x domain is transferred to ŷ by d(e(x), s )=ŷ where e and d represent an encoder and a decoder, respectively. the style is modified once again with the transferred output ŷ by d(e(y), s)=x. the difference between the original input x and the final output x is minimized, which prevents the loss of content in the text. however, considerable time is required for training because the transfer procedure must be performed twice. second, the style adversarial loss provides an indirect guide to the generation model to transfer the input sentence. this guidance constrains the generation model to follow the style information in the label embedding rather than the latent text representation. however, label embedding does not represent style expressions directly. therefore, models with this architecture are limited to generating output sentences with only a single modality. even if the same sentence is converted multiple times, the exact same result is obtained each time without any variation. additionally, similar to the disentanglement approach, this adversarial loss hinders the generation model from focusing only on the sentence reconstruction. thus, we propose a method that does not require a discriminator or model constraints, such as the back-translation loss, pretrained classifiers or pretrained autoencoders, but instead employs rewriting with style label embedding. ## method the architecture of our proposed model is presented in figure 2 . the model is divided into two parts: the autoencoder model for the content, and the style embedding model. in the autoencoder model, the latent representation from the encoder and the style representation are combined, and the decoder uses the resulting expression to generate the output text. during training, the autoencoder model's objective is to reconstruct the input text using the combined latent representation. the style embedding model is responsible for controlling the style of the input text. the style embedding model learns the representation for each style, and the classifier predicts the style using this embedding information. the objective of this part is to learn the style expression classifying the style label. the separation of these two parts simplifies the generation model and makes it possible to use adaptive style expressions. additionally, each model can concentrate solely on its task. ## conclusion in this paper, we proposed a transformer-based autoencoder model for the text style transfer task that is combined with a separate style embedding module based on the similarity measurement with the latent text representation. with this style embedding part, our model can adjust the style strength of the output. in both yelp and amazon datasets, our model showed better accuracy and bleu scores than previous models. in particular, our approach generated a variety of outputs with regard to the style strength. additionally, with the input's own style, the generated sentences could represent the initial style more @xmath0, no treatment and no medication to help me deal with my condition . @xcite so , no treatment and no medication to help me deal with my condition . ours so , no treatment and no medication to help me deal with my pain . input food was cold ( still frozen ) , i had the ribs . @xcite food was cold ( still frozen ) , i had the ribs . ours food was cold ( still frozen ) , i had the trash ribs . input the pizza is offered without toppings and it 's lacking in flavor . @xcite the pizza is offered without toppings and it 's lacking in flavor . ours the pizza is offered without toppings and it 's barely lacking in flavor . @xmath1, the service is always great ! @xcite i love this place , the service is always great ! ours i love this place , the service is always great and delicious ! input the service was amazing and the staff was very friendly . @xcite the service was amazing and the staff was very friendly . ours the service was amazing and the staff was very friendly and great . input it is the most authentic thai in the valley . @xcite it is the most authentic thai in the valley . ours it is the most authentic thai in the valley and great service .