Cycle-Consistent Adversarial Autoencoders for Unsupervised Text Style Transfer

Yufang Huang, Wentao Zhu, Deyi Xiong, Yiye Zhang, Changjian Hu, Feiyu Xu

Text style transfer (TST) is a fundamental task in Natural Language Processing that involves rewriting a sentence to alter a specific attribute—such as sentiment, formality, or topic—while preserving the underlying semantic content. Despite its utility, the field faces significant challenges, primarily the scarcity of parallel corpora where the same content is expressed in multiple styles. This paper, presented at COLING 2020, introduces Cycle-consistent Adversarial autoEncoders (CAE), a framework designed to overcome these hurdles without requiring parallel data.

The Challenge of Unsupervised Style Transfer

Traditional approaches to TST often struggle with three main issues:

  1. Lack of Parallel Data: It is rare to find datasets containing "before and after" versions of the same sentence across different styles.
  2. Discrete Text Nature: Unlike images, text consists of discrete tokens. This prevents the direct application of gradient-based optimization techniques like Generative Adversarial Networks (GANs), as one cannot easily perform infinitesimal updates to a word.
  3. Content Preservation vs. Style Accuracy: Many models succeed at changing the style but fail to retain the original meaning, often "forgetting" the core information during the transformation.

Previous research attempted to "disentangle" content from style by separating them into distinct latent vectors. However, in natural language, style and content are often deeply intertwined, making explicit separation difficult and often leading to degraded performance.

Methodology: The CAE Architecture

The CAE architecture avoids the pitfalls of explicit disentanglement. Instead, it embeds both content and style into a shared latent space and learns to shift representations between style-specific "neighborhoods." The model consists of three integrated components:

  • LSTM Autoencoders: An encoder maps the input sentence into a continuous latent vector, while a decoder reconstructs the text from this vector.
  • Adversarial Style Transfer Networks: A generator ($T$) transforms a latent vector from Style A into a vector that mimics the distribution of Style B. Simultaneously, a discriminator ($D$) attempts to distinguish between genuine Style B vectors and those produced by the generator.
  • Cycle-Consistent Constraint: This is the core innovation of the paper. Inspired by CycleGAN, the model enforces a constraint where a vector transformed from Style A to Style B and then back to Style A must return to its original state.
The CAE architecture illustrates the flow of latent vectors through the encoding, transformation, and cycle-consistency phases.

By performing this cycle entirely within the continuous latent space rather than the discrete text space, the authors bypass the non-differentiability of words. This allows for stable, end-to-end training using standard backpropagation.

Key Insights and Latent Space Dynamics

A central argument of the paper is that explicit disentanglement is unnecessary. Through the cycle-consistency loss, the model naturally learns to preserve content-heavy features of the latent vector while only modifying the features relevant to style. The discriminators ensure that the transformed vectors land within the appropriate manifold of the target style.

Visualization of latent space clusters and example style-transferred sentences showing the shift between style neighborhoods.

As shown in the visualization above, sentences of different styles form distinct clusters in the latent space. The CAE learns the mapping between these clusters, allowing for smooth transitions that maintain semantic integrity. For example, a positive review like "it was delicious!" is mapped to a negative counterpart like "the food was bland." while remaining in the same semantic domain of food quality.

Experimental Results

The model was evaluated on two standard benchmarks: the Yelp Restaurant Reviews (sentiment transfer) and Yahoo QA (topic transfer). CAE consistently outperformed strong baselines such as ARAE and Cross-aligned Autoencoders across several key metrics:

  • Style Transfer Accuracy: On the Yelp dataset, CAE achieved an 86.9% success rate, a significant improvement over the previous state-of-the-art of 81.8%.
  • Fluency: The model achieved the lowest Perplexity (PPL) scores (21.6 on Yelp), indicating that the generated sentences are more natural and grammatically correct than those from competing models.
  • Content Preservation: Human evaluations confirmed that CAE is superior at keeping the original meaning intact. Ablation studies highlighted that removing the cycle-consistency constraint led to a massive drop in BLEU scores, proving the constraint's vital role in content preservation.

Conclusion and Future Directions

Cycle-consistent Adversarial autoEncoders provide a robust, stable framework for unsupervised text style transfer by leveraging latent space cycling. While the current work focuses on LSTMs and transfers between two styles, the underlying principle of latent cycle-consistency is highly extensible. Future work may involve adapting this approach to Transformer-based architectures or extending the framework to handle multi-style transfer in a single unified model.

Summary updated

BibTeX
@inproceedings{huang2020cycle,
  author = {Yufang Huang and Wentao Zhu and Deyi Xiong and Yiye Zhang and Changjian Hu and Feiyu Xu},
  title = {{Cycle-Consistent Adversarial Autoencoders for Unsupervised Text Style Transfer}},
  booktitle = {International Conference on Computational Linguistics},
  year = {2020},
  doi = {10.18653/v1/2020.coling-main.201},
}
Figure