Introduction
Automated hate speech detection is a vital tool for maintaining healthy online environments. However, current systems predominantly focus on high-resource languages like English, leaving low-resource languages such as Sinhala and Tamil underserved. These languages often lack the large-scale annotated datasets and robust NLP tools required for training effective classifiers. Traditional approaches using SVMs or standard deep learning models (CNNs, LSTMs) frequently struggle with small, imbalanced datasets and the informal, culturally nuanced nature of social media text.
The Dual Contrastive Learning (DCL) Framework
To address these challenges, the authors propose a Dual Contrastive Learning (DCL) framework designed to fine-tune Multilingual Large Language Models (MLLMs) like XLM-RoBERTa and TwHIN-BERT. The framework utilizes a multi-stage loss function to extract rich semantic features even from limited data.
The DCL methodology consists of four key components:
- Data Augmentation via Dropout: Input sentences are passed through the MLLM twice with standard dropout, creating two distinct embedding "views" that act as positive pairs.
- Self-Supervised Contrastive Learning: The model maximizes cosine similarity between augmented views of the same sentence while minimizing similarity between different sentences in a batch.
- Supervised Contrastive Learning: Using dataset labels, the model pulls embeddings from the same class closer together and pushes different classes apart.
- Focal Loss Integration: To handle class imbalance, Focal Loss is used to prioritize hard-to-classify examples over majority-class samples.
Experimental Evaluation
The framework was evaluated on three datasets: Facebook Sinhala (6,345 samples), Twitter Sinhala (4,502 samples), and Tamil Hate Speech (5,503 samples). The Twitter Sinhala dataset is particularly challenging due to its high class imbalance, with only 24.6% of samples categorized as hate speech.
Key Results and Insights
A major finding of the study is that the pre-training domain of the MLLM is a critical factor in performance. TwHIN-BERT, pre-trained on 7 billion tweets, significantly outperformed XLM-RoBERTa, which was trained on formal web text. This highlights the importance of domain-specific pre-training for noisy social media environments.
As shown in the table above, the $DCL_{TwHIN-BERT}$ model achieved a 94.00% F1 score on the Twitter Sinhala dataset. Notably, while an ensemble of CNN, LSTM, and BiGRU reached a similar accuracy, its F1 score was significantly lower (91.90%), indicating that the DCL framework is far more robust against severe class imbalance. Similar state-of-the-art results were observed for the Facebook Sinhala and Tamil datasets.
Conclusion
The Dual Contrastive Learning framework provides a powerful method for hate speech detection in low-resource settings. By combining intrinsic semantic learning with supervised class separation, it overcomes the limitations of small, imbalanced datasets. Future work will involve testing the framework on a wider variety of MLLMs and extending the methodology to more low-resource languages.
Summary updated