Improving Generalization of Hate Speech Detection Systems to Novel Target Groups via Domain Adaptation (2022)

Abstract: Despite recent advances in machine learning based hate speech detection, classifiers still struggle with generalizing knowledge to out-of-domain data samples. In this paper, we investigate the generalization capabilities of deep learning models to different target groups of hate speech under clean experimental settings. Furthermore, we assess the efficacy of three different strategies of unsupervised domain adaptation to improve these capabilities. Given the diversity of hate and its rapid dynamics in the online world (e.g. the evolution of new target groups like virologists during the COVID-19 pandemic), robustly detecting hate aimed at newly identified target groups is a highly relevant research question. We show that naively trained models suffer from a target group specific bias, which can be reduced via domain adaptation. We were able to achieve a relative improvement of the F1-score between 5.8% and 10.7% for out-of-domain target groups of hate speech compared to baseline approaches by utilizing domain adaptation.

## introduction current state-of-the-art machine learning approaches for hate speech detection reach f1-scores above 93% @xcite . despite this progress, in some settings these scores drop to 50% when tested on out-of-domain data @xcite . the lack of generalization capabilities of hate speech detection systems hinders their suitability in real world applications. several challenges are faced when trying to generalize knowledge in hate speech detection tasks. firstly, most benchmark hate speech datasets are focused on certain topics, such as hate speech directed at journalists @xcite , refugees and muslims @xcite , women only @xcite or blacks, other races and women @xcite . these datasets reflect biases towards different targets of hate, which will usually influence model training and predictive performance. different target groups are also addressed by different perpetrators in the real world. for example, left-wing hate is frequently aimed against the 'system', with police or politicians being targeted, whereas right-wing hate is frequently aimed against jews or foreigners. moreover, new target groups can arise due to new phenomena such as the corona pandemic @xcite . therefore, being able to adapt models to unknown target groups of hate speech without the need of time consuming labeling of new datasets is crucial. another challenge for generalizing knowledge across different hate speech datasets is the disagreement over the definition of hate speech @xcite , which is especially problematic for benchmark datasets. these disagreements lead to incompatible annotation of different datasets @xcite , which hinders a proper assessment of the generalization capabilities of the models. in this work we investigate the generalization and adaptation capabilities of hate speech classifiers to different domains of hate speech while eliminating errors due to incompatible datasets. this is done by conducting our experiments on a single dataset, namely the hatexplain dataset @xcite , which was annotated following consistent annotation rules. there are many possibilities to categorize hate speech into different domains. for example, hate speech with common topics, hate speech that addresses common target groups, hate speech from common time periods or hate speech from common datasets can be considered as separate domains. in this work, we regard the adaptation capabilities of the (a) mixup regularization. in manifold mixup, virtual samples and virtual labels are computed by interpolating between the feature representations and corresponding labels (pseudo-labels for unlabeled samples) of data points. models with respect to different target groups of hate speech due to the relevance of the topic for real world applications and the suitability of the hatexplain dataset for this research. an advantage of utilizing the hatexplain dataset for this research is, that target groups were annotated for all samples, not only the hateful ones, which allows us to appropriately select samples that correspond to different domains and therefore to properly investigate the generalization capabilities of our approaches. adaptation of models to different target groups of hate speech is here investigated by unsupervised domain adaptation methods, namely via manifold mixup regularization (fig. 1a ), adversarial domain adaptation (fig. 1b ) and curriculum labeling (fig. 1c ). in summary, we make the following contributions: ## related work several approaches for machine learning based hate speech detection were investigated in recent years @xcite @xcite ). an active line of research aims at improving generalization capabilities of hate speech detection systems, with most studies focusing on cross-dataset generalization capabilities of models @xcite . @xcite show the the difficulties of hate speech classifier to deal with outdomain datasets. the authors emphasize the importance of in-domain data for their generalization results. they integrated target domain data in their learning procedure using frustratingly easy domain adaptation @xcite . in contrast to our work, the authors investigated the cross-corpus generalization and adaptation capabilities of linear support vector machines. in this work, we focus on target group specific domain adaptation of deep learning based hate speech classifiers. the generalization capabilities of deep learning models from topic generic to topic specific hate speech corpora were investigated by @xcite . the authors showed that models failed to generalize to domain specific corpora, but that the integration of domain specific knowledge improves the classification results in new domains. in contrast to our work, the authors focus on cross dataset generalization, which makes a clean evaluation of target group specific generalization difficult. @xcite suggested exploitation of multitask learning and domain adaptation for improving the generalization capabilities of hate speech classifiers. after domain adaptive pre-training of a bert based feature extractor @xcite , the whole model was trained on multiple tasks by utilizing shared parameters as well as task specific parameters. the authors showed that the reduction of unintended target group specific model bias via multi-task learning successfully boosted generalization. in contrast to our work, they focus on general robustness with respect of target groups rather than a target group specific optimization. in @xcite , the authors propose to train a language model to learn domain invariant and disentangled feature representation for different hate speech domains. after that, they trained a classifier on top of these feature representations and used it for robustly classifying hate speech from different domains. the authors demonstrated the success of the model in detecting hate speech related to the covid-19 pandemic. on the other side, @xcite showed that the application of widely used unsupervised domain adaptation approaches can be problematic in the field of hate speech detection. the authors applied various pivot-based and adversarial-based approaches to generalize knowledge across different hate speech corpora. unlike our work, which focuses on target group specific domain adaptation, these works focus on generalizing on knowledge on the level of hate speech corpora, which introduced previously discussed difficulties in model evaluation and which might be the main reason for bad adaptation results. ## methods and experiments in this section we describe the dataset, model architecture as well as the training and evaluation strategies used in our experiments. ## results and discussion in this section, we present and discuss the results of our experiments. in offensive content warning: the following sections contain examples of hateful content. this is strictly for the purpose of enabling this research. please be aware that this content could be offensive and cause you distress. ## conclusion the goal of this work was to analyze the generalization capabilities of hate speech classifiers to different target groups of hate under clean experimental conditions. furthermore, we aimed to investigate the suitability of unsupervised domain adaptation to improve these generalization capabilities. our results indicate that naively trained hate speech classifiers suffer from a target group specific bias and that unsupervised domain adaptation is able to improve the generalization capabilities of models across different target groups of hate. in contrast to previous works, which mainly focus on the generalization capabilities of hate speech classifiers in cross dataset settings, we investigated the generalization capabilities of hate speech classifiers to new hate targets on a single dataset, the hatexplain dataset. this enabled us to strictly separate target groups across all class labels and therefore allowed a clean analysis of the abilities of models to generalize to different target groups of hate, while avoiding the risk of inconsistencies over the definition of hate speech between datasets. we observed a gap of the model performances on the source domains and the model performances on the target domains. while data augmentation and balanced data sampling was able to generally improve the model performances, these methods tend to preserve these gaps. the integration of domain specific knowledge via domain adaptation was able to improve the generalization capabilities of models to other target groups, whereby the number of the involved labeled and unlabeled training samples strongly influenced the results of the approaches. however, our study does not allow a clear conclusion about which domain adaptation approach is best in which constellation of available data, which makes the choice of the appropriate approach difficult in real world situations. in total, there is still potential to improve the prediction quality of the models, especially when it comes to real world applications. failures to detect hate speech, which contain threats, may lead to life-threatening situations for people, for example. in such scenarios, the achieved model performances are not good enough to reliably support law enforcement agencies. improvements could be made with more advanced model architectures and a larger amount of available training data, which is a limitation of our work. we also analyzed generalization capabilities for only three target groups of hate, namely "race," "religion," and "sexual orientation." these limitations should be addressed in future works, for which we suggest investigating the generalization capabilities to new targets of hate in settings with a greater amount of data, higher diversity of target groups and with more advanced models like transformer based models. moreover, the limitations of each of the domain adaptation methods can be further investigated in order gain insight into when and why some methods might fail.