Revisiting Supervised Contrastive Learning for Microblog Classification

Junbo Huang, Ricardo UsbeckEMNLP 2024

Abstract

Classifying microblog content, such as tweets, remains a significant challenge in NLP due to the prevalence of informal language, sarcasm, and limited context. While large-scale pre-training and massive models are common solutions, they are often computationally prohibitive. This paper explores a more resource-efficient alternative: enhancing the fine-tuning of base models like RoBERTa through Supervised Contrastive Learning (SCL). By employing a joint loss function that combines standard Cross-Entropy with SCL, the proposed framework explicitly structures the embedding space to cluster similar labels. Our results demonstrate that this approach leads to substantial performance gains, frequently outperforming specialized domain-specific models and even large-scale models like ChatGPT.

Introduction

The short, noisy nature of microblogs makes tasks like sentiment analysis or topic classification particularly difficult. Standard fine-tuning of "base" models often struggles with ambiguous samples—for instance, distinguishing between genuine and sarcastic uses of emojis. While the field has trended toward massive Large Language Models (LLMs) or domain-specific pre-training (e.g., BERTweet), these methods require significant computational resources.

This research addresses the need for a robust, efficient fine-tuning strategy. The authors propose that by explicitly "pulling" representations of similar labels together and "pushing" different ones apart in the embedding space, smaller models can achieve superior performance on noisy data without the need for massive scale.

Methodology: Joint Learning with SCL

The core of the proposed framework is a joint learning objective. During fine-tuning, the model is optimized using both a standard Cross-Entropy (CE) loss and a Supervised Contrastive Learning (SCL) loss.

The proposed fine-tuning architecture featuring a RoBERTa-base feature extractor, a linear projection network, and a joint loss objective (SCL + Cross-Entropy).

The SCL loss functions by shaping the model's internal representations. It forces the model to cluster tweets sharing the same label while separating those with different labels. To implement contrastive learning without manual data augmentation, the researchers utilize the dropout mechanism inherent in Transformer architectures. By passing the same input through the network twice, the stochastic nature of dropout generates two distinct "views" of the same data point. The final objective is a weighted combination of the SCL and CE losses, controlled by a hyperparameter $\alpha$.

Experimental Setup

The framework was evaluated on two primary English microblog benchmarks:

  1. TweetEval: Comprising seven subtasks: Emoji prediction, Emotion detection, Hate speech detection, Irony detection, Offensive language identification, Sentiment analysis, and Stance detection.
  2. Tweet Topic Classification: A single-label task involving six diverse categories such as sports, gaming, and technology.

Results and Analysis

The integration of SCL yielded consistent improvements across all evaluated tasks. On the Tweet Topic Classification benchmark, the SCL-enhanced model achieved a macro F1-score of 76.2, a significant increase over the 65.6 baseline.

Performance comparison of the SCL-enhanced RoBERTa model (Rob-bs CE+SCL) against various baselines, including ChatGPT and domain-specific models, across TweetEval subtasks.

As shown in the results table, the proposed method (Rob-bs CE+SCL) outperformed ChatGPT in several key areas, including Emoji prediction, Sentiment analysis, and Stance detection. Furthermore, it surpassed specialized models like BERTweet and TimeLMs in multiple categories, demonstrating that clever loss functions can effectively compensate for the lack of domain-specific pre-training or massive parameter counts.

Key Insights

  • Resilience to Noise: SCL explicitly pulls ambiguous samples toward their correct class clusters, making the model more resilient to the inherent noise of microblogging.
  • The Role of Labels: An ablation study comparing SCL to Self-Supervised Contrastive Learning (SSCL) revealed that label information is crucial. Without it, the model suffers from "class collision," where it incorrectly pushes apart samples belonging to the same category.
  • Emoji Handling: Qualitative analysis suggests SCL prevents the model from overfitting to specific emojis by leveraging broader class context, leading to better generalization.

Conclusion and Future Work

This study confirms that Supervised Contrastive Learning is a powerful tool for improving microblog classification with relatively small models. By structuring the embedding space more effectively, researchers can achieve state-of-the-art results with modest hardware.

Future research directions include extending this framework to low-resource languages, exploring more sophisticated data augmentation techniques (such as back-translation), and testing the approach on a wider variety of model architectures. Additionally, investigating the impact of larger batch sizes—which typically benefit contrastive learning—could further unlock the potential of this method.

Summary updated

BibTeX
@inproceedings{huang2024revisiting,
  author = {Junbo Huang and Ricardo Usbeck},
  title = {{Revisiting Supervised Contrastive Learning for Microblog Classification}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.emnlp-main.876},
}
Figure