Statistical Analysis of Perspective Scores on Hate Speech Detection

Hadi Mansourifar, Dana Alsagheer, Weidong Shi, Lan Ni, Yan Huang · DOI

Abstract

Hate speech detection has become a critical area of research due to the exponential growth of offensive language on social media. State-of-the-art hate speech classifiers are often efficient only when tested on data with the same feature distribution as their training data. Consequently, model architecture plays a secondary role compared to feature selection in improving results. In diverse data distributions, relying on low-level features causes deficiency due to natural bias. This paper statistically analyzes Google Perspective Scores and their impact on hate speech detection, demonstrating that different datasets share similar patterns in these high-level features. Ultimately, we prove that over-sampling Perspective Scores can significantly improve generalization performance when testing across different hate speech datasets.

Introduction: The Generalization Gap

A major hurdle in automated hate speech detection is the lack of a universal definition for "hate," leading to datasets that function as "isolated islands." A model trained on political discourse often fails when applied to sports or social movements because it relies on low-level features—specific words or character n-grams—that are highly sensitive to the vocabulary of the training set. When these distributions shift, the model's predictive power collapses.

To address this, we propose using high-level features: scores generated by Google’s Perspective API. These scores provide an abstract representation of content (e.g., Toxicity, Identity Attack), which we hypothesize are more consistent across different contexts of hate speech.

Methodology: High-Level Feature Engineering

Our approach involves a multi-step pipeline designed to extract, validate, and balance high-level features before classification. The researchers used the Google Perspective API to generate scores (ranging from 0 to 1) for various categories, including Toxicity, Severe Toxicity, Identity Attack, Insult, Profanity, and Threat.

To handle the inherent class imbalance in hate speech data, we applied the Synthetic Minority Over-sampling Technique (SMOTE) and Borderline-SMOTE to the high-level feature vectors. This process ensures that the classifiers are trained on a balanced representation of the data, enhancing their ability to detect minority class instances (hate speech) in unseen datasets.

Methodological pipeline for balancing Perspective Scores using SMOTE.

Statistical Insights

Our analysis of two distinct datasets—TweetBLM (tweets related to Black Lives Matter) and the Davidson Dataset (general offensive language)—revealed a "common pattern." ANOVA tests showed that Toxicity, Identity Attack, and Spam scores were consistently the most significant predictors across both datasets. This suggests that these high-level attributes serve as the "connective tissue" between disparate forms of hate speech.

Furthermore, we found that interaction effects are crucial. In the TweetBLM dataset, the interaction between Toxicity and Identity Attack was statistically significant, indicating that hate speech in social justice contexts often combines general hostility with targeted identity-based attacks.

Results: Performance and Generalization

We evaluated several classifiers, including Random Forest (RF), K-Nearest Neighbors (KNN), and XGBoost (XGB), by training them on the general Davidson dataset and testing them on the specific TweetBLM data. The results demonstrate that over-sampling high-level features significantly boosts generalization.

Performance comparison across Random Forest, KNN, and XGBoost classifiers showing improvements in Recall and F1-score with SMOTE.

Key findings include:

  • Recall and F1-Score Boost: There was a substantial increase in recall across all models. For instance, SVM and Random Forest models saw their recall scores nearly triple in cross-dataset tests when using SMOTE-balanced Perspective Scores.
  • Robustness: While precision and accuracy remained stable or improved, the significant gains in F1-score across all base classifiers (Decision Tree, RF, SVM, KNN, GNB, and XGB) confirm that the models became much more sensitive to hate speech in new environments.

Conclusion

By focusing on high-level Perspective Scores rather than raw text, we can bridge the generalization gap in hate speech detection. Statistical analysis confirms that these scores capture universal characteristics of offensive language. Moreover, applying over-sampling techniques like SMOTE to these abstract features allows models to learn more robust decision boundaries, leading to significantly better performance on unseen datasets.

Summary updated

Abstract

Hate speech detection has become a hot topic in recent years due to the exponential growth of offensive language in social media. It has proven that, state-of-the-art hate speech classifiers are efficient only when tested on the data with the same feature distribution as training data. As a consequence, model architecture plays the second role to improve the current results. In such a diverse data distribution relying on low level features is the main cause of deficiency due to natural bias in data. That's why we need to use high level features to avoid a biased judgement. In this paper, we statistically analyze the Perspective Scores and their impact on hate speech detection. We show that, different hate speech datasets are very similar when it comes to extract their Perspective Scores. Eventually, we prove that, over-sampling the Perspective Scores of a hate speech dataset can significantly improve the generalization performance when it comes to be tested on other hate speech datasets.
BibTeX
@misc{mansourifar2021statistical,
  author = {Hadi Mansourifar and Dana Alsagheer and Weidong Shi and Lan Ni and Yan Huang},
  title = {{Statistical Analysis of Perspective Scores on Hate Speech Detection}},
  year = {2021},
  eprint = {2107.02024},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2107.02024},
}
Figure