Abstract
Existing work on automated hate speech detection typically focuses on binary classification or on differentiating among a small set of categories. In this paper, we propose a novel method on a fine-grained hate speech classification task, which focuses on differentiating among 40 hate groups of 13 different hate group categories. We first explore the Conditional Variational Autoencoder (CVAE) as a discriminative model and then extend it to a hierarchical architecture to utilize the additional hate category information for more accurate prediction. Experimentally, we show that incorporating the hate category information for training can significantly improve the classification performance and our proposed model outperforms commonly-used discriminative models.
Introduction
Most automated hate speech detection systems are "coarse-grained," typically performing binary classification (Is this hate speech?) or sorting text into a handful of broad categories like racism or sexism. However, the real-world landscape of hate speech is far more complex. The Southern Poverty Law Center (SPLC) tracks nearly 1,000 active hate groups in the U.S., ranging from Neo-Nazis to Anti-Immigrant groups.
The challenge lies in the fact that these groups often share similar vocabularies, making fine-grained classification—identifying exactly which group a tweet belongs to—extremely difficult. Standard neural networks often struggle to capture the subtle semantic distinctions required to tell these groups apart, especially when the dataset is highly imbalanced.
Methods: The Hierarchical CVAE
To address these challenges, we propose a novel architecture based on the Conditional Variational Autoencoder (CVAE). While VAEs are traditionally used for generative tasks, this research explores their power as discriminative models.
The core innovation is the Hierarchical CVAE (HCVAE). Instead of treating all 40 hate groups as a flat list, the model utilizes the hierarchical structure of hate: broad ideologies (the Category Level) and specific organizations within those ideologies (the Group Level).
In this architecture, a Bi-LSTM processes the tweet text. The model uses two sets of latent variables ($z_c$ for category and $z_g$ for group). During training, the model learns to map the text and the ground-truth labels into a latent space. The "Hierarchy Trick" involves conditioning the group-level prediction on the category-level representation. This forces the model to learn that a specific group is a subset of a larger ideology, providing a "semantic anchor" that helps it make more accurate fine-grained predictions. During inference, since ground-truth labels aren't available, the model uses "prior networks" to estimate the latent distributions based solely on the input text.
Datasets
We curated a massive, specialized dataset of Twitter content (tweets, retweets, and replies) from 40 hate group accounts. These groups were mapped to 13 different ideologies based on SPLC classifications. The final dataset includes approximately 3.5 million tweets collected from 2009 to 2017.
As shown in the figure above, the data is "long-tailed" and highly imbalanced—some groups have hundreds of thousands of tweets, while others have fewer than a thousand. This imbalance presents a significant challenge for standard classification models, as the lack of data for smaller groups makes it difficult for models to generalize.
Key Insights and Results
The HCVAE was tested against several baselines, including SVMs, Logistic Regression, Char-CNNs, and standard Bi-LSTMs.
- Superior Accuracy: On the complete dataset, the HCVAE achieved a Micro-F1 score of .844, outperforming the standard Bi-LSTM (.767) and the baseline CVAE (.799). This represents a performance gain of up to 10% in Micro-F1 over traditional neural baselines.
- Robustness to Data Scarcity: One of the most striking findings is that CVAE-based models are more robust than standard discriminative models when training data is limited. When trained on only 10% of the data, the HCVAE maintained a Micro-F1 of .787, while the Bi-LSTM plummeted to .599.
- Latent Space Advantages: Standard models like Bi-LSTMs try to compress text directly into a label. CVAEs, by contrast, model the underlying distribution of the data, capturing higher-level semantic information that generalizes better to unseen inputs.
- Error Correction through Hierarchy: The hierarchical structure acts as a built-in error correction mechanism. If the model is unsure about a specific group, the category-level information helps steer it toward the correct "neighborhood" of ideologies, preventing wild misclassifications.
Limitations and Future Work
Despite these improvements, the model still struggles with Macro-F1 scores, which weigh every class equally. For groups with very few examples (less than 3k tweets), even a hierarchical prior isn't enough to overcome the lack of data. Additionally, some errors are due to the inherent "noisiness" of the data; for example, tweets from different groups within the same ideology may be indistinguishable even to human experts.
Future work could involve applying this hierarchical framework to other complex classification tasks beyond hate speech, such as fine-grained sentiment analysis or intent detection in dialogue systems.
Summary updated