Disentangled Learning with Synthetic Parallel Data for Text Style Transfer (2024)

Abstract: Text style transfer (TST) is an important task in natural language generation, which aims to transfer the text style (e.g., sentiment) while keeping its semantic information. Due to the absence of parallel datasets for supervision, most existing studies have been conducted in an unsupervised manner, where the generated sentences often suffer from high semantic divergence and thus low semantic preservation. In this paper, we propose a novel disentanglement-based framework for TST named DisenTrans, where disentanglement means that we separate the attribute and content components in the natural language corpus and consider this task from these two perspectives. Concretely, we first create a disentangled Chain-of-Thought prompting procedure to synthesize parallel data and corresponding attribute components for supervision. Then we develop a disentanglement learning method with synthetic data, where two losses are designed to enhance the focus on attribute properties and constrain the semantic space, thereby benefiting style control and semantic preservation respectively. Instructed by the disentanglement concept, our framework creates valuable supervised information and utilizes it effectively in TST tasks. Extensive experiments on mainstream datasets present that our framework achieves significant performance with great sample efficiency.

## introduction text style transfer (tst) aims to modify sentence style with its semantics unchanged. the main task in tst is sentiment transfer, along with some other tasks like politeness, formality and humor transfer. tst has wide extensive applications, such as neutralizing offensive remarks @xcite , data augmentation @xcite , and human-computer interaction @xcite . the main challenge in tst is the lack of parallel data as supervised information, so the existing mainstream works design their frameworks in an unsupervised manner for training non-parallel data. these frameworks employ an additional style embedding into the transformer architecture and design at least three losses to construct supervision, such as cycle consistency loss @xcite , self-construct loss @xcite and style loss @xcite . however, without parallel data as supervised information, the transferred sentences often exhibit high semantic divergence, which will consequently cause low semantic preservation and reduced human-like characteristics. in this paper, we propose a disentanglementbased tst framework (disentrans), in which we create a disentangled data synthesis paradigm and construct a disentanglement learning method to learn from synthetic data. specially, we employ a novel disentanglement concept to instruct our framework. this concept considers that a sentence is identified with a particular style mainly because some parts exhibit the characteristics of that style. the parts with these style characteristics are defined as the attribute component, while the remaining parts with content characteristics are defined as the content component. figure 1 shows three cases from the test set of the yelp @xcite sentiment transfer dataset. the attribute components of these three cases are "very good", "not hot or good" and "fun" respectively. obviously, the modification of attribute components determines style accuracy, while the modification of content components determines semantic preservation. these two components naturally exist in most of the sentences within the tst task and suggest that we can consider this task from a disentanglement perspective. inspired by the disentanglement concept, we create a special cot prompting procedure for data synthesis. initially, we prompt the llm to explicitly identify the attribute components in the sentences. subsequently, we query the llm to transfer the original style by modifying these attribute components while keeping the rest unchanged. therefore, the attribute components are accurately disentangled and original semantics are preserved to the greatest extent. moreover, we design an error detection module to filter out synthetic sentences with incorrect style and inadequate semantic preservation, which ultimately minimizes the propagation of generated errors in llms. in general, this data synthesis paradigm synthesizes a certain amount of parallel data and corresponding attribute components with satisfactory quality. with such synthetic data as supervised information, we develop a disentanglement learning method to address the tst task from two perspectives. concretely, we design a meaningful contrastive loss, where the attribute components are regarded as positive examples and other style ones as negative examples for the original sentences. this loss pulls the representations of attribute components closer to the representations of the original sentences, enhancing the model's focus on style properties and ultimately improving the model's style control capability. in addition, we also employ a sequence-to-sequence loss with parallel data to constrain the semantic space of generated sentences, thereby enhancing the model's semantic preservation capability. by incorporating these two losses, we can achieve both substantial style control and semantic preservation, which demonstrate significant performance in the tst tasks. in addition, we also demonstrated in our experiments that this learning method allowed us to achieve better results than directly using llm for the tst task. in summary, our contributions are as follows: ## approach we propose a disentanglement-based framework for the tst task (disentrans), where the disentanglement concept refers to separating the attribute and content components within a sentence and addressing this task from these two perspectives. in this framework, we primarily create a disentangled data synthesis paradigm to synthesize parallel data and corresponding attribute components. subsequently, we construct a disentanglement learning method to learn from these synthetic data and achieve significant tst performance. we will formulate the tst task first, and then further elaborate on disentrans through the data synthesis paradigm and disentanglement learning method. ## related work text style transfer tst task has proven to be quite challenging due to the discrete nature of language @xcite . most approaches are unsupervised owing to the difficulty of obtaining parallel data @xcite . previous work can mainly be categorized into two groups. the first group attempts to identify and revise the words with stylistic attributes in the early stage of tst @xcite @xcite . these methods employed attention mechanisms and directly revised words with style information in sentences according to attention scores. however, most of these approaches suffer from flat attention distribution due to the limitations of the network's capacity, where similar at-tention scores are assigned to tokens and numerous tokens without stylistic attributes would be revised. moreover, due to the lack of a high-level understanding of semantics, the generated sentences are not sufficiently authentic and logical. @xcite employ the editing technique which involves token deletion through simple counts and target word retrieval via tf-idf weighted overlap. the second group focuses on revising an entangled representation of input @xcite @xcite , which is mainstream in tst currently. these methods employ a style embedding or encoder and create many losses to construct training supervision. arae @xcite proposes the incorporation of two collaborative loss functions with the adversarially regularized autoencoder framework. sa-mlm @xcite performs tst by using a style-masked input and performs a simple same-style reconstruction task with a transformer encoder block. large language model recently, there has been a growing trend of research related to llms @xcite , and our primary focus is on data synthesis. for text classification tasks, @xcite generates private synthetic data by dp-finetuned llm to privately estimate predictive models. in the computational social science field, @xcite study three strategies to increase the faithfulness of synthetic data generated by llms: grounding, filtering, and taxonomy-based generation. for human-computer interaction research, @xcite llms to generate openended questionnaire responses about experiencing video games. however, there is also no suitable cot method available to assist llms in synthesizing the supervised data in the tst field. ## conclusion in this work, we propose a novel disentanglementbased framework for text style transfer (disen-trans), which is instructed by a disentanglement concept. concretely, we first create a cot prompting procedure to synthesize parallel data and corresponding disentangled information for supervision. then we develop a disentanglement learning method with such synthetic data, where contrastive loss and sequence-to-sequence loss are designed to improve the focus on attribute properties and constrain the semantic space, thereby benefiting the tst tasks from style control and semantic preservation respectively. experiments on two widely used datasets demonstrate that disentrans achieves superior performance with great sample efficiency.