A Soft Contrastive Learning-Based Prompt Model for Few-Shot Sentiment Analysis

Jingyi Zhou, Jie Zhou, Jiabao Zhao, Siyin Wang, Haijun Shan, Tao Gui, Qi Zhang, Xuanjing Huang

TL;DR

This paper introduces the Soft Contrastive learning-based Prompt (SCP) model, a novel approach for few-shot sentiment analysis that tackles the challenge of subtle semantic differences between fine-grained emotions. SCP combines a "chain of thought" prompting strategy for step-by-step sentiment reasoning with a soft contrastive learning method that accounts for label correlations, significantly improving performance over existing methods, including ChatGPT.

What Problem Does This Paper Address?

Few-shot sentiment analysis is a critical but challenging task, especially when dealing with fine-grained emotions. Unlike broad categories like "positive" or "negative," emotions like "joy" and "love" can be semantically very close, making it difficult for models to distinguish them with limited training data. Traditional few-shot classification methods often treat all non-target classes as equally dissimilar, overlooking these nuanced relationships. This paper aims to bridge this gap by developing a model that explicitly considers the subtle correlations between sentiment labels, leading to more accurate predictions in low-data scenarios.

Methods

The proposed SCP model has two main components:

  1. Sentiment-Aware Chain of Thought Prompt (SCOT): Inspired by human reasoning, this module guides the model to predict sentiment in a step-by-step manner, moving from coarse to fine-grained categories. It uses a series of intermediate prompts to break down the sentiment classification process, allowing the model to build up its understanding. For example, a sentence might first be classified as "positive," then refined to "joy," and finally to a more specific emotion.
  2. Soft Contrastive Learning (SoftCL): This is the core innovation for handling label correlations. Instead of treating all other classes as hard negative examples, SoftCL calculates a "soft" contrastive loss. This loss function leverages the pre-computed correlation coefficients between sentiment labels. This means that samples from closely related sentiment classes are pulled closer in the model's representation space, while samples from distant classes are pushed further apart, but with a degree of flexibility based on their correlation.

The model is trained by jointly optimizing a cross-entropy loss for the prompt predictions and the SoftCL loss.

Datasets

The experiments were conducted on datasets derived from GoEmotions, a fine-grained emotion dataset containing 58K Reddit comments with 27 emotions and a neutral category. The authors created few-shot sentiment analysis datasets by randomly selecting K samples (K = 1, 5, 10, 15, 20) for training, using 500 samples for validation, and 5% of the original test set for evaluation.

Key Insights and Ideas

  • Subtlety of Fine-Grained Emotions: The paper highlights that the semantic distances between fine-grained sentiment labels are crucial and often overlooked by standard classification methods.
  • Chain of Thought for Reasoning: Breaking down sentiment prediction into intermediate steps (SCOT) mimics human reasoning and significantly aids the model in understanding complex emotional nuances.
  • Correlation-Aware Contrastive Learning: Explicitly modeling the correlations between sentiment labels (SoftCL) is key to improving performance in few-shot settings, as it allows the model to learn more sophisticated relationships between classes.
  • Prompting is Powerful, but Needs Nuance: While prompt-based methods are effective for few-shot learning, they benefit greatly from specialized techniques like SCOT and SoftCL for tasks with subtle class distinctions.

Key Results

The SCP model consistently outperformed all compared baselines, including strong few-shot text classification methods and even ChatGPT, across various few-shot settings (K=1 to K=20). For instance, in the K=20 setting, SCP achieved an accuracy of 0.560 and an F1 score of 0.529, surpassing ChatGPT's 0.362 (F1) and 0.322 (Acc) in their limited few-shot experiments. Ablation studies confirmed that both the SCOT module and the SoftCL component contribute significantly to the overall performance improvement. Visualizations using t-SNE showed that SCP effectively clusters representations of samples with highly correlated labels while separating those with less correlated ones.

Limitations and Future Work

The authors acknowledge that few-shot sentiment analysis remains a challenging task, even for large language models like ChatGPT. They suggest that future work could involve exploring more complex prompt templates for the SCOT module and extending the SCP method to other fine-grained classification tasks beyond sentiment analysis.

Summary updated

BibTeX
@inproceedings{zhou2024soft,
  author = {Jingyi Zhou and Jie Zhou and Jiabao Zhao and Siyin Wang and Haijun Shan and Tao Gui and Qi Zhang and Xuanjing Huang},
  title = {{A Soft Contrastive Learning-Based Prompt Model for Few-Shot Sentiment Analysis}},
  booktitle = {IEEE International Conference on Acoustics, Speech and Signal Processing},
  year = {2024},
  doi = {10.1109/icassp48485.2024.10446983},
}
Figure