Abstract
Hate speech detection on Twitter is critical for applications like controversial event extraction, building AI chatterbots, content recommendation, and sentiment analysis. We define this task as being able to classify a tweet as racist, sexist or neither. The complexity of the natural language constructs makes this task very challenging. We perform extensive experiments with multiple deep learning architectures to learn semantic word embeddings to handle this complexity. Our experiments on a benchmark dataset of 16K annotated tweets show that such deep learning methods outperform state-of-the-art char/word n-gram methods by ~18 F1 points.
Introduction
Hate speech on social media is a moving target, characterized by complex natural language constructs, sarcasm, and rapidly evolving slang. Manually filtering this content at scale is impractical, yet automated detection remains difficult. Previous approaches largely relied on "hand-crafted" features or simple character n-grams. However, these methods often fail to capture the underlying semantic meaning, allowing users to bypass filters by slightly altering their vocabulary. This paper addresses the gap by applying deep learning architectures—specifically CNNs, LSTMs, and FastText—to capture the nuances of hate speech, categorized here as racist, sexist, or neutral.
Methodology
The researchers propose a two-stage approach to improve classification performance:
- Learning Semantic Embeddings: Three neural architectures are employed to transform tweets into dense mathematical vectors:
- Convolutional Neural Networks (CNN): Effective at identifying local patterns and key phrases.
- Long Short-Term Memory (LSTM): Designed to capture long-range dependencies and the sequential nature of text.
- FastText: An efficient model that represents documents by averaging word vectors while allowing for updates during training.
- Hybrid Classification: While neural networks can perform classification directly, the authors discovered a performance "sweet spot" by using the embeddings learned by these networks as input features for a Gradient Boosted Decision Tree (GBDT) classifier.
The study also explored two initialization strategies for word vectors: random initialization and pre-trained GloVe vectors (trained on 2 billion tweets).
Experimental Setup
The models were evaluated using a benchmark dataset of 16,000 annotated tweets (Waseem and Hovy, 2016), consisting of 3,383 sexist tweets, 1,972 racist tweets, and a majority of neutral tweets. The authors utilized 10-fold cross-validation and reported weighted macro precision, recall, and F1-scores to ensure robust results.
Task-Specific Semantic Shifts
A key insight from the study is how task-specific training alters the semantic space of word embeddings. While general-purpose embeddings like GloVe associate "female" with neutral terms like "woman" or "girl," the embeddings learned specifically for hate speech detection shift "female" closer to sexist slurs and derogatory terms. This shift is not a flaw but a feature; it indicates the model is successfully capturing the specific context in which these words are weaponized within hateful communities.
Results
The experimental results demonstrate a significant performance leap over traditional methods. The baseline character n-gram model achieved an F1-score of 0.753. In contrast, the hybrid model combining LSTM-learned embeddings (with random initialization) and a GBDT classifier achieved the top performance with an F1-score of 0.930.
This ~18-point improvement in F1-score underscores the power of deep semantic representations over surface-level character patterns. Interestingly, random initialization often outperformed pre-trained GloVe vectors when paired with GBDTs, suggesting that for niche tasks like hate speech detection, allowing the model to tune its vocabulary from scratch can be more effective.
Conclusion and Future Work
While deep learning significantly advances hate speech detection, several challenges remain. The current models rely solely on tweet text, whereas hate speech is often deeply contextual. Future work could incorporate user network features—such as social circles and posting history—to provide additional context. Furthermore, as these high-performing models often act as "black boxes," improving interpretability is essential for transparent and fair content moderation in real-world applications.
Summary updated