HateSense: Hierarchical Sentiment Analysis Framework for Hate Speech Detection: Implementing Binary and Multiclass Classification Strategy
Organizations: Department of Electrical & Computer & Engineering, North South University, Dhaka, Bangladesh
Abstract
Hate speech detectors must separate hateful posts from the far more common offensive but non-hateful ones, and two popular ideas for doing so are hierarchical (coarse-to-fine) classification and sentiment features. We revisit our earlier transformer-based framework, which combines both ideas, and test each component in a controlled study on two public benchmarks (Davidson et al., 24,783 tweets; HateXplain, 19,229 posts) with five random splits, validation-based tuning, and paired bootstrap tests. With linear models over word and character n-grams, the dominant-class-first hierarchy used in our framework lowered macro-F1 by 1.1-1.5 points relative to a flat classifier (p <= 0.007), and adding VADER sentiment features changed Davidson macro-F1 by at most 0.6 points, never significantly in the class-weighted settings. Class-weighted training was the only intervention with a large effect (+2.0 to +3.5 macro-F1 and +5.9 to +9.1 hate-class F1), and sentiment cannot separate the two abusive classes because hateful and offensive tweets are almost equally negative (mean VADER compound -0.35 vs. -0.29). Cross-dataset transfer cut macro-F1 to 43-53, and a reclaimed slur doubled the false hate rate of a logistic-regression detector, showing that in-domain scores overstate real-world reliability.
Figures & tables
| Davidson (5 splits) | HateXplain | |||||||||||||
| Wt. | Decomposition | Sent. | Macro-F1 | Hate P | Hate R | Hate F1 | Off. F1 | Neither F1 | o h | Macro-F1 | Hate F1 | Off. F1 | Normal F1 | |
| LogReg | – | Flat | – | 71.7 2.0 | 54.7 | 26.6 | 35.7 6.8 | 94.2 | 85.3 | 1.5 | 65.9 | 75.7 | 48.6 | 73.5 |
| – | Flat | ✓ | 71.7 2.2 | 53.0 | 26.4 | 35.2 7.8 | 94.2 | 85.8 | 1.6 | 66.0 | 75.7 | 48.6 | 73.6 | |
| – | Dom.-first (v1) | – | 69.9 2.1 | 49.0 | 26.3 | 33.9 6.4 | 93.5 | 82.2 | 1.9 | 63.1 | 74.5 | 42.2 | 72.5 | |
| – | Dom.-first (v1) | ✓ | 70.2 1.1 | 47.9 | 27.7 | 34.9 5.2 | 93.4 | 82.4 | 2.0 | 63.2 | 75.3 | 41.9 | 72.6 | |
| – | Abus.-first | – | 71.9 2.1 | 57.3 | 25.3 | 35.0 6.9 | 94.3 | 86.3 | 1.3 | 64.9 | 72.1 | 52.9 | 69.6 | |
| Model | Class | P | R | F1 | Acc. |
|---|---|---|---|---|---|
| Stage 1: binary (label 1 vs. merged label 0) | |||||
| RoBERTa-base | 0 | 0.67 | 0.45 | 0.54 | 87% |
| 1 | 0.89 | 0.95 | 0.92 | 73% | |
| XLM-RoBERTa | 0 | 0.69 | 0.48 | 0.57 | 88% |
| 1 | 0.91 | 0.97 | 0.94 | 75% | |
| Stage 2: multiclass (labels 2, 3, 4) | |||||
| Class | Mean compound | Mean neg. score | Share negative |
|---|---|---|---|
| Hate | 0.27 | 66.8% | |
| Offensive | 0.25 | 65.1% | |
| Neither | 0.07 | 24.9% |
| Decomp. | Sent. | Macro-F1 | Hate P | Hate R | Hate F1 | Off. F1 | Neither F1 | |
|---|---|---|---|---|---|---|---|---|
| D H | Flat | – | 45.1 | 45.9 | 56.7 | 50.7 | 35.4 | 49.3 |
| D H | Flat | ✓ | 44.6 | 46.4 | 52.0 | 49.0 | 38.5 | 46.3 |
| D H | Dom.-first (v1) | – | 44.4 | 42.9 | 57.6 | 49.2 | 36.0 | 47.9 |
| D H | Dom.-first (v1) | ✓ | 42.3 | 40.4 | 57.9 | 47.6 | 33.3 | 46.1 |
| D H | Abus.-first | – | 43.8 | 47.3 | 50.0 | 48.6 | 36.8 | 45.9 |
| D H | Abus.-first | ✓ | 43.4 | 45.4 | 52.9 | 48.9 | 34.9 | 46.4 |
| Model | With term | Without term | Ratio |
|---|---|---|---|
| ( ) | ( ) | ||
| LogReg, flat | 9.0 | 3.9 | 2.3 |
| LogReg, dominant-first (v1) | 8.2 | 4.5 | 1.8 |
| Linear SVM, flat | 4.9 | 3.1 | 1.6 |
| Linear SVM, flat + sentiment | 4.3 | 3.0 | 1.4 |
Hate Speech Detection
Hate Speech Detection identifies hateful or abusive language, its targets and intent, to support safer and more accountable content moderation.
See all 100 papers