Adversarially Robust Multitask Learning for Offensive and Hate Speech Detection in Arabic Text Using Transformer-Based Models and RNN Architectures
Open Access
- 31 August 2025
- journal article
- research article
- Published by MDPI AG in Applied Sciences
- Vol. 15 (17) , 9602
Abstract
Offensive language and hate speech have a detrimental effect on victims and have become a significant problem on social media platforms. Recent research has developed automated techniques for detecting Arabic offensive language and hate speech but remains limited, and further research is required compared to the research on high-resource languages such as English due to limited resources, annotated corpora, and morphological analysis. Most social media users who use profanities attempt to modify their text while maintaining the same meaning, thereby deceiving detection methods that forbid offending phrases. Therefore, this study proposes an adversarially robust multitask learning framework for detection of Arabic offensive and hate speech. For this purpose, this study used the OSACT2020 dataset, augmented with additional posts collected from the X social media platform. To improve contextual understanding, classification models based on various configurations were constructed using four pre-trained Arabic language models integrated with various sequential layers that were trained and evaluated in three different settings: single-task learning with the original dataset, single-task learning with the augmented dataset, and multitask learning with the augmented dataset. The multitask MARBERTv2+BiGRU model achieved the best results, with an 88% macro-F1 for hate speech and 93% for offensive language on clean data. To improve the model’s robustness, adversarial samples were generated using attacks on both the character and sentence levels. These attacks subtly change the text to mislead the model while maintaining the overall appearance and meaning. The clean model’s performance dropped significantly under attack, especially for hate speech, to a 74% macro-F1; however, adversarial training, which re-trains the model using both clean and adversarial data, improved the results to a 78% macro-F1 for hate speech. Further improvements were achieved with input transformation techniques, boosting the macro-F1 to 81%. Notably, the adversarially trained model maintained high performance on clean data, demonstrating both robustness and generalization.Keywords
This publication has 50 references indexed in Scilit:
- Advancing offensive language detection in Arabic social media: a BERT-based ensemble learning approachSocial Network Analysis and Mining, 2024
- Generalizing Hate Speech Detection Using Multi-Task Learning: A Case Study of Political Public FiguresComputer Speech & Language, 2024
- Detection of Arabic offensive language in social media using machine learning modelsIntelligent Systems with Applications, 2024
- Comparative performance of ensemble machine learning for Arabic cyberbullying and offensive language detectionLanguage Resources and Evaluation, 2023
- Offensive language identification with multi-task learningJournal of Intelligent Information Systems, 2023
- A Multi-Task Learning Approach to Hate Speech Detection Leveraging Sentiment AnalysisIEEE Access, 2021
- A Survey on Multi-Task LearningIEEE Transactions on Knowledge and Data Engineering, 2021
- A Deep Learning Framework for Automatic Detection of Hate Speech Embedded in Arabic TweetsArabian Journal for Science and Engineering, 2021
- A Survey of Offensive Language Detection for the Arabic LanguageACM Transactions on Asian and Low-Resource Language Information Processing, 2021
- Improving the Reliability of Deep Neural Networks in NLP: A ReviewKnowledge-Based Systems, 2020