TL;DR
This paper presents a comprehensive empirical comparison of 14 deep and shallow learning models for hate speech detection across three popular datasets. The study reveals that transformer-based models, particularly BERT, ELECTRA, and ALBERT, generally outperform traditional and GloVe-based methods in effectiveness, though at a higher computational cost.
What Problem Does This Paper Address?
The proliferation of social media has made identifying and combating hate speech a critical challenge. While numerous automated hate speech detection methods exist, there's a lack of clear guidance on which approaches are most effective, efficient, and generalizable across different contexts. This paper aims to bridge this gap by providing a large-scale, comparative study of various deep and shallow learning models, evaluating their performance, computational efficiency, and ability to generalize to unseen data.
Methods
The study categorizes hate speech detection approaches into three main groups:
- Shallow Methods: These rely on traditional text representations like TF-IDF combined with classifiers such as SVM, XGB, and MLP.
- Deep Learning Methods with GloVe Embeddings: These use pre-trained GloVe word embeddings as input for deep neural networks like CNNs, MLPs, and Bi-LSTMs.
- Deep Learning Methods with Transformers-based Pretraining: This category includes state-of-the-art models like BERT, Small BERT, ALBERT, and ELECTRA, which leverage large-scale pre-trained transformer architectures. These are also combined with CNN and MLP classifiers.
The researchers implemented 14 distinct models by combining these embedding and classification techniques. They then evaluated these models using standard performance metrics (Precision, Recall, F1-score) and computational efficiency measures.
Datasets
The study utilizes three publicly available datasets for its experiments:
- Davidson: This dataset contains tweets labeled as "Offensive," "Hate," or "Neither hate speech nor offensive."
- Founta: A larger dataset with four classes: "Normal," "Spam," "Hate," and "Abusive."
- Twitter Sentiment Analysis (TSA): This dataset is binary-labeled as "Not Racist/Sexist" and "Racist/Sexist."
The paper notes that user information has been removed from these datasets to address privacy concerns.
Key Insights and Ideas
- Transformers Reign Supreme (Mostly): Transformer-based models consistently demonstrate superior effectiveness in hate speech detection across all three datasets, especially in identifying minority classes (like "hate").
- Shallow vs. Deep Trade-offs: While deep learning models generally outperform shallow ones, TF-IDF combined with XGB can be surprisingly competitive, sometimes even surpassing GloVe-based deep models.
- Computational Cost is Real: The enhanced performance of transformers comes at a significant computational price, requiring more time for training compared to GloVe or TF-IDF based methods.
- Pre-training Matters: Pre-trained embeddings (GloVe and especially transformers) significantly boost performance compared to non-pre-trained TF-IDF representations.
- Domain Generalization is Tricky: Models struggle to generalize well when trained on one dataset and tested on another, particularly when class distributions and definitions differ significantly. The performance drop is often substantial, highlighting the challenge of creating robust, cross-domain hate speech detectors.
Key Results
- Effectiveness: Transformer-based models achieved the highest macro F1 scores, with BERT, ELECTRA, and ALBERT consistently outperforming others. For instance, on the TSA dataset, BERT and ELECTRA achieved macro F1 scores of 0.90.
- Efficiency: While transformers are the most effective, they are also the most computationally expensive. AI-BERT and BERT were the most time-consuming among transformers. ELECTRA-based MLP models are highlighted as a practical sweet spot, offering good effectiveness with reasonable efficiency.
- Cross-Domain Performance: Models trained on larger datasets (like Founta) tended to generalize better to smaller datasets (like Davidson) than vice-versa. However, overall cross-domain performance was significantly lower than within-domain performance, indicating a substantial gap to bridge. For example, when training on TSA and testing on Davidson, macro F1 scores dropped considerably.
Limitations and Future Work
The authors acknowledge that even the best transformer models still face challenges in achieving high macro F1 scores, indicating the difficulty in accurately identifying minority "hate" tweets. A significant challenge remains in achieving robust domain generalization, as datasets often have differing class definitions and data distributions. Future work should focus on improving cross-domain generalization and developing models that can better handle the nuances of hate speech across diverse online contexts. The paper also suggests that the "non-reversible" nature of cross-domain performance (i.e., models performing better when transferring knowledge from a larger to a smaller dataset than the reverse) warrants further investigation.
Summary updated