Abstract
Hate speech detection on social media is often hindered by extreme class imbalance and data scarcity. This paper explores token replacement-based data augmentation (DA) strategies to enhance model performance. By evaluating specialized word embeddings, such as Counter-fitted and Dependency-based Word2Vec, alongside intelligent selection algorithms like Particle Swarm Optimization (PSO), the study demonstrates significant improvements in Macro-F1 scores. The findings highlight the importance of label preservation and the effectiveness of homogeneous embedding settings in boosting detection accuracy.
Introduction
Hate speech detection presents a significant "needle in a haystack" challenge in natural language processing (NLP). In real-world social media datasets, hateful content is often a tiny minority—sometimes less than 6%—compared to neutral or offensive-but-not-hateful posts. This data scarcity leads to models that overfit on specific keywords and fail to generalize to new, unseen slurs or contexts.
While data augmentation is a standard solution in computer vision, it is considerably more complex in NLP. Randomly swapping a word in a sentence can inadvertently alter its entire meaning, potentially turning a hateful sentence into a neutral one or vice versa. This research tackles the mechanics of text augmentation: identifying reliable synonym sources, selecting the most impactful words for replacement, and ensuring label preservation.
Methodology
The authors categorize data augmentation into local and global strategies, focusing primarily on local token replacement to maintain the core structure of the original text.
The token replacement process is broken down into four key components:
- Source of Synonyms: Standard Word2Vec often confuses antonyms (e.g., "black" and "white") because they appear in similar contexts. To solve this, the authors propose Counter-fitted Word2Vec (CF-W2V), which uses an external lexicon to pull synonyms together and push antonyms apart, and Dependency-based Word2Vec (DE-W2V), which considers grammatical roles.
- Substituted Word Selection: Instead of random selection, the study employs Particle Swarm Optimization (PSO) to find the best word combinations for maximizing model performance, and Integrated Gradients (IG) to identify words most critical to the model's current predictions.
- Label Preservation: The researchers use t-SNE visualizations and iterative data mixing to ensure that augmented sentences remain semantically aligned with their original class labels.
Experimental Setup
The study utilizes two prominent Twitter-based hate speech datasets: the Davidson dataset (~25,000 instances, 5.77% hate) and the Founta dataset (~80,000 instances, 7.5% hate). A key aspect of the experiment was testing the interaction between the augmentation embedding and the classification model embedding.
As shown in the table above, the researchers tested whether it is more effective to use the same embedding for both augmentation and final classification (homogeneous) or to mix different representations (heterogeneous).
Key Insights and Results
- The Antonym Trap: Standard embeddings are prone to flipping labels by swapping words for their opposites. Utilizing Counter-fitted embeddings proved to be a crucial safeguard against this issue.
- Importance-Driven Replacement: Replacing "important" words identified via Integrated Gradients generally yielded better results than replacing "unimportant" ones, suggesting that providing variations of core signals is more effective than adding background noise.
- Performance Gains: All DA methods outperformed the original dataset baseline. On the Davidson dataset, Macro-F1 scores improved from 0.646 (baseline) to 0.733 (WordNet/Oversampling) and 0.723 (PSO).
- Consistency is Key: The "homogeneous" setting performed slightly better, likely because it reduces information loss by keeping the model's input layer consistent with the vector representations used during augmentation.
Conclusion
While token replacement provides significant performance boosts, it remains a "local" method that limits structural diversity. Future work will focus on improving homonym handling to distinguish between different word meanings and moving toward "global" augmentation—full sentence paraphrasing—while maintaining the sensitive nuances required for accurate hate speech detection.
Summary updated