Disentangled Learning with Synthetic Parallel Data for Text Style Transfer

Jingxuan Han, Quan Wang, Zikang Guo, Benfeng Xu, Licheng Zhang, Zhendong Mao

Abstract

Text Style Transfer (TST) aims to alter the stylistic attributes of a sentence while preserving its core semantic content. A primary challenge in this field is the scarcity of parallel datasets, which often forces researchers to rely on unsupervised methods that frequently result in "semantic divergence"—where the meaning of the sentence is unintentionally altered. This paper introduces DisenTrans, a novel framework that utilizes Large Language Models (LLMs) to generate high-quality synthetic parallel data. By explicitly disentangling style attributes from semantic content during both the data synthesis and model training phases, DisenTrans achieves state-of-the-art performance. Furthermore, the framework exhibits remarkable sample efficiency, reaching superior results with ten times less data than previous unsupervised approaches.

Introduction: The Parallel Data Bottleneck

The "holy grail" for training Text Style Transfer models is parallel data: pairs of sentences that share identical meanings but differ in style (e.g., "The food was terrible" vs. "The food was excellent"). In the absence of such data, unsupervised techniques like cycle-consistency or style embeddings are used. However, these methods often struggle to maintain semantic integrity. For instance, a model might change "the pizza was cold" (negative) to "the burger was hot" (positive), failing to preserve the subject of the sentence.

DisenTrans addresses this by treating style transfer as a localized edit rather than a global rewrite. It operates on the principle that style is often concentrated in specific "attribute components," while the rest of the sentence constitutes the "content component."

The DisenTrans Framework

The framework is built upon two core pillars: Disentangled Data Synthesis and Disentangled Learning.

1. Disentangled Data Synthesis

Instead of a simple zero-shot rewrite prompt, which can lead to overly transformative and semantically drifted text, DisenTrans employs a Chain-of-Thought (CoT) prompting strategy to synthesize training pairs.

  • Step 1 (Disentanglement): The LLM is first tasked with identifying the specific "attribute components" that determine the sentence's style.
  • Step 2 (Synthesis): The LLM then modifies only these identified attributes to the target style while keeping the "content components" frozen.
Comparison of standard prompting versus the proposed Chain-of-Thought (CoT) approach for disentangled data synthesis. The CoT method ensures higher semantic integrity by isolating and modifying only style-relevant components.

To further ensure quality, an Error Detection Module (EDM) filters the generated pairs. It uses BERT-based classifiers to verify style transfer and BLEU scores to ensure content stability, retaining only the highest-quality pairs for the training set.

2. Disentangled Learning

With a high-quality synthetic parallel dataset in hand, the researchers train a compact and efficient model (T5-base) using prefix-tuning. This approach keeps the backbone model frozen and optimizes a small set of "virtual tokens" or prefixes to steer the generation.

The DisenTrans learning architecture, featuring prefix-tuning and a dual-loss objective. The contrastive loss aligns sentence representations with style attributes, while the Seq2Seq loss ensures accurate generation.

The training process is guided by two primary loss functions:

  • Contrastive Loss: This loss pulls the representation of the sentence closer to its style-carrying attributes in the vector space, forcing the model to distinguish between content and style.
  • Seq2Seq Loss: A standard cross-entropy loss that ensures the model can accurately reconstruct the target sentence from the source and the style prefix.

Experimental Results

DisenTrans was evaluated on standard sentiment transfer benchmarks (Yelp and IMDb) as well as formality (GYAFC) and personal style (Shakespeare) transfer tasks.

Superior Performance and Efficiency

The model achieved a higher G-score—the harmonic mean of style accuracy and semantic preservation—than all previous state-of-the-art (SOTA) models. On the Yelp dataset, it showed a significant +4.1 point improvement over the previous best.

One of the most striking findings was the framework's sample efficiency. While previous unsupervised SOTA methods required approximately 450,000 training samples to reach their peak, DisenTrans achieved better results using only 45,000 samples. This 10x reduction in data requirements highlights the power of even synthetic parallel data over massive amounts of non-parallel data.

Human Evaluation

In blind human evaluations, DisenTrans consistently outperformed baselines in style control, semantic preservation, and fluency. Notably, human raters occasionally found that DisenTrans preserved meaning better than the human-written reference sentences provided in the original test sets, underscoring the precision of the disentangled approach.

Conclusion and Future Directions

DisenTrans demonstrates that the chronic lack of parallel data in TST can be overcome by using LLMs as "teachers" to synthesize high-quality training pairs. By focusing on the disentanglement of style and content, the framework provides a more surgical and semantically faithful approach to style transfer.

Future work will explore multi-attribute transfer (e.g., changing sentiment and formality simultaneously) and the application of this method to more complex styles like sarcasm or humor, where the boundary between style and content is more fluid. Additionally, integrating detoxification modules will be crucial to ensure that synthetic data remains free from biases inherent in large-scale language models.

Summary updated

BibTeX
@inproceedings{han2024disentangled,
  author = {Jingxuan Han and Quan Wang and Zikang Guo and Benfeng Xu and Licheng Zhang and Zhendong Mao},
  title = {{Disentangled Learning with Synthetic Parallel Data for Text Style Transfer}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  doi = {10.18653/v1/2024.acl-long.811},
}
Figure