Robust Hate Speech Detection via Mitigating Spurious Correlations (2022)

Abstract: We develop a novel robust hate speech detection model that can defend against both word- and character-level adversarial attacks. We identify the essential factor that vanilla detection models are vulnerable to adversarial attacks is the spurious correlation between certain target words in the text and the prediction label. To mitigate such spurious correlation, we describe the process of hate speech detection by a causal graph. Then, we employ the causal strength to quantify the spurious correlation and formulate a regularized entropy loss function. We show that our method generalizes the backdoor adjustment technique in causal inference. Finally, the empirical evaluation shows the efficacy of our method.

## introduction online social media bring people together and encourage people to share their thoughts freely. however, it also allows some users to misuse the platforms to promote the hateful language. as a result, hate speech, which "expresses hate or encourages violence towards a person or group based on characteristics such as race, religion, sex, or sexual orientation" foot_1 , unfortunately becomes a common phenomenon on online social media. as a result, many online social media platforms such as facebook and twitter have policies prohibiting hate speech on their platforms. in order to prevent the spread of hate speech, programs have been deployed to automatically filter out hateful contents. however, in response to these programs, malicious users develop various approaches to evade detection, making hate speech very difficult to be detected by vanilla machine learning approaches. one of the common strategy is to deliberately revising texts, especially misspelling hate words, while preserving the intended meaning, such as typing the f-word as "fxxk". some malicious users also replace racial slurs with other names, such as technology brands or products, to evade detection. such strategy can be treated as the evasion attacks in the field of the adversarial attacks, where the adversary aims to evade detection by revising the malicious samples @xcite . research on defending against adversarial attacks in the text domain has been received significant attention in recent years @xcite . however, how to make the hate speech detection model robust to malicious users is still under studied. many existing adversarial defense methods assume that attackers replace the words in the original text by their synonyms in order to preserve semantic similarity (e.g., @xcite ). however, in practice the malicious users may use the words with different semantic meanings for the word substitutions. for example, in the coded hate speech, the word "google" may be used to represent "african-american" and "skittles" may be used to indicate muslim @xcite . in this paper, we develop a novel robust hate speech detection model. we target the situation where a group of target words could be replaced with any words even with entire different semantic meanings. we identify the essential factor to defend such attacks as to capture the causation between the semantic meaning of input text and the label and remove the spurious correlation between them. to this end, we use causal graphs @xcite to describe the causal relationship among the semantic meaning of input text, the target words, and the label. the impact of the adversarial attack is modeled as the causal strength of the arrow between the target words and the label in the graph. we then formulate the learning problem by integrating the causal strength into a regularized entropy loss. finally, we analyze the objective function and show that it generalizes the backdoor adjustment which is a technique widely used for removing spurious correlation in machine learning. the empirical evaluation shows that our method can defend against both word-and character-level attacks. related work. hate speech detection as a supervised text classification task has attracted a lot of attention in the natural language processing community @xcite @xcite @xcite . vanilla hate speech detection techniques are vulnerable to adversarial attacks. thus, several frameworks are proposed to achieve robustness on various adversarial attacks @xcite such as adversarial data augmentation @xcite , adversarial training @xcite , and certified defenses @xcite . different from above works, we propose a causal graph-guided models and employ the causal strength to measure the impact of adversarial attacks. to the best of our knowledge, this is the first work that leverage causal modeling to tackle the challenge of adversarial attacks on hate speech detection. ## method a hate speech detection model can be defined as a functional mapping from t to y , where @xmath0. in general, the output of the detection model is the softmax probability of predicting each class k, i.e., f k (t; θ) = p (@xmath1, where θ is the parameters of the model. we presume a given group of target words (usually hateful or sentiment words) denoted by h, and use x to indicate the remaining text excluding the words in h, i.e., @xmath2, h⟩. adversarial examples are inputs to detection models with perturbations on h that purposely cause the model make mistakes. ## conclusions we developed a robust hate speech detection model by leveraging the causal inference to mitigate spurious correlations. the experiment results show that our model can achieve better performance under both word-and character-level attacks compared with other baselines.