A Machine Learning Framework for Detecting Hate Speech and Fake Narratives in H indi- E nglish Tweets (2024)

Abstract: This paper presents a novel system developed for the Faux-Hate Shared Task at ICON2024, addressing the detection of hate speechand fake narratives within Hindi-English code-mixed social media data. Our approach com-bines advanced text preprocessing, TF-IDFvectorization, and Random Forest classifiersto identify harmful content, while employingSMOTE to address class imbalance. By lever-aging ensemble learning and feature engineer-ing, our system demonstrates robust perfor-mance in detecting hateful and fake content,classifying targets, and evaluating the sever-ity of hate speech. The results underscore thepotential for real-world applications, such asmoderating online platforms and identifyingharmful narratives. Furthermore, we highlightethical considerations for deploying such tools,emphasizing responsible use in sensitive do-mains, thereby advancing research in multilin-gual hate speech detection and online abusemitigation.

## introduction the spread of hate speech and fake narratives on social media has become a pervasive issue, significantly impacting individuals and communities. this problem is further exacerbated in code-mixed languages, where multiple languages are seamlessly interwoven within the same text. a prominent example is hindi-english code-mixed text, commonly observed on social platforms in regions where both languages are spoken. this linguistic complexity adds layers of difficulty to traditional text analysis models, making the detection of harmful content, such as hate speech and fake narratives, much more challenging. in recent years, numerous efforts @xcite @xcite have been made to detect hate speech and misinformation in monolingual texts. however, codeswitching the act of mixing two or more languages in the same conversation-poses significant challenges for existing models, which are often optimized for a single language. furthermore, the high level of informality and contextual variations in social media discourse adds another layer of complexity. the faux-hate shared task at icon 2024 addresses this unique challenge by focusing on detecting fake narratives and hate speech in hindi-english code-mixed social media data. this paper presents a machine learning-based system designed specifically to tackle the issues associated with this task. our approach combines tf-idf (term frequency-inverse document frequency) vectorization for feature extraction with random forest classifiers for classification. we also incorporated smote (synthetic minority over-sampling technique) to handle class imbalance, a common problem in datasets where harmful content, such as hate speech and fake news, is often underrepresented. the system is evaluated on the faux-hate dataset, which contains social media comments labeled for both hate speech detection and fake news detection. the results from our approach demonstrate promising performance, particularly in identifying hate speech and fake narratives across the linguistically diverse and informal nature of the dataset. moreover, our system also identifies the target and severity of hateful speech, providing more granular insights into the content. by leveraging state-of-the-art techniques in text preprocessing, vectorization, and classification, our work provides a robust solution for detecting harmful content in multilingual and code-mixed social media data. this approach not only contributes to the faux-hate shared task but also has potential applications in real-world scenarios, such as content moderation, social media monitoring, and automated detection of harmful speech across diverse languages. the complexity of processing code-mixed text, especially hindi-english, is well-documented in studies like @xcite . these works highlight challenges such as transliteration, phonetic spellings, and informal expressions, which hinder effective hate speech detection. despite advancements in multilingual hate speech detection by @xcite , these studies fall short of addressing code-mixed scenarios, leaving a gap that our work aims to fill through targeted preprocessing and feature extraction techniques. in the domain of fake news detection, (zhou and zafarani, 2020) emphasized the importance of linguistic feature-based approaches, such as tf-idf, which aligns with our methodology. @xcite introduced hybrid models combining linguistic and network-based features, offering complementary strategies to enhance detection. feature engineering plays a critical role in analyzing code-mixed text. @xcite extracted features for capturing the structural and lexical variations unique to code-mixed data using deep learning approach. addressing class imbalance is crucial for tasks like hate speech detection, where minority classes often face underrepresentation. techniques such as smote, introduced by @xcite , and class weighting have been shown to enhance recall for minority classes, mitigating bias and improving overall model performance. these methods are central to our approach, enabling more equitable handling of imbalanced datasets. this survey provides a foundation for our research by integrating insights from prior studies and addressing gaps specific to code-mixed text processing, particularly in hate speech and fake news detection. ## dataset and task description the dataset utilized in this study is part of the faux-hate shared task at icon 2024 @xcite , focusing on detecting hate speech and fake narratives in hindi-english code-mixed text. it is structured into two main tasks, each addressing distinct classification challenges. the dataset is divided into training, validation, and test subsets. the training set contains 6,397 tweets labeled for both tasks, the validation set includes 801 labeled tweets, and the test set comprises 801 unlabeled tweets reserved for final evaluation. this structure allows for comprehensive development and testing of models designed to identify and characterize harmful content in multilingual, codemixed social media environments. ## methodology our methodology involves preprocessing the dataset, extracting meaningful features, addressing class imbalance, and evaluating multiple models using robust metrics to optimize performance. the proposed methodology begins with an extensive preprocessing phase to clean and prepare the dataset for analysis. this involved removing urls, mentions, hashtags, and non-alphanumeric characters to eliminate noise and irrelevant information. the text was then tokenized into meaningful units, and stopwords were removed to focus on critical content, enhancing the quality of feature extraction. features were extracted using tf-idf vectorization, leveraging unigrams and bigrams to capture both individual words and contextual relationships within the text. to further enrich the feature set, text length was included as an additional feature, allowing the model to detect nuanced patterns often present in longer and more detailed content. class imbalance, a significant challenge in detecting hate speech and fake narratives, was addressed through a combination of techniques. synthetic minority over-sampling technique (smote) was applied to generate synthetic samples for the underrepresented classes, ensuring the model was exposed to a balanced dataset during training. additionally, class weights were adjusted in several models to give higher importance to minority classes, improving recall for underrepresented categories without substantially compromising precision for the majority class. several models were explored to identify the optimal approach for this task. random forest was chosen as the primary classifier due to its robustness and ability to handle high-dimensional data, making it highly effective for text classification. logistic regression and support vector machine (svm) served as baseline models for performance comparison. gradient boosting algorithms, including xgboost and lightgbm, were evaluated for their capability to capture complex interactions in the data and enhance overall performance. simple feed-forward neural networks were also tested to model non-linear patterns; however, random forest outperformed them in this context. the models' performance was evaluated using multiple metrics, including accuracy to assess overall correctness, and macro f1-score to provide a balanced measure of performance across both classes, particularly important for imbalanced datasets. precision and recall were also examined to ensure the models could accurately identify both positive and negative samples. this comprehensive approach allowed us to address the unique challenges of codemixed text while optimizing the detection of fake content and hate speech. ## results the proposed approach demonstrates significant achievement in detecting fake content and hate speech in hindi-english code-mixed text, achieving balanced performance across both tasks. as shown in figure 1 , the model achieved an accuracy of 0.7575, demonstrating strong performance in identifying hate speech. the high macro f1 score indicates a balanced capability to handle both hate speech (minority class) and non-hate speech (majority class). precision measures the proportion of tweets correctly identified as hate speech, minimizing false positives. recall evaluates the model's ability to detect most hate speech tweets, reducing false negatives. to address class imbalance, smote was employed, enhancing the model's generalization and effectiveness in detecting hate speech. our performance in task a of the icon competition earned us a commendable 3rd place finish as shown in a similar experiment was conducted for fake news dection and the result is shown in figure 2 . as we mention in figure 2 , the model achieved an accuracy of 0.7875, reflecting strong performance in distinguishing fake narratives from real content. the results indicate the model's ability to effectively differentiate between fake and genuine content in a multilingual, code-mixed dataset. the model also exhibited strong precision, indicating that the majority of content flagged as fake was indeed fake, thereby minimizing false positives. this is particularly important to ensure that genuine content is not incorrectly classified as fake. additionally, the model achieved high recall, effectively identifying a substantial portion of fake content. this reduces false negatives and ensures that most instances of fake news are successfully detected, further solidifying the model's robustness and reliability in handling multilingual, code-mixed datasets. in the next experiment, we addressed two specific tasks: binary faux-hate detection (task a) and target and severity prediction (task b). for task a, the goal was to classify content as fake, hate, or both, and our custom model, hate-fakenet, demonstrated strong performance. built using a random forest base, enhanced with feature engineering and smote to handle class imbalance, the model effectively outperformed baseline approaches such as logistic regression and support vector machines (svm). for task b, which involved predicting the target (individual, organization, religion) and severity (low, medium, high) of hate speech, we introduced an improved model, hate-fakenet-plus. this version utilized random forest and incorporated advanced techniques like gradient boosting machines (xgboost and lightgbm) to better capture complex data interactions. optimized for multi-class classification, the model achieved high precision across multiple categories. as presented in ## conclusion the system performed well, particularly in distinguishing explicit hate speech and fake content. however, challenges remain in identifying subtle forms of fake narratives and implicit hate speech. the detailed error analysis and confusion matrix show areas where the model misclassified subtle content.