Towards Fine-grained Text Sentiment Transfer

Fuli Luo, Peng Li, Pengcheng Yang, Jie Zhou, Yutong Tan, Baobao Chang, Zhifang Sui, Xu Sun

Abstract

Traditional sentiment transfer research often simplifies the task into a binary classification problem, ignoring the inherent nuances of human language. This paper introduces Seq2SentiSeq, a novel framework designed for fine-grained text sentiment transfer. By incorporating a Gaussian kernel layer into an encoder-decoder architecture and employing a Cycle Reinforcement Learning (CycleRL) strategy, the proposed model achieves precise control over sentiment intensity on a continuous scale. Evaluated on the Yelp review dataset, Seq2SentiSeq demonstrates significant improvements in content preservation, sentiment accuracy, and fluency compared to existing state-of-the-art methods.

1. Introduction

Text sentiment transfer involves modifying the sentiment of a sentence while preserving its semantic content. While previous work has focused on binary flipping (e.g., positive to negative), real-world applications require more granular control. For instance, a user might want to upgrade a "decent" review to an "extraordinary" one. Achieving this fine-grained control presents two primary challenges: the difficulty of injecting specific numeric intensity values into generative models and the absence of parallel datasets containing the same content at varying intensity levels.

2. Methodology

The Seq2SentiSeq framework addresses these challenges through a specialized architecture and an unsupervised training paradigm.

2.1 Seq2SentiSeq Architecture

The core of the system is an encoder-decoder network enhanced with a Gaussian kernel layer to modulate sentiment intensity. The model decomposes the probability of generating the next word into semantic and sentiment components.

The Seq2SentiSeq architecture featuring the Gaussian kernel layer for intensity control.

As shown in Figure 1, the sentiment probability $p_5^s(y_5)$ is determined by a Gaussian distribution centered at the target sentiment intensity value $v_y$. This mechanism prioritizes words whose predicted sentiment intensity aligns closely with the desired target, allowing for precise, continuous-scale adjustments.

2.2 Cycle Reinforcement Learning (CycleRL)

To overcome the lack of parallel training data, the authors utilize CycleRL, a training strategy inspired by back-translation in machine translation.

The Cycle Reinforcement Learning (CycleRL) framework for unsupervised training.

As illustrated in Figure 3, the training process involves two primary rewards:

  • Sentiment Reward ($r_s$): A pre-trained sentiment scorer evaluates the generated output $\hat{y}$. The model receives a higher reward if the output's sentiment matches the target intensity $v_y$.
  • Content Reward ($r_c$): To ensure semantic integrity, the generated text $\hat{y}$ is fed back into an encoder-decoder to reconstruct the original input $x$. A successful reconstruction indicates that the core meaning was preserved during the transfer.

3. Experimental Setup and Results

The model was trained on the Yelp Review Dataset (640K sentences), with star ratings normalized to a 0–1 intensity scale. For evaluation, a benchmark of 500 test sentences with human-written references across five intensity levels was created.

Seq2SentiSeq significantly outperformed both fine-grained and coarse-grained baselines across several metrics:

  • Content Preservation: The model achieved a BLEU-1 score of 32.5, a substantial improvement over the previous state-of-the-art of 23.9.
  • Sentiment Accuracy: It attained a Mean Absolute Error (MAE) of 0.13, indicating high precision in matching requested intensities.
  • Fluency: Human evaluations rated the model's fluency at 4.17/5.0, surpassing competing models that often struggled with grammatical consistency.

4. Conclusion

Seq2SentiSeq represents a significant advancement in text style transfer by enabling fine-grained control over sentiment intensity. By leveraging Gaussian kernels and CycleRL, the model effectively balances sentiment accuracy with content preservation in an unsupervised setting. Future research may explore extending this intensity-based control to other linguistic attributes such as formality or politeness.

Summary updated

BibTeX
@inproceedings{luo2019towards,
  author = {Fuli Luo and Peng Li and Pengcheng Yang and Jie Zhou and Yutong Tan and Baobao Chang and Zhifang Sui and Xu Sun},
  title = {{Towards Fine-grained Text Sentiment Transfer}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2019},
  doi = {10.18653/v1/p19-1194},
}
Figure