Abstract
Most existing deep learning-based sentiment classification methods need large human-annotated data, but labeling large amounts of high-quality emotional texts is labor-intensive. Users on various social platforms generate massive amounts of tagged opinionated text (e.g., tweets, customer reviews), providing a new resource for training deep models. However, some of the tagged instances have sentiment tags that are diametrically opposed to their true semantics. We cannot use this tagged data directly because the noisy labeled instances have a negative impact on the training phase. In this paper, we present a novel Simple Weakly-supervised Contrastive Learning framework (SWCL). We use the contrastive learning strategy to pre-train the deep model on the large user-tagged data (referred to as weakly-labeled data) and then the pre-trained model is fine-tuned on the small human-annotated data. We refine the contrastive loss function to better exploit inter-class contrastive patterns, making contrastive learning more applicable to the weakly-supervised setting. Besides, multiple sampling on different sentiment pairs reduces the negative impact of label noises. SWCL captures the diverse sentiment semantics of weakly labeled data and improves their suitability for downstream sentiment classification tasks. Our method outperforms the other baseline methods in experiments on the Amazon review, Twitter, and SST-5 datasets. Even when fine-tuned on 0.5 percent of the training data (i.e. 32 instances), our framework significantly boosts the deep models’ performance, demonstrating its robustness in a few-shot learning scenario.
Introduction
Deep learning models for sentiment classification are notoriously data-hungry, typically requiring thousands of human-annotated examples to achieve high performance. While the internet provides a "free" alternative in the form of weakly-labeled data—such as product reviews with star ratings or tweets with emoticons—this data is inherently noisy. A user might provide a 5-star rating but write a sarcastic, negative review. If a model is trained directly on this noisy data, it often "memorizes" the errors, leading to poor generalization.
The Simple Weakly-supervised Contrastive Learning (SWCL) framework addresses this challenge by effectively harvesting rich sentiment patterns from massive, noisy datasets without allowing label noise to degrade model performance.
Methodology
The SWCL framework employs a two-step transfer learning paradigm designed to maximize the utility of noisy data while maintaining robustness.
1. Weakly-supervised Contrastive Pre-training
Unlike standard self-supervised contrastive learning that relies on data augmentation, SWCL utilizes weak labels (e.g., positive or negative ratings) to form contrastive pairs. The framework employs a modified version of the NT-Xent (normalized temperature-scaled cross-entropy) loss. This objective forces the model to map instances with the same weak label to nearby points in the embedding space while pushing instances with different labels further apart.
2. Supervised Fine-tuning
Following pre-training, the model is fine-tuned on a small, high-quality, human-annotated dataset. To combat noise during the pre-training phase, the framework uses multiple sampling within mini-batches. By comparing an "anchor" instance against many others, the impact of a single mislabeled instance is statistically diluted.
Experimental Results
The framework was evaluated on three major benchmarks: Amazon Reviews, Twitter, and the SST-5 fine-grained sentiment dataset.
Performance and Robustness
SWCL-BERT achieved state-of-the-art results, with 90.6% accuracy on the Amazon dataset and 90.5% on Twitter, significantly outperforming standard BERT and other contrastive baselines.
The framework's most striking capability is its performance in few-shot scenarios. When fine-tuned on only 0.5% of the labeled data (approximately 32 instances), SWCL-BERT maintained an accuracy of 85.7%, whereas standard BERT performance dropped to 71.4%. This demonstrates that the contrastive pre-training phase successfully captures robust sentiment features that generalize well even with minimal supervision.
Handling Label Noise
Contrastive learning acts as a natural noise filter. Because it focuses on relative similarity rather than forcing a sample to match a specific potentially incorrect label, the model learns the underlying sentiment structure more effectively. The temperature hyperparameter ($\tau$) in the loss function further allows for controlling the model's tolerance to noisy samples that appear as "hard" negatives.
Conclusion
The SWCL framework provides a robust solution for sentiment classification in low-resource settings. By leveraging massive, noisy, weakly-labeled data through a refined contrastive learning strategy, it significantly reduces the dependency on expensive human annotation. Future work may explore the application of this framework to more complex tasks such as aspect-based sentiment analysis and its integration with newer transformer architectures.
Summary updated