NAIJAHATE: Evaluating Hate Speech Detection on Nigerian Twitter Using Representative Data (2024)

Abstract: To address the global issue of online hate, hate speech detection (HSD) systems are typically developed on datasets from the United States, thereby failing to generalize to English dialects from the Majority World. Furthermore, HSD models are often evaluated on non-representative samples, raising concerns about overestimating model performance in real-world settings. In this work, we introduce NAIJAHATE, the first dataset annotated for HSD which contains a representative sample of Nigerian tweets. We demonstrate that HSD evaluated on biased datasets traditionally used in the literature consistently overestimates real-world performance by at least two-fold. We then propose NAIJAXLM-T, a pretrained model tailored to the Nigerian Twitter context, and establish the key role played by domainadaptive pretraining and finetuning in maximizing HSD performance. Finally, owing to the modest performance of HSD systems in realworld conditions, we find that content moderators would need to review about ten thousand Nigerian tweets flagged as hateful daily to moderate 60% of all hateful content, highlighting the challenges of moderating hate speech at scale as social media usage continues to grow globally. Taken together, these results pave the way towards robust HSD systems and a better protection of social media users from hateful content in low-resource settings. Content warning: This article contains illustrative examples of hateful content.

text: Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 9020–9040 August 11-16, 2024 ©2024 Association for Computational Linguistics
To address the global issue of online hate, hate speech detection (HSD) systems are typically developed on datasets from the United States, thereby failing to generalize to English dialects from the Majority World. Furthermore, HSD models are often evaluated on non-representative samples, raising concerns about overestimating model performance in real-world settings. In this work, we introduce NAIJAHATE, the first dataset annotated for HSD which contains a representative sample of Nigerian tweets. We demonstrate that HSD evaluated on biased datasets traditionally used in the literature consistently overestimates real-world performance by at least two-fold. We then propose NAIJAXLM-T, a pretrained model tailored to the Nigerian Twitter context, and establish the key role played by domainadaptive pretraining and finetuning in maximizing HSD performance. Finally, owing to the modest performance of HSD systems in realworld conditions, we find that content moderators would need to review about ten thousand Nigerian tweets flagged as hateful daily to moderate 60% of all hateful content, highlighting the challenges of moderating hate speech at scale as social media usage continues to grow globally. Taken together, these results pave the way towards robust HSD systems and a better protection of social media users from hateful content in low-resource settings.
Content warning: This article contains illustrative examples of hateful content.

heading: 1 Introduction
text: Social media came with the promise to connect people, increase social cohesion, and let everyone have an equal say. Yet, this technology has also been associated with online harms and detrimental effects on democracy (Lorenz-Spreen et al., 2023). In particular, users are regularly exposed to hate
speech1 (Vidgen et al., 2019), fueling fears of its impact on social unrests and hate crimes (Müller and Schwarz, 2021). While regulatory frameworks have compelled social media platforms to take action (Gagliardone et al., 2016), hate speech detection (HSD) and moderation efforts have largely focused on the North American and European markets, prompting questions on how to efficiently tackle this issue in the Majority World (Milmo, 2021; Tonneau et al., 2024). Our study focuses on Nigerian Twitter, a low-resource context which provides an opportunity to study online hate speech at the highest level (Ezeibe, 2021). Exemplifying the issue, Twitter was banned by the Nigerian government between June 2021 and January 2022, following the platform’s deletion of a tweet by President Buhari in which he incited violence towards Biafran separatists (Maclean, 2021).
The challenges in developing HSD systems are two-fold. First, hateful content is infrequent – approximately 0.5% of posts on US Twitter (Jiménez Durán, 2021) – creating an obstacle to generating representative annotated datasets at a reasonable cost. To alleviate this issue, models are developed on curated datasets by oversampling hateful content matching predefined keywords (Davidson et al., 2017), or by using active learning to maximize performance for a given annotation cost (Kirk et al., 2022; Markov et al., 2023). These sampling choices generate biases in evaluation datasets (Wiegand et al., 2019; Nejadgholi and Kiritchenko, 2020), raising questions on the generalizability of HSD models to real-world settings.
Second, while a plethora of HSD modeling options are available, it is unclear how well they adapt to a new context. Although few-shot learners are appealing for requiring no or few finetuning data, the evidence on their performances relative to su-
1Hate speech is defined as any communication that disparages a person or a group based on the perceived belonging of a protected characteristic, such as race (Basile et al., 2019).
9020
pervised HSD baselines is mixed (Plaza-del arco et al., 2023a; Guo et al., 2024). Supervised learners are typically finetuned on US data (Tonneau et al., 2024) and tend to not generalize well to English dialects spoken in the Majority World (Ghosh et al., 2021). Finally, while further pretraining existing architectures to adapt them to a new context is known to increase performance on downstream tasks (Gururangan et al., 2020), it is unclear whether highly specific contexts require a custom domain adaptation. Overall, questions remain on the extent to which available HSD methods perform when adapted to a low-resource context (Li, 2021).
In this work, we present NAIJAHATE, a dataset of 35,976 Nigerian tweets annotated for HSD, which includes a representative evaluation sample to shed light on the best approach to accurately detect hateful content in real-world settings. We also introduce NAIJAXLM-T, a pretrained language model adapted to the Nigerian Twitter domain. We demonstrate that evaluating HSD models on biased datasets traditionally used in the literature largely overestimates performance on representative data (83-90% versus 34% in average precision). We further establish that domain-adaptive pretraining and finetuning leads to large HSD performance gains on representative evaluation data over both US and Nigerian-centric baselines. We also find that finetuning on linguistically diverse hateful content sampled through active learning significantly improves performance in real-world conditions relative to a stratified sampling approach. Finally, we discuss the cost-recall tradeoff in moderation and show that having humans review the top 1% of tweets flagged as hateful allows to moderate up to 60% of hateful content on Nigerian Twitter, highlighting the limits of a human-in-the-loop approach to content moderation as social media usage continues to grow globally.
Therefore, our main contributions are 2:
• NAIJAHATE, a dataset which includes the first representative evaluation sample annotated for HSD on Nigerian Twitter;
• NAIJAXLM-T, a pretrained language model adapted to the Nigerian Twitter domain;
• an evaluation on representative data of the role played by domain adaptation and training data diversity and a discussion of the feasibility of hateful content moderation at scale.
2The dataset and the related models can be found at http s://github.com/worldbank/NaijaHate.

heading: 2 Related work

heading: 2.1 Nigerian hate speech datasets
text: While existing English hate speech datasets are primarily in US English (Tonneau et al., 2024), mounting evidence highlights the limited generalizability of learned hate speech patterns from one dialect to another (Ghosh et al., 2021; Castillolópez et al., 2023). In this context, recent work has developed hate speech datasets tailored to the Nigerian context; however, the latter either focused on one form of hate speech (Aliyu et al., 2022), specific languages (Adam et al., 2023; Aliyu et al., 2024), or particular events (Ndabula et al., 2023; Ilevbare et al., 2024). To the best of our knowledge, our work is the first to construct a comprehensive dataset annotated for hate speech for the entire Nigerian Twitter ecosystem, covering both the diversity of languages and hate targets.

heading: 2.2 Hate speech detection
text: HSD methods fall into three categories: rule-based (Mondal et al., 2017), supervised learning (Davidson et al., 2017), and zero-shot or few-shot learning (ZSL) (Nozza, 2021). Rule-based methods rely on predefined linguistic patterns and therefore typically achieve very low recall. Additionally, supervised learning require annotated datasets which are usually scarce in Majority World contexts. While recent advancements in ZSL could potentially circumvent the need to produce finetuning data for supervised learning, existing evidence on the relative performance of the two approaches is mixed (Plaza-del arco et al., 2023a; Guo et al., 2024).
A major shortcoming of this literature is that HSD is typically evaluated on curated non-representative datasets whose characteristics greatly differ from real-world conditions (Wiegand et al., 2019; Nejadgholi and Kiritchenko, 2020), raising concerns about overestimating HSD performance (Arango et al., 2019). While past work has annotated representative samples for HSD, the samples have either not been used solely for evaluation (Vidgen et al., 2020) or originate from largely unmoderated platforms, such as Gab (Kennedy et al., 2022), where hatred is much more prevalent and therefore HSD is an easier task. To the best of our knowledge, we provide the first evaluation of HSD on a representative evaluation sample from a mainstream social media platform, Twitter, where hate content is rare.

heading: 2.3 Hate speech moderation
text: Most large social media platforms prohibit hate speech (Singhal et al., 2023) and have done so since their inception (Gillespie, 2018). However, with millions of daily social media posts, enforcing this policy is a very challenging task. While such scale has motivated the use of algorithmic detection methods (Gillespie, 2020), these approaches have raised concerns related to the fairness and potential biases their use imply in moderation decisions (Gorwa et al., 2020). As a middle ground, recent work has proposed a human-in-the-loop approach (Lai et al., 2022), where a model flags content likely to infringe platform rules, which is then reviewed by humans who decide whether or not to moderate it. Albeit promising, it remains unclear whether this process is scalable both from a cost and a performance standpoint. To fill this gap, we provide the first estimation of the feasibility of a human-inthe-loop approach in the case of Nigerian Twitter.

heading: 3 Data

heading: 3.1 Data collection
text: We use the Twitter API to collect a dataset containing 2.2 billion tweets posted between March 2007 and July 2023 and forming the timelines of 2.8 million users with a profile location in Nigeria.3 We iteratively collect the timeline of users with a profile location in Nigeria being mentioned in the timeline of other Nigerian users until no additional Nigerian users were retrieved, ensuring maximum coverage of the Nigerian ecosystem. This Nigerian Twitter dataset is mostly constituted of English
3The dataset contains 13.9 billion tokens and 525 million unique token, for a total of 89GB of uncompressed text.
tweets (77%) followed by tweets in Nigerian Pidgin – an English-based creole widely spoken across Nigeria – (7%), tweets mixing English and Pidgin (1%), tweets in Hausa (1%) and tweets in Yoruba (1%) (Table 8). We then draw two distinct random samples of 100 million tweets each, one for model training and the other one for evaluation.

heading: 3.2 Annotation
text: We recruit a team of four Nigerian annotators, two female and two male, each of them from one of the four most populated Nigerian ethnic groups – Hausa, Yoruba, Igbo and Fulani.
We follow a prescriptive approach (Rottger et al., 2022) by instructing annotators to strictly adhere to extensive annotation guidelines describing our taxonomy of hate speech (detailed in §A.2.2). Following prior work (Davidson et al., 2017; Mathew et al., 2021), HSD is operationalized by assigning tweets to one of three classes: (i) hateful, if it contains an attack on an individual or a group based on the perceived possession of a protected characteristic (e.g., gender, race) (Basile et al., 2019), (ii) offensive, if it contains a personal attack or an insult that does not target an individual based on their identity (Zampieri et al., 2019), or (iii) neutral if it is neither hateful nor offensive. If a tweet is labeled as hateful, it is also annotated for the communities being targeted (Table 1).
In the next sections §3.3 and §3.4, we detail the different samples that were annotated. Each tweet in these samples was labeled by three annotators. For the three-class annotation task, the three annotators agreed on 90% of all labeled tweets, two out of three agreed in 9.5% of cases, and all three of them disagreed in 0.5% of cases (Krippendorff’s α = 0.7).

heading: 3.3 Training samples
text: Stratified sample Due to the rarity of hateful content, sampling tweets randomly would result in a highly imbalanced set. Indeed, the prevalence of hate speech on large social media platforms typically ranges from 0.003% to 0.7% depending on the platform and timeframe (Gagliardone et al., 2016; Mondal et al., 2017; Jiménez Durán, 2021). To circumvent this issue, we follow previous work (Davidson et al., 2017) by oversampling training examples containing keywords expected to be associated with hate. We handpick a list of 89 hate-related keywords combining hate speech lexicons and online dictionaries (Ferroggiaro, 2018; Farinde and Omolaiye, 2020; Udanor and Anyanwu, 2019). We also identify 45 keywords referring to communities frequently targeted by hate in the Nigerian context (Pate and Ibrahim, 2020), due to their ethnicity (Fulani, Hausa, Herdsmen4, Igbo, Yoruba), religion (Christians, Muslims), region of origin (northerners, southerners, easterners), gender identity or sexual orientation (women, LGBTQ+) (Onanuga, 2023). We then annotate 1,607 tweets from the training sample that are stratified by communityrelated and hate-related keywords (see §A.1.3). Owing to the rarity of some individual targets and for descriptive purposes, we bundle targets into 6 target categories: North (Hausa, Fulani, Herdsmen, Northerner), South (Southerner, Yoruba), East (Biafra, Igbo, Easterner), Muslims, Women and Other (Christians and LGBTQ+). Stratified sampling indeed enables to reduce the imbalance in the training data (Figure 1): the resulting shares of tweets labeled as neutral, offensive and hateful are respectively equal to 50%, 17%, and 33%.
Active learning sample While stratified sampling makes it possible to oversample hateful content in the training data, it is constrained by a predefined vocabulary which limits the coverage and diversity of the positive class. As an alternative, we employ certainty sampling (Attenberg et al., 2010) to annotate a second sample of training examples. Certainty sampling is an active learning method that focuses the learning process of a model on instances with a high confidence score of belonging to the minority class, spanning a more diverse spectrum of examples. We generate additional training instances in four steps: (i) we start by finetuning
4Herdsmen are not a ethnic group per se but this term refers exclusively to Fulani herdsmen in the Nigerian context, hence the categorization as an ethnic group.
Conversational BERT (Burtsev et al., 2018) on the stratified sample; (ii) we then deploy the finetuned model on the training sample of 100 million tweets; (iii) next, we label an additional 100 tweets sampled from the top 10% tweets from the training sample in terms of confidence score; and finally, (iv) we incorporate the additional labels into Conversational BERT’s finetuning sample. We repeat this process 25 times, thereby producing a set of 2,500 training examples, of which 2,405 have a majority label after annotation. We find that certainty sampling produces about the same proportion of observations from the hateful class (25% versus 31%) as stratified sampling (Figure 1). However, it enables to generate more diversity in the hateful class: the proportion of training examples that do not contain any seed keywords5, the proportion of unique tokens and the average pairwise GTE embedding distance (Li et al., 2023) are consistently larger in the active learning sample compared to the stratified sample (Table 2).
Stratified Active learning Top-scored Random
Proportion of tweets not containing seed keywords (%) 7.5 ± 1.2 72.5 ± 1.8 70.8 ± 1.5 93.8 ± 3.5
Proportion of unique tokens (%) 32.2 ± 0.4 33.3 ± 0.4 29 ± 0.3 61.5 ± 1.6
Average pairwise embedding distance 0.139 ± 0.0 0.152 ± 0.0 0.159 ± 0.0 0.172 ± 0.001
Table 2: Diversity metrics for the hateful class across datasets. Active learning enables to generate more diversity in the training data, bringing them closer to the representative random sample. Metrics are reported with standard errors.

heading: 3.4 Evaluation samples
text: Top-scored sample To evaluate models’ performance in real-world conditions, we start by testing how they behave in the presence of a distribution shift. We first train each supervised model considered in this study on the union of the stratified and the active learning sample, deploy it on the random sample of 100 million tweets used for evaluation and annotate 200 high-scored tweets. We repeat this process for the 10 models evaluated in this study (see §4 for more details) and combine all the high-scored tweets, yielding a pooled sample of 2,000 tweets, of which 1,965 have a majority label after annotation. The shares of tweets labeled
5i.e., keywords used for stratified sampling
as neutral, offensive and hateful are respectively equal to 28%, 22% and 50% (Figure 1). This approach traditionally used in information retrieval enables to evaluate the performance of each model on a large dataset containing a high and diverse proportion of positive examples discovered by qualitatively different models, and whose distribution differs from that of the training data (Voorhees et al., 2005).
Random sample Finally, we annotate a random sample of 30,000 tweets, of which 29,999 have a majority label after annotation, to evaluate HSD models on a representative dataset of Nigerian tweets. As expected, we discover that the prevalence of hateful content is very low: approximately 0.16% and 1.6% of tweets are labeled as hateful and offensive, respectively (Figure 1). In addition, we find that the diversity within the positive class in the random sample is larger than in the training samples (Table 2).

heading: 4 Experimental setup
text: In this study, our experiments aim to determine the impact of domain adaptation – both for pretraining and finetuning – on real-world performance. For this purpose, we evaluate the performance of supervised learning with language models pretrained and finetuned in various domains that we present below. Additionally, we test recent off-the-shelf generalpurpose models in a zero-shot setting, specifically GPT-3.56. We finally benchmark the finetuned models against Perspective API (Lees et al., 2022), a widely-deployed toxic language detection system relying on BERT-based supervised learning and for which the finetuning data is not public.
Finetuning domain We experiment with four finetuning datasets: HATEXPLAIN (Mathew et al., 2021), which contains US English posts from Twitter and Gab annotated for HSD; HERDPHOBIA (Aliyu et al., 2022), a dataset of Nigerian tweets annotated for hate against Fulani herdsmen; HSCODEMIX (Ndabula et al., 2023), containing Nigerian tweets posted during the EndSARS movement and the 2023 Nigerian presidential election and annotated for general hate speech; and finally NAIJAHATE, our dataset presented in §3.
6https://openai.com/blog/chatgpt
Pretraining domain We introduce NAIJAXLMT (full), an XLM-R model (Conneau et al., 2020) further pretrained on 2.2 billion Nigerian tweets for one epoch. We compare its performance relative to BERT-based models pretrained in three different domains:
• the general domain, which includes a variety of sources such as books and news, both in English (DeBERTaV3 (He et al., 2021)) and in multilingual settings (XLM-R (Conneau et al., 2020), mDeBERTaV3 (He et al., 2021))
• the social media domain, both in English (Conversational BERT (Burtsev et al., 2018), BERTweet (Nguyen et al., 2020)) and in multilingual settings (XLM-T (Barbieri et al., 2022))
• social media posts marked as offensive, abusive or hateful (HateBERT (Caselli et al., 2021) and fBERT (Sarkar et al., 2021))
• the African domain (AfriBERTa (Ogueji et al., 2021), Afro-XLM-R (Alabi et al., 2022) and XLM-R Naija (Adelani et al., 2021)).
Differences in performance across models may be explained by several factors including not only the pretraining domain, but also pretraining data size and preprocessing, model architecture and hyperparameter selection. While it is hard to account for the latter as they are rarely made public, we estimate the impact of the pretraining domain on performance, holding pretraining data size and model architecture constant. To do so, we introduce NAIJAXLM-T (198M), an XLM-R model further pretrained on a random sample of 198 million Nigerian tweets, matching the amount of data used to pretrain XLM-T on multilingual tweets. We adopt the same preprocessing as for XLM-T by removing URLs, tweets with less than three tokens, and running the pretraining for one epoch.
Evaluation HSD models are evaluated by their average precision for the hateful class, a standard performance metric in information retrieval which is particularly well-suited when class imbalance is high. For supervised learning, we perform a 90-10 train-test split and conduct a 5-fold cross-validation with five learning rates ranging from 1e-5 to 5e-5 and three different seeds. The train-test split is repeated for 10 different seeds, and the evaluation metrics are averaged across the 10 seeds.

heading: 5 Results

heading: 5.1 Hate speech detection
text: Evaluating on representative data We evaluate HSD performance on three datasets: the holdout sample from the train-test splits, the top-scored sample and the random sample described in §3.4 (Table 3). Overall, we observe that the ordering of models’ performance remains stable across evaluation sets. However, the striking result is that across the wide range of models considered in this study, the average precision on the random sample (20.92% on average) is substantially lower than that on the holdout (73.75%) and top-scored sets (81.88%). This finding highlights the risk of considerably overestimating classification performance when evaluating HSD models on a dataset whose characteristics greatly differ from real-world conditions. We now present more details on the impact of the learning framework, the pretraining domain and the finetuning domain on performance.
Learning framework We find that in-domain supervised learning on the NAIJAHATE dataset (90.2% average precision on the top-scored set and 34% on the random set) generally largely out-
performs GPT3.5-based zero-shot learning (ZSL) (60.3% and 3.1%) and out-of-domain supervised learning on existing US and Nigerian-centric hate speech datasets (68.9% and 4.3%). We also note that ZSL and out-of-domain supervised learning, such as Perspective API, perform on par with each other. Given that the prompt used does not provide a definition of hate speech (App. A.4.4), it implies that GPT3.5 has incorporated enough knowledge from pretraining and reinforcement learning with human feedback to conceptualize and categorize hate speech as well as models finetuned on thousands of examples. Still, it exhibits a rather low performance which is likely due to the predominance of US English in the pretraining data, making it hard to generalize to Nigerian English.
Pretraining domain We find that the language and register models are pretrained on have a large impact on downstream performance. In-domain pretraining on Nigerian Twitter, combining Nigerian dialects and informal social media language, generally outperforms the other models both on the top-scored and random samples, followed by models pretrained on social media and general purpose domains. This result also holds when keeping
the architecture and pretraining data size constant, with NaijaXLM-T (198M) yielding significantly better performance than XLM-T. A notable exception to NaijaXLM-T’s dominance is BERTweet, a RoBERTa model pretrained from scratch on English tweets, which is on par with NaijaXLM-T on all evaluation sets. Such performance may be explained by the predominance of English on Nigerian Twitter, granting an advantage to Englishcentric models such as BERTweet or DeBERTaV3. It is also plausible that BERTweet’s pretraining data contains some English tweets originating from Nigeria. Finally, BERTweet was pretrained from scratch on tweets, implying that its vocabulary is tailored to the social media lingo, contrary to the XLM-based models.
We also observe that pretraining in the social media domain generally yields larger improvements than in the African linguistic domain. For instance, XLM-R Naija, an XLM-R model further pretrained on news in Nigerian Pidgin English, produces a rather poor performance, especially on the random set (19.1% average precision), which is likely due to differences between news and social media lingo as well as the limited share of tweets in Pidgin English. Still, pretraining on the social media domain does not ensure a high performance, as illustrated by the low performance of models pretrained on toxic social media posts, such as HateBERT and fBERT. This underperformance may be explained by the fact that these models are pretrained on US-centric posts that emanate partly from other platforms than Twitter (e.g., Reddit) and contain aggressive and offensive speech, which may differ from hate speech.
Finetuning domain In-domain finetuning on the NaijaHate dataset outperforms out-of-domain finetuning on both US-centric (Perspective, HateXPlain) and Nigerian-centric (HERDPhobia and HSCodeMix) datasets. When inspecting classification errors, we find that XLM-T HateXPlain, which is finetuned on US data, flags as hateful tweets that contain words that are very hateful in the US but not necessarily in Nigeria. For instance, “ya k*ke” means “How are you” in Hausa while k*ke is an antisemitic slur in the US context. As a result, XLM-T HateXplain assigns very high hateful scores to tweets containing this sentence whereas XLM-T NaijaHate does not. While finetuning on Nigerian Twitter data yields better performance than on US data, it does not ensure high perfor-
mance, as illustrated by the poor performance of XLM-T HERDPhobia and HSCodeMix. In the case of HERDPhobia, the focus on hate against Fulani herdsmen leads to a low performance on other types of hate such as misogyny, underlining the importance of designing a comprehensive annotation scheme covering the most prevalent types of hate.
Finetuning data diversity In light of the higher diversity in the training data sampled through active learning compared to stratified sampling (Table 2), we further investigate the role that finetuning data diversity plays on downstream performance. Specifically, we produce downsampled versions of the stratified and the active learning sets keeping dataset size and class distribution constant. We report the results on the random sample in Figure 2 and on the other evaluation sets in Figure 5 in the Appendix.
We find that finetuning on more diverse data significantly and consistently improves the average precision across models. The performance gains from diversity are particularly large for models that are not pretrained in the African linguistic domain, such as BERTweet and DeBERTaV3. We also discover that NaijaXLM-T significantly outperforms BERTweet on the less diverse stratified set. This finding indicates that the performance gains from in-domain pretraining may be particularly large when the finetuning data is less diverse, presumably because the lower diversity in the finetuning data is counterbalanced by a higher diversity and domain alignment in the pretraining data, allowing for a better generalization in real-world settings.
Precision-recall tradeoff We find that no classification threshold allows to reach a precision and recall that are both above 0.5 (Figure 4 in the Appendix), with the best possible F1 value for NaijaXLM-T (full) at 0.395. This high likelihood of error renders automatic moderation undesirable and calls for alternative moderation approaches, such as the human-in-the-loop moderation we present in the next section.

heading: 5.2 Human-in-the-loop moderation
text: In light of the low performance of hate speech classifiers on Nigerian real-world data, we explore the feasibility of a human-in-the-loop approach to hate speech moderation, in which content likely to contain hate is flagged by a classifier and then reviewed by humans. Instead of the traditional precision-recall tradeoff, human-in-the-loop moderation implies a cost-recall tradeoff, where augmenting the recall comes at the cost of having more flagged content reviewed by humans. We represent this tradeoff by plotting the relationship between the share of all tweets flagged as hateful by a hate speech classifier, thus requiring human annotation in a human-in-the-loop moderation setting, and recall (Figure 3). We provide more details in §A.4.6.
We find that supervised learning enables to divide the amount of flagged tweets to be reviewed by a factor of 60 compared to a random baseline, with 1% of the data to be sent for review in order
to achieve a recall of 60%. With an average daily flow of about 920,000 tweets on Nigerian Twitter in 2023, this translates to an average of 9,200 tweets to be reviewed daily, which is a feasible objective for a small team of moderators. However, increasing recall comes at a cost that quickly becomes prohibitively high, even for relatively small markets such as Nigeria: 10% of posts would need to be reviewed daily in order to reach 76% recall.

heading: 6 Discussion
text: Performance overestimation We demonstrate that evaluating HSD on biased datasets leads to a large overestimation of real-world performance, the latter being rather low (34% average precision). A possible reason for this gap is that hateful content is much more rare in real-world settings (0.16% in our Nigerian Twitter case) compared to traditional evaluation sets (31% in English hate speech datasets (Tonneau et al., 2024)), rendering its detection more challenging. This result expands on past work which pointed at the risk of overestimating HSD performance in real-world settings but did not quantify the latter (Arango et al., 2019; Wiegand et al., 2019; Nejadgholi and Kiritchenko, 2020).
Feasibility of moderation Low real-world HSD performance has implications for hate speech moderation, making automated moderation unfeasible on top of being problematic for fairness and bias reasons (Gorwa et al., 2020). In this context, we investigate the feasibility of human-in-the-loop moderation, where content likely to be hateful is flagged by a model before being reviewed by humans. We highlight a cost-recall tradeoff, where a higher recall comes at the expense of increasing reviewing efforts and find that 60% recall can be achieved by reviewing 1% of all tweets. While reviewing 1% of posts is a feasible goal for small online communities like Nigerian Twitter, it represents substantial costs for larger communities, both financial and in terms of reviewer harm (Steiger et al., 2021). We also find that increasing recall comes at a cost that quickly becomes prohibitively high for both small and large communities – 10% of posts need to be reviewed to reach a 76% recall. This may partly explain the low hate speech removal rates on large social media platforms (e.g., 3-5% on Facebook (Giansiracusa, 2021)) and highlights the need for complementary approaches to support the moderation effort.
Learning framework In terms of HSD approaches, we find that in-domain supervised learning significantly outperforms both out-of-domain supervised learning and zero-shot learning. We also find that out-of-domain supervised learning and zero-shot learning perform on par with each other. These findings complement prior work underlining the superiority of supervised learning over zero-shot learning for HSD (Plaza-del arco et al., 2023a) by extending this result to a lowresource setting.
Pretraining domain Further, the choice of pretraining model has a large impact on downstream performance. Pretraining on in-domain data that blends the noisy aspect of social media text with the linguistic domain of finetuning tasks yields significantly better performance than pretraining only on the former, even when holding pretraining data size and model architecture constant. Our results support the established finding that in-domain pretraining increases downstream task performance (Gururangan et al., 2020) and complements it by underlining the importance of all relevant domains during pretraining, both in terms of register and linguistic focus.
Finetuning domain We find that in-domain finetuning outperforms out-of-domain finetuning. The main reason is that hateful statements are highly context-specific (Lee et al., 2023; Davani et al., 2024), leading to a limited generalizability of HSD across cultures, as pointed out in previous work (Ghosh et al., 2021). It is therefore crucial to develop HSD datasets in low-resource contexts and our work contributes to this effort for Nigeria, which is largely under-represented in English HSD resources (Tonneau et al., 2024).
Role of diversity We observe that using diverse data acquired through active learning yields significant performance gains over stratified sampling. This suggests that annotating a small stratified sample and acquiring a larger and more diverse dataset through active learning is preferable to only using stratified data. Our results align and complement past findings showing the benefits of active learning to maximize performance at a limited cost (Kirk et al., 2022), including in extremely imbalanced settings like ours (Tonneau et al., 2022), and help better understand them through the prism of diversity.

heading: 7 Conclusion
text: This work introduced NAIJAHATE, the largest HSD dataset to date in the Nigerian context and the first to contain a representative evaluation set. We also introduced NAIJAXLM-T, the first pretrained language model tailored to Nigerian Twitter. Leveraging these resources, we provided the first evaluation of HSD in a real-world setting, finding that HSD performance is largely overestimated by traditional evaluation approaches. We finally presented the cost-recall tradeoff at play in human-in-the-loop moderation, where augmenting the recall comes with a higher annotation cost. We find that this moderation approach is effective at moderating a large share of all hateful content but that the associated annotation cost is prohibitive for large social media communities.
While the present work demonstrates the low real-world performance of HSD and the substantial cost of hate speech moderation, there are several possible directions to further improve this performance. Based on the hypothesis that hate is homophilous (Jiang et al., 2023), future work could use network features to improve HSD performance (Ahmed et al., 2022). Synthetic data could be used as well to further increase the number and diversity of examples to train models on (Khullar et al., 2024). Future work could also evaluate performance at the target level to identify hate types that are harder to detect and develop resources for these. Further, the moderation analysis could be enhanced by taking popularity into account and measuring recall in terms of views of hateful content. Finally, future work could expand our study to other languages, countries and platforms in order to evaluate the external validity of our results and pinpoint areas where new resources are most needed.

heading: Limitations
text: Dataset Low number of positives: The random set used to evaluate HSD in real-world settings contains 49 hateful examples, which is a very small number. This number is linked to the very low prevalence of hate speech in our dataset as well as our budget constraint which impeded us from further expanding the annotation effort. While statistically significant, we acknowledge that our performance results on the random set are necessarily more uncertain, as illustrated by the larger confidence intervals.
Limited generalizability to other platforms, timeframes and linguistic domains: The entirety of our dataset was sampled from one single social media platform for a long yet bounded timeframe. This limits the generalizability of models trained on our dataset to data from other social media platforms and covering other timespans. Our dataset is also specific to the Nigerian linguistic context and may exhibit poorer performance in other English dialects.
We do not exhaust all targets of hate: The selection of communities often targeted by hate speech and frequent on Nigerian Twitter necessarily leaves out of the analysis other communities even though they are targeted by online hate speech. In the annotation process, we observed for instance that South Africans, British people and Men are also targeted on Nigerian Twitter.
Moderation prior to collection: Our analysis of moderation considers that the hateful content in our random sample is representative of all hateful content on Nigerian Twitter. We acknowledge though that some hateful content may have been moderated by Twitter before we collected it and that our estimate of the prevalence of hate speech is necessarily a lower bound estimate. However, based on publicly available information, we suspect the enforcement of hate speech removal to be very low (Giansiracusa, 2021).
Experiments Other prompts could lead to different results: We craft a prompt using the terms “hateful” and “offensive” (see App. A.4.4 for details) which exhibit good performance in past research for HSD using ZSL (Plaza-del arco et al., 2023b). We do not test other prompts and acknowledge that using other prompts may have an impact on classification performance.

heading: Ethical considerations
text: Annotator Wellbeing Annotators were provided with clear information regarding the nature of the annotation task before they began their work. They received a compensation of 12 US dollars per hour, which is above the Nigerian minimum wage.
Data Privacy We collected public tweets through the Twitter API according to its Terms and Services. To protect the identity of hateful users and their victims, we anonymize all tweets in our dataset upon release, replacing all user names by a fixed token @USER.

heading: Acknowledgements
text: We thank Daniel Barkoczi, Khashau Adenike Eleburuike, Niyati Malhotra, Haaya Naushan, Arinze Alex Okoyeugha, Luis Eduardo San Martin, Fatima Suleiman Sanusi and Philipp Zimmer for their excellent research assistance. We also thank Alice Grishchenko for outstanding visual design work. This work is part of a broader project conducted by the World Bank Development Impact (DIME) department. The study was supported by funding from the United Kingdom’s Foreign Commonwealth and Development Office (FCDO) and the World Bank’s Research Support Budget. This work was also supported in part through the NYU IT High Performance Computing resources, services, and staff expertise. The findings, interpretations, and conclusions expressed in this paper are entirely those of the authors. They do not necessarily represent the views of the International Bank for Reconstruction and Development/World Bank and its affiliated organizations or those of the Executive Directors of the World Bank or the governments they represent.

heading: A Experimental details

heading: A.1 Data collection

heading: A.1.1 Word lists
text: In this section, we provide the detailed lists of slurs and communities specific to Nigerian hate speech (Table 4). Summary statistics on the number of words per category can be found in Table 7.
Hate words We first build a list of 89 Nigeriaspecific slurs, which are referred to as hate words thereafter. To do so, we rely on lexicons from past work on the topic (Ferroggiaro, 2018; Udanor and Anyanwu, 2019; Farinde and Omolaiye, 2020), Nigerian online dictionaries such as Naija Lingo as well as local knowledge from our Nigerian colleagues. The final list contains two types of words: regular slurs (n=84) and words combining a slur and community name, such as “fulanimal” (n=5). The list of 84 regular slurs contains 28 Yoruba words, 26 English words, 12 Hausa words, 11 Pidgin words and 7 Igbo words. We detail the full list of hate words in Table 4.
Community names Second, we define a list of names of communities that are often targeted by hate speech in Nigeria, again relying on past work (Onanuga, 2023) and local knowledge from Nigerian colleagues. We build an initial list (see Table 5 for the full list of considered and retained community names) and we then restrict this initial list of community names to the names that are most frequently mentioned on Nigerian Twitter. This approach yields 12 communities, including 5 ethnic groups (Yoruba, Igbo, Hausa, Fulani, Herdsmen), 2 religious groups (Christians and Muslims), 3 regional groups (Northern, Southern, Eastern) and 2 groups on gender identity and sexual orientation (Women and LGBTQ+). As mentioned earlier, Herdsmen are not a ethnic group per se but this term refers exclusively to Fulani herdsmen in the Nigerian context, hence the categorization as an ethnic group. For each of these groups, we list the different denominations of each group as well as their plural form and combine it in regular expressions (see Table 6). Finally, we also identify 5 words combining a community name with a derogatory word (e.g., “fulanimal”) that we coin combined word thereafter. Since some targets are very rare in the annotated data, we decide to bundle the 12 communities into 5 groups: North (Northern, Hausa, Fulani, Herdsmen), South (Southern,
Yoruba), East (Igbo, Biafra), Women, Muslim and Other (Christian, LGBTQ+).
A.1.2 Sampling and evaluation sets We draw two distinct random samples of 100 million tweets each, one for sampling and model training Ds and the other one for evaluation De.

heading: A.1.3 Stratified sample
text: As previously stated, the extreme imbalance in our classification task makes random sampling ineffective and prohibitively expensive. With the aim to build high-performing classifiers at a reasonable cost, we build and annotate a stratified sample of tweets from Ds. We use three different sampling strategies to build this stratified sample. First, for each possible combination of community name and hate word, we sample up to 4 tweets that both contain the respective hate word and match with the respective community regular expression. The subset of tweets containing both the hate word and the community regular expression may be smaller than 4 and we sample the full subset in that case. Second, for each combined word W, we randomly sample 50 tweets containing W. Some combined words occur at a very low frequency such that the sample size is sometimes smaller than 50. Finally, for each community, we draw 50 random tweets matching the community regular expression, in order to avoid having a classifier that associates the community name with hate speech.
This yields a stratified sample of 1,607 tweets annotated as either hateful, offensive or neutral.
A.1.4 Active learning sample Each active learning iteration samples a total of 100 tweets. The type of active learning method we employ is called certainty sampling and consists in sampling instances at the top of the score distribution in order to annotate false positives and maximize precision. Specifically, each iteration i consists of:
• Model training: we train a model on all of the labels we have, that is the stratified sample and the combination of all Active Learning samples from prior iterations
• Inference: we then deploy this model on Ds and rank all tweets based on their BERT confidence score.
• Sampling and annotating: we define 5 rank buckets as: [1, 103], [103, 104], [104, 105],
[105, 106], [106, 107]. We then sample n tweets per rank bucket and annotate this sample.
We conduct a total of 25 iterations, of which 10 are conducted on the subset of Ds containing community keywords and 15 on the full Ds. In our active learning process, three separate phases can be distinguished:
• iterations 1-10:
– the sampling is done on the subset of Ds containing community words
– the active learning process is done separately for the hateful and the offensive classes
– the value of n equals 10
– the overall sample size per iteration is 100 and equals to 5 buckets x n=10 x 2 classes (hateful and offensive)
• iterations 10-19
– the sampling is done on the full sampling set Ds – the active learning process is done separately for the hateful and the offensive classes
– the value of n equals 10 – the overall sample size per iteration is
100 and equals to 5 buckets x n=10 x 2 classes (hateful and offensive)
• iterations 20-24
– the sampling is done on the full sampling set Ds – the active learning process is done only for the hateful class
– the value of n equals 20 – the overall sample size per iteration is
100 and equals to 5 buckets x n=20 x 1 class (hateful)

heading: A.2 Annotation

heading: A.2.1 Annotation team
text: The annotation team was composed of a Hausa man, a Hausa-Fulani woman, an Igbo man and a Yoruba woman.

heading: A.2.2 Annotation guidelines
text: Offensive tweets For tweets to be offensive, but not hateful, a tweet must satisfy all of the following criteria.
• The hate keyword is being used as pejorative towards another individual or group, and this group is not one of our communities.
– A personal attack against another individual, that does not mention a protected attribute such as, race, ethnicity, national origin, disability, religious affiliation, caste, sexual orientation, sex, gender identity and serious disease.
– An insult towards a group based on nonprotected attributes, such as, hobbies, fandom (e.g., sports, comic books).
• It is not offensive if the hate keyword is not being used on an individual or group.
– Not offensive if directed towards inanimate objects, abstract concepts (that do not have religious or cultural significance) or animals (unless the animal is used as a negative metaphor to describe a community). We define these as “outof-scope entities” (Röttger et al., 2021).
• It is not offensive if the hate word is selfreferential. This would account for some types of sarcasm, or humour via self deprecation.
• It is not offensive if the hate word is used for emphasis without being directed towards an individual or group. Several offensive words such as “shit” or “stupid” can be used as exclamations.
• If the hate word is being used ambiguously (not recognizable as pejorative), then it is offensive if your answer is yes to one of these questions.
– Can you imagine that someone might be offended by this? (err on the side of caution, aim for the lower bound)
– Would Twitter potentially detect it as an insult and make the user verify before posting?
Hateful tweets This section is adapted from (Waseem and Hovy, 2016; Basile et al., 2019) and Facebook Community Standards7. For tweets to be hateful, instead of merely offensive, the tweet must satisfy one or more of the following criteria:
• Uses a sexist, racial or homophobic slur.
– Misogyny/Sexist slurs to be defined as a statement that expresses hate towards women in particular (in the form of insulting, sexual harassment, threats of violence, stereotype, objectification and negation of male responsibility).
– Racial slurs to be defined as an insult that is designed to denigrate others based on their race or ethnicity.
– Homophobic slurs to be defined as an insult that is designed to denigrate other on the basis of sexuality. This includes slurs targeted towards specific LGBTQ+ communities, such as transphobic slurs.
– Usage of slur must not constitute a “reclaiming” of negative terms by the community in question. For instance, the n* word or “fag” or “bitch”.
• Attacks a minority.
– Minorities to be defined as a group based on protected characteristics: race, ethnicity, national origin, disability, religious
7https://transparency.fb.com/en-gb/policies/communitystandards/hate-speech/
affiliation, caste, sexual orientation, sex, gender identity and serious disease.
– Attack to be defined as violent or dehumanizing speech, harmful stereotypes, statements of inferiority, expressions of contempt, disgust or dismissal, cursing and calls for exclusion or segregation.
– Seeks to silence a minority. – Criticizes a minority (without a well
founded argument).
* Criticizes a minority and uses a straw man argument.
* Blatantly misrepresents truth or seeks to distort views on a minority with unfounded claims.
– Negatively stereotypes a minority. Negative stereotypes to be defined as dehumanizing comparisons that have historically been used to attack, intimidate, or exclude specific groups.
– Promotes, but does not directly use, hate speech or violent crime.
* Shows support of problematic hashtags. e.g.,“#BanIslam”
* Defends xenophobia, racism, sexism, homophobia or other types of intolerance and bigotry.
– If it is a retweet, it must indicate support for the original tweet. People sometimes share content that includes someone else’s hate speech to condemn it or raise awareness.

heading: A.3 Language distribution
text: We ask the annotators to characterize the language of a random sample of 500 tweets, both for the stratified and active learning sets and for the random sample. We report the language distribution in Table 8.

heading: A.4 Models

heading: A.4.1 Number of parameters
text: Conversational BERT has 110 million parameters. The XLM models, BERTweet and AfriBERTa have 125 million parameters. The DeBERTaV3 models have 86 million parameters. The number of parameters for GPT3.5 is undisclosed by OpenAI.

heading: A.4.2 Pretraining of NaijaXLM-T
text: We followed Alabi et al. (2022) and performed an adaptive fine tuning of XLM-R (Conneau et al.,
2020) on our Twitter dataset. We kept the same vocabulary as XLM-R and trained the model for one epoch, using 1% of the dataset as validation set. The training procedure was conducted in a distributed environment, for approximately 10 days, using 4 nodes with 4 RTX 8000 GPUs each, with a total batch size of 576.

heading: A.4.3 Supervised Learning
text: Hyperparameter tuning Hyperparameter tuning was conducted in a 5-fold cross validation training. A grid search was run testing different learning rates (from 1e-5 to 5e-5). The cross validation trainings were conducted for 10 epochs. The batch size used was 8, and three different seeds were used for each learning rate. We used F1-score as early stopping metric for hate speech detection models. The best results were averaged across the seeds, and the best combination after the grid search was picked as the resulting model.
Computing infrastructure For supervised learning, we used either V100 (32GB) or RTX8000 (48GB) GPUs for finetuning. The average runtime for finetuning is 45 minutes. Inferences from offthe-shelf models were ran locally on a laptop CPU.

heading: A.4.4 Off-the-shelf models
text: Perspective API We used the IDENTITY_ATTACK category for HSD with Perspective API as it is the closest to our hate speech definition. This is a binary classification problem and the API outputs a score between 0 and 1. The inferences were run on February 1, 2024.
GPT3.5 We use the gpt-3.5-turbo-0613 model. The prompt used for zero-shot predictions with this model is: "Now consider this message : ’[TWEET]’ Respond 0 if this message is neutral, 1 if this message is offensive and 2 if this message is hateful. It is very important that you only respond the number (e.g., ’0’, ’1’ or ’2’)."
The prompt is run 5 times for each tweet. We then define the hateful score as the share of the 5 times for which the model predicted that the tweet was hateful. We then use this score to compute the average precision. We use all default values for the main hyperparameters, including 1 for temperature.

heading: A.4.5 Evaluation results
text: We provide the diversity results for the holdout and the top-scored sets in Figure 5. We also provide
the precision-recall curve for NaijaXLM-T on the random sample in Figure 4.

heading: A.4.6 Human-in-the-loop moderation
text: In the human-in-the-loop setting, we compute the proportion of all tweets to be reviewed by human annotators as follows. We first compute the number of predicted positives PP:
PP = TP + FP = TP/precision
PP = (recall ∗ (TP + FN))/precision PP = (recall ∗ total # hateful tweets)/precision PP = (recall∗base rate∗total # tweets)/precision
We then derive the share S of all tweets that are predicted positive by a given model, that is the share of all tweets that will be reviewed by human moderators in a human-in-the-loop approach, by dividing PP by the total number of tweets:
S = (recall ∗ base rate)/precision
with the base rate equal to the prevalence of hateful content which is 0.16%. We finally use the precision and recall values from the precision-recall curve to derive the curve illustrating the relationship between recall and S.

heading: Future Work
text: , 2023), future work could use network features to improve HSD performance (Ahmed et al. , 2022). Synthetic data could be used as well to further increase the number and diversity of examples to train models on (Khullar et al. , 2024). Future work could also evaluate performance at the target level to identify hate types that are harder to detect and develop resources for these. Further, the moderation analysis could be enhanced by taking popularity into account and measuring recall in terms of views of hateful content. Finally, future work could expand our study to other languages, countries and platforms in order to evaluate the external validity of our results and pinpoint areas where new resources are most needed