Hypothesis Engineering for Zero-Shot Hate Speech Detection (2022)

Abstract: Standard approaches to hate speech detection rely on sufficient available hate speech annotations. Extending previous work that repurposes natural language inference (NLI) models for zero-shot text classification, we propose a simple approach that combines multiple hypotheses to improve English NLI-based zero-shot hate speech detection. We first conduct an error analysis for vanilla NLI-based zero-shot hate speech detection and then develop four strategies based on this analysis. The strategies use multiple hypotheses to predict various aspects of an input text and combine these predictions into a final verdict. We find that the zero-shot baseline used for the initial error analysis already outperforms commercial systems and fine-tuned BERT-based hate speech detection models on HateCheck. The combination of the proposed strategies further increases the zero-shot accuracy of 79.4% on HateCheck by 7.9 percentage points (pp), and the accuracy of 69.6% on ETHOS by 10.0pp.

## introduction with the increasing popularity of social media and online forums, phenomena such as hate speech, offensive and abusive language, and personal attacks have gained a powerful medium through which they can propagate fast. due to the sheer number of posts and comments on social media, manual content moderation has become unfeasible, thus the automatic detection of harmful content becomes essential. in natural language processing, there now exist established tasks with the goal of detecting offensive language @xcite , abusive language @xcite , hate speech @xcite and other related types of harmful content @xcite . in this work, we focus on the detection of hate speech, which is typically defined as attacking, abusive or discriminatory language that targets people on the basis of identity defining group characteristics such as gender, sexual orientation, disability, race, religion, national origin etc. @xcite @xcite . most current hate speech detection approaches rely on either training models from scratch or fine-tuning pre-trained language models @xcite . both types of approaches need large amounts of labeled data which are only available for a few high-resource languages @xcite and costly to create. therefore, exploring data-efficient methods for hate speech detection is an attractive alternative. in this paper, we build on @xcite who proposed to re-frame text classification tasks as natural language inference, enabling high accuracy zero-shot classification. we exploit the fact that we can create arbitrary hypotheses to predict aspects of an input text that might be relevant for hate speech detection. to identify effective hypotheses, we first find a well-performing hypothesis formulation that claims that the input text contains hate speech. an error analysis based on hatecheck @xcite shows that given a well-performing formulation the model still struggles with multiple phenomena, including (1) abusive or profane language that does not target people based on identitydefining group characteristics, (2) counterspeech, (3) reclaimed slurs, and (4) implicit hate speech. to mitigate these misclassifications, we develop four strategies. each strategy consists of multiple hypotheses and rules that combine these hypotheses in order to address one of the four identified error types. we show that the combination of all proposed strategies improves the accuracy of vanilla nlibased zero-shot prediction by 7.9pp on hatecheck @xcite and 10.0pp on ethos @xcite . an error analysis shows that the overall gains in accuracy largely stem from increased performance on previously identified weaknesses, demonstrating that the strategies work as intended. overall, our primary contributions are the following: c1 an error analysis of vanilla nli-based zeroshot hate speech detection. c2 developing strategies that combine multiple hypotheses to improve zero-shot hate speech detection. c3 an evaluation and error analysis of the proposed strategies. early approaches to hate speech detection have focused on english social media posts, especially twitter, and treated the task as binary or ternary text classification @xcite @xcite . in more recent work, additional labels have been introduced that indicate whether the post is group-directed or not, who the targeted group is, if the post calls for violence, is aggressive, contains stereotypes, if the hate is expressed implicitly, or if sarcasm or irony is used @xcite @xcite @xcite . sometimes hate speech is not directly annotated but instead labels, such as racism, sexism, homophobia that already combine hostility with a specific target are annotated and predicted @xcite @xcite . while early approaches relied on manual feature engineering @xcite , most current approaches are based on pre-trained transformer-based language models that are then fine-tuned on hate speech datasets @xcite @xcite @xcite . some work has focused on reducing the need for labeled data by multi-task learning on different sets of hate speech labels @xcite or adding sentiment analysis as an auxiliary task @xcite . others have worked on reducing the need for non-english annotations by adapting hate speech detection models from high-to lowresource languages in a cross-lingual zero-shot setting @xcite . however the approach has been criticized for being unreliable when encountering language-specific taboo interjections @xcite . ## evaluating standard zero-shot prediction the evaluation of standard zero-shot nli-based hate speech detection has two goals: to (1) obtain an error analysis that serves as the starting point for developing zero-shot strategies in section 5, and experiment setup to test if an input text contains hate speech, we need a hypothesis expressing that claim. however, there are many ways how the claim, that a given text contains hate results ## methods in this section, we present four methods, which we call strategies, that aim to improve zero-shot hate speech detection. a strategy has the following components and structure: the aim is to assign a label @xmath0, 1} to input text t, where 1 corresponds to the class hate speech and 0 corresponds to the class not-hate speech. the input text t can be used in one or multiple a premises p 0 to p m , that are used in conjunction with the main hypothesis h 0 and one or multiple supporting hypotheses [h 1 , ..., h n ] to obtain nli model predictions m(p i , h j ) ∈ {0, 1} where 0 corresponds to contradiction and 1 corresponds to entailment. the variables i and j are defined as: @xmath1, ..., m] and @xmath2, ..., n]. the rules for how to combine model predictions to obtain the final label y are given by the individual strategies. as the main hypothesis we use "that contains hate speech.", since it lead to the highest accuracy on hatecheck in section 4. the supporting hypotheses used to implement the strategies are listed in ## experiments we use the same model and adopt the entailment threshold of 0.5 from section 4 for the main and all supporting hypotheses. further, we take the hypothesis leading to the highest accuracy in section 4 as the main hypothesis. since the main hypothesis in our experiments is chosen for maximum accuracy on hatecheck (based on the experiment in section 4) and the strategies developed are based on an error analysis on hatecheck, the overall system might be overfitting on this specific dataset. an evaluation on this dataset might thus lead to results that overestimate a potential positive effect of the proposed strategies. we therefore also evaluate on ethos as an "unseen" dataset. ## discussion supporting hypotheses the performance of nli-strategies largely depends on the accuracy of the supporting hypotheses. testing the accuracy of each supporting hypothesis is not always possible, since annotated data for the predicted aspect of the input text might not be available. indeed, one of the strengths of our approach is that it can use aspects for which no annotated data exists. another uncertainty lies in the formulation of supporting hypotheses. a suboptimal formulation of supporting hypotheses negatively affects the overall results. by using annotated targets in hatecheck and inferring stance labels as well as self-directedness from hatecheck functionalities, we compute and compare the accuracy of multiple supporting hypothesis formulations. the results (in appendix b) show that testing for the presence of a target group mostly leads to accuracies above 90%, independent of the specific formulation. detecting the outer stance towards the inner text obtained a perfect accuracy of 100% and testing for self-directedness leads to low accuracies, which are probably partly due to faulty label inferences from functionalities. ## conclusion in this work, we combine hypotheses to create more accurate nli-based zero-shot hate speech detection systems. specifically, we develop four simple strategies, filtering by target, filtering counter speech, filtering reclaimed-slurs, and catching dehumanizing comparisons, that target specific model weaknesses. we evaluate the strategies on hate-check, which served as the basis for developing these strategies, and on ethos, which acts as an "unseen" dataset. the nli-based zero-shot baseline already outperforms fine-tuned models on hat-echeck and beats an svm baseline on ethos. using all four proposed strategies leads to a further performance increase of 7.9% on hatecheck and 10.0% on ethos. however, the contribution of the strategies to the performance increases varies, with catching dehumanizing comparisons even having a small negative effect on the accuracy on ethos. the proposed approach is simple and modular making it easy to implement and adjust to different scenarios. in future work, we plan to evaluate such strategies in a multi-lingual setup and in a few-shot scenario. further, this works leads to the question how effective supporting hypotheses could be searched and generated automatically.