Skip to main content

HateGuard: Automated Multi-Class Cyberbullying Detection Framework

Page 1


International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056

Volume: 13 Issue: 04 | Apr 2026 www.irjet.net p-ISSN: 2395-0072

HateGuard: Automated Multi-Class Cyberbullying Detection Framework

1 , V.Munni2

1PursuingComputerScience,AndhraLoyolaInstituteofEngineeringandTechnology,Vijayawada -12

2AssociateProfessor,DepartmentofCSE(AIML),AndhraLoyolaInstituteofEngineeringandTechnology, Vijayawada – 12

ABSTRACT - The rapid growth of social media platforms has led to a significant increase in cyberbullying, posing serious challenges to user safety and online communication. Detecting and categorizing such harmful content at scale requires efficient and automated Natural Language Processing (NLP) techniques. This work presents a multi-class cyberbullying detection system designedtoclassifytextualdatafromsocialmediaintosix categories: age-based, ethnicity-based, gender-based, religion-based, other cyberbullying, and noncyberbullying. The proposed approach follows a structured pipeline involving text preprocessing techniques such as tokenization, stopword removal, and lemmatization usingNLTK, followed by featureextraction using Term Frequency–Inverse Document Frequency (TFIDF).Multiplemachinelearningmodels,includingLogistic Regression, Support Vector Machine (SVM), Random Forest,XGBoost,andMultinomialNaiveBayes,aretrained and evaluated to determine the most effective classifier. Experimental results show that Logistic Regression achievesthebest performance, withanaccuracy of81.9% and an F1-score of 0.822, demonstrating reliable classificationacrossmultiplecategories.

Keywords- Cyberbullying detection, Natural Language Processing, text classification, TF-IDF, machine learning, Logistic Regression, Support Vector Machine, Random Forest, XGBoost, Naive Bayes, social media analysis, multi-classclassification

I. INTRODUCTION

The rapid expansion of social media platforms has transformed the way individuals communicate, share opinions, and interact in digital spaces. While these platforms offer numerous benefits, they have also becomeabreedinggroundforharmfulbehaviorssuchas cyberbullying,whichcanhaveseriouspsychologicaland social consequences for individuals. Cyberbullying manifests in various forms, including harassment based on age, gender, ethnicity, and religion, making its detection a complex and multi-dimensional problem. Traditional moderation techniques, which rely heavily onmanualreview,arenotscalablegiventhevastvolume ofuser-generatedcontentproducedacrossplatforms.

Toaddressthesechallenges,thereisa growingneedfor automatedsystemscapableofaccuratelyidentifyingand categorizing cyberbullying content in real time. Natural Language Processing (NLP) provides effective tools for analyzing textual data and extracting meaningful patterns that can be used for classification tasks. In this context,machinelearning-basedapproacheshaveshown promise in detecting abusive language by learning from labeled datasets. However, many existing systems focus only on binary classification, failing to capture the nuanced differences between various types of cyberbullying.

This work aims to develop a multi-class classification systemthatcandetectandcategorizecyberbullyinginto six distinct classes: age-based, ethnicity-based, genderbased, religion-based, other cyberbullying, and noncyberbullying. By leveraging text preprocessing techniques, feature extraction methods, and multiple machinelearningalgorithms,theproposedsystemseeks toimprovetheaccuracyandgranularityofcyberbullying detection, thereby contributing to safer and more inclusiveonlineenvironments.

II. LITERATURE SURVEY

Cyberbullying detection has been an active area of research within Natural Language Processing (NLP), with various approaches proposed to identify abusive andharmfulcontentononlineplatforms.Earlyresearch primarily focused on traditional machine learning techniquescombinedwithhandcraftedfeaturessuchas bag-of-words and Term Frequency–Inverse Document Frequency (TF-IDF) [15]. These approaches provided a foundation for automated text classification and were widely adopted due to their simplicity and computationalefficiency[13].

Algorithms such as Multinomial Naive Bayes and SupportVectorMachine(SVM)were commonlyusedin these early systems and demonstrated reasonable performance in detecting offensive language [1], [2]. However, these models relied heavily on surface-level textual featuresandfailedtocapture deepercontextual meaning and semantic relationships. As a result, their effectiveness decreased when dealing with subtle,

International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056

Volume: 09 Issue: 04 | Apr 2026 www.irjet.net p-ISSN: 2395-0072

implicit, or context-dependent forms of cyberbullying [5].

To overcome these limitations, deep learning-based models such as Recurrent Neural Networks (RNN) and Long Short-Term Memory (LSTM) networks were introduced [3], [9]. These models are capable of capturing sequential dependencies in text, allowing them to better understand context and improve classification performance. By learning representations automatically from data, they reduced the need for manual feature engineering and achieved higher accuracycomparedtotraditionalapproaches.

More recently,transformer-basedmodelssuchasBERT andRoBERTahavesignificantlyadvancedthefield[11], [12]. These models leverage attention mechanisms to understand contextual relationships within text more effectively and have achieved state-of-the-art results in various NLP tasks, including cyberbullying detection. However, they require large datasets and high computationalresources,whichcanlimittheirpractical deploymentinresource-constrainedenvironments[10].

In addition to model advancements, research has also focusedonimprovingdatasetqualityandhandlingclass imbalance, which is a common issue in cyberbullying datasets[6],[7].Techniquessuchasdataaugmentation, resampling, and cost-sensitive learning have been applied to enhance performance across minority classes.Despitetheseefforts,manyexistingsystemsare limited to binary classification and fail to provide finegrained categorization of cyberbullying types [8]. This highlights the need for multi-class classification frameworks that can deliver more detailed and actionable insights, which motivates the approach proposedinthiswork.

III. PROPOSED WORK

This paper proposes a cyberbullying detection system that integrates Natural Language Processing (NLP) techniques with machine learning models and rulebasedanalysistoidentifyandclassifyharmfulcontentin social mediatext.The framework isdesignedtoprocess raw textual data, such as tweets, and generate accurate classification results across multiple categories of cyberbullying.

A. System Overview

Theproposedsystempresentsanend-to-endframework for detecting and classifying cyberbullying in social mediatextusingNaturalLanguageProcessing(NLP)and machine learning techniques. The system is designed as a modularpipeline thatprocessesrawtextual inputand produces a categorized output indicating the type of cyberbullying. Initially, textual data, such as tweets, is collected and passed through a preprocessing stage to

remove noise and standardize the content. This stage includes operations such as tokenization, stopword removal, and lemmatization to improve text quality and consistency[14].

B. Data Collection

The dataset used in this study consists of textual data collected from social media platforms, primarily in the form of tweets. These tweets are labeled into six predefined categories representing different types of cyberbullying, along with a non-cyberbullying class.The dataset is curated to include diverse linguistic patterns, informal language, abbreviations, and slang commonly found in online communication. This diversity ensures that the model learns realistic patterns of cyberbullying behavior[6].

C. Data Preprocessing

Data preprocessing is a critical step in the proposed system, aimed at improving the quality and consistency of textual input. The raw text data undergoes multiple preprocessing operations to remove noise and standardize the content. Initially, tokenization is performed to split the text into individual words or tokens, enabling easier analysis. Stopword removal is thenappliedtoeliminatecommonlyusedwordssuchas “the,” “is,” and “and,” which do not contribute significantlytoclassification[14].

D. Feature Engineering

Feature engineering is performed using the Term Frequency–Inverse Document Frequency (TF-IDF) technique to convert textual data into numerical form [15]. TF-IDF assigns weights to words based on their importance within a document and across the entire dataset. Words that appear frequently in a specific text but are rare across other documents receive higher importance,makingthemusefulforclassificationtasks.

E. Model Training

Multiplemachinelearningmodelsaretrainedtoperform multi-class classification of cyberbullying text. These models include Logistic Regression, Support Vector Machine (SVM), Random Forest, XGBoost, and Multinomial Naive Bayes. Each model is trained using the TF-IDF feature vectors and labeled data to learn patterns associated with different categories of cyberbullying.Theimplementationandtrainingofthese models are carried out using machine learning libraries suchasScikit-learn[13].

F. Model evaluation

Model evaluation is conducted using standard performance metrics, including accuracy, precision, recall, and F1-score. These metrics provide a comprehensive understanding of how well each model

International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056

Volume: 09 Issue: 04 | Apr 2026 www.irjet.net p-ISSN: 2395-0072

performsacrossdifferentclasses.Accuracymeasuresthe overall correctness of predictions, while precision and recall evaluate the model’s ability to correctly identify cyberbullying instances. The evaluation methodology follows commonly used practices in text classification tasks[8].

G. Prediction Pipeline

Thefinalsystemisimplementedasapredictionpipeline that processes raw input text and generates classificationresultsinrealtime.Thepipelineintegrates preprocessing, feature extraction, and the trained machinelearningmodelintoaunifiedworkflow.Whena user inputs text, it is first cleaned and transformed into TF-IDFfeaturesbeforebeingpassedtotheclassifier.The system then outputs the predicted category of cyberbullying.

The pipeline supports the following classification outputs:

• Age-basedcyberbullying

• Ethnicity-basedcyberbullying

• Gender-basedcyberbullying

• Religion-basedcyberbullying

• Othercyberbullying

• Non-cyberbullying

This structured pipeline ensures efficient and scalable deployment, making it suitable for integration into automatedmoderationsystems. Fig.-1: MethodologyPipeline

IV. REQUIREMENT ANALYSIS

A. Hardware Requirements

Thesystemrequiresastandardcomputingenvironment withaminimumof8GBRAMandamulti-coreprocessor such as Intel i5 or equivalent for efficient data processingandmodeltraining.WhileGPUsupportisnot mandatory, it can significantly speed up training for large datasets. Adequate storage is required to handle datasetsandmodelfiles.Thesystemcanbedeployedon personal computers or cloud-based platforms for scalabilityandperformance.

B. Software Requirements

The proposed system is implemented using Python as the primary programming language. Key libraries include NLTK for text preprocessing, Scikit-learn for machine learning models, and Pandas and NumPy for data handling and manipulation. TF-IDF vectorization is performed using Scikit-learn utilities. The development environment may include Jupyter Notebook or any Python IDE. Additional tools such as Matplotlib or Seaborn can be used for visualization and performance analysis.

C. Functional Requirements

The system must process raw textual input, perform preprocessing, and convert text into numerical features. Itshouldclassifytheinputintopredefinedcyberbullying categories using trained machine learning models. The system must support multi-class classification and generate accurate predictions. Additionally, it should allow easy integration into real-time applications for automatedcontentmoderationandanalysis.

V. RESEARCH AND METHODOLOGY

The proposed system follows a structured machine learning-based methodology for detecting and classifying cyberbullying in textual data. The workflow begins with data collection from social media sources, primarily consisting of tweets labeled into multiple categories of cyberbullying. The collected data is first subjected to preprocessing to remove noise and standardize the text. This includes tokenization, stopword removal, lemmatization, and elimination of irrelevant elements such as URLs, mentions, and special characters. These steps ensure that the textual data is cleanandsuitableforanalysis[14].

Followingpreprocessing,featureextractionisperformed usingtheTermFrequency–InverseDocumentFrequency (TF-IDF) technique [15]. This method converts textual data into numerical feature vectors by assigning importance to words based on their frequency and relevance across documents. The resulting feature vectors provide a structured representation of the text, enabling machine learning models to learn meaningful patternsassociatedwithcyberbullying.

International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056

Volume: 09 Issue: 04 | Apr 2026 www.irjet.net p-ISSN: 2395-0072

Multiple classification algorithms are then trained using the extracted features, including Logistic Regression, Support Vector Machine (SVM), Random Forest, XGBoost, and Multinomial Naive Bayes. The dataset is divided into training and testing sets to evaluate the performance of each model effectively. Hyperparameter tuning is applied to optimize model performance and ensure generalization. The implementation of these models is carried out using machine learning frameworkssuchasScikit-learn[13].

Themodelsareevaluatedusingstandardmetricssuchas accuracy, precision, recall, and F1-score, which are widely used in text classification tasks [8]. Based on comparative analysis, the best-performing model is selected for deployment. The final system integrates preprocessing, feature extraction, and classification into a unified prediction pipeline capable of processing raw text inputs and producing classification outputs in real time. This methodology ensures an efficient, scalable, and reliable approach for multi-class cyberbullying detection.

Dataset

Thedatasetusedinthisstudyconsistsoflabeledtextual data collected from social media platforms, primarily in the form of tweets.Each data sample is categorized into one of six classes: age-based, ethnicity-based, genderbased, religion-based, other cyberbullying, and noncyberbullying. The dataset includes a wide variety of linguistic patterns, including informal language, abbreviations, slang, and context-specific expressions commonlyfoundinonlinecommunication.

To ensure the quality and effectiveness of the dataset, preprocessing steps are applied to remove duplicates, irrelevant content, and noise such as URLs, user mentions,hashtags,andspecialcharacters.Thiscleaning process helps improve the consistency of the data and enhances model performance. The dataset is carefully analyzed to understand class distribution, as cyberbullyingdatasetsoftensufferfromclassimbalance. Techniques such as balanced sampling or weighting strategiesmaybeconsideredtoaddressthisissue.

VI. RESULTS AND ANALYSIS

The performance of the proposed cyberbullying detection system is evaluated using standard classification metrics, including accuracy, precision, recall, and F1-score. Accuracy measures the overall correctness of the model’s predictions, while precision evaluates the proportion of correctly identified positive instancesamongallpredictedpositives.Recallmeasures the model’s ability to correctly identify actual cyberbullying instances, and the F1-score provides a balanced measure by combining both precision and recall.Thesemetricsareparticularlyimportantinmulti-

class classification tasks, where class imbalance can significantlyaffectperformance.

Fig.2-AccuracyComparisonofDifferentMachine LearningModels

The experimental evaluation was conducted by training andtestingmultiple machine learning models,including Logistic Regression, Support Vector Machine (SVM), Random Forest, XGBoost, and Multinomial Naïve Bayes, on the cyberbullying dataset. Each model was assessed using standard classification metrics such as accuracy, precision, recall, and F1-score to ensure a comprehensiveperformancecomparison.

Among the evaluated models, Logistic Regression demonstratedthebestoverallperformance,achievingan accuracy of 81.9% and an F1-score of 0.822. This indicates that the model maintains a balanced trade-off betweenprecisionandrecall,makingitmorereliablefor multi-class classification compared to other models. In contrast, ensemble models such as Random Forest and XGBoost showed comparable accuracy but exhibited slightly lower F1-scores, suggesting less consistent performance across minority classes. Similarly, Multinomial Naïve Bayes, while computationally efficient, struggled with capturing complex contextual relationships in textual data, leading to comparatively weakerclassificationresults.

International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056

Volume: 09 Issue: 04 | Apr 2026 www.irjet.net p-ISSN: 2395-0072

–F1–Scorecomparisonofdifferentmachine learningmodels

Graphical analysis further supports these findings through performance comparison charts and evaluation curves. The accuracy and F1-score comparison graph illustrates that Logistic Regression outperforms other models in terms of balanced performance. Precisionrecall curves indicate that the model maintains a good trade-off between identifying true positives and minimizing false positives across different classes. Additionally, training and validation trends suggest stable learning behavior with minimal overfitting, as performanceremainsconsistentacrossbothdatasets.

ConfusionMatrixforLogisticRegression Model

VII. CONCLUSION

The study presents a machine learning-based approach for detecting and classifying cyberbullying in social media text using Natural Language Processing techniques. The proposed system follows a structured pipeline that includes text preprocessing, feature extraction using TF-IDF, and multi-class classification using various machine learning algorithms. Among the evaluated models, Logistic Regression demonstrates the best overall performance, achieving an accuracy of 81.9% and an F1-score of 0.822, indicating reliable classificationacrossmultiplecategoriesofcyberbullying.

The system effectively categorizes text into six distinct classes, enabling more detailed analysis compared to traditional binary classification approaches. The results highlight that classical machine learning models, when combined with proper preprocessing and feature engineering, can provide efficient and scalable solutions forcyberbullyingdetection.However,certainlimitations remain, particularly in handling context-dependent language and subtle forms of harassment. Future improvements can focus on incorporating advanced deep learning models to enhance contextual understanding and overall performance, making the system more robust for real-world deployment in automatedcontentmoderationsystems.

ACKNOWLEDGEMENT

Theauthorswouldliketoexpresstheirsinceregratitude to their project guide and faculty members for their continuous support, guidance, and valuable suggestions throughout the development of this work. Their expertise and encouragement played a crucial role in shaping the direction and quality of the project. The authors also thank their institution for providing the necessaryresourcesandinfrastructurerequiredtocarry outthisresearcheffectively.

REFERENCES

[1] T. Davidson, D. Warmsley, M. Macy, and I. Weber, “Automated hate speech detection and the problem of offensive language,” in Proc. ICWSM,2017.

[2] Z. Waseem and D. Hovy, “Hateful symbols or hateful people? Predictive features for hate speech detection on Twitter,” in Proc. NAACLHLT,2016,pp.88–93

[3] P. Badjatiya, S. Gupta, M. Gupta, and V. Varma, “Deep learning for hate speech detection in tweets,” in Proc. WWW Companion, 2017, pp. 759–760.

[4] I.KwokandY.Wang,“Locatethehate:Detecting tweets against blacks,” in Proc. AAAI, 2013, pp. 1621–1622.

[5] S. Nobata, J. Tetreault, A. Thomas, Y. Mehdad,

Fig.3
Fig-.4:

International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395-0056

Volume: 09 Issue: 04 | Apr 2026 www.irjet.net p-ISSN: 2395-0072

and Y. Chang, “Abusive language detection in online user content,” in Proc. WWW, 2016, pp. 145–153.

[6] J.Golbeck,Z.Ashktorab,R.O.Banjo,A.Berlinger, S. Bhagwan, and C. Buntain, “A large labeled corpusforonlineharassmentresearch,”inProc. CSCW,2017.

[7] F. Del Vigna, A. Cimino, F. Dell’Orletta, M. Petrocchi, and M. Tesconi, “Hate me, hate me not: Hate speech detection on Facebook,” in Proc.ITASEC,2017.

[8] A. Schmidt and M. Wiegand, “A survey on hate speech detection using natural language processing,”inProc.SocialNLP,2017,pp.1–10.

[9] Y.Zhang,B.Wallace,andJ. Tetreault,“Detecting hatespeechonTwitterusingaconvolution-GRU based deep neural network,” in Proc. ESWC, 2018.

[10] J. Howard and S. Ruder, “Universal language model fine-tuning for text classification,” in Proc.ACL,2018.

[11] J. Devlin, M. Chang, K. Lee, and K. Toutanova, “BERT: Pre-training of deep bidirectional transformers for language understanding,” in Proc.NAACL-HLT,2019.

[12] Y. Liu, M. Ott, N. Goyal, et al., “RoBERTa: A robustlyoptimizedBERTpretrainingapproach,” arXivpreprintarXiv:1907.11692,2019.

[13] F. Pedregosa et al., “Scikit-learn: Machine learning in Python,” J. Machine Learning Research,vol.12,pp.2825–2830,2011.

[14] S.Bird,E.Klein,andE.Loper,“NaturalLanguage ProcessingwithPython,”O’ReillyMedia,2009.

[15] G. Salton and C. Buckley, “Term-weighting approaches in automatic text retrieval,” Information Processing & Management, vol. 24, no.5,pp.513–523,1988

Turn static files into dynamic content formats.

Create a flipbook
HateGuard: Automated Multi-Class Cyberbullying Detection Framework by IRJET Journal - Issuu