LREC 2026 | HatePrototypes: Interpretable and Transferable Representations for Hate Speech Detection
Official implementation, datasets, evaluation scripts, and reproduction utilities for:
Irina Proskurina, Marc-Antoine Carpentier, Julien Velcin
Proceedings of LREC 2026, pp. 4387–4399 DOI: 10.63317/3opu4zq9p6pc
- 14 May 2026: 🎉 Presented at LREC 2026 in Palma de Mallorca. Proceedings
- 26 February 2026: 🔥 Official code and data release.
- 12 February 2026: ✨ Accepted to LREC 2026.
Current approaches to hate speech detection, particularly for implicit or indirect expressions of hate, often depend on repeated pre-training or fine-tuning of language models on newly collected datasets.
We introduce HatePrototypes, class-level vector representations derived from models optimized for hate speech detection and safety moderation. Prototypes built from as few as 50 labeled examples per class enable cross-dataset transfer between explicit and implicit hate benchmarks, and support parameter-free classification and early exiting.
For evaluation domain X and prototype source domain Y, relative transfer performance is:
Prototypes constructed from other datasets retain a substantial fraction of in-domain performance. The OLID-tuned model retains 95–100% of the in-domain macro-F1 for several prototype sources.
We additionally evaluate:
Largest reported improvements include:
- SBIC + LLaMA-Guard: 52.14 → 70.33 macro-F1
- IHC + BLOOMz-Guard: 49.49 → 60.92 macro-F1
Install from the repository root:
git clone https://github.com/upunaprosk/hate-prototypes.git
cd hate-prototypes
pip install -e ".[dev]"
The experiments use HateXplain, SBIC, IHC, and OLID. Processed splits are provided in data/all_data_hate.zip.
Fine-tune BERT:
python model_finetuning.py \
--model_name bert-base-cased \
--datasets hatexplain,olid,ihc,sbic \
--train_pattern "data/{ds}_train.csv" \
--test_pattern "data/{ds}_test.csv" \
--seeds 0,1,2,3,4 \
--models_dir models
Fine-tune OPT:
python model_finetuning_opt.py \
--datasets hatexplain,olid,ihc,sbic \
--train_pattern "data/{ds}_train.csv" \
--test_pattern "data/{ds}_test.csv" \
--models_dir models
BERT:
python hate_prototypes_bert.py \
--datasets hatexplain olid sbic ihc \
--seeds 0 1 2 3 4 \
--model_pattern "models/bert-base-cased-{ds}-s{seed}" \
--csv_train "data/{ds}_train.csv" \
--csv_test "data/{ds}_test.csv" \
--max_protos 500 \
--out_dir results/prototypes-bert
OPT:
python hate_prototypes_opt.py \
--datasets hatexplain olid sbic ihc \
--seeds 0 1 2 3 4 \
--model_pattern "models/opt-125m-{ds}-s{seed}" \
--csv_train "data/{ds}_train.csv" \
--csv_test "data/{ds}_test.csv" \
--max_protos 500 \
--out_dir results/prototypes-opt
Generate the transfer heatmap:
python analyze_prototype_transfer.py \
--seeds 0 1 2 3 4 \
--proto_dir "results/prototypes-{model}" \
--relative \
--out_pdf figures/prototype_transfer.pdf
Example with BLOOMz-3B-Guard:
python prototypes_guardrail.py \
--datasets hatexplain olid sbic ihc \
--seeds 0 1 2 3 4 \
--csv_train "data/{ds}_train.csv" \
--csv_test "data/{ds}_test.csv" \
--max_protos 500 \
--out_dir results/prototypes-bloomz
Entropy- and patience-based BERT baselines:
bash run_deebert_entropy.sh
bash run_deebert_patience.sh
Prototype-based early exiting is demonstrated in notebooks/early_exiting_prototypes.ipynb.
pytest -v
ruff check src tests
If you use HatePrototypes in your research, please cite:
@inproceedings{proskurina-etal-2026-hateprototypes,
title = {HatePrototypes: Interpretable and Transferable Representations for Implicit and Explicit Hate Speech Detection},
author = {Proskurina, Irina and Carpentier, Marc-Antoine and Velcin, Julien},
booktitle = {Proceedings of the Fifteenth Language Resources and Evaluation Conference (LREC 2026)},
month = {May},
year = {2026},
pages = {4387--4399},
address = {Palma, Mallorca, Spain},
publisher = {European Language Resources Association (ELRA)},
editor = {Piperidis, Stelios and Bel, Núria and van den Heuvel, Henk and Ide, Nancy and Krek, Simon and Toral, Antonio},
doi = {10.63317/3opu4zq9p6pc}
}
Citation metadata is also available in CITATION.cff.
See LICENSE for licensing information.


