Research
HatePrototypes: Interpretable and Transferable Representations for Implicit and Explicit Hate Speech Detection
Overview Research area: Natural Language Processing — hate speech detection, cross-domain transfer, prototype-based representation learning, and early exiting for inference efficiency. Technical level

- arXiv
- 2511.06391
- Published
- 2025-11-09
- Authors
- Irina Proskurina, Marc-Antoine Carpentier, Julien Velcin
AI summary
Overview
- Research area: Natural Language Processing — hate speech detection, cross-domain transfer, prototype-based representation learning, and early exiting for inference efficiency.
- Technical level: Intermediate. Readers should be comfortable with transformer language models, embeddings, and standard classification metrics (accuracy, macro-F1), but the method itself is mathematically simple (class centroids plus cosine similarity).
- Scope (one sentence): The paper shows that simple class-level vector representations ("HatePrototypes") built from as few as 50 examples per class allow hate speech detection models to transfer across implicit and explicit hate benchmarks without additional fine-tuning, and can also drive parameter-free early exiting from intermediate transformer layers.
What This Paper Is About
Hate speech detection models usually have to be fine-tuned again for every new benchmark, and existing benchmarks mostly capture explicit hate (slurs, direct attacks) while missing implicit hate such as coded comparisons, irony, or calls for exclusion. This paper asks whether repeated fine-tuning is actually necessary, by computing a single mean embedding per class (hate vs. non-hate) from a fine-tuned model and classifying new texts by similarity to those prototypes. It then extends the same prototypes to early exiting, letting a model stop at an intermediate layer when it is confident enough.
Key Contributions
- The authors analyze the role of HatePrototypes in the transferability of language models optimized for implicit hate detection, explicit hate detection, or general safety moderation, and report significant prototype-based transfer gains between models.
- They show that HatePrototypes are transferable between implicit and explicit hate messages, with consistent findings across two model families (BERT and OPT).
- They explore early exiting in models fine-tuned on implicit and explicit hate speech tasks, demonstrating how layer-wise prototype construction can improve efficiency while maintaining performance.
- They release code, prototype resources, and evaluation scripts for efficient and transferable hate speech detection (GitHub:
https://github.com/upunaprosk/hate-prototypes).
Main Findings
- Small prototypes suffice: Prototypes built from as few as 50 examples per class reach performance close to that achieved with 500 per-class samples; transfer performance stabilizes at around 50–200 examples per class. In the cross-domain experiments, prototypes were computed using 500 examples per class.
- Large cross-domain gains: For BERT, the largest gains over the fine-tuning baseline occur transferring from a HateXplain-tuned model to OLID (+20.42 F1) and to SBIC (+28.02 F1). For OPT, the largest improvements are from HateXplain to SBIC (+19.87 F1) and from IHC to OLID (+18.16 F1).
- Transferable across explicitness: Prototypes constructed from other datasets retain most in-domain performance. The OLID-tuned model retains 95–100% of its in-domain fine-tuned macro-F1 when using prototypes from other benchmarks. The lowest relative performance occurs when prototypes built from the implicit SBIC dataset are applied to the explicit HateXplain domain.
- Architecture differences: BERT maintains substantially higher relative macro-F1 than OPT on the implicit pair IHC–SBIC (96.7 vs. 64.0) and on the explicit pair HX–OLID (90.1 vs. 72.4). On average, prototypes from the implicit IHC training set yield the highest relative macro-F1 across evaluation domains, with prototypes from the explicit HateXplain dataset ranking second.
- Interchangeable prototypes: Prototype transfer is interchangeable, meaning out-of-domain data can be used to construct prototypes for in-domain classification and vice versa.
- Guard models improve: Prototypes significantly enhance safety-moderation models with no fine-tuning. The largest macro-F1 improvements are for SBIC with LLaMA-Guard (70.33 vs. 52.14) and for IHC with BLOOMz-Guard (60.92 vs. 49.49). Despite having more parameters (3B vs. 1B), BLOOMz-Guard achieves lower scores on SBIC (54.45), suggesting a bias toward explicit hate categories such as those in OLID.
- Parameter-free early exiting works: Prototype-based early exiting reduces computation by about 20% with minimal performance degradation. On OLID it outperforms the entropy-based DeeOPT, improving macro-F1 from 72.44% to 81.11%. Patience-based methods degrade notably on OLID and IHC under comparable efficiency settings.
- Implicit hate needs deeper processing: Implicit hate detection shows a stronger delay in exiting; BERT requires an average of 10.5 layers to match OPT's 8.5 on SBIC. Most SBIC samples exit around the 9th–12th layers, whereas for HateXplain a substantial portion exits earlier under comparable savings.
- Speedups: Prototype-based early exiting achieves speedups comparable to entropy-based baselines while consistently outperforming the patience-based approach. The most reliable gains, with no significant F1 drop, occur for speedups below 1.5x.
- Tighter margins for explicit hate: For HateXplain, macro-F1 stabilizes with a similarity gap of 0.05 at an average exit around the 10th layer; for SBIC, stabilization occurs at a gap of 0.125. The overall similarity margin is small (<0.2), which the authors attribute to overlapping linguistic features between hateful and non-hateful texts.
- Fine-grained weaknesses: On IHC implicit hate types (white grievance, incitement, group stereotypes, irony) and the neutral class, the lowest accuracy is for incitement, where models fine-tuned on datasets other than IHC score between 40% and 58%. Misclassifications cluster around question-answer ironic framings and imperative or presupposition-based calls to action.
- Training size effects are limited: Under balanced sampling (subsampled to 2×min(|D_c|) examples, 4,000 for OLID) no statistically significant effects are observed across seeds. Under reduced training-size stratified sampling (8,000 examples), two FT–Eval pairs show significant differences: BERT fine-tuned on HateXplain and evaluated on SBIC drops to 74.00 accuracy (-2.60) and 67.91 macro-F1 (-3.47), while OPT fine-tuned on OLID and evaluated on SBIC rises to 74.95 accuracy (+1.56) and 70.89 macro-F1 (+0.84).
Methodology in Plain English
For each dataset, the authors fine-tune a language model normally, then run the training texts through it and average the hidden representations of all hateful examples into one vector and all non-hateful examples into another. These two average vectors are the class prototypes. To classify a new text, they take its hidden representation, normalize both it and the prototypes, and compute a dot product (cosine similarity) with each. The class with the higher similarity wins.
Because the representation can be read out at any transformer layer, the same procedure can be repeated layer by layer. For early exiting, the model checks the gap between the top similarity score and the second-best; if the gap exceeds a threshold δ, inference stops there. δ is chosen by grid search over {0, 0.01, 0.025, 0.05, 0.075, 0.1}, selecting the smallest value that achieves roughly 20% layer reduction while keeping macro-F1 within 1 absolute point of the full-model baseline.
The evaluation uses BERT-base (109M parameters) and OPT-125M (125M parameters), both case-sensitive with 12 layers, 12 attention heads, and hidden size 768, plus two guard models (Llama-Guard-3-1B and BLOOMZ-Guardrail-3B). Four Twitter-sourced benchmarks are used: IHC and SBIC for implicit hate, OLID and HateXplain for explicit hate (HateXplain and SBIC also include Gab posts). Fine-tuning uses 3 epochs, a learning rate of 1×10⁻⁵, batch size 64, and weighted cross-entropy for class imbalance, with 10 random seeds on a single NVIDIA A100 GPU (80 GB). Three transfer setups are tested: cross-domain transfer (prototypes and test data from the same dataset, model fine-tuned on another), prototype-based transfer (model and test data from the same dataset, prototypes from another), and guard-model classification. Parameter-dependent baselines are DeeBERT (entropy-based) and PABEE (patience-based), which add roughly 38k trained parameters per model, in contrast to the zero trained parameters of the prototype approach.
Why This Matters
Impact on research: The paper challenges an implicit assumption in hate speech NLP — that each new benchmark or hate subtype requires a fresh fine-tuning round. It offers an evaluation framework for comparing how different architectures and layers encode hate semantics, and it separates the questions of what a model represents from how a classification head is trained.
Real-world applications:
- Content moderation platforms that need to handle new hate-speech categories or languages without labeled in-domain training data.
- Real-time streaming moderation, where early exiting can cut roughly 20% of computation while keeping macro-F1 within one point of the full model.
- Safety guardrails for generated text, where prototype similarity improved LLaMA-Guard and BLOOMz-Guardrail on both implicit and explicit benchmarks with no fine-tuning.
- Dataset curation and pre-annotation, since examples with low prototype similarity or inconsistent predictions can flag ambiguous or underrepresented hate cases for human review.
Industry relevance: The method is parameter-free at classification time, requires only a single threshold hyperparameter for early exiting, and has a minimal data requirement (as few as 50 examples per class). That makes it attractive for teams that already run a fine-tuned encoder or a moderation guard model and want extra robustness without retraining pipelines.
Future Directions
- Calibrating the exit threshold δ on a per-layer basis to reduce the performance gap that early exiting introduces on out-of-domain data.
- Extending the prototype framework to multiview representations in multimodal architectures, where prototypes would be built jointly from text and other modalities.
- Constructing group-specific prototypes (for example, hateful texts targeting a group paired with neutral texts mentioning the same group) and auditing whether early exiting affects bias across protected groups — explicitly named as outside the scope of this study.
- Using prototype similarity as an interpretability signal to study how model depth reflects the subtlety of an instance, and to pre-annotate implicit hate data for human review.
Target Audience
Researchers and practitioners working on hate speech detection, content moderation, and model efficiency. It is most useful for those studying cross-domain and cross-task transfer in NLP, those building early-exiting or anytime-prediction systems, and engineers who maintain moderation or guardrail models and need low-cost, fine-tuning-free improvements. Readers already comfortable with transformer internals will get the most out of the layer-wise analysis.
Authors’ abstract
Optimization of offensive content moderation models for different types of hateful messages is typically achieved through continued pre-training or fine-tuning on new hate speech benchmarks. However, existing benchmarks mainly address explicit hate toward protected groups and often overlook implicit or indirect hate, such as demeaning comparisons, calls for exclusion or violence, and subtle discriminatory language that still causes harm. While explicit hate can often be captured through surface features, implicit hate requires deeper, full-model semantic processing. In this work, we question the need for repeated fine-tuning and analyze the role of HatePrototypes, class-level vector representations derived from language models optimized for hate speech detection and safety moderation. We find that these prototypes, built from as few as 50 examples per class, enable cross-task transfer between explicit and implicit hate, with interchangeable prototypes across benchmarks. Moreover, we show that parameter-free early exiting with prototypes is effective for both hate types. We release the code, prototype resources, and evaluation scripts to support future research on efficient and transferable hate speech detection.