A Hierarchical Reinforced Sequence Operation Method for Unsupervised Text Style Transfer

Chen Wu, Xuancheng Ren, Fuli Luo, Xu Sun

Abstract

Unsupervised text style transfer aims to alter text styles while preserving the content, without aligned data for supervision. Existing seq2seq methods face three challenges: 1) the transfer is weakly interpretable, 2) generated outputs struggle in content preservation, and 3) the trade-off between content and style is intractable. To address these challenges, we propose a hierarchical reinforced sequence operation method, named Point-Then-Operate (PTO), which consists of a high-level agent that proposes operation positions and a low-level agent that alters the sentence. We provide comprehensive training objectives to control the fluency, style, and content of the outputs and a mask-based inference algorithm that allows for multi-step revision based on the single-step trained agents. Experimental results on two text style transfer datasets show that our method significantly outperforms recent methods and effectively addresses the aforementioned challenges.

Introduction

Unsupervised text style transfer (TST) is the task of changing the stylistic attributes of a sentence (e.g., sentiment, formality) while maintaining its semantic content, without the benefit of parallel corpora. Traditional approaches typically rely on Sequence-to-Sequence (seq2seq) models. However, these "black-box" models often suffer from poor interpretability, as it is unclear why specific changes are made. Furthermore, global generation often leads to "hallucinations" or the loss of style-independent content. Finally, balancing the intensity of style transfer against content preservation remains a difficult trade-off in generative models.

The Point-Then-Operate (PTO) Framework

To overcome these limitations, we introduce Point-Then-Operate (PTO), a hierarchical reinforcement learning framework. Instead of rewriting a sentence from scratch, PTO treats style transfer as a sequence of targeted, "surgical" edits.

Hierarchical Architecture

The system employs two specialized agents:

  1. High-Level Agent (Pointer): This agent identifies the specific word or position in the sentence that requires modification. By focusing on stylized tokens, the model preserves the rest of the sentence's factual content.
  2. Low-Level Agent (Operator): Once a position is selected, this agent chooses an operation from a predefined toolkit, including Replace, InsertFront, InsertBehind, Delete, and Skip.
The PTO architecture consists of a Pointer agent and an Operator agent, trained with rewards for style, fluency, and reconstruction.

Training with Reinforcement Learning

Since parallel data is unavailable, PTO is trained using Reinforcement Learning (RL) with three primary reward signals:

  • Style Polarity: A pre-trained classifier rewards changes that align the sentence with the target style.
  • Fluency: A language model ensures the resulting sentence remains grammatically correct and natural.
  • Content Preservation: A self-supervised reconstruction reward encourages the model to retain enough information to "undo" its edits, preventing the loss of critical semantic data.

Iterative Inference and Interpretability

A key advantage of PTO is its iterative nature. During inference, a mask-based algorithm allows the model to perform multiple revisions on a single sentence. This process is highly interpretable, as each step explicitly shows which word was targeted and how it was changed.

An example of iterative style transfer: the model replaces "great" with "horrible," "enjoying" with "avoid," and inserts "not" to negate the sentiment.

Experimental Results

We evaluated PTO on the Yelp and Amazon sentiment transfer datasets. PTO demonstrated significant improvements over state-of-the-art seq2seq methods:

  • Content Preservation: On the Yelp dataset, PTO achieved a BLEU score of 29.86, significantly higher than the previous best of 22.75.
  • Human Evaluation: In blind tests, PTO was rated highest for both Fluency (4.39/5) and Content Preservation (4.56/5).
  • Controllability: By adjusting the "stop" threshold ($p_{stop}$) during the iterative process, users can effectively navigate the trade-off between style strength and content preservation.

Conclusion

The Point-Then-Operate method shifts the paradigm of text style transfer from global generation to local, interpretable operations. By surgically editing stylized words, PTO achieves superior content preservation and provides a clear window into the model's decision-making process. Future work will explore applying this framework to more complex style attributes and multi-word stylized phrases.

Summary updated

BibTeX
@inproceedings{wu2019hierarchical,
  author = {Chen Wu and Xuancheng Ren and Fuli Luo and Xu Sun},
  title = {{A Hierarchical Reinforced Sequence Operation Method for Unsupervised Text Style Transfer}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2019},
  doi = {10.18653/v1/p19-1482},
}
Figure