Robust Hate Speech Detection in Social Media: A Cross-Dataset Empirical Evaluation (2023)

Abstract: The automatic detection of hate speech online is an active research area in NLP. Most of the studies to date are based on social media datasets that contribute to the creation of hate speech detection models trained on them. However, data creation processes contain their own biases, and models inherently learn from these dataset-specific biases. In this paper, we perform a large-scale cross-dataset comparison where we fine-tune language models on different hate speech detection datasets. This analysis shows how some datasets are more generalizable than others when used as training data. Crucially, our experiments show how combining hate speech detection datasets can contribute to the development of robust hate speech detection models. This robustness holds even when controlling by data size and compared with the best individual datasets.

## introduction social media has led to a new form of communication that has changed how people interact across the world. with the emergence of this medium, hateful conduct has also found a place to propagate online. from more obscure online communities such as 4chan @xcite and telegram rooms @xcite to mainstream social media platforms such as facebook @xcite and twitter @xcite , the spread of hate speech is an on going issue. hate speech detection is a complex problem that has received a lot of attention from the natural language processing (nlp) community. it shares a lot of challenges with other social media problems (emotion detection, offensive language detection, etc), such as an increasingly amount of user generated content, unstructured @xcite and constantly evolving text @xcite , and the need of efficient large scale solutions. when dealing with hate speech in particular, one has to consider the sensitivity of the topics, their wide range (e.g. sexism, sexual orientation, racism), and their evolution through time and location @xcite . understanding the extent of the problem and tracking hate speech online through automatic techniques can therefore be part of the solution of this ongoing challenge. one way to contribute to this goal is to both improve the current hate speech detection models and, crucially, the data used to train them. the contributions of this paper are twofold. first, we provide a summary and unify existing hate speech detection datasets from social media, in particular twitter. second, we analyse the performance of language models trained on all datasets, and highlight deficiencies in generalisation across datasets, including the evaluation in a new independently-constructed dataset. finally, as a practical added value stemming from this paper, we share all the best models trained on the unification of all datasets, providing a relatively small-size hate speech detection model that is generalisable across datasets. 1 content warning the article contains examples of hateful and abusive language. the first vowel in hateful slurs, vulgar words, and in general profanity language is replaced with an asterisk (*). ## related work identifying hate speech in social media is an increasingly important research topic in nlp. it is often framed as a classification task (binary or multiclass) and through the years various machine learning and information sources approaches have been utilised @xcite @xcite . a common issue of supervised approaches lies not necessarily with their architecture, but with the existing hate speech datasets that are available to train supervised models. it is often the case that the datasets are focused on specific target groups @xcite , constructed using some specific keyword search terms @xcite , or have particular class distributions @xcite that leads to a training process that may or may not generalise. for instance, @xcite analysed the temporal aspect of hate speech, and demonstrate how brittle hate speech models are when evaluated on different periods. recent work has also shown that there is a need to both focus on the resources available and also try to expand them in order to develop robust hate speech classifiers that can be applied in various context and in different time periods @xcite . in this paper, we perform a large-scale evaluation to analyse how generalisable supervised models are depending on the underlying training set. then, we propose to mitigate the relative lack of generalisation by using datasets from various sources and time periods aiming to offer a more robust solution. ## data in this section, we describe the data used in our experiments. first, we describe existing hate speech datasets in section 3.1. then, we unify those datasets and provide statistics of the final data in section 3.2 ## evaluation we present our main experimental results comparing various language models trained on single datasets and in the unified dataset presented in the previous section. ## analysis in this section, we dissect the results presented in the previous section by performing a cross-dataset comparison and a qualitative error analysis. ## conclusion in this paper, we presented a large-scale analysis of hate speech detection systems based on language models. in particular, our goal was to show the divergences across datasets and the importance of having access to a diverse and complete training set. our results show how the combination of datasets make for a robust model performing competitively across all datasets. this is not a surprising finding given the size of the corresponding training sets, but the considerable gap (e.g. 70.7% to 61.0% in macro-f1 for the best timelms-21 performing model) shows that models trained on single datasets have considerable room for improvement. moreover, even when controlling for data size, a model trained on a diverse set instead of a single dataset leads to better overall results. as future work, we are planning to extend this analysis beyond english, in the line of previous multilingual approaches @xcite @xcite , and masked language models by including, among others, generative and instruction-tuning language models. in addition to the extensive binary-level evaluation, recognising the target group is a challenging area of research. while in section 4.3.2, we provided some encouraging results, the results could be expanded with a unified taxonomy.