Abstract
The proliferation of hate speech on private messaging platforms, such as WhatsApp, presents a significant moderation challenge because these platforms are encrypted and operate as closed environments. Following the CRISP-DM methodology, this paper presents the design, implementation, and validation of an integrated system for real-time hate speech detection and intervention. The architecture combines three components: a Selenium-based client monitor for WhatsApp Web, a REST API, and the “PitBot” alert bot. The system uses a RoBERTa-Spanish Transformer model selected through experimental validation. The “Spanish Hate Speech Superset” was preprocessed and balanced through random undersampling, and seven models were benchmarked, including traditional algorithms, such as SVM, and Logistic Regression and Transformer models, such as BETO and mBERT. After hyperparameter optimization, RoBERTa-Spanish achieved the highest performance in this benchmark, with an F1-score above 90% and an AUC-ROC of 0.956. These results support the use of a monolingual model pretrained on a large Spanish-language corpus for this application.
1. Introduction
The proliferation of online hate speech has become a significant societal concern. This toxic content, which can incite discrimination and violence, creates hostile digital environments and has been linked to real-world harm. Although major social media platforms invest heavily in moderation, the volume, velocity, and evolving nature of this content make automated detection using artificial intelligence a critical and challenging research area.
However, most academic research and moderation efforts have focused on public-facing platforms, such as Twitter, Facebook, and Reddit, which provide APIs for data collection. A significant research gap remains in the mitigation of hate speech within private, end-to-end encrypted (E2EE) messaging applications, such as WhatsApp. These closed environments pose a distinct challenge because hate speech can circulate within private groups beyond the reach of public scrutiny and conventional moderation tools.
Natural language processing (NLP) has advanced substantially, and Transformer-based models such as BERT and RoBERTa have proved effective at modeling complex linguistic contexts and nuances. However, most existing studies remain post hoc analyses of static datasets that evaluate detection performance without addressing deployment. Therefore, a gap remains between the development of accurate models and the engineering of effective systems that can operate in real time on closed platforms.
This paper addresses that gap by presenting the design, implementation, and validation of a real-time hate speech detection and intervention system for WhatsApp. The contribution is twofold: (1) we conduct an experimental comparison of traditional machine-learning and Transformer models and identify an optimized RoBERTa-Spanish model as the best-performing configuration in this benchmark; and (2) we introduce a three-component software architecture that integrates this model, using Selenium for live chat monitoring and Twilio and PitBot for immediate alerting and intervention.
The remainder of this paper is organized as follows. Section 2 reviews related work. Section 3 describes the materials and methods, including the system architecture and experimental setup. Section 4 presents the model-validation and functional-test results. Section 5 discusses their implications and limitations, and Section 6 presents the conclusions and directions for future work.
2. Related Work
Automated hate speech detection has attracted substantial academic interest and has evolved from simple keyword matching to sophisticated deep-learning models. This section reviews the state of the art along two axes relevant to this work: (1) the evolution of NLP models for text classification and (2) architectural approaches to moderation systems across different platform types.
2.1. NLP Models for Hate Speech Detection
Early approaches to hate speech detection relied on traditional machine-learning algorithms. Models such as Naive Bayes, support vector machines (SVM), and logistic regression were commonly employed [1,2]. These models depend primarily on handcrafted features or feature-engineering techniques, such as bag-of-words (BoW) and TF-IDF. Although effective for relatively simple classification tasks, they have limited ability to represent the context, nuance, and sarcasm frequently found in toxic language.
The advent of deep learning brought further improvements. Architectures such as convolutional neural networks (CNNs) and recurrent neural networks (RNNs), particularly those using long short-term memory (LSTM) units, improved sequence modeling and reduced the need for manual feature engineering [3]. However, these models still struggled with long-range dependencies and complex semantic relationships.
Recent advances in hate speech detection have been largely driven by Transformer-based models, beginning with BERT (Bidirectional Encoder Representations from Transformers) [4]. Their self-attention mechanisms support contextual representations of words based on their surrounding text. This development has produced models such as RoBERTa, ALBERT, and DistilBERT. Because much of the early research focused on English, language-specific models were subsequently developed. For Spanish, BETO [5] and RoBERTa-Spanish [6], which is used in this work, were pretrained on large native Spanish-language corpora and may, therefore, represent local idioms and slang more effectively.
More recently, Sanchez-Gomez et al. [7] compared several Spanish-specific Transformer variants, including BETO and DistilBETO, for hate speech detection and reported that architectural efficiency, rather than scale alone, can improve performance. Bernal-Beltrán et al. [8] compared fine-tuned encoder-only Spanish models with zero- and few-shot large language models (LLMs) for the forensic detection of maliciously disseminated hate speech. Their results indicated that fine-tuned encoders remained competitive with, and often outperformed, in-context-learning approaches at a lower inference cost. At a larger scale, Chapagain et al. [9] benchmarked BERT, RoBERTa, GPT-2, and ELECTRA on the 1.2-million-post MetaHate corpus. Together, these studies support the practical use of monolingual and domain-adapted Transformer encoders for production-oriented hate speech detection and motivate the evaluation of RoBERTa-Spanish in a real-time deployment scenario.
2.2. System Architectures for Moderation
Although accurate models are essential, their practical application also depends on system architecture. Most existing research focuses on public-facing social media platforms with accessible APIs, such as Twitter and Facebook. These studies typically collect large static datasets through an API and conduct post hoc analysis. Such work is valuable for model benchmarking but does not address real-time intervention.
A significant research gap exists in two areas. First, relatively little research targets closed-ecosystem platforms such as WhatsApp and Telegram. Their end-to-end encryption and lack of public chat-monitoring APIs make data collection and live moderation technically challenging. Second, few studies move beyond analysis to propose complete end-to-end intervention systems. A moderation system requires not only a detection model but also an engineering pipeline capable of capturing and processing data and triggering an action in real time.
This paper addresses both gaps by proposing a system for the closed WhatsApp environment rather than for a platform with an open API. It also shifts the focus from post hoc analysis to a complete real-time detection-and-intervention loop, a practical architecture that is seldom addressed in the literature. Table 1 compares the characteristics of previous studies with those of the proposed approach.
Table 1.
Comparison of the proposed approach with related hate speech detection studies.
3. Materials and Methods
The study was structured according to the CRISP-DM (Cross-Industry Standard Process for Data Mining) framework [15], an iterative and flexible approach widely used in data-science projects. Its six phases, illustrated in Figure 1, organize this section. The following subsections describe how each phase—from business and data understanding to modeling, evaluation, and deployment—was applied to develop the proposed detection system.
Figure 1.
CRISP-DM process diagram. Bidirectional arrows show phase interactions, internal curved arrows represent sequential flow, and the outer loop indicates continuous improvement.
The Business Understanding phase (Phase 1), discussed in the Introduction and Related Work Sections, identified the principal gap: the lack of real-time moderation systems for WhatsApp.
3.1. Data Understanding and Preparation (CRISP-DM Phases 2 & 3)
Experimental validation used the “Spanish Hate Speech Superset” [16], a specialized corpus of 29,855 annotated posts (7265 “Hate” and 22,590 “No-Hate”) that aggregates hatEval, HaterNet, a Chilean hate speech corpus, HaSCoSVa, HOMO-MEX, and MisoCorpus. A curated working subset of 10,000 entries (4000 “Hate” and 6000 “No-Hate”) was drawn from this superset for model development. Random undersampling was then applied to reduce class imbalance and support robust evaluation. This procedure produced a balanced dataset of 8000 samples, comprising 4000 “Hate” and 4000 “No-Hate” entries, which was used to train and test all models.
Careful data preparation was essential for reliable model training. The raw text from the “Spanish Hate Speech Superset” [16] underwent several cleaning steps before modeling. Standard NLP preprocessing included converting text to lowercase, removing URLs and user mentions (@handles), and eliminating special characters, numbers, repeated whitespace, and excessive punctuation. This normalization encouraged the models to learn from linguistic content rather than formatting noise.
Following text normalization, the next step addressed class imbalance. The working corpus contained 6000 “No-Hate” samples and 4000 “Hate” samples, which could have biased the models toward the majority class. We therefore applied random undersampling reducing the “No-Hate” class to the size of the “Hate” class. The resulting balanced dataset contained 8000 samples (4000 “Hate” and 4000 “No-Hate”) and was used for subsequent model training and evaluation.
The dataset was balanced through random undersampling to obtain a 1:1 class distribution and a consolidated set of 8000 samples. To assess whether this procedure reduced the linguistic diversity of the retained corpus, we conducted a controlled resampling analysis of the source superset. Across 200 independent seed-controlled random draws, we compared the 2000 discarded “No-Hate” samples with an equally sized random subset of the retained samples along four dimensions: lexical diversity (type–token ratio), exact-duplicate rate, source-dataset composition, and the geographic origin of the post author. As shown in Figure 2, the type–token ratios were equal to three decimal places (0.274; SD = 0.002), while duplicate rates were low and comparable (0.11% vs. 0.19%), consistent with the low overall duplication rate of the source corpus (0.66%). Chi-square tests of source-dataset and country-of-origin composition identified statistically significant differences in only 2.0% and 4.5% of iterations, respectively, which is consistent with the false-positive rate expected under the null hypothesis (). These results suggest that uniform random undersampling did not systematically select a distinct linguistic or geocultural subpopulation, although reducing the sample size necessarily removes some individual examples.
Figure 2.
Empirical comparison of retained () and discarded () “No-Hate” samples under random undersampling, averaged across 200 seed-controlled Monte Carlo iterations: (a) lexical diversity (type–token ratio), (b) exact-duplicate rate, (c) source-dataset composition, and (d) geographic composition. Error bars represent one standard deviation across iterations.
3.2. Modeling and Evaluation Setup (CRISP-DM Phase 4)
To select the model for the system’s core, we conducted a comparative experiment using four traditional machine-learning models—Naive Bayes, support vector machines (SVM), random forest, and logistic regression—and four Transformer models: BETO, DistilBERT, mBERT, and RoBERTa-Spanish. All models were trained and evaluated under a common experimental setup to support a fair comparison.
The balanced 8000-sample dataset was divided using an 80/20 train–test split, yielding 6400 training samples and 1600 test samples. The traditional machine-learning models were trained on TF-IDF representations of the preprocessed text.
The Transformer models were fine-tuned using the Hugging Face transformers library and a common set of hyperparameters. Training used the AdamW optimizer, a learning rate of 2 × , a batch size of 16, and three epochs. All experiments were conducted in Google Colab using an NVIDIA T4 GPU.
3.3. Evaluation Setup (CRISP-DM Phase 5)
Model performance was evaluated using accuracy, balanced accuracy, and F1-score. Because hate speech detection requires a balance between precision and recall, the F1-score—their harmonic mean—was used as the primary metric for final model selection.
3.4. Deployment (CRISP-DM Phase 6)
The system uses a three-component modular architecture for real-time monitoring and detection. It separates data capture at the client, model inference at the server, and alert delivery. The three components are (1) the Client Monitor, (2) the model-serving REST API, and (3) the “PitBot” assistance and alert bot.
3.4.1. Client Monitor
The first component, the Client Monitor, operates through the WhatsApp Web interface. Using the Python libraries selenium and webdriver-manager, it connects to the browser session, identifies the active chat, and extracts new text messages. After capture, each message is sent to the processing server through an HTTP POST request.
To manage variability in the WhatsApp Web DOM, the capture module implements explicit waits through the WebDriverWait class. Unlike fixed sleep commands, this mechanism adapts to the platform’s rendering cycle and interacts with elements, such as message containers, only after they become available. It reduces NoSuchElementException errors and improves stability under network latency and minor interface updates. CSS selectors were also preferred over absolute XPath expressions to improve resilience to small structural changes.
3.4.2. AI Model REST API
The second component is the REST API, which serves as the system’s computational core. Developed with the Flask microframework, the API hosts the trained RoBERTa-Spanish model. Upon receiving text from the monitor, it tokenizes the message, performs inference, and returns a prediction (e.g., “Hate” or “No-Hate”) in JSON format.
3.4.3. Operational Flow and Alerting Subsystem
Figure 3 presents the static system components, whereas Figure 4 shows the operational workflow. The process begins when the Client Monitor captures a new message and sends it to the REST API for inference.
Figure 3.
Multilayer architecture of the proposed system.
Figure 4.
Operational flow of the real-time detection process.
If a message is classified as hate speech, the system triggers an automated alert sequence. The backend server, exposed through ngrok, uses the Twilio API to send an immediate alert to the administrator’s WhatsApp chat.
In addition to the Twilio alert, the system sends an email notification through SMTP using Python’s smtplib library. The module connects to the configured SMTP server using TLS encryption and sends an alert to a designated administrator, thereby providing a persistent record of the event.
After the alert is issued, “PitBot” is activated in the monitored chat and offers assistance to the affected user, thereby completing the detection-and-intervention cycle.
3.4.4. Technical Stack and Libraries
The system was developed using the tools and libraries described in the Table 2.
Table 2.
Tools and libraries used in the development of the system.
3.5. Hyperparameter Tuning and Model Optimization
Because RoBERTa-Spanish was the best-performing baseline Transformer, it was selected for hyperparameter optimization. The optimized configuration used a learning rate of , a batch size of 8, five epochs, a weight decay of 0.01, 50 warmup steps, and a maximum sequence length of 256 tokens. This configuration improved the F1-score and AUC-ROC relative to the baseline configuration and was therefore used for real-time deployment.
3.6. Ethical Considerations and Data Privacy
The system was deployed only in groups whose participants provided informed consent. Messages were processed transiently through a private REST API; non-hate messages were immediately discarded, while detected cases retained only the classification information required for evaluation. Personal identifiers, metadata, credentials, and unrelated sensitive content were neither stored nor included in the analysis.
4. Results
This section presents the results of the model comparison and then evaluates the integrated system in a real-time test scenario.
4.1. Model Validation
Table 3 presents the model-comparison results. Contrary to the common assumption that Transformer-based models uniformly outperform traditional machine-learning algorithms, the baseline (pre-optimization) Transformers did not show clear superiority in this benchmark. Random Forest (F1-score = 0.835) outperformed all four baseline Transformer models: BETO (0.772), DistilBERT (0.751), mBERT (0.774), and baseline RoBERTa-Spanish (0.781). Naive Bayes (F1-score = 0.775) and logistic regression (F1-score = 0.758) also remained competitive with the Transformer group, whereas SVM (F1-score = 0.644) performed markedly worse. These findings are consistent with the effectiveness of shallow, keyword-driven representations such as TF-IDF when hate speech is expressed through explicit lexical markers. They also show that a Transformer architecture alone does not guarantee superior performance without further optimization.
Table 3.
Performance of traditional machine-learning and Transformer models.
To determine whether the differences in Table 3 reflected genuine performance gaps rather than sampling variance, we conducted pairwise McNemar exact tests using per-instance predictions from the same held-out test set () for the four traditional machine-learning baselines presented in Table 4. Random Forest’s advantage over logistic regression, Naive Bayes, and SVM was statistically significant in all three pairwise comparisons (). Significance testing among the Transformer models (RoBERTa-Spanish, BETO, DistilBERT, and mBERT) requires their per-instance predictions on the same test set. These predictions were not retained during the original training runs, and regenerating them would require GPU-based inference beyond the scope of this revision. We therefore report this as an explicit limitation and a concrete objective for future work rather than omitting significance testing entirely.
Table 4.
Pairwise McNemar exact tests among traditional machine-learning baselines using the same held-out test set ().
4.2. Hyperparameter Tuning and Model Optimization Results
As shown in Table 5, optimization improved all reported performance metrics. Accuracy increased by 0.122%, balanced accuracy by 0.106%, and F1-score by 0.122%, while AUC-ROC reached 0.956. These results indicate that the optimized hyperparameters improved the model’s ability to capture the semantic nuances of Spanish hate speech. All subsequent system evaluations use this optimized configuration.
Table 5.
Performance comparison of the baseline and optimized RoBERTa-Spanish models.
To complement the aggregate metrics, Table 6 reports the confusion matrix and per-class precision, recall, and F1-score for the optimized RoBERTa-Spanish model on the held-out test set (), obtained by rerunning inference with the saved model checkpoint. For the majority “No-Hate” class, the model achieved a precision of 0.971 and a recall of 0.919. For the minority “Hate” class, recall (0.914) exceeded precision (0.784), indicating that the model produced more false positives than false negatives on this test set. In a real-time moderation system, this recall-oriented profile prioritizes the detection of hate speech at the cost of some overflagging, consistent with the 4% real-time, false-positive rate reported in Section 4.4.
Table 6.
Confusion matrix and per-class metrics for the optimized RoBERTa-Spanish model on the held-out test set ().
4.3. System Functional Test
After selecting RoBERTa-Spanish, we validated the integrated system in a real-time proof-of-concept test. Figure 5a illustrates the first stage of the workflow, in which participants interact through WhatsApp Web, whereas Figure 5b shows the client monitor capturing a message that the API classified as hate speech and initiating the automated alert sequence. Upon detection, the API backend used Twilio and SMTP to notify the administrator of the incident and the message content in real time.
Figure 5.
Functional validation of message capture and hate-speech detection: (a) WhatsApp Web conversation; (b) client-monitor output.
Finally, the “PitBot” assistant was activated to complete the intervention cycle. It sent a message to the monitored chat offering support and resources to the user affected by the hate speech, thereby closing the detection-and-response loop. Figure 6 shows the complete assistance message, including emergency, legal, psychosocial, care-center, and online resources.
Figure 6.
Complete PitBot response after hate speech was detected, showing emergency, legal, psychosocial, care-center, and online support resources.
4.4. Real-Time Production Performance Evaluation
Beyond the model-level metrics, we quantitatively evaluated the integrated system in a live, controlled environment. PitBot was deployed in a WhatsApp group to assess the operational performance of the Selenium-based data-acquisition module and the REST API inference pipeline. Four key performance indicators were measured: extraction latency, inference latency, maximum throughput, and the real-time false-positive rate. As summarized in Table 7, mean extraction and inference latencies were 653 ms and 44 ms, respectively, and the system processed up to 70 messages per minute. These results demonstrate the technical feasibility of the proposed architecture for real-time moderation with limited disruption to the communication flow.
Table 7.
System performance metrics in a real-time environment.
Extraction and inference latencies were measured as the wall-clock time elapsed at each stage of the pipeline. The extraction latency covered message capture and parsing by the Selenium-based client monitor, whereas the inference latency covered the interval from receipt of the extracted text by the REST API to the return of a prediction. Maximum throughput was derived from these stage-level timings as the system’s sustained processing capacity under continuous operation. The real-time false-positive rate was estimated through field tests conducted across multiple independent WhatsApp sessions involving genuine messages from volunteer participants. Each message flagged as “Hate” was manually reviewed in context to distinguish true from false positives. The reported rate is the proportion of non-hate messages incorrectly classified as hate speech across the cumulative field tests.
5. Discussion
A central question is not only whether RoBERTa-Spanish outperformed the other models after optimization, but also why. Its advantage over BETO and mBERT may be partly attributable to its pretraining.
Unlike mBERT, which distributes its representational capacity across 104 languages, RoBERTa-Spanish is monolingual. Its vocabulary and attention mechanisms are therefore specialized for the syntactic, semantic, and idiomatic characteristics of Spanish, which are important for interpreting hate speech in context. Together with extensive pretraining, optimization on the balanced dataset may explain the increase in F1-score from 0.781 at baseline to 0.903 after tuning.
RoBERTa-Spanish may also benefit from the scale and quality of its pretraining data. The RoBERTa-BNE model was pretrained on 570 GB of curated Spanish text from the National Library of Spain [6]. This extensive corpus provides a strong language-model foundation before fine-tuning on the hate speech dataset.
The model-validation results only partly support the common expectation that Transformer models consistently outperform traditional machine-learning algorithms in NLP tasks. As noted in Section 3, random forest matched or exceeded every baseline Transformer in this benchmark, and only SVM performed clearly worse than the Transformer group. Traditional models based on surface-level word frequencies (e.g., TF-IDF) can therefore remain competitive when hate speech is expressed through explicit, keyword-driven language and does not require the resolution of complex context, nuance, or sarcasm. The principal result is the performance advantage of the optimizedRoBERTa-Spanish model over the other evaluated models, including BETO, mBERT, and random forest, as indicated by its F1-score and AUC-ROC after hyperparameter tuning. This advantage may be related to its pretraining on a large native Spanish-language corpus, which supports the representation of Spanish-specific slang, idioms, and cultural context.
To test the sensitivity of the reported results to the class-balancing strategy, we conducted a controlled ablation using random forest, the strongest traditional baseline. The data, 80/20 stratified split (seed = 42), TF-IDF vectorizer, and classifier hyperparameters were held constant, while only the balancing method applied to the training partition was varied: class weighting, random undersampling, or random oversampling (Table 8). The macro-F1 score varied by 0.023 across the three strategies (0.727–0.750), indicating limited sensitivity to the selected balancing method in this experiment. This finding is consistent with the cross-model observation that random forest with class weighting matched or exceeded every baseline Transformer trained with undersampling, suggesting that model architecture had a greater effect than the balancing method. This controlled ablation was performed in random forest because retraining the Transformer models required GPU resources beyond the scope of this revision; extending the analysis to RoBERTa-Spanish remains an important direction for future work.
Table 8.
Controlled ablation of class-balancing strategies for Random Forest (fixed 80/20 split, seed = 42, fixed TF-IDF configuration).
Beyond model selection, a primary contribution of this work is the engineering architecture for real-time response. The functional tests provide a proof of concept for monitoring WhatsApp, whereas most hate speech research focuses on public platforms with accessible APIs, such as Twitter and Facebook. Because WhatsApp is private and end-to-end encrypted, it presents a more challenging deployment environment. The modular architecture (Figure 3 and Figure 4) uses Selenium for message capture and Twilio and PitBot for intervention, demonstrating a practical path from post hoc analysis toward immediate detection and response in a closed messaging environment.
This study must be framed within its limitations. First, the data preparation phase relied on a random undersampling technique to balance the dataset. Our empirical analysis (Section 3.1, Figure 2) shows that, in aggregate, the discarded “No-Hate” samples were not systematically different from the retained ones in lexical diversity, duplicate content, source composition, or geographic origin; however, this population-level equivalence does not rule out that individual discarded instances contained complex, non-offensive language (e.g., sarcasm or counter-speech) whose absence could still simplify the model’s learning task in ways that aggregate statistics cannot fully capture.
Second, all reported results, including the model comparison and the real-time system evaluation, were obtained using a single dataset family: the Spanish Hate Speech Superset [16]. This resource aggregates a limited number of source corpora dominated by Chilean and Spanish social media posts and includes a large proportion of instances of unknown origin. Consequently, the reported performance advantage of RoBERTa-Spanish should be interpreted as specific to this corpus and its geocultural composition, rather than as evidence of generalization across Spanish varieties, platforms, Latin American dialectal regions, or hate speech categories that are underrepresented in the source data. Evaluation on independent and geographically and dialectally diverse corpora is required before broader claims of generalizability can be made.
Third, the deployment architecture relies on Selenium to monitor the WhatsApp Web interface. Although practical for a closed platform, this browser-automation approach is inherently fragile: changes to the WhatsApp Web DOM could disrupt the Client Monitor and require maintenance.
Although the Selenium-based approach provides a functional bridge for real-time monitoring in encrypted environments, it remains susceptible to major platform redesigns. Future work could investigate lower-level protocols, such as WebSockets, or browser-automation frameworks such as Playwright to improve throughput and long-term stability.
These limitations motivate the development of more robust integration methods for both WhatsApp Web and the mobile ecosystem.
The core model could also be extended beyond binary classification (Hate vs. No-Hate) to a fine-grained multiclass task. Such a model could distinguish categories including misogyny, racism, xenophobia, and religious intolerance, enabling more targeted interventions, richer analytics, and a deeper understanding of hate speech within private chat groups.
6. Conclusions
Following the CRISP-DM methodology, this paper presented the design, implementation, and validation of a real-time hate speech detection system for WhatsApp. The proof-of-concept results demonstrate the feasibility of deploying NLP models to detect and respond to toxic content in a closed messaging environment.
The study makes two primary contributions. First, the optimized RoBERTa-Spanish configuration achieved the best performance in the evaluated benchmark, with an F1-score above 90% and an AUC-ROC of 0.956. Second, the functional evaluation demonstrated that a Selenium-based monitor, a RoBERTa-serving API, and Twilio/PitBot alerts can be integrated into a real-time detection-and-intervention loop.
This study provides a foundation for future development while retaining several limitations. The system relies on Selenium interaction with the WhatsApp Web DOM and is therefore vulnerable to interface updates. It is also limited to the web client because direct monitoring of the native end-to-end encrypted mobile application is restricted by the platform. Future work should pursue more stable integration methods and extend detection beyond text to multimodal content, including hateful memes and images.
Author Contributions
Conceptualization, E.B.-A., J.M. and N.P.; investigation, E.B.-A., J.M., N.P. and D.N.-A.; data curation, E.B.-A., J.M., N.P. and D.N.-A.; formal analysis, J.M., N.P., D.N.-A., R.B.-C. and J.C.-F.; writing—original draft preparation, E.B.-A., J.M. and N.P.; writing—review and editing, E.B.-A., J.M., N.P., R.B.-C. and J.C.-F. All authors have read and agreed to the published version of the manuscript.
Funding
This research received no external funding. The APC was funded by Universidad de las Fuerzas Armadas ESPE.
Institutional Review Board Statement
Not applicable.
Informed Consent Statement
Not applicable.
Data Availability Statement
The source code, including the data preparation, model training, and deployment scripts, together with the trained model configuration, is publicly available at https://github.com/Jeyner17/whatsapp-hate-speech-detector (accessed on 13 August 2026). The dataset used in this study is publicly available at https://huggingface.co/datasets/manueltonneau/spanish-hate-speech-superset (accessed on 2 August 2026).
Conflicts of Interest
The authors declare no conflicts of interest.
References
- Bilal, M.; Khan, A.; Jan, S.; Musa, S. Context-aware deep learning model for detection of roman urdu hate speech on social media platform. IEEE Access 2022, 10, 121133–121151. [Google Scholar] [CrossRef] [Scilit]
- Soto, J.A.; Gonzales, H.Á.; Saines, V.B. Uso de una herramienta de NLP aplicada a la detección del ciberacoso en Twitter. Innov. Softw. 2022, 3, 81–90. [Google Scholar] [CrossRef] [Scilit]
- Herrera-López, M.; Romera, E.M.; Ortega-Ruiz, R. Bullying y Cyberbullying en Latinoamérica. Un estudio bibliométrico. Rev. Mex. Investig. Educ. 2018, 23, 125–155. [Google Scholar]
- Devlin, J.; Chang, M.W.; Lee, K.; Toutanova, K. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (NAACL-HLT), Minneapolis, MN, USA, 2–7 June 2019; pp. 4171–4186. [Google Scholar]
- Cañete, J.; Chaperon, G.; Fuentes, R.; Ho, J.H.; Kang, H.; Pérez, J. Spanish Pre-Trained BERT Model and Evaluation Data. arXiv 2020, arXiv:2308.02976. [Google Scholar]
- Gutiérrez-Fandiño, A.; Armengol-Estapé, J.; Pàmies, M.; Llop-Palao, J.; Silveira-Ocampo, J.; Carrino, C.P.; Villegas, M. RoBERTa-BNE: A Spanish RoBERTa Model Pre-Trained on 570 GB of Spanish Text. Pre-Trained Model Available at Hugging Face. Based on the MarIA Spanish Language Models Trained on 570 GB of Clean Spanish Text. 2021. Available online: https://huggingface.co/PlanTL-GOB-ES/roberta-base-bne (accessed on 5 February 2026).
- Sanchez-Gomez, J.M.; Batista, F.; Vega-Rodríguez, M.A.; Pérez, C.J. A transformer-based deep learning approach for detecting online hate speech in Spanish. Appl. Soft Comput. 2026, 187, 114259. [Google Scholar] [CrossRef] [Scilit]
- Bernal-Beltrán, T.; Pan, R.; García-Díaz, J.A.; Salas-Zárate, M.d.P.; Paredes-Valverde, M.A.; Valencia-García, R. Detection of Maliciously Disseminated Hate Speech in Spanish Using Fine-Tuning and In-Context Learning Techniques with Large Language Models. Comput. Mater. Contin. 2026, 87, 10. [Google Scholar] [CrossRef] [Scilit]
- Chapagain, S.; Hamdi, S.M.; Boubrahimi, S.F. Advancing Hate Speech Detection with Transformers: Insights from the MetaHate Dataset; Accepted at the Deviant Dynamics in Digital Spaces Workshop, ASONAM 2025. arXiv 2025, arXiv:2508.04913. [Google Scholar]
- Risso Ferrand, M. La libertad de expresión y el combate al discurso del odio. Estud. Const. 2020, 18, 51–89. [Google Scholar] [CrossRef] [Scilit]
- Pereira-Kohatsu, J.C.; Quijano-Sánchez, L.; Liberatore, F.; Camacho-Collados, M. Detecting and monitoring hate speech in Twitter. Sensors 2019, 19, 4654. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Plaza-del Arco, F.M.; Molina-González, M.D.; Urena-López, L.A.; Martín-Valdivia, M.T. Comparing pre-trained language models for Spanish hate speech detection. Expert Syst. Appl. 2021, 166, 114120. [Google Scholar] [CrossRef] [Scilit]
- Garibo i Orts, Ò. Multilingual Detection of Hate Speech Against Immigrants and Women in Twitter at SemEval-2019 Task 5: Frequency Analysis Interpolation for Hate in Speech Detection. In Proceedings of the 13th International Workshop on Semantic Evaluation, Minneapolis, MN, USA, 6–7 June 2019; pp. 460–463. [Google Scholar] [CrossRef] [Scilit]
- Aklouche, B.; Bazine, Y.; Ghalia-Bououchma, Z. Offensive Language and Hate Speech Detection Using Transformers and Ensemble Learning Approaches. Comput. Sist. 2024, 28, 1031–1039. [Google Scholar] [CrossRef] [Scilit]
- Chapman, P.; Clinton, J.; Kerber, R.; Khabaza, T.; Reinartz, T.; Shearer, C.; Wirth, R. CRISP-DM 1.0: Step-by-Step Data Mining Guide; Technical Report; The CRISP-DM Consortium, SPSS Inc.: Chicago, IL, USA, 2000. [Google Scholar]
- Tonneau, M. Spanish Hate Speech Superset. 2024. Available online: https://huggingface.co/datasets/manueltonneau/spanish-hate-speech-superset (accessed on 1 August 2025).
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.





