Introduction
Sentiment modification aims to alter the sentiment polarity of a sentence while preserving its core semantic content. For example, transforming "The food is delicious" into "The food is disgusting" requires changing the attribute (positive to negative) while maintaining the subject (the food). This task is particularly challenging in the absence of parallel datasets—pairs of sentences with identical content but opposite sentiments.
The Challenge of Content Preservation
Traditional unsupervised approaches often rely on adversarial learning to disentangle sentiment from content in a latent space. However, these implicit methods frequently fail to preserve context, often producing nonsensical outputs where the modified sentence bears little resemblance to the original topic. Researchers at Peking University address this by proposing the Sentiment Memory based Auto-Encoder (SMAE), which shifts from implicit disentanglement to an explicit "identify and replace" strategy.
The SMAE Framework
The SMAE model operates through three distinct phases designed to isolate emotional triggers and replace them using context-aware memory retrieval.
1. Emotional Word Detection
Unlike standard attention mechanisms that distribute weights across many tokens, SMAE employs a modified self-attention mechanism utilizing a sigmoid function. This approach forces the model to make binary-like decisions: assigning weights near 1 to emotional keywords (e.g., "excellent") and weights near 0 to context-bearing words (e.g., "service").
2. Sentiment Memories
The model maintains two external memory matrices, $M^{pos}$ and $M^{neg}$. During the training phase, the embeddings of detected emotional words are used to populate and update these memories. This creates a structured repository of sentiment-specific vocabulary.
3. Context-Aware Decoding
To generate the modified sentence, the model uses the "content" (words with low attention weights) as a query to the target sentiment memory. For instance, if the context is "staff," the model queries the negative memory to find a semantically appropriate replacement, such as "rude." The decoder then synthesizes this retrieved sentiment information with the original context to produce the final output.
Experimental Evaluation
The model was evaluated using the Yelp Review Dataset, consisting of 510,000 training sentences. Sentences were filtered using a pre-trained CNN classifier to ensure high sentiment polarity (probability > 0.8). SMAE was compared against two prominent unsupervised frameworks: the Cross-aligned Auto-Encoder (CAE) and the Multi-decoder Auto-Encoder (MAE).
Quantitative Results
The primary breakthrough of SMAE lies in its ability to preserve content while successfully flipping sentiment. As shown in the performance metrics below, SMAE achieved a BLEU score of 24.00, representing a nearly five-fold improvement over previous state-of-the-art methods.
The model also achieved a sentiment modification accuracy (ACC) of 76.64%, outperforming both CAE (71.96%) and MAE (74.59%).
Human Evaluation
In addition to automated metrics, human evaluators rated the models on a 1-10 scale for Sentiment, Content Preservation, and Fluency. SMAE significantly outperformed baselines in Content Preservation (5.98 vs. ~4.4) and Fluency (6.69 vs. ~5.6), confirming that the explicit memory-based approach produces more coherent and contextually relevant sentences.
Key Insights
The success of SMAE highlights several critical principles in sentiment modification:
- Context as a Retrieval Cue: Non-emotional context provides strong constraints on which emotional words are appropriate. By using context to query a memory bank, the model ensures that "food" leads to "tasty" rather than "friendly."
- Explicit vs. Implicit Disentanglement: Explicitly masking and replacing words is more effective for preserving meaning than trying to "hide" sentiment within a dense latent vector.
- Efficiency: Using a single decoder assisted by sentiment memories reduces parameter count compared to multi-decoder architectures while providing more targeted generation.
Limitations and Future Work
Despite its strengths, SMAE struggles with ambiguous inputs that lack explicit emotional "trigger" words. For example, a sentence like "Been here twice" may imply a negative experience in context but lacks a specific adjective for the model to identify and replace. Future research may focus on more sophisticated detection mechanisms capable of handling sarcasm or sentiment expressed through complex sentence structures and long-range dependencies.
Conclusion
The Sentiment Memory based Auto-Encoder represents a significant advancement in unsupervised sentiment modification. By leveraging explicit sentiment memories and context-aware retrieval, the model achieves unprecedented levels of content preservation, bridging the gap between sentiment accuracy and semantic relevance.
Summary updated