Performance Comparison of State-of-the-Art NLP Models for Urdu Hate Speech Detection
Keywords:
Urdu Hate Speech Detection, Low-Resource NLP, Transformer Models, Multilingual Models, Urdu Language ProcessingAbstract
The growth of social media has significantly increased the spread of hate speech in the Urdu language. Urdu is a low-resource language, and building accurate natural language processing models for Urdu remains a challenging task. The main reasons are linguistic complexity and limited labelled data. Manual content moderation is slow, subjective, and inconsistent. To address this issue, automated hate speech detection using natural language processing has become a technical necessity for maintaining safe digital platforms. This research presents a comparative evaluation of multilingual and Urdu-specific transformer-based models for binary hate speech detection in Urdu text. Four transformer models were compared: XLM-RoBERTa (multilingual baseline), urdu-bert-ner and roberta-urdu-small (Urdu-specific), and mmBERT-base (a recent multilingual encoder). All models were fine-tuned under one protocol on a public corpus of 26,174 usable Urdu texts, using a stratified, duplicate-aware train/validation/test split, learning-rate selection on validation macro-F1, and three random seeds. On the test set, mean accuracy ranged from 78.43% to 79.83%, macro-precision from 78.47% to 79.90%, macro-recall from 78.41% to 79.82%, and macro-F1 from 78.41% to 79.82%. XLM-RoBERTa and mmBERT-base performed best (79.8% macro-F1) and were significantly better than urdu-bert-ner by about 1.4 points (Holm-adjusted p ≤ 0.005); mmBERT-base also exceeded roberta-urdu-small by 1.1 points (p = 0.028). XLM-RoBERTa had the lowest evaluation loss (0.460 versus 0.511 to 0.536) and the lowest median inference latency on a Tesla T4 GPU (12.4 ms versus 13.5 to 29.3 ms), whereas mmBERT-base was about 2.4 times slower without an accuracy gain. A dataset audit found 1,419 texts labelled both hate and no-hate, which limits attainable accuracy; on texts with a single label, accuracy rose to 81.9% to 83.4%. The results show no advantage for Urdu-specific pretraining in this setting, and XLM-RoBERTa gave the best balance of accuracy, calibration and speed among the models tested.
References
M. S. I. Malik, A. Nawaz, and M. M. Jamjoom, “Hate Speech and Target Community Detection in Nastaliq Urdu Using Transfer Learning Techniques,” IEEE Access, vol. 12, pp. 116875–116890, 2024, doi: 10.1109/ACCESS.2024.3444188.
I. Hussain, M. M. A. Arshad, A. N. Cheema, and I. M. Almanjahie, “Enhancing Urdu hate speech detection through differential transfer learning and adaptive loss functions,” Sci. Reports 2025 151, vol. 15, no. 1, pp. 37407-, Oct. 2025, doi: 10.1038/s41598-025-21306-w.
M. S. Khan, M. S. I. Malik, and A. Nadeem, “Detection of violence incitation expressions in Urdu tweets using convolutional neural network,” Expert Syst. Appl., vol. 245, p. 123174, Jul. 2024, doi: 10.1016/J.ESWA.2024.123174.
G. Musa Raza, A. Naseem, S. Iqbal, T. Masood, B. S. Kim, and T. N. Nguyen, “Intelligent model for target identification from Urdu threatening tweets in low-resource language using deep learning and fine-tuning of language models,” J. Inf. Telecommun., vol. 10, no. 3, pp. 383–401, Jul. 2026, doi: 10.1080/24751839.2025.2576951.
J. A. Siddiqui, S. S. Yuhaniz, G. M. Shaikh, S. A. Soomro and Z. A. Mahar, “Fine-Grained Multilingual Hate Speech Detection Using Explainable AI and Transformers,” IEEE Access, vol. 12, pp. 143177–143192, 2024, doi: 10.1109/ACCESS.2024.3470901.
M. Ahmad, M. Waqas, A. Hamza, S. Usman, I. Batyrshin, and G. Sidorov, “UA-HSD-2025: Multi-Lingual Hate Speech Detection from Tweets Using Pre-Trained Transformers,” Comput. 2025, Vol. 14, Page 239, vol. 14, no. 6, p. 239, Jun. 2025, doi: 10.3390/COMPUTERS14060239.
T. Srikissoon and V. Marivate, “Combating Hate: How Multilingual Transformers Can Help Detect Topical Hate Speech,” Epic Ser. Comput., vol. 93, pp. 203–215, 2023, doi: 10.29007/1CM6.
Muhammad Usman, Muhammad Ahmad, Moein Shahiki Tash, Irina Gelbukh, Rolando Quintero Tellez, Grigori Sidorov, “Multilingual Hate Speech Detection in Social Media Using Translation-Based Approaches with Large Language Models,” Prepr. Submitt. to Results Phys., 2025, [Online]. Available: https://arxiv.org/pdf/2506.08147
A. Ullah et al., “Threatening language detection from Urdu data with deep sequential model,” PLoS One, vol. 19, no. 6, Jun. 2024, doi: 10.1371/JOURNAL.PONE.0290915.
S. Ud Din, S. Khusro, F. Ali Khan, M. Ahmad, O. Ali, and T. M. Ghazal, “An Automatic Approach for the Identification of Offensive Language in Perso-Arabic Urdu Language: Dataset Creation and Evaluation,” IEEE Access, vol. 13, pp. 19755–19769, 2025, doi: 10.1109/ACCESS.2025.3534662.
A. Rashid, S. Mahmood, U. Inayat, and M. F. Zia, “Urdu Toxicity Detection: A Multi-Stage and Multi-Label Classification Approach,” AI 2025, Vol. 6, Page 194, vol. 6, no. 8, p. 194, Aug. 2025, doi: 10.3390/AI6080194.
E. Shoukat, R. Irfan, I. Basharat, M. A. Tahir, and S. Shaukat, “Attention based Bidirectional GRU hybrid model for inappropriate content detection in Urdu language,” Jan. 2025, Accessed: Oct. 25, 2026. [Online]. Available: https://arxiv.org/pdf/2501.09722
M. Ali, F. Sarwar, and A. Ashraf, “Hate Speech Detection Using Transformer-Based BERT model,” Gd. Asian J. Comput. Emerg. Technol. , vol. 1, no. 1, pp. 12–19, Aug. 2025, Accessed: Oct. 25, 2026. [Online]. Available: https://gajcet.com/article/view/14
Muhammad Bilal, Atif Khan, “Roman Urdu Hate Speech Detection Using Transformer-Based Model for Cyber Security Applications,” Sensors, vol. 23, no. 8, p. 3909, 2023, doi: https://doi.org/10.3390/s23083909.
F. Maqbool, B. Spahiu, and A. Maurino, “Impact of Data Augmentation on Hate Speech Detection in Roman Urdu,” CEUR Workshop Proc., vol. 3741, pp. 321–330, 2024, Accessed: Oct. 25, 2026. [Online]. Available: https://boa.unimib.it/handle/10281/490399
M. Zain et al., “RU-OLD: A Comprehensive Analysis of Offensive Language Detection in Roman Urdu Using Hybrid Machine Learning, Deep Learning, and Transformer Models,” Algorithms, vol. 18, no. 7, Jul. 2025, doi: 10.3390/A18070396.
“(PDF) Fine-Tuning Large Language Models with QLoRA for Offensive Language Detection in Roman Urdu-English Code-Mixed Text.” Accessed: Oct. 25, 2026. [Online]. Available: https://www.researchgate.net/publication/396249813_Fine-Tuning_Large_Language_Models_with_QLoRA_for_Offensive_Language_Detection_in_Roman_Urdu-English_Code-Mixed_Text
N. Hussain, A. Qasim, G. Mehak, O. Kolesnikova, A. Gelbukh, and G. Sidorov, “Hybrid Machine Learning and Deep Learning Approaches for Insult Detection in Roman Urdu Text,” AI 2025, Vol. 6, Page 33, vol. 6, no. 2, p. 33, Feb. 2025, doi: 10.3390/AI6020033.
M. O. Raza, A. Umar, and M. Awan, “Slur and Emoji Aware Models for Hate and Sentiment Detection in Roman Urdu Transgender Discourse,” 2025. doi: 10.26615/978-954-452-100-4-014.
T. Zubair, M. J. Asif, F. Kamiran, H. H. Saeed, and R. F. Ahmad, “Efficient Adaptation of LLMs for Hate Speech Detection in Low-Resource Languages: A Comparative Study on Roman Urdu,” Aug. 2026, Accessed: Oct. 25, 2026. [Online]. Available: https://arxiv.org/pdf/2608.18142
K. Ullah, M. Aslam, M. U. G. Khan, F. S. Alamri, and A. R. Khan, “UEF-HOCUrdu: Unified Embeddings Ensemble Framework for Hate and Offensive Text Classification in Urdu,” IEEE Access, vol. 13, pp. 21853–21869, 2025, doi: 10.1109/ACCESS.2025.3532611.
S. Harris, H. J. Hadi, N. Ahmad, and M. A. Alshara, “Multi-domain Urdu fake news detection using pre-trained ensemble model,” Sci. Reports 2025 151, vol. 15, no. 1, pp. 8705-, Mar. 2025, doi: 10.1038/s41598-025-91054-4.
“Sentiment Analysis of Urdu Text using Hybrid Deep Learning Techniques | Journal of Computing & Biomedical Informatics.” Accessed: Oct. 25, 2026. [Online]. Available: https://www.jcbi.org/index.php/Main/article/view/962
M. S. I. Malik, A. Nazarova, and M. M. Jamjoom, “Explainable threatening tweets identification using abstract meaning representation graph and pattern structure approaches,” Intell. Data Anal., vol. 29, no. 6, pp. 1501–1519, Nov. 2025, doi: 10.1177/1088467X251330977.
A. Mehmood, M. T. Hassan, and Q. Baig, “Analyzing and Visualizing Urdu News Articles Using NLP and Concept Graphs,” 2025 6th Int. Conf. Adv. Comput. Sci. ICACS 2025, 2025, doi: 10.1109/ICACS64902.2025.10937859.
“Memorization vs. Generalization : Quantifying Data Leakage in NLP Performance Evaluation | Request PDF.” Accessed: Jun. 20, 2026. [Online]. Available: https://www.researchgate.net/publication/355429440_Memorization_vs_Generalization_Quantifying_Data_Leakage_in_NLP_Performance_Evaluation
K. Lee et al., “Deduplicating Training Data Makes Language Models Better,” Proc. Annu. Meet. Assoc. Comput. Linguist., vol. 1, pp. 8424–8445, Jul. 2021, doi: 10.18653/v1/2022.acl-long.577.
E. Leonardelli, S. Menini, A. P. Aprosio, M. Guerini, and S. Tonelli, “Agreeing to Disagree: Annotating Offensive Language Datasets with Annotators’ Disagreement,” EMNLP 2021 - 2021 Conf. Empir. Methods Nat. Lang. Process. Proc., pp. 10528–10539, Sep. 2021, doi: 10.18653/v1/2021.emnlp-main.822.
M. Marone, O. Weller, W. Fleshman, E. Yang, D. Lawrie, and B. Van Durme, “mmBERT: A Modern Multilingual Encoder with Annealed Language Learning,” Sep. 2025, Accessed: Oct. 25, 2026. [Online]. Available: https://arxiv.org/pdf/2509.06888
“Adnan855570/Urdu_Hate_Speech · Datasets at Hugging Face.” Accessed: Oct. 25, 2026. [Online]. Available: https://huggingface.co/datasets/Adnan855570/Urdu_Hate_Speech
A. Conneau et al., “Unsupervised Cross-lingual Representation Learning at Scale,” Proc. Annu. Meet. Assoc. Comput. Linguist., pp. 8440–8451, 2020, doi: 10.18653/V1/2020.ACL-MAIN.747.
“mirfan899/urdu-bert-ner · Hugging Face.” Accessed: Oct. 25, 2026. [Online]. Available: https://huggingface.co/mirfan899/urdu-bert-ner
“urduhack/roberta-urdu-small · Hugging Face.” Accessed: Oct. 25, 2026. [Online]. Available: https://huggingface.co/urduhack/roberta-urdu-small
Downloads
Published
How to Cite
Issue
Section
License
Copyright (c) 2026 International Journal of Innovations in Science & Technology

This work is licensed under a Creative Commons Attribution 4.0 International License.


















