# What Did You Learn To Hate? A Topic-Oriented Analysis of Generalization in Hate Speech Detection

Tom Bourgeade, Patricia Chiril, Farah Benamara, Véronique Moriceau

► To cite this version:

Tom Bourgeade, Patricia Chiril, Farah Benamara, Véronique Moriceau. What Did You Learn To Hate? A Topic-Oriented Analysis of Generalization in Hate Speech Detection. 17th Conference of the European Chapter of the Association for Computational Linguistics (EACL 2023), Association for Computational Linguistics (ACL), May 2023, Dubrovnik, Croatia. pp.3495-3508. hal-04122231

HAL Id: hal-04122231

https://hal.science/hal-04122231

Submitted on 8 Jun 2023

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>
# What Did You Learn To Hate? A Topic-Oriented Analysis of Generalization in Hate Speech Detection

Tom Bourgeade¹, Patricia Chiril³, Farah Benamara¹,², Véronique Moriceau¹

(1) IRIT, Université de Toulouse, CNRS, Toulouse INP, UT3, Toulouse, France
{firstname.lastname}@irit.fr

(2) IPAL, CNRS-NUS-ASTAR, Singapore

(3) University of Chicago, Chicago, IL, USA
pchiril@uchicago.edu

## Abstract

**Warning:** This paper includes messages that may contain instances of vulgarity, degrading terms, or hate speech, which may be offensive or upsetting to some readers.

Hate speech has unfortunately become a significant phenomenon on social media platforms, and it can cover various topics (*misogyny, sexism, racism, xenophobia, etc.*) and targets (e.g., *black people, women*). Various hate speech detection datasets have been proposed, some annotated for specific topics, and others for hateful speech in general. In either case, they often employ different annotation guidelines, which can lead to inconsistencies, even in datasets focusing on the same topics. This can cause issues in models trying to generalize across more data and more topics in order to improve detection accuracy. In this paper, we propose, for the first time, a topic-oriented approach to study generalization across popular hate speech datasets. We first perform a comparative analysis of the performances of Transformer-based models in capturing *topic-generic* and *topic-specific* knowledge when trained on different datasets. We then propose a novel, simple yet effective approach to study more precisely which topics are best captured in implicit manifestations of hate, showing that selecting combinations of datasets with better out-of-domain topical coverage improves the reliability of automatic hate speech detection.

## 1 Introduction

On social media and other online communication platforms, hate speech (HS hereafter) is found in many forms, from textual harassment to threats, targeting an individual or group (e.g., black people, women), based on some characteristics, such as race, color, ethnicity, gender, sexual orientation, nationality, religion, etc, which we refer to as *topics*. While the broad nature of these topics of HS is generally understood (Erjavec and Kovačič, 2012),

determining whether a social media post is a manifestation of HS (and if so, to which topic(s) it belongs to) is not a trivial task for humans and automated machine-learning systems. Indeed, the latter often require large quantities of annotated data, which in the case of HS, is made difficult due to (1) the absence of a comprehensive definition of these topics; but also, (2) the potential internal biases and subjectivity present in annotators and/or annotation guidelines employed to construct annotated datasets (Schmidt and Wiegand, 2017; Fortuna and Nunes, 2018; Vidgen et al., 2019; Fortuna et al., 2020).

To palliate these issues, cross-dataset evaluation has become an active line of research aiming at studying the generalization capabilities of HS detection systems to unseen data during training (Talat et al., 2018; Ludwig et al., 2022; Toraman et al., 2022). As data collection and annotation is an expensive and time-consuming process, current approaches use *mixtures* of existing HS detection datasets to study generalization across different social media platforms (Swamy et al., 2019; Salminen et al., 2020; Nejadgholi and Kirichenko, 2020) or across different manifestations of HS, often relying on one-to-many (train on one dataset/mixture, test on others) experimental settings (Fortuna et al., 2021; Talat et al., 2018; Chiril et al., 2022; Talat et al., 2018; Karan and Šnajder, 2018). In most of these, a unification scheme is proposed to adapt the original datasets' potentially fine-grained annotations to a set of binary labels, which can often fail to take into account the heterogeneity inherently present across different encodings of HS (Vidgen et al., 2019).

In addition, some datasets intentionally focus only on some specific kinds of manifestations of HS covering for example gender (e.g., misogyny, sexism), ethnicity, religion or race (e.g., xenophobia, anti-immigrants/refugees HS), i.e., they are *topic-specific*, whereas others attempt to cast a
wider net without specific sets of topics in mind, i.e., they are *topic-generic*. In either case, variations will always exist, either due to the reasons mentioned above, or due to shifts in the content found on social media through time. All of these may cause significant differences in the topics of HS that classification models might learn to recognize, which ultimately might make them less reliable, particularly in out-domain contexts (Yin and Zubiaga, 2021).

Acknowledging these issues and being aware of the noise that will invariably be introduced by mixing together different datasets, we propose for the first time to empirically study what modern Transformer architectures can effectively learn to generalize from existing datasets, in a unified setting, with a *focus on their topical nature*. More precisely: *Do models learn similarly from topic-generic datasets as from mixtures of topic-specific datasets? Does this acquired knowledge generalize to implicit expressions of HS, and if so, which finer-grained HS topics are learned by these models?* Our contributions are:

(1) An in-depth analysis of the generalizability of generic HS datasets, in which we show how using mixtures of those could be effective to attain better generalization across more topics.

(2) A similar analysis for *topic-specific* datasets, for which we show successful generalization in-domain, especially when using models fine-tuned on mixtures of such corpora.

(3) A novel, simple yet effective approach to study which finer-grained topics are best captured when dealing with *implicit* expressions of HS. We show that selecting mixtures of datasets with a better topical coverage can improve the reliability of models for out-of-domain applications.

## 2 Related Work

A number of previous works have studied generalizability of HS detection datasets and models, with different focuses: for example, Fortuna et al. (2020) and Fortuna et al. (2021) have analyzed the compatibility of many HS datasets (including some used in this study), both in terms of their properties (origin of data, annotated phenomena, class definitions, etc.) and empirically with intra- and inter-dataset generalization experiments. They conclude that model choice, intra-dataset performance, and the type of phenomenon being classified, are the most

important factor that determine generalization. In particular, they conclude that phenomena like *toxicity*, *abuse*, or *offensiveness* that are often lexicalized are easier to generalize than hate speech, something which was also confirmed and discussed in other works (Nejadgholi and Kirichenko, 2020; Yin and Zubiaga, 2021). In this paper, we are interested in the topic-oriented nature of HS specifically, and thus discard these former classes from our study.

Alternative solutions have recently been proposed to handle unseen topics by building new target-oriented datasets from scratch, such as the HateXplain dataset (Ludwig et al., 2022), with an additional labeling of the target topics of hate (Race, Religion, and Origin). While such linguistic resources are valuable for the research community, we believe existing larger datasets could be successfully exploited for generalization, as mixtures of datasets, as shown for example by Fortuna et al. (2018), Salminen et al. (2020), and Chiril et al. (2022), or, in a different fashion, by multitask HS detection systems or domain adaptation techniques (Talat et al., 2018; Kapil and Ekbal, 2020; Safi Samghabadi et al., 2020). In this paper, we continue this line of research by proposing for the first time, as far as we know, models able to generalize across topic generic vs. specific datasets as well as predict fine-grained manifestations in implicit hate messages. This is particularity challenging as these manifestations are more difficult to generalize due to their limited lexical features (ElSherief et al., 2021; Qian et al., 2019).

To this end, we rely on Transformer models like BERT that have been shown to be able to generalize better overall than previous architectures (Swamy et al., 2019). In particular, we experiment with both existing BERT-like models, some pre-adapted to the domain of HS, as well as T5 (Raffel et al., 2020), a text-to-text architecture that has never been used in a generalizability study.

## 3 Datasets

We experiment with six popular and freely available English tweets corpora (or English subsets thereof) from previous studies. We first present the datasets and how they were used in a common experimental setting. We then provide some discussions on the compatibility of these datasets, and how this may impact the generalization performances in our experiments.
## 3.1 Topic Generic vs. Topic Specific Datasets

The first two datasets are *topic-generic* while the other four are *topic-specific*, as follows.

**Davidson** (Davidson et al., 2017). It contains English tweets annotated into *hate speech*, *offensive*, and *neither*, with the intent of helping to distinguish between messages simply containing offensive terms, from those actually manifesting HS.

**Founta.** We make use of the dataset released by (Kallumadi et al., 2020) which is an updated version of the dataset initially proposed by Founta et al. (2018) and annotated for four types mutually exclusive of abusive behaviors: *abusive*, *hateful*, *spam* and *normal*.

**IberEval** (Fersini et al., 2018b) and **Evalita** (Fersini et al., 2018a) are part of the Automatic Misogyny Identification (AMI) shared task which aims at identifying tweets that convey hate or prejudice against women while categorizing different forms of misogynous behavior. We only use the main binary layer of annotation (i.e., presence vs. absence of misogyny).

**HatEval** (Basile et al., 2019) also known as SemEval-2019 Task 5, is a topic-specific HS detection dataset with tweets targeting *immigrants* and *women*, and annotated with three different binary layers of annotation: *hateful/non-hateful*, targeting a group/individual, *aggressive/non-aggressive*. Note that most of the tweets that target women in this dataset were derived from the AMI corpora (IberEval and Evalita).

**Waseem** (Talat and Hovy, 2016). It contains tweets targeting gender minorities, instances of racism, and tweets that were judged to be neither sexist nor racist.

We frame all the datasets used here as binary HS classification tasks, with the labels “hateful” (also referred to as the positive class) for instances containing some manifestation of hate speech, and “normal” for those containing none. Hence, for Founta and Davidson we filter out retweets/duplicates (keeping only the source tweets and their annotations) and only keep the *hateful/hate speech* and *normal* classes, and similarly, for the different topic-specific datasets, we unify the specific hate classes (*misogyny*, *sexism*, *racism*) with *hateful*, and the respective negative classes with *normal*.

To allow a more granular and topic-level analysis of results, we split all multi-targets topic-specific datasets into separate training, validation,

and testing sets, according to the topics. Therefore, we split *HatEval* into its two topics subsets (i.e., *HatEval*<sub>women</sub> and *HatEval*<sub>immigrants</sub>) and *Waseem* into *Waseem*<sub>sexism</sub> and *Waseem*<sub>racism</sub>. However, in this last dataset, because only one negative class is provided, and corresponds to both the absence of sexism and racism, we choose to duplicate it and use it as the negative class for both subsets.

When not explicitly provided, we use a 75%-20%-5% train-test-validation split ratio. Table 1 further details how datasets have been mixed to train our models.

## 3.2 Issues with Dataset Compatibility

Because we also manipulate mixtures of these corpora, the effective hateful and non-hateful classes will contain instances annotated within different contexts and labelling guidelines. For example, the *Evalita* and *IberEval* datasets are annotated only for the presence of misogyny, and not other manifestations of HS. This makes their negative (i.e., non-misogyny) class inconsistent with, say, the negative class from a topic-generic dataset, which is not ideal.

Aside from re-annotating all these datasets under a unified and consistent annotation schema, the issues that may arise as part of these simplifications cannot be circumvented, and should thus be taken into account as a fixed parameter in our experiments. These issues have been broadly acknowledged in the relevant literature (Schmidt and Wiegand, 2017; Fortuna and Nunes, 2018; van Aken et al., 2018). As noted by Malmasi and Zampieri (2018) and Poletto et al. (2021), the distinctions between offense, abuse, and HS, are not always clear-cut, which can cause issues in generalization experiments, due to the former's in theory more lexical nature (Vidgen et al., 2019; Fortuna et al., 2020).

Furthermore, as noted by Madukwe et al. (2020), even when using relatively similar definitions for these phenomena, a number of other parameters may affect the compatibility, consistency, and comparability between HS detection datasets, from biases introduced in the annotations, differences in preprocessing steps (e.g., anonymization, emojis, URLs, etc.), to issues of class balance and unspecified train-test-validation splits.

We are aware that mixing the datasets may effectively introduce various kinds of noise in the training and evaluation data, but we consider it
<table><caption>Table 1: Overview of the datasets used to train models in this study.</caption><thead><tr><th>Topic</th><th>Dataset</th><th>Abbrev.</th><th>Total Size</th><th>Pos. Size</th><th>Ratio</th><th>Train</th><th>Val.</th><th>Test</th></tr></thead><tbody><tr><td rowspan="2">Topic-Generic</td><td>Davidson</td><td>Gene Davi</td><td>5590</td><td>1430</td><td>25.58%</td><td>4293</td><td>179</td><td>1118</td></tr><tr><td>Founta</td><td>Gene Fnt</td><td>57355</td><td>4119</td><td>7.18%</td><td>44048</td><td>1836</td><td>11471</td></tr><tr><td rowspan="4">Topic-Specific (Gender)</td><td>Evalita</td><td>Gndr Evit</td><td>5000</td><td>2245</td><td>44.90%</td><td>3839</td><td>161</td><td>1000</td></tr><tr><td>HatEval<sub>women</sub></td><td>Gndr HatE</td><td>6472</td><td>2845</td><td>43.96%</td><td>4500</td><td>500</td><td>1472</td></tr><tr><td>IberEval</td><td>Gndr Iber</td><td>3977</td><td>1851</td><td>46.54%</td><td>3120</td><td>131</td><td>726</td></tr><tr><td>Waseem<sub>sexism</sub></td><td>Gndr Wasm</td><td>14531</td><td>3216</td><td>22.13%</td><td>11159</td><td>465</td><td>2907</td></tr><tr><td rowspan="2">Topic-Specific (Race)</td><td>HatEval<sub>immigrants</sub></td><td>Race HatE</td><td>6499</td><td>2617</td><td>40.27%</td><td>4500</td><td>500</td><td>1499</td></tr><tr><td>Waseem<sub>racism</sub></td><td>Race Wasm</td><td>13272</td><td>1957</td><td>14.75%</td><td>10192</td><td>425</td><td>2655</td></tr><tr><td rowspan="4">Mixtures</td><td>Topic-Generic Mixture</td><td>Gene Mixt</td><td colspan="7">Davidson + Founta</td></tr><tr><td>Gender Topic Mixture</td><td>Gndr Mixt</td><td colspan="7">Evalita + HatEval<sub>women</sub> + IberEval + Waseem<sub>sexism</sub></td></tr><tr><td>Race Topic Mixture</td><td>Race Mixt</td><td colspan="7">HatEval<sub>immigrants</sub> + Waseem<sub>racism</sub></td></tr><tr><td>Topic-Specific Mixture</td><td>Spec Mixt</td><td colspan="7">Topic Gender Mixture + Topic Race Mixture</td></tr></tbody></table>

to be part of the experimental settings, especially since these kinds of issues would likely as well be encountered in end-user applications dealing with raw unfiltered data.

## 4 Models

To study how different pre-trained models and architectures may differ in how they capture HS in various settings, we choose five pre-trained Transformers from the literature. Among them, the last three have been adapted to the domain of HS detection, either through pretraining or pre-finetuning, on data related directly or indirectly to HS detection. For the experiments, we relied on the Hugging Face transformers library (Wolf et al., 2020).

**RoBERTa-base** (Liu et al., 2019) is an optimized BERT-like (Devlin et al., 2019) encoder Transformer commonly used for various NLP classification tasks, including HS detection.

**T5-base** is the 220 million parameters pretrained variant of the T5 architecture, initially proposed by Raffel et al. (2020). It differs from BERT-like encoder Transformers in that it is a *text-to-text* model, for which classification tasks are reframed as text generation, with the output labels used in their textual form (in our case, “normal” and “hateful”), and as this particular variant was also pretrained on various supervised tasks (sentiment analysis, natural language inference, and question answering, etc.), a task prefix is traditionally prepended to the input text, which for our fine-tuning, we fix to “hate speech: ”.

**fBERT** (Sarkar et al., 2021) and **HateBERT** (Caselli et al., 2021) are two models derived from

BERT, retrained with a Masked Language Modelling (MLM) objective on over 1.4 million social media offensive posts from the SOLID dataset, and Reddit Abusive Language English dataset (RAL-E), respectively.

**ToxDectRoBERTa** was proposed by Zhou et al. (2021), and is a RoBERTa-large model, finetuned on Founta, with the *hateful* and *abusive* classes merged into a single *toxic* class. The authors use the methods proposed by Clark et al. (2019) and Swayamdipta et al. (2020) to attempt to avoid dataset bias issues, such as spurious correlations between particular lexical and dialectical markers (such as those found in African American English) with the *toxic* class.

## 5 Cross-Topics Generalization

We first study the differences in generalizability between topic-generic and topic-specific datasets and their potential mixtures, in a cross-dataset/mixture setting: in each individual experiment, one of the previously described models is trained on one dataset/mixture and tested on all individual test sets. For technical details on the experimental parameters used in this study, see Appendix A.

To measure improvements or deteriorations in performances in the generalization experiments, Table 2 presents an intra-dataset evaluation, in which models are simply trained and tested on the same datasets, for the sake of comparison. In the remainder of this section, we report macro F1 scores on all test sets (see Table 1 for abbreviations), with the best scores for each test set highlighted in **bold**. Scores are gradient-colored for legibility.
<table><caption>Table 2: Results of intra-dataset evaluations (training and testing on the same dataset's train and test sets).</caption><thead><tr><th>Dataset \ Model</th><th>T5-base</th><th>RoBERTa-base</th><th>ToxDectRoBERTa</th><th>fBERT</th><th>HateBERT</th></tr></thead><tbody><tr><td>Gene Davi</td><td>92.70</td><td>93.30</td><td><strong>93.78</strong></td><td>92.46</td><td>93.14</td></tr><tr><td>Gene Fnt</td><td>81.08</td><td>80.84</td><td><strong>85.92</strong></td><td>80.98</td><td>79.41</td></tr><tr><td>Gndr Evit</td><td>67.00</td><td>69.58</td><td>67.37</td><td><strong>73.12</strong></td><td>71.02</td></tr><tr><td>Gndr HatE</td><td>46.29</td><td>56.88</td><td>51.65</td><td><strong>64.28</strong></td><td>59.11</td></tr><tr><td>Gndr Iber</td><td>84.86</td><td><strong>88.76</strong></td><td>83.89</td><td>84.55</td><td>86.41</td></tr><tr><td>Gndr Wasm</td><td>85.81</td><td><strong>87.11</strong></td><td>86.27</td><td>86.28</td><td>86.05</td></tr><tr><td>Race HatE</td><td>38.73</td><td>38.24</td><td>40.75</td><td><strong>41.72</strong></td><td>38.53</td></tr><tr><td>Race Wasm</td><td>87.03</td><td>86.27</td><td>86.29</td><td><strong>87.53</strong></td><td>86.37</td></tr></tbody></table>

## 5.1 Learning from Topic-Generic Datasets

We investigate here how well knowledge can transfer from topic-generic to topic-specific datasets. We thus train each of the five chosen models on the Davidson (Gene Davi) and Founta (Gene Fnta) train sets, as well as on a mixture of the two (Gene Mixt), then evaluate those models on every individual test set.

Table 3 presents the results of these evaluations, in terms of macro F1 score. Observing the results, firstly, we can notice that Davidson and Founta generalize relatively well to each other, with relatively small deteriorations in F1 scores (~ -10 F1) compared to the intra-dataset models (see Table 2), in the favor of Davidson → Founta for our 5 models. When used as a mixture of datasets (Gene Mixt), we observe very small improvements for 3 of our five models and very small deteriorations (~ ±1 F1) for the rest (RoBERTa-base and ToxDectRoBERTa), which would tend to indicate a good compatibility between these two datasets, or at the very least, some high overlap in the topic-generic HS knowledge extracted by Transformer models across these two datasets.

Looking then at the evaluation results obtained on the topic-specific test sets, we can make a number of observations: first, we note quite significant deteriorations compared to the intra-dataset models for all datasets, except for both HatEval subsets, in particular HatEvalimmigrants, for which all three topic-generic datasets/mixture yield significant improvements (from ~ +3 F1 up to ~ +27 F1). We believe this to be due to a significant distribution shift between the HatEval train and test set, which would explain why the models perform so poorly in the intra-dataset setting, while using different training sets appears to significantly improve performance.

For the other datasets, the least significant deteriorations can be found for Evalita, while the greatest ones are found for Waseemsexism, which may indicate an overall low overlap in the types of manifestations of HS found in the topic-generic and topic-specific datasets explored here. However, in most cases, the use of the topic-generic mixture (Gene Mixt) appears to be beneficial, in that it tends to attenuate the worst deteriorations found in models trained on Davidson or Founta individually. This may indicate that using mixtures of topic-generic training datasets may be beneficial when trying to detect HS instances where the topic is not necessarily known.

## 5.2 Learning from Topic-Specific Datasets

We similarly trained HS classifiers, this time on the remaining 6 topic-specific datasets, separated into the Race and Gender topics (see Table 1). Table 4 presents the results (in a form similar to Table 3), however, for space reasons and as they are the focus of our study, we only present the results for the gender and race topics mixtures (Gndr Mixt, and Race Mixt respectively), as well as the mixture of both (Spec Mixt). See Table A in Appendices for more detailed results.

Observing the results, we can first see that, similarly to the previous experiments, training on these three mixtures of topic-specific datasets does not seem to generalize too well back onto the topic-generic datasets, with even greater deteriorations in F1 scores compared to the intra-dataset setting (cf. Table 2). This is the most pronounced for Race Mixt, which is the smaller of the two one-topic mixtures. Even more prominently than for topic-generic mixture discussed previously (Gene Mixt), we find that the topic-specific mixture (Spec Mixt), which combines both the Gender and Race topics, yields significantly lesser deteriorations than ei-
<table><caption>Table 3: Results of learning from the two topic-generic datasets used here, Davidson (Gene Davi) and Founta (Gene Fnta), as well as their mixture (Gene Mixt). Scores are gradient-colored for legibility.</caption><thead><tr><th rowspan="2">Model<br>Test</th><th colspan="3">T5-base</th><th colspan="3">RoBERTa-base</th><th colspan="3">ToxDectRoBERTa</th><th colspan="3">fBERT</th><th colspan="3">HateBERT</th></tr><tr><th>Gene<br>Davi</th><th>Gene<br>Fnta</th><th>Gene<br>Mixt</th><th>Gene<br>Davi</th><th>Gene<br>Fnta</th><th>Gene<br>Mixt</th><th>Gene<br>Davi</th><th>Gene<br>Fnta</th><th>Gene<br>Mixt</th><th>Gene<br>Davi</th><th>Gene<br>Fnta</th><th>Gene<br>Mixt</th><th>Gene<br>Davi</th><th>Gene<br>Fnta</th><th>Gene<br>Mixt</th></tr></thead><tbody><tr><td>Gene Davi</td><td>92.70</td><td>82.64</td><td><strong>93.92</strong></td><td>93.30</td><td>82.50</td><td>91.60</td><td>93.78</td><td>84.73</td><td>90.96</td><td>92.46</td><td>85.59</td><td>92.92</td><td>93.14</td><td>85.43</td><td>93.42</td></tr><tr><td>Gene Fnt</td><td>73.02</td><td>81.08</td><td>81.41</td><td>74.50</td><td>80.84</td><td>80.49</td><td>81.42</td><td><strong>85.92</strong></td><td>84.70</td><td>76.47</td><td>80.98</td><td>81.37</td><td>73.02</td><td>79.41</td><td>80.32</td></tr><tr><td>Gndr Evit</td><td>63.29</td><td>58.07</td><td>61.79</td><td>60.68</td><td>58.51</td><td>56.97</td><td>62.10</td><td>54.25</td><td>60.20</td><td>61.44</td><td>57.00</td><td>62.16</td><td><strong>63.92</strong></td><td>56.74</td><td>59.99</td></tr><tr><td>Gndr HatE</td><td>42.21</td><td>42.90</td><td>54.60</td><td>46.39</td><td>55.17</td><td>49.45</td><td>40.30</td><td>39.81</td><td>52.35</td><td>38.25</td><td>49.75</td><td>45.83</td><td>44.46</td><td>55.76</td><td><strong>56.31</strong></td></tr><tr><td>Gndr Iber</td><td>57.76</td><td><strong>74.22</strong></td><td>59.48</td><td>60.50</td><td>62.96</td><td>68.89</td><td>64.14</td><td>73.00</td><td>67.83</td><td>60.34</td><td>71.43</td><td>63.74</td><td>60.12</td><td>67.11</td><td>65.24</td></tr><tr><td>Gndr Wasm</td><td>54.06</td><td>59.07</td><td>52.21</td><td>51.55</td><td>51.11</td><td>51.63</td><td>51.13</td><td>56.44</td><td>52.72</td><td>53.84</td><td><strong>61.47</strong></td><td>51.73</td><td>52.36</td><td>58.24</td><td>54.52</td></tr><tr><td>Race HatE</td><td>43.75</td><td>64.54</td><td>50.97</td><td>47.79</td><td>56.76</td><td>63.71</td><td>52.23</td><td><strong>68.58</strong></td><td>66.92</td><td>50.65</td><td>66.49</td><td>45.70</td><td>44.13</td><td>66.08</td><td>65.62</td></tr><tr><td>Race Wasm</td><td>56.66</td><td>72.73</td><td>73.69</td><td>56.89</td><td><strong>75.52</strong></td><td>70.72</td><td>69.92</td><td>73.47</td><td>73.45</td><td>70.16</td><td>72.33</td><td>70.01</td><td>63.01</td><td>72.81</td><td>73.28</td></tr></tbody></table>

<table><caption>Table 4: Results of learning from the mixtures of the gender topic-specific (Gndr Mixt) datasets (Evalita, HateEval women, IberEval, and Waseem sexism), race topic-specific (Race Mixt) datasets (HateEval immigrants, and Waseem racism), and a mixture of both topics (Spec Mixt).</caption><thead><tr><th rowspan="2">Model<br>Test</th><th colspan="3">T5-base</th><th colspan="3">RoBERTa-base</th><th colspan="3">ToxDectRoBERTa</th><th colspan="3">fBERT</th><th colspan="3">HateBERT</th></tr><tr><th>Gndr<br>Mixt</th><th>Race<br>Mixt</th><th>Spec<br>Mixt</th><th>Gndr<br>Mixt</th><th>Race<br>Mixt</th><th>Spec<br>Mixt</th><th>Gndr<br>Mixt</th><th>Race<br>Mixt</th><th>Spec<br>Mixt</th><th>Gndr<br>Mixt</th><th>Race<br>Mixt</th><th>Spec<br>Mixt</th><th>Gndr<br>Mixt</th><th>Race<br>Mixt</th><th>Spec<br>Mixt</th></tr></thead><tbody><tr><td>Gene Davi</td><td>61.72</td><td>50.23</td><td>68.33</td><td>62.20</td><td>47.75</td><td>68.22</td><td>65.04</td><td>62.26</td><td>67.13</td><td>68.38</td><td>51.78</td><td><strong>72.60</strong></td><td>62.67</td><td>56.10</td><td>68.75</td></tr><tr><td>Gene Fnt</td><td>58.61</td><td>57.44</td><td>62.09</td><td>57.60</td><td>54.14</td><td>61.17</td><td>62.92</td><td>60.92</td><td>63.24</td><td>60.46</td><td>55.14</td><td>59.93</td><td>57.91</td><td>58.11</td><td><strong>63.36</strong></td></tr><tr><td>Gndr Evit</td><td>82.90</td><td>36.42</td><td>84.78</td><td>86.33</td><td>35.92</td><td>86.89</td><td>85.40</td><td>42.15</td><td>85.58</td><td><strong>88.59</strong></td><td>38.58</td><td>87.37</td><td>87.96</td><td>38.95</td><td>86.80</td></tr><tr><td>Gndr HatE</td><td>47.83</td><td>36.82</td><td>54.58</td><td>52.69</td><td>37.02</td><td>53.65</td><td>50.80</td><td>48.80</td><td><strong>58.53</strong></td><td>54.80</td><td>36.71</td><td>58.44</td><td>55.33</td><td>42.57</td><td>49.06</td></tr><tr><td>Gndr Iber</td><td><strong>93.31</strong></td><td>40.84</td><td>93.17</td><td>92.12</td><td>38.66</td><td>92.84</td><td>92.32</td><td>40.84</td><td>92.30</td><td>92.55</td><td>39.42</td><td>92.55</td><td>92.85</td><td>39.42</td><td>92.86</td></tr><tr><td>Gndr Wasm</td><td>85.14</td><td>44.92</td><td>87.85</td><td>85.66</td><td>43.96</td><td>88.53</td><td>85.72</td><td>44.76</td><td>87.39</td><td>86.92</td><td>43.59</td><td>87.93</td><td>84.85</td><td>44.28</td><td><strong>88.87</strong></td></tr><tr><td>Race HatE</td><td>42.98</td><td>40.49</td><td><strong>44.29</strong></td><td>37.69</td><td>40.44</td><td>38.06</td><td>38.59</td><td>41.23</td><td>44.03</td><td>39.47</td><td>43.68</td><td>40.40</td><td>37.56</td><td>37.01</td><td>35.80</td></tr><tr><td>Race Wasm</td><td>46.49</td><td>86.76</td><td>85.39</td><td>46.30</td><td>85.90</td><td>88.00</td><td>48.12</td><td>87.05</td><td>85.46</td><td>48.58</td><td>86.25</td><td><strong>89.17</strong></td><td>46.66</td><td>86.42</td><td>88.37</td></tr></tbody></table>

ther of the two individually: this intuitively makes sense, as both separate topics can help cover different subsets of the topic-generic datasets, and should also help in learning manifestations of hate which exist at the intersection of both topics.

Looking at the scores obtained on the topic-specific test sets, we can observe that, unlike in the topic-generic generalization experiments, both the one-topic mixtures and Spec Mixt appear to yield improvements over the intra-dataset models, for most of the models. For Gndr Mixt and Race Mixt, the improvements are, as expected, mostly found for the test sets of the datasets making up the mixtures, but not always: for example, with the T5-base model, training on Gndr Mixt appears to yield improvements on Waseem racism (~ +4 F1). This seems to indicate a better ability to generalize in-domain from mixtures of topic-specific datasets, at least to other topic-specific datasets, but more experiments with more topic-specific datasets, cov-

ering a wider range of topics, would be necessary to determine whether this may also apply to topic-generic datasets.

# 6 Finer-Grained Topics Analysis

To better understand which manifestations of HS can be generalized to out-of-domain data, we then perform a finer-grained analysis of the topics learned by our models, by relying on an implicit hate speech dataset, for which fine-grained target annotations are available.

## 6.1 Implicit Hate Speech Dataset

IMPLICIT HATE CORPUS (which we refer to as ElSherief, for brevity) corresponds to the dataset proposed by ElSherief et al. (2021), which consists of 21,480 English tweets annotated for (in a first stage) the presence of implicit or explicit HS (or neither), as mutually exclusive classes. Further, for each of the tweets containing implicit HS, two an-
notators supplied the targeted demographic groups and the implied statement of the hateful messages, both as free-form texts. In our experiments, we rely on the 6,196 implicit hate instances and their target annotations, which we have manually grouped into different sets of finer-grained topics of HS (whose sizes are in Table 5): *Islam, Black People, Immigrants / Refugees, Beliefs / Religion, Gender, LGBTQIA+, Unspecified Minorities, and Nationality*.

## 6.2 Results

To better show the observations that can be mainly linked to training dataset/mixture selection, we choose to present, in Table 5, the results of the best performing non-domain adapted architecture used here, T5-base. To this end, we rely on the previously mentioned trained T5-base models to obtain binary HS predictions on the entire processed ElSherief dataset, and compute the accuracy (as the tested instances are by definition all from the positive class) of the models for each of the finer-grained topic-specific subsets described previously.

The first three results columns show the topics learned by the models trained on the topic-generic datasets, Davidson, Founta, and their mixture (Gene Mixt). We observe that the model trained on Founta alone yields the highest accuracy scores over a number of topics, except for the *Immigrants/Refugees, Unspecified Minorities, and Gender* topics. Due to the latter's small size, and higher degree of co-occurring kinds of HS manifestations (see Section 6.3), accuracies appear to be relatively lower across the board, even for the gender topic-specific datasets. Still, topic-generic datasets, and their mixture, display fairly decent generalization on average for most fine-grained topics analyzed here, and represent a promising avenue for future research aimed at constructing effective out-of-domain generalization mixtures of datasets.

The next group of three columns show the differences in variety of finer-grained topics, between the gender and the race topic, and this in spite of fewer number of instances in the Race topic mixture compared to Gender one. Training on both topics combined (Spec Mixt) only yields improvement in the *Gender* and *LGBTQIA* topics, while all the other accuracies drop. This could be a sign that the dual-topic mixture allows for the learning of intersectional manifestations of HS between these

topics. Indeed, in the *Gender* group, we find that 22 out of the 58 instances also belong to one or more other groups, and among those, 16 are in the *Muslims, Immigrants / Refugees*, or both groups (10 for *Immigrants / Refugees* and/or *Black People* in *LGBTQIA*). As such, it appears that mixtures of topic-specific datasets may prove useful in the generalization of intersectional HS detection, though more research would be necessary to verify this for other topics, and with more data.

The next two columns demonstrate how two datasets annotated for similar topics can wildly vary in which fine-grained topics they allow models to capture. Due to the significant differences in data collection, annotation, and cultural/temporal contexts, the *HatEval* and *Waseem* datasets result in very different learned distributions of fine-grained topics, with the latter almost exclusively covering the *Muslims* topics, whereas the former yields a more varied, and overall more performant on the ElSherief dataset, out-of-domain generalization.

The final group of three columns further illustrates this point: *Waseem* yields significantly lower performance on the *Gender* topic, and, if removed from the Gender topic mixture (Gndr Mixt), improves its overall accuracy. While removing the entirety of a dataset might not be ideal, this shows the importance of data selection for both in and out-of-domain generalization, and we believe this kind of analysis could be used to guide data selection, for the purpose of constructing such mixtures of datasets.

## 6.3 Error Analysis

To further investigate how these different models behave on those out-of-domain instances, we perform and present an error analysis on a selection of instances<fnref n="1" /> from some of the different finer-grained topics.

We find that misclassifications are often due to several factors, among which implicit expressions of HS such as stereotypes, irony, or humor (as in (1)), or the presence of multiple topics of HS used in potentially ambiguous ways (2): is this instance (ironically) Islamophobic, sexist, or both?

(1) *what pronoun should we use to refer to people who are transitioning into martians?*

(2) *women are intellectually deficient, islam says*

<footnote n="1">¹These are examples taken from the ElSherief public dataset which provides texts of the tweets (because of Twitter otherwise having deleted a lot of them).</footnote>
<table><caption>Table 5: Accuracy scores obtained by the T5-base models trained on the datasets and mixtures of datasets (columns), evaluated on each of finer-grained topic of HS grouped from the ElSherief dataset (rows), with the number of instances of each topic reported in the Size column. The best accuracies for each topic are highlighted in **bold**, and the scores are gradient-colored for legibility. Gndr Mixt\Wasm corresponds to the Gender topic mixture (Gndr Mixt), from which Waseem<sub>sexism</sub> has been removed. **All** corresponds to the mixture of all 8 individual datasets (see Table 1). **ES** corresponds to baseline accuracy scores obtained from training a similar model on the ElSherief dataset itself, for comparison.</caption><thead><tr><th rowspan="2">Model<br>Test</th><th rowspan="2">Size</th><th colspan="10">T5-base</th><th rowspan="2">All</th><th rowspan="2">ES</th></tr><tr><th>Gene Davi</th><th>Gene Fnta</th><th>Gene Mixt</th><th>Gndr Mixt</th><th>Race Mixt</th><th>Spec Mixt</th><th>Race HatE</th><th>Race Wasm</th><th>Gndr Iber</th><th>Gndr Wasm</th><th>Gndr Mixt\Wasm</th></tr></thead><tbody><tr><td>Muslims</td><td>801</td><td>35.58</td><td><strong>81.90</strong></td><td>56.67</td><td>1.13</td><td>63.17</td><td>41.57</td><td>70.04</td><td>39.95</td><td>2.50</td><td>0.37</td><td>5.36</td><td>52.06</td><td>94.51</td></tr><tr><td>Black People</td><td>1391</td><td>78.43</td><td><strong>78.58</strong></td><td>54.71</td><td>2.80</td><td>34.94</td><td>23.22</td><td>52.41</td><td>2.44</td><td>3.16</td><td>0.93</td><td>9.78</td><td>50.75</td><td>88.79</td></tr><tr><td>Immigrants / Refugees</td><td>1386</td><td>24.82</td><td>47.40</td><td>26.19</td><td>2.45</td><td>53.03</td><td>42.14</td><td><strong>66.52</strong></td><td>1.30</td><td>2.45</td><td>0.51</td><td>9.95</td><td>50.36</td><td>96.90</td></tr><tr><td>Beliefs / Religion</td><td>652</td><td>63.03</td><td><strong>76.99</strong></td><td>53.53</td><td>1.68</td><td>35.74</td><td>28.53</td><td>51.69</td><td>6.74</td><td>2.76</td><td>0.16</td><td>6.44</td><td>53.99</td><td>93.25</td></tr><tr><td>Gender</td><td>58</td><td>31.03</td><td>41.38</td><td>24.14</td><td>32.76</td><td>17.24</td><td>46.55</td><td>25.86</td><td>5.17</td><td>44.83</td><td>12.07</td><td>46.55</td><td><strong>48.28</strong></td><td>96.55</td></tr><tr><td>LGBTQIA</td><td>87</td><td>43.68</td><td><strong>63.22</strong></td><td>33.33</td><td>3.45</td><td>12.64</td><td>21.84</td><td>37.93</td><td>0.00</td><td>12.64</td><td>2.30</td><td>14.94</td><td>32.18</td><td>88.51</td></tr><tr><td>Unsp. Minorities</td><td>1147</td><td><strong>79.42</strong></td><td>66.61</td><td>40.45</td><td>1.22</td><td>23.45</td><td>12.55</td><td>44.90</td><td>2.01</td><td>1.48</td><td>0.17</td><td>6.02</td><td>38.10</td><td>85.44</td></tr><tr><td>Nationality</td><td>203</td><td>50.24</td><td><strong>67.98</strong></td><td>44.83</td><td>1.97</td><td>34.97</td><td>24.14</td><td>56.16</td><td>3.45</td><td>4.43</td><td>0.49</td><td>7.39</td><td>40.39</td><td>84.24</td></tr></tbody></table>

in sahih bukhari 1:6:301. *disagree? you are islamophobe.*

Both (3) and (4) were misclassified due to the lack of context: neither of the two implied statements provided by the annotators (i.e., Women are dumb/Muslims are repugnant and kill gays/immigrants should be shot like rats) can be reliably automatically inferred without more information.

(3) *oh honey. justoh, honey. bless your heart.*

(4) *maybe time to oil up the deer rifles, the ones with the hd night scopes to keep the "vermin" population down.*

# 7 Conclusion and Perspectives

In this work, we have proposed a set of topic-oriented analyses of the generalizability of HS datasets. We have shown how *topic-generic* and *topic-specific* datasets yield different degrees and nature of generalization, both when used individually, or as mixtures of datasets. With the former, we found that, while not very successful at generalizing in-domain to topic-specific datasets, the use of mixtures allows smoothing out individual weaknesses. With topic-specific datasets, we found that generalization is possible, both for single-topic and multi-topic mixtures. Through a finer-grain out-of-domain generalization analysis, we showed how a priori somewhat similar datasets can vary wildly in

the forms of *implicit* HS that can be learned from them. Implicit expressions of hate, with few lexical features, are more difficult to generalize, as models can struggle to capture underlying hateful intents in messages. Notably, one barrier to understanding more implicit manifestations of hate is the lack of context for individual social media posts: more conversational datasets could represent an interesting avenue of research in that regard. These are all important considerations for the purpose of constructing more reliable automatic HS detection systems, intended to function on raw, potentially noisy, and never-seen-before data. In particular, we found that topic-generic datasets like Founta (Founta et al., 2018) appear promising for future research on generalization-optimized mixtures of datasets. Finally, concerning HS detection architectures, we found that, for BERT-like models, pre-domain adapted variants generalize slightly better than a more generic RoBERTa classifier, but yield similar results to a generic text-to-text T5 architecture, which seems promising for future research in HS detection.

In future work, we will explore the use of these approaches to guide data selection, by for example employing the method proposed by Swayamdipta et al. (2020), in order to construct mixtures of HS datasets better suited to out-of-domain generalization. Alternatively, Active Learning methods have been shown to be successful in NLP (Ein-Dor
et al., 2020), and could be used to palliate annotated
scarcity in HS detection: by using topic-oriented
analysis methods to detect difficult-to-predict top-
ics, better targeted additional annotations could be
acquired, to help improve the topical coverage of
automated systems.

Limitations

In this work, we acknowledge a number of issues
with the compatibility of HS datasets (cf. Sections
1, 2, and 3.2): namely, the phenomena annotated in
these datasets, even those labelled using similar or
equal terms, will, in theory and in practice, repre-
sent wildly different classes. While, unlike some
other previous works (Fortuna et al., 2020, 2021),
we do not merge initially distinct labels in datasets,
but instead only keep whole classes that correspond
to hate speech (excluding other forms of abuse, like
toxicity, offensiveness, etc.), using them in a unified
binarized setting is still bound to introduce signif-
icant amounts of noise in the training data, with
regards to the HS detection task. Most of these
issues are well documented, however, as complete
re-annotation of all relevant data would be a pro-
hibitively expensive enterprise, we believe there is
value in exploring alternative solutions that may
enable generalization despite these problems, us-
ing existing annotated datasets as they are currently
available. Additionally, the analyses presented in
this work are by no means comprehensive, both in
quantity and variety of datasets and models experi-
mented with. For example, some of the fined-grain
topic groups found in the ElSherief dataset are
not large enough to draw strong conclusions from
(namely, Gender and LGBTQIA): supplementing
these less represented topics with more data would
enable better insights into generalizability for these
kinds of HS manifestations.

Ethics Statement

The data that was used for conducting the experi-
ments is composed of text from the public domain
taken from datasets publicly available to the re-
search community. These corpora also conform
to the Twitter Developer Agreement and Policy
that allows unlimited distribution of the numeric
identification number of each tweet. The desire to
combat online HS and prevent the widespreading
of stereotypes cannot be done without automatic
moderation tools, at the risk of increasing cases of
algorithmic discrimination. However, the deploy-

ment of such algorithms should be done with care,
as algorithmic discrimination results from the in-
troduction of biases at the time of the design of the
system. These biases consist in the transposition
of general (often stereotyped) or statistical obser-
vations into systematic algorithmic conditions.

Acknowledgements

This work has been carried out in the framework of
the STERHEOTYPES project funded by the Com-
pagnia San Paolo 'Challenges for Europe'. The
research of Farah Benamara is also partially sup-
ported by DesCartes: The National Research Foun-
dation, Prime Minister's Office, Singapore under
its Campus for Research Excellence and Techno-
logical Enterprise (CREATE) program.

References

Valerio Basile, Cristina Bosco, Elisabetta Fersini, Debora Nozza, Viviana Patti, Francisco Manuel Rangel Pardo, Paolo Rosso, and Manuela Sanguinetti. 2019. SemEval-2019 Task 5: Multilingual Detection of Hate Speech Against Immigrants and Women in Twitter. In *Proceedings of the 13th International Workshop on Semantic Evaluation*, pages 54–63, Minneapolis, Minnesota, USA. Association for Computational Linguistics.

Tommaso Caselli, Valerio Basile, Jelena Mitrović, and Michael Granitzer. 2021. HateBERT: Retraining BERT for Abusive Language Detection in English. In *Proceedings of the 5th Workshop on Online Abuse and Harms (WOAH 2021)*, pages 17–25, Online. Association for Computational Linguistics.

Patricia Chiril, Endang Wahyu Pamungkas, Farah Benamara, Véronique Moriceau, and Viviana Patti. 2022. Emotionally Informed Hate Speech Detection: A Multi-target Perspective. *Cognitive Computation*, 14(1):322–352.

Christopher Clark, Mark Yatskar, and Luke Zettlemoyer. 2019. Don't Take the Easy Way Out: Ensemble Based Methods for Avoiding Known Dataset Biases. In *Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP)*, pages 4069–4082, Hong Kong, China. Association for Computational Linguistics.

Thomas Davidson, Dana Warmsley, Michael Macy, and Ingmar Weber. 2017. Automated Hate Speech Detection and the Problem of Offensive Language. *Proceedings of the International AAAI Conference on Web and Social Media*, 11(1):512–515.

Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. 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, Volume 1 (Long and Short Papers)*, pages 4171–4186, Minneapolis, Minnesota. Association for Computational Linguistics.

Liat Ein-Dor, Alon Halfon, Ariel Gera, Eyal Shnarch, Lena Dankin, Leshem Choshen, Marina Danilevsky, Ranit Aharonov, Yoav Katz, and Noam Slonim. 2020. Active Learning for BERT: An Empirical Study. In *Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)*, pages 7949–7962, Online. Association for Computational Linguistics.

Mai ElSherief, Caleb Ziems, David Muchlinski, Vaishnavi Anupindi, Jordyn Seybolt, Munmun De Choudhury, and Diyi Yang. 2021. Latent Hatred: A Benchmark for Understanding Implicit Hate Speech. In *Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing*, pages 345–363, Online and Punta Cana, Dominican Republic. Association for Computational Linguistics.

Karmen Erjavec and Melita Poler Kovačič. 2012. “You Don’t Understand, This is a New War!” Analysis of Hate Speech in News Web Sites’ Comments. *Mass Communication and Society*, 15(6):899–920.

Elisabetta Fersini, Debora Nozza, and Paolo Rosso. 2018a. Overview of the Evalita 2018 Task on Automatic Misogyny Identification (AMI). In *Proceedings of the Sixth Evaluation Campaign of Natural Language Processing and Speech Tools for Italian*. Final Workshop (EVALITA 2018) co-located with the Fifth Italian Conference on Computational Linguistics (CLiC-it 2018), Turin, Italy, December 12-13, 2018, volume 2263 of *CEUR Workshop Proceedings*. CEUR-WS.org.

Elisabetta Fersini, Paolo Rosso, and Maria Anzovino. 2018b. Overview of the Task on Automatic Misogyny Identification at IberEval 2018. In *Proceedings of the Third Workshop on Evaluation of Human Language Technologies for Iberian Languages (IberEval 2018) co-located with 34th Conference of the Spanish Society for Natural Language Processing (SEPLN 2018)*, Sevilla, Spain, September 18th, 2018, volume 2150 of *CEUR Workshop Proceedings*, pages 214–228. CEUR-WS.org.

Paula Fortuna, Ilaria Bonavita, and Sérgio Nunes. 2018. Merging datasets for hate speech classification in Italian. In *EVALITA@ CLiC-it*.

Paula Fortuna and Sérgio Nunes. 2018. A Survey on Automatic Detection of Hate Speech in Text. *ACM Computing Surveys*, 51(4):85:1–85:30.

Paula Fortuna, Juan Soler, and Leo Wanner. 2020. Toxic, Hateful, Offensive or Abusive? What Are We Really Classifying? An Empirical Analysis of Hate Speech Datasets. In *Proceedings of the Twelfth Language Resources and Evaluation Conference*, pages 6786–6794, Marseille, France. European Language Resources Association.

Paula Fortuna, Juan Soler-Company, and Leo Wanner. 2021. How well do hate speech, toxicity, abusive and offensive language classification models generalize across datasets? *Information Processing & Management*, 58(3):102524.

Antigoni Maria Founta, Constantinos Djouvas, Despoina Chatzakou, Ilias Leontiadis, Jeremy Blackburn, Gianluca Stringhini, Athena Vakali, Michael Sirivianos, and Nicolas Kourtellis. 2018. Large Scale Crowdsourcing and Characterization of Twitter Abusive Behavior. In *Twelfth International AAAI Conference on Web and Social Media*.

Surya Kallumadi, Srijan Kumar, and Diyi Yang. 2020. ICWSM Data Challenge. In *In Proceedings of the Fourteenth International Conference on Web and Social Media (ICWSM)*. AAAI Organization.

Prashant Kapil and Asif Ekbal. 2020. A deep neural network based multi-task learning approach to hate speech detection. *Knowledge-Based Systems*, 210:106458.

Mladen Karan and Jan Šnajder. 2018. Cross-domain detection of abusive language online. In *Proceedings of the 2nd Workshop on Abusive Language Online (ALW2)*, pages 132–137, Brussels, Belgium. Association for Computational Linguistics.

Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. RoBERTa: A Robustly Optimized BERT Pretraining Approach. *arXiv:1907.11692 [cs]*.

Ilya Loshchilov and Frank Hutter. 2019. Decoupled Weight Decay Regularization. *arXiv:1711.05101 [cs, math]*.

Florian Ludwig, Klara Dolos, Torsten Zesch, and Eleanor Hobley. 2022. Improving generalization of hate speech detection systems to novel target groups via domain adaptation. In *Proceedings of the Sixth Workshop on Online Abuse and Harms (WOAH)*, pages 29–39, Seattle, Washington (Hybrid). Association for Computational Linguistics.

Kosisochukwu Madukwe, Xiaoying Gao, and Bing Xue. 2020. In Data We Trust: A Critical Analysis of Hate Speech Detection Datasets. In *Proceedings of the Fourth Workshop on Online Abuse and Harms*, pages 150–161, Online. Association for Computational Linguistics.

Shervin Malmasi and Marcos Zampieri. 2018. Challenges in discriminating profanity from hate speech. *Journal of Experimental & Theoretical Artificial Intelligence*, 30(2):187–202.

Isar Nejadgholi and Svetlana Kirchenko. 2020. On Cross-Dataset Generalization in Automatic Detection
of Online Abuse. In Proceedings of the Fourth Work-
shop on Online Abuse and Harms, pages 173–183,
Online. Association for Computational Linguistics.

Fabio Poletto, Valerio Basile, Manuela Sanguinetti,
Cristina Bosco, and Viviana Patti. 2021. Resources
and benchmark corpora for hate speech detection: A
systematic review. Language Resources and Evalua-
tion, 55(2):477–523.

Jing Qian, Mai ElSherief, Elizabeth Belding, and
William Yang Wang. 2019. Learning to Decipher
Hate Symbols. In Proceedings of the 2019 Confer-
ence of the North American Chapter of the Associ-
ation for Computational Linguistics: Human Lan-
guage Technologies, Volume 1 (Long and Short Pa-
pers), pages 3006–3015, Minneapolis, Minnesota.
Association for Computational Linguistics.

Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. 2020. Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer. Journal of Machine Learning Research, 21(140):1–67.

Niloofar Safi Samghabadi, Parth Patwa, Srinivas PYKL, Prerana Mukherjee, Amitava Das, and Thamar Solorio. 2020. Aggression and Misogyny Detection using BERT: A Multi-Task Approach. In Proceedings of the Second Workshop on Trolling, Aggression and Cyberbullying, pages 126–131, Marseille, France. European Language Resources Association (ELRA).

Joni Salminen, Maximilian Hopf, Shammur A. Chowdhury, Soon-gyo Jung, Hind Almerekhi, and Bernard J. Jansen. 2020. Developing an online hate classifier for multiple social media platforms. Human-centric Computing and Information Sciences, 10(1):1.

Diptanu Sarkar, Marcos Zampieri, Tharindu Ranasinghe, and Alexander Ororbia. 2021. fBERT: A Neural Transformer for Identifying Offensive Content. In Findings of the Association for Computational Linguistics: EMNLP 2021, pages 1792–1798, Punta Cana, Dominican Republic. Association for Computational Linguistics.

Anna Schmidt and Michael Wiegand. 2017. A Survey on Hate Speech Detection using Natural Language Processing. In Proceedings of the Fifth International Workshop on Natural Language Processing for Social Media, pages 1–10, Valencia, Spain. Association for Computational Linguistics.

Steve Durairaj Swamy, Anupam Jamatia, and Björn
Gambäck. 2019. Studying Generalisability across
Abusive Language Detection Datasets. In Proceed-
ings of the 23rd Conference on Computational Nat-
ural Language Learning (CoNLL), pages 940–950,
Hong Kong, China. Association for Computational
Linguistics.

Swabha Swayamdipta, Roy Schwartz, Nicholas Lourie,
Yizhong Wang, Hannaneh Hajishirzi, Noah A. Smith,
and Yejin Choi. 2020. Dataset Cartography: Map-
ping and Diagnosing Datasets with Training Dynam-
ics. In Proceedings of the 2020 Conference on Em-
pirical Methods in Natural Language Processing
(EMNLP), pages 9275–9293, Online. Association
for Computational Linguistics.

Zeerak Talat and Dirk Hovy. 2016. Hateful Symbols or
Hateful People? Predictive Features for Hate Speech
Detection on Twitter. In Proceedings of the NAACL
Student Research Workshop, pages 88–93, San Diego,
California. Association for Computational Linguis-
tics.

Zeerak Talat, James Thorne, and Joachim Bingel. 2018. Bridging the Gaps: Multi Task Learning for Domain Transfer of Hate Speech Detection. In Jennifer Golbeck, editor, Online Harassment, Human–Computer Interaction Series, pages 29–55. Springer International Publishing, Cham.

Cagri Toraman, Furkan Şahinuş, and Eyup Yilmaz. 2022. Large-Scale Hate Speech Detection with Cross-Domain Transfer. In Proceedings of the Thirteenth Language Resources and Evaluation Conference, pages 2215–2225, Marseille, France. European Language Resources Association.

Betty van Aken, Julian Risch, Ralf Krestel, and Alexander Löser. 2018. Challenges for Toxic Comment Classification: An In-Depth Error Analysis. In Proceedings of the 2nd Workshop on Abusive Language Online (ALW2), pages 33–42, Brussels, Belgium. Association for Computational Linguistics.

Bertie Vidgen, Alex Harris, Dong Nguyen, Rebekah
Tromble, Scott Hale, and Helen Margetts. 2019.
Challenges and frontiers in abusive content detec-
tion. In Proceedings of the Third Workshop on Abu-
sive Language Online, pages 80–93, Florence, Italy.
Association for Computational Linguistics.

Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierre Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander Rush. 2020. Transformers: State-of-the-Art Natural Language Processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 38–45, Online. Association for Computational Linguistics.

Wenjie Yin and Arkaitz Zubiaga. 2021. Towards generalisable hate speech detection: A review on obstacles and solutions. PeerJ Computer Science, 7:e598.

Xuhui Zhou, Maarten Sap, Swabha Swayamdipta, Yejin Choi, and Noah Smith. 2021. Challenges in Automated Debiasing for Toxic Language Detection. In Proceedings of the 16th Conference of the European
*Chapter of the Association for Computational Linguistics: Main Volume*, pages 3143–3155, Online. Association for Computational Linguistics.
A Experimental Parameters

In each cross-topic/cross-dataset experiment, we train one of the classifiers models described in Section 4 on either a specific dataset, or on a mixture of datasets (see Table 1). For all models, we use the Hugging Face transformer library’s implementation of the AdamW optimizer (Loshchilov and Hutter, 2019), with the default 5 × 10⁻⁵ learning rate for all models, except for T5-base (1 × 10⁻⁴) and ToxDectRoBERTa (1 × 10⁻⁵), as recommended by their respective authors. When possible using our available hardware (multiple Nvidia GTX 1080 Ti and RTX 2080 GPUs), we use “effective” batch sizes of 64 instances (either as proper mini-batches, or by using gradient accumulation alongside smaller mini-batch sizes). When using mixtures of datasets, batches are constructed by sampling each component dataset proportionally to its relative size, to avoid oversampling the smaller datasets or subsampling the larger ones. Models are trained for a maximum of 8 epochs, with early stopping according to the validation loss, and only the best model checkpoints are retained, according to the validation macro F1 score. Average runtimes vary between architectures and datasets, with the BERT-like (fBERT, HateBERT, and RoBERTa-base) taking the least time (less than an hour on the largest mixture of datasets, All, combining all 8 datasets detailed in Table 1), and the longest being ToxDectRoBERTa, since it is based on the RoBERTa-large architecture (approximately 6 hours of training for the All mixture). The smallest architectures in number of parameters used in this study are those derived from BERT-base, with ~ 110 million parameters, followed by RoBERTa-base (~ 125 million parameters), T5-base (220 million parameters), and finally ToxDectRoBERTa, based on RoBERTa-large, with 355 million parameters. For data preprocessing, we replace all emojis with their text form descriptions using the Python emoji library, and replace all “@” user mentions and URLs with the replacement strings “[USER]” and “[URL]” respectively.
<table><caption>Table A: Detailed results of learning from individual datasets (in terms of Macro F1-scores).</caption><thead><tr><th>Test</th><th>Gene Davi</th><th>Gene Fnt</th><th>Gndr Evit</th><th>Gndr HatE</th><th>Gndr Iber</th><th>Gndr Wasm</th><th>Gndr HatE</th><th>Gndr Wasm</th></tr></thead><tbody><tr><td colspan="9" style="text-align: center; font-weight: bold;">T5-base</td></tr><tr><td>Gene Davi</td><td>92.70</td><td>82.64</td><td>69.32</td><td>68.79</td><td>63.34</td><td>61.80</td><td>59.51</td><td>43.28</td></tr><tr><td>Gene Fnt</td><td>73.02</td><td>81.08</td><td>59.82</td><td>59.52</td><td>59.16</td><td>54.58</td><td>60.22</td><td>51.77</td></tr><tr><td>Gndr Evit</td><td>63.29</td><td>58.07</td><td>67.00</td><td>78.40</td><td>66.89</td><td>58.00</td><td>52.97</td><td>34.62</td></tr><tr><td>Gndr HatE</td><td>42.21</td><td>42.90</td><td>44.55</td><td>46.29</td><td>34.09</td><td>49.62</td><td>54.28</td><td>36.58</td></tr><tr><td>Gndr Iber</td><td>57.76</td><td>74.22</td><td><strong>93.46</strong></td><td>92.02</td><td>84.86</td><td>74.15</td><td>79.59</td><td>37.90</td></tr><tr><td>Gndr Wasm</td><td>54.06</td><td>59.07</td><td>63.65</td><td>68.92</td><td>67.90</td><td>85.81</td><td>51.00</td><td>42.46</td></tr><tr><td>Race HatE</td><td>43.75</td><td>64.54</td><td>42.14</td><td>43.07</td><td>37.59</td><td>41.29</td><td>38.73</td><td>41.09</td></tr><tr><td>Race Wasm</td><td>56.66</td><td>72.73</td><td>49.59</td><td>48.05</td><td>46.68</td><td>47.67</td><td>66.64</td><td>87.03</td></tr><tr><td colspan="9" style="text-align: center; font-weight: bold;">ToxDectRoBERTa</td></tr><tr><td>Gene Davi</td><td><strong>93.78</strong></td><td>84.73</td><td>73.74</td><td>70.36</td><td>74.33</td><td>69.57</td><td><strong>81.34</strong></td><td>60.76</td></tr><tr><td>Gene Fnt</td><td>81.42</td><td><strong>85.92</strong></td><td>72.81</td><td>67.81</td><td>74.96</td><td>60.89</td><td>78.97</td><td>61.90</td></tr><tr><td>Gndr Evit</td><td>62.10</td><td>54.25</td><td>67.37</td><td>82.08</td><td>63.08</td><td>64.69</td><td>59.10</td><td>45.69</td></tr><tr><td>Gndr HatE</td><td>40.30</td><td>39.81</td><td>45.63</td><td>51.65</td><td>32.88</td><td>47.04</td><td>41.59</td><td>50.67</td></tr><tr><td>Gndr Iber</td><td>64.14</td><td>73.00</td><td>91.25</td><td>92.07</td><td>83.89</td><td>74.35</td><td>68.65</td><td>38.93</td></tr><tr><td>Gndr Wasm</td><td>51.13</td><td>56.44</td><td>67.74</td><td>68.82</td><td>67.69</td><td>86.27</td><td>49.40</td><td>43.95</td></tr><tr><td>Race HatE</td><td>52.23</td><td>68.58</td><td>57.57</td><td>53.00</td><td>47.86</td><td>37.04</td><td>40.75</td><td>63.48</td></tr><tr><td>Race Wasm</td><td>69.92</td><td>73.47</td><td>68.07</td><td>62.16</td><td>64.55</td><td>46.50</td><td>73.59</td><td>86.29</td></tr><tr><td colspan="9" style="text-align: center; font-weight: bold;">fBERT</td></tr><tr><td>Gene Davi</td><td>92.46</td><td>85.59</td><td>64.64</td><td>66.18</td><td>67.33</td><td>73.69</td><td>64.46</td><td>42.88</td></tr><tr><td>Gene Fnt</td><td>76.47</td><td>80.98</td><td>58.23</td><td>59.32</td><td>61.04</td><td>60.43</td><td>62.45</td><td>51.57</td></tr><tr><td>Gndr Evit</td><td>61.44</td><td>57.00</td><td>73.12</td><td>88.66</td><td>69.40</td><td>63.19</td><td>52.79</td><td>34.48</td></tr><tr><td>Gndr HatE</td><td>38.25</td><td>49.75</td><td>64.34</td><td>64.28</td><td>43.62</td><td>50.30</td><td>55.19</td><td>36.58</td></tr><tr><td>Gndr Iber</td><td>60.34</td><td>71.43</td><td>93.01</td><td><strong>93.02</strong></td><td>84.55</td><td>76.99</td><td>52.80</td><td>38.66</td></tr><tr><td>Gndr Wasm</td><td>53.84</td><td>61.47</td><td>67.03</td><td>64.38</td><td>72.60</td><td>86.28</td><td>47.52</td><td>42.99</td></tr><tr><td>Race HatE</td><td>50.65</td><td>66.49</td><td>39.31</td><td>39.74</td><td>37.56</td><td>38.95</td><td>41.72</td><td>39.73</td></tr><tr><td>Race Wasm</td><td>70.16</td><td>72.33</td><td>48.06</td><td>46.64</td><td>47.80</td><td>47.53</td><td>74.03</td><td><strong>87.53</strong></td></tr><tr><td colspan="9" style="text-align: center; font-weight: bold;">HateBERT</td></tr><tr><td>Gene Davi</td><td>93.14</td><td>85.43</td><td>63.89</td><td>65.02</td><td>60.67</td><td>70.70</td><td>61.63</td><td>45.68</td></tr><tr><td>Gene Fnt</td><td>73.02</td><td>79.41</td><td>57.88</td><td>58.19</td><td>57.47</td><td>59.74</td><td>59.25</td><td>52.59</td></tr><tr><td>Gndr Evit</td><td>63.92</td><td>56.74</td><td>71.02</td><td>87.98</td><td>68.99</td><td>64.06</td><td>47.37</td><td>34.71</td></tr><tr><td>Gndr HatE</td><td>44.46</td><td>55.76</td><td>53.70</td><td>59.11</td><td>50.95</td><td>59.43</td><td>53.59</td><td>36.58</td></tr><tr><td>Gndr Iber</td><td>60.12</td><td>67.11</td><td>92.70</td><td>92.71</td><td>86.41</td><td>68.08</td><td>63.74</td><td>37.90</td></tr><tr><td>Gndr Wasm</td><td>52.36</td><td>58.24</td><td>74.26</td><td>68.54</td><td>71.20</td><td>86.05</td><td>50.83</td><td>43.01</td></tr><tr><td>Race HatE</td><td>44.13</td><td>66.08</td><td>43.79</td><td>43.60</td><td>37.11</td><td>36.89</td><td>38.53</td><td>39.26</td></tr><tr><td>Race Wasm</td><td>63.01</td><td>72.81</td><td>49.96</td><td>47.77</td><td>48.03</td><td>45.92</td><td>71.60</td><td>86.37</td></tr><tr><td colspan="9" style="text-align: center; font-weight: bold;">RoBERTa-base</td></tr><tr><td>Gene Davi</td><td>93.30</td><td>82.50</td><td>66.12</td><td>64.43</td><td>63.00</td><td>68.02</td><td>67.35</td><td>46.57</td></tr><tr><td>Gene Fnt</td><td>74.50</td><td>80.84</td><td>59.21</td><td>56.56</td><td>58.06</td><td>55.65</td><td>61.92</td><td>53.28</td></tr><tr><td>Gndr Evit</td><td>60.68</td><td>58.51</td><td>69.58</td><td>86.77</td><td>60.53</td><td>63.18</td><td>45.80</td><td>35.92</td></tr><tr><td>Gndr HatE</td><td>46.39</td><td>55.17</td><td>50.27</td><td>56.88</td><td>42.64</td><td>47.22</td><td>53.31</td><td>36.96</td></tr><tr><td>Gndr Iber</td><td>60.50</td><td>62.96</td><td>92.43</td><td>92.61</td><td><strong>88.76</strong></td><td>65.55</td><td>74.30</td><td>37.90</td></tr><tr><td>Gndr Wasm</td><td>51.55</td><td>51.11</td><td>71.14</td><td>68.11</td><td>74.93</td><td><strong>87.11</strong></td><td>53.06</td><td>43.70</td></tr><tr><td>Race HatE</td><td>47.79</td><td>56.76</td><td>43.30</td><td>40.56</td><td>37.86</td><td>37.10</td><td>38.24</td><td>48.65</td></tr><tr><td>Race Wasm</td><td>56.89</td><td>75.52</td><td>49.67</td><td>47.58</td><td>49.08</td><td>46.87</td><td>70.09</td><td>86.27</td></tr></tbody></table>