Introduction
Modern NLP models have achieved remarkable success in detecting hate speech, yet they frequently fall victim to "keyword bias." Because training datasets are often curated via keyword searches or sourced from toxic environments, models learn to associate protected identity terms (e.g., "Muslim," "gay," "black") directly with hate speech. This "trigger-happy" behavior results in high false-positive rates, where neutral or even supportive sentences are incorrectly flagged simply for mentioning a specific group. This bias is particularly harmful as it can lead to the over-censorship of the very communities these classifiers are intended to protect.
Methodology: SOC Regularization
To address this, the authors propose a novel approach to "contextualize" BERT-based classifiers using Sampling and Occlusion (SOC). SOC is an explanation algorithm that determines word importance by masking a term and sampling surrounding contexts from a pre-trained language model to observe how the prediction shifts.
Rather than using SOC merely for post-hoc analysis, the researchers integrate it into the training process through Explanation Regularization. They introduce a regularization term to the standard cross-entropy loss that specifically penalizes the model if it assigns high importance scores to a predefined list of 25 "group identifiers." This forces the model to ignore the identity term as a primary signal and instead search for evidence of hate within the surrounding verbs, adjectives, and phrases.
Experimental Setup and Datasets
The method was evaluated using three distinct datasets:
- Gab Hate Corpus (GHC): 27,000 posts from Gab annotated for dehumanization and calls for violence.
- Stormfront: Sentences from a white supremacist forum.
- NYT Adversarial Set: A "stress test" consisting of 12,500 New York Times articles containing the same group identifiers but assumed to be non-hateful. This dataset measures the model's tendency toward false positives.
Key Insights: Shifting the Model's Focus
A critical finding of the study is that regularization is significantly more effective than simple "Word Removal." While deleting identity terms might reduce bias, it destroys the model's ability to understand the target of the hate, leading to a collapse in performance. In contrast, SOC regularization allows the model to retain knowledge of who is being discussed while shifting its "Aha!" moment toward dehumanizing language and insults.
As shown in the visualization above, standard BERT models often fixate on the identity term itself. After regularization, the model's attention shifts to the actual hateful context (e.g., "hate against"), allowing it to correctly classify neutral mentions of protected groups.
Results and Performance
The regularized BERT+SOC model demonstrated a substantial improvement in robustness:
- Adversarial Accuracy: On the neutral NYT dataset, a standard BERT model achieved only ~77.8% accuracy due to false positives. The regularized model boosted this to 90.1% accuracy.
- Maintaining Utility: Unlike word removal strategies, SOC regularization maintained or slightly improved F1 scores on the Gab and Stormfront datasets, ensuring that the reduction in bias did not come at the cost of detecting actual hate speech.
Conclusion and Future Work
This research highlights the potential of using Explainable AI (XAI) not just for human auditing, but as a functional training signal to improve model robustness. While the current method relies on a curated list of identifiers and may struggle with complex rhetoric like "dog whistles," it provides a scalable framework for reducing keyword bias. Future work may involve expanding this technique to larger generative models and other domains where keyword bias persists, such as sentiment analysis or legal document classification.
Summary updated