Language Style Transfer from Sentences with Arbitrary Unknown Styles

Yanpeng Zhao, Wei Bi, Deng Cai, Xiaojiang Liu, Kewei Tu, Shuming ShiarXiv 2018

Abstract

This paper addresses a critical limitation in current language style transfer models: the assumption that source sentences belong to a single, known style. In real-world applications, such as open-domain chatbots, source inputs often consist of arbitrary and unknown styles. We propose a novel encoder-decoder framework that disentangles content from style without requiring parallel training data. By integrating a style discrepancy loss with cycle consistency, our model successfully transfers sentences into a target style while preserving core meaning. Experimental results across sentiment modification, persona-based dialogue, and literary style transfer tasks demonstrate that our approach significantly outperforms existing baselines, particularly when dealing with noisy, mixed-style source data.

Introduction

Language style transfer aims to alter the stylistic attributes of a sentence (e.g., sentiment, politeness, or persona) while maintaining its semantic content. Most existing research operates under a "binary" assumption, focusing on transferring from one well-defined style to another (e.g., negative to positive reviews). However, practical scenarios involve source data with diverse, unknown styles. If a chatbot is designed to maintain a "romantic" persona, it must be able to process user inputs that are neutral, formal, or even sarcastic.

Furthermore, the lack of large-scale parallel datasets—where the same content is expressed in multiple styles—precludes the use of standard supervised learning. This paper introduces a robust unsupervised method to handle arbitrary source styles by treating style as a continuous representation rather than a binary label.

Methodology

Disentanglement and Architecture

The proposed model uses an encoder-decoder architecture designed to separate a sentence into two latent representations: a style-independent content vector ($z$) and a style vector ($y$). The framework consists of a content encoder $E_z$, a style encoder $E_y$, and a generator $G$.

The proposed framework architecture showing (a) the overall training process with style discrepancy loss and (b) the cycle consistency mechanism for content preservation.

Key Innovations

  1. Style Discrepancy Loss ($L_{dis}$): To handle unknown source styles, we introduce a pre-trained discriminator $D_s$ that estimates the proximity of a source sentence to the target style distribution. This probability guides the latent style representation; if a sentence is already stylistically similar to the target, its style vector reflects this proximity, allowing for more nuanced transfer.
  2. Cycle Consistency Loss ($L_{cyc}$): To ensure content preservation, we employ a "round-trip" reconstruction constraint. A sentence transferred from its original style to a target style must be reconstructible back to its original form when combined with its original style vector. This forces the generator to retain semantic information during the transfer process.
  3. Adversarial Training: A global discriminator $D$ is used in a Generative Adversarial Network (GAN) setup to ensure the generated sentences are indistinguishable from real target-style text, improving the naturalness of the output.

Experimental Results

Robustness to Style Noise

The model was evaluated on the Yelp Restaurant Reviews dataset, where the authors intentionally created "noisy" source sets by mixing neutral and negative sentences. This setup tests the model's ability to identify and modify style when the source domain is not pure.

Performance comparison (accuracy) on the Yelp sentiment task with varying amounts of mixed-style source data, demonstrating the robustness of the proposed model.

As shown in the results, the performance of the standard Style Transfer Baseline (STB) degrades significantly as the amount of mixed-style data increases, dropping to an accuracy of 53.5% with 150k samples. In contrast, our proposed model maintains high stability, achieving 93.4% accuracy. This confirms that the style discrepancy loss effectively leverages distance as a signal to handle unknown source styles.

Qualitative and Human Evaluation

In the Shakespearean task (Modern $\rightarrow$ Early Modern English), the model successfully adopted period-specific vocabulary (e.g., "thee," "hath") while maintaining better grammatical structure than baselines. Human evaluations across three metrics—content preservation, sentiment modification, and fluency—consistently rated our model higher than previous state-of-the-art methods.

Conclusion

This work presents a significant step toward flexible language style transfer. By moving away from binary style assumptions and utilizing cycle consistency with a novel discrepancy loss, we provide a model that is robust to real-world data noise. Future work will focus on incorporating prior knowledge of style distributions to further refine the latent representations and addressing minor grammatical inconsistencies in low-resource literary tasks.

Summary updated

BibTeX
@misc{zhao2018language,
  author = {Yanpeng Zhao and Wei Bi and Deng Cai and Xiaojiang Liu and Kewei Tu and Shuming Shi},
  title = {{Language Style Transfer from Sentences with Arbitrary Unknown Styles}},
  year = {2018},
  eprint = {1808.04071},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1808.04071},
}
Figure