Abstract
Sentiment modification aims to alter the sentiment of a sentence while preserving its semantic content. A significant challenge in this field is the lack of parallel data—pairs of sentences identical in content but differing in sentiment. We present the Sentiment Memory based Auto-Encoder (SMAE), a novel framework that explicitly separates emotional words from context and stores them in specialized sentiment memories. Our approach achieves a substantial 18.55-point improvement in BLEU score over previous state-of-the-art methods, demonstrating superior content preservation without sacrificing sentiment transformation accuracy.
Introduction
Sentiment modification is a key task in natural language processing, involving transformations such as changing "The food is cold and tasteless" to "The food is warm and delicious." The primary difficulty lies in balancing sentiment transformation with content preservation in the absence of parallel training data. Previous implicit methods often failed to maintain context, leading to outputs that changed sentiment but lost the original subject matter. For instance, a model might transform a movie review into a restaurant review simply because it lacks a robust mechanism to anchor the sentiment to the specific context.
Methodology
The proposed Sentiment Memory based Auto-Encoder (SMAE) addresses these issues by explicitly decoupling sentiment from content through a three-step architecture.
1. Emotional Word Detection
SMAE utilizes a modified self-attention mechanism with a sigmoid-based activation. Unlike standard softmax attention, which spreads weights across many words, this approach pushes weights toward binary values (0 or 1). This allows the model to precisely identify words that carry emotional weight versus neutral context words. By feeding only the non-emotional words into the encoder, the resulting "content representation" remains truly sentiment-neutral.
2. Sentiment Memories
The model maintains two distinct memory matrices, $M^{pos}$ and $M^{neg}$. During training, emotional words identified in the first step (e.g., "delicious" or "disgusting") are used to update the corresponding sentiment memory. This creates a structured, explicit repository of sentiment-specific vocabulary that the model can draw from during generation.
3. Context-Aware Retrieval
During decoding, the model uses the sentiment-neutral context vector to query the target sentiment memory. This ensures that the retrieved emotional words are contextually appropriate. For example, if the context involves "staff," the memory module is more likely to provide "friendly" or "attentive" rather than food-related adjectives like "crunchy."
Experimental Results
The SMAE model was evaluated on the Yelp Review Dataset, consisting of 510,000 training sentences filtered for high sentiment confidence (score > 0.8) using a CNN-based classifier.
Quantitative Performance
SMAE was compared against two major baselines: the Cross-aligned Auto-Encoder (CAE) and the Multi-decoder Auto-Encoder (MAE). As shown in the table below, SMAE significantly outperforms both in content preservation and sentiment accuracy.
SMAE achieved a BLEU score of 24.00, a massive jump from MAE's 5.45 and CAE's 2.77. This indicates that the output was much more semantically similar to the input. Furthermore, it reached a sentiment accuracy (ACC) of 76.64%, leading the field in successfully flipping sentence sentiment.
Human Evaluation
Blind human tests corroborated the automated metrics. SMAE received significantly higher ratings for content preservation (5.98/10 vs. ~4.4 for baselines) and fluency (6.69/10). These results suggest that the explicit memory approach produces text that is not only more accurate but also more natural to human readers.
Discussion and Conclusion
The success of SMAE highlights that explicit separation of sentiment and content is more effective than implicit latent-space separation. By leveraging non-emotional words as contextual cues for memory retrieval, the model maintains a truly sentiment-neutral content representation, making it much easier for the decoder to apply a new sentiment later.
However, limitations remain regarding ambiguous inputs. When an input sentence lacks a clear emotional tendency (e.g., "Been here twice"), the model's focus on content preservation can hinder the injection of a new sentiment. Future research will explore more robust handling of neutral phrases and the application of memory-based architectures to other style-transfer tasks, such as modifying the formality or persona of a text.
Summary updated