Hate Speech and Offensive Language Identification on Multilingual Code Mixed Text using BERT

Snehaan Bhawal, Pradeep Roy, Abhinav KumarFIRE (Working Notes) 2021

Introduction

The proliferation of social media has necessitated robust automated systems for detecting hate speech and offensive language. While significant progress has been made in monolingual English contexts, multilingual societies like India present a unique challenge: code-mixing. This linguistic phenomenon involves the blending of native languages (e.g., Tamil, Malayalam) with English, often using the Roman script (transliteration) rather than native scripts. This creates a significant "Out-of-Vocabulary" (OOV) problem for standard NLP models, as transliterated words like "Namaskaram" (Malayalam for hello) are not recognized by models trained only on English or native scripts.

Methodology

This study evaluates three distinct architectural approaches to bridge the gap in identifying offensive content within code-mixed Dravidian language datasets.

Proposed architecture for hate speech detection across conventional ML, Deep Learning, and Transfer Learning models.
  1. Conventional Machine Learning: Baseline models including Logistic Regression (LR), Naive Bayes (NB), XGBoost (XGB), and Support Vector Machines (SVM) were implemented using 1-5 gram TF-IDF features.
  2. Deep Neural Networks: The researchers explored sequential and convolutional architectures, including a four-layer Dense Neural Network (DNN), a 1D Convolutional Neural Network (CNN) for local feature extraction, and Bidirectional Long Short-Term Memory (Bi-LSTM) networks to capture long-range dependencies.
  3. Transfer Learning (Transformer Models): The core of the study compared three BERT variants:
  4. mBERT: A multilingual model trained on 102 languages.
  5. IndicBERT: A multilingual ALBERT model focused on 12 Indian languages.
  6. MuRIL (Multilingual Representations for Indian Languages): A BERT variant specifically trained on 17 Indian languages, including both native scripts and their transliterated counterparts.

Experimental Setup

The research utilized the HASOC-Dravidian-CodeMix-FIRE2021 dataset, focusing on Malayalam and Tamil code-mixed text. The Malayalam subset contained approximately 4,000 training and 950 validation samples, while the Tamil subset contained 4,000 training and 940 validation samples. Preprocessing involved cleaning social media noise and converting emojis to text using the demoji library.

Results and Discussion

The experimental results demonstrated a clear hierarchy in model performance. While traditional ML models like Logistic Regression performed respectably (Weighted F1-score of 0.70 for Malayalam and 0.82 for Tamil), they were consistently outperformed by deep learning and transformer-based architectures.

Comparative performance of Transfer Learning models (BERT, IndicBERT, and MuRIL) on Malayalam and Tamil code-mixed datasets.

As shown in the results, MuRIL emerged as the superior model, achieving a Weighted F1-score of 0.78 for Malayalam and 0.91 for Tamil. The success of MuRIL is attributed to its training regimen, which includes translated and transliterated pairs. This allows the model to understand the relationship between Romanized text and its native meaning, a feature lacking in IndicBERT, which primarily focuses on native scripts. While performance on the final test set was slightly lower (0.734 for Malayalam and 0.636 for Tamil), MuRIL maintained its lead over all other baselines.

Conclusion

The study confirms that transformer-based models, specifically those pre-trained on transliterated Indian languages like MuRIL, are highly effective at navigating the complexities of code-mixed social media text. Future research will focus on normalizing spelling variations in transliterated text and expanding the dataset to include a wider variety of social media platforms to further improve model robustness against evolving internet slang.

Summary updated

BibTeX
@inproceedings{bhawal2021hate,
  author = {Snehaan Bhawal and Pradeep Roy and Abhinav Kumar},
  title = {{Hate Speech and Offensive Language Identification on Multilingual Code Mixed Text using BERT}},
  booktitle = {FIRE (Working Notes)},
  year = {2021},
}
Figure