HateBERT: Retraining BERT for Abusive Language Detection in English
Summary
General-purpose BERT is trained mostly on standard, neutral text, which limits it on social-media abusive language. The authors adapt it rather than train a new model from scratch. They built RAL-E, a corpus of English Reddit comments from subreddits that Reddit banned for harassment, hate, violence or similar content. About 1.49M messages (43.8M tokens, 2012–2015) were collected. They then continued Masked Language Model training of BERT base-uncased on this corpus, producing HateBERT.
Compared with generic BERT under identical fine-tuning, HateBERT scored higher on all three benchmarks: OffensEval 2019 (offensive language), AbusEval (abusive language) and HatEval (hate speech). The gain was largest on AbusEval. Cross-dataset experiments showed that how well a fine-tuned model transfers depends on how compatible the annotated phenomena are, ordered by specificity: offensive language is the broadest, then abusive language, then hate speech. The work shows that cheap further pre-training on a carefully chosen community corpus yields a useful domain model. Both the model and the dataset are released.
Key points
- RAL-E contains 1,492,740 messages and 43,820,621 tokens, with 342,377 types and an average post length of 32.25 tokens.
- Only 1.2% of RAL-E tokens are explicit offensive words, based on Wiegand et al.'s lexicon with an offensiveness score of at least 0.75. Only 260,815 messages contain such a word.
- Training setup:
- continued MLM training of BERT base-uncased with the original vocabulary;
- 100 epochs, about 2M steps, batch size 64, sequences up to 512 tokens;
- Adam with learning rate 5e-5;
- one V100 GPU for about 18 days.
- In-dataset macro F1, BERT vs. HateBERT:
- AbusEval: .727 vs .765;
- OffensEval 2019: .803 vs .809;
- HatEval: .480 vs .516.
- Known limitations: the corpus is skewed toward r/fatpeoplehate. The authors collected about 1.3M more messages, including from three additional subreddits, to rebalance it.
Interesting ideas
- I1. Platform moderation as weak labels. Community bans act as a free, large-scale signal for selecting domain text, without manual annotation. A similar approach could gather domain corpora from moderated or blocked sources in other languages.
- I2. Templates to check vocabulary-free adaptation. Because the vocabulary was unchanged, the authors confirmed the domain shift by comparing fill-mask predictions on simple templates such as "[someone] are [MASK]". This is a quick sanity check for any continued pre-training run.
- I3. Interpret transfer through a phenomenon hierarchy. Instead of collapsing different label schemes into one binary category, the authors explain cross-dataset results by how broad or narrow each annotated phenomenon is. This is a more principled way to compare datasets whose definitions only partly overlap.
- I4. Lexicon audit of the pre-training corpus. Measuring the share of explicit slurs showed that the corpus is not just profanity. It shows that keyword scraping would have missed much of the relevant material.
- I5. Practical privacy measures. The authors dropped usernames and community names, both from the release and from training. They also manually checked a sample to confirm that messages cannot be found again by searching their text. These are lightweight safeguards for releasing scraped social-media data.
Cited by
- ToxiGen: A Large-Scale Machine-Generated Dataset for Adversarial and Implicit Hate Speech Detection
- SemEval-2023 Task 10: Explainable Detection of Online Sexism
- ToxicChat: Unveiling Hidden Challenges of Toxicity Detection in Real-World User-AI Conversation
- Orca 2: Teaching Small Language Models How to Reason
- Orca: Progressive Learning from Complex Explanation Traces of GPT-4
- Explainable AI for Ethical Counter Speech Generation in Hate Speech Mitigation
Cite
@inproceedings{caselli2021hatebert,
title = {{HateBERT: Retraining BERT for Abusive Language Detection in English}},
author = {Caselli, Tommaso and Basile, Valerio and Mitrović, Jelena and Granitzer, Michael},
booktitle = {Proceedings of the 5th Workshop on Online Abuse and Harms (WOAH 2021)},
year = {2021},
doi = {10.18653/v1/2021.woah-1.3},
url = {https://doi.org/10.18653/v1/2021.woah-1.3}
}References
- Davidson et al., 2019). Furthermore, we think that such tools must always be used under the supervision of humans. Current datasets are completely lacking the actual context of occurrence of a messsage and the associated meaning nuances that may accompany it, labelling the positive classes only on the basis of superficial linguistic cues. The deployment of models based on HateBERT “in the wild” without human supervision requires additional research and suitable datasets for training. We see benefits in the use of HateBERT in research on abusive language phenomena as well as in the availability of RAL-E. Researchers are encouraged to be aware of the intrinsic biased nature of HateBERT and of its impacts in real-world scenarios. find
- Francesco Barbieri, Jose Camacho-Collados, Luis Espinosa Anke, and Leonardo Neves. 2020. TweetEval: Unified benchmark and comparative evaluation for tweet classification. In Findings of the Association for Computational Linguistics: EMNLP 2020, pages 1644–1650, Online. Association for Computational Linguistics. find our card
- Valerio Basile, Cristina Bosco, Elisabetta Fersini, Debora Nozza, Viviana Patti, Francisco Manuel Rangel Pardo, Paolo Rosso, and Manuela Sanguinetti. 2019. SemEval-2019 task 5: Multilingual detection of hate speech against immigrants and women in twitter. In Proceedings of the 13th International Workshop on Semantic Evaluation, pages 54–63, Minneapolis, Minnesota, USA. Association for Computational Linguistics. find our card
- Michaela Benk. 2019. Data Augmentation in Deep Learning for Hate Speech Detection in Lower Resource Settings. Ph.D. thesis, Universität Zürich. find
- Tommaso Caselli, Valerio Basile, Jelena Mitrovic, Inga Kartoziya, and Michael Granitzer. 2020. I feel offended, don’t be abusive! implicit/explicit messages in offensive and abusive language. In Proceedings of The 12th Language Resources and Evaluation Conference, pages 6193–6202, Marseille, France. European Language Resources Association. find our card
- Ilias Chalkidis, Manos Fergadiotis, Prodromos Malakasiotis, Nikolaos Aletras, and Ion Androutsopoulos. 2020. LEGAL-BERT: The muppets straight out of law school. In Findings of the Association for Computational Linguistics: EMNLP 2020, pages 2898– 2904, Online. Association for Computational Linguistics. ↗ our card
- Eshwar Chandrasekharan, Umashanthi Pavalanathan, Anirudh Srinivasan, Adam Glynn, Jacob Eisenstein, and Eric Gilbert. 2017. You can’t stay here: The efficacy of reddit’s 2015 ban examined through hate speech. Proceedings of the ACM on Human-Computer Interaction, 1:1–22. find
- Thomas Davidson, Debasmita Bhattacharya, and Ingmar Weber. 2019. Racial bias in hate speech and abusive language detection datasets. In Proceedings of the Third Workshop on Abusive Language Online, pages 25–35, Florence, Italy. Association for Computational Linguistics. ↗ our card
- Paula Fortuna and Sérgio Nunes. 2018. A survey on automatic detection of hate speech in text. ACM Computing Surveys (CSUR), 51(4):85. find
- Leon Graumas, Roy David, and Tommaso Caselli. 2019. Twitter-based Polarised Embeddings for Abusive Language Detection. In 2019 8th International Conference on Affective Computing and Intelligent Interaction Workshops and Demos (ACIIW), pages 1–7. find
- Pushkar Mishra, Helen Yannakoudakis, and Ekaterina Shutova. 2018. Neural character-based composition models for abuse detection. In Proceedings of the 2nd Workshop on Abusive Language Online (ALW2), pages 1–10, Brussels, Belgium. Association for Computational Linguistics. find
- Suchin Gururangan, Ana Marasović, Swabha Swayamdipta, Kyle Lo, Iz Beltagy, Doug Downey, and Noah A. Smith. 2020. Don’t stop pretraining: Adapt language models to domains and tasks. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 8342–8360, Online. Association for Computational Linguistics. ↗
- Jelena Mitrović, Bastian Birkeneder, and Michael Granitzer. 2019. nlpUP at SemEval-2019 task 6: A deep neural language model for offensive language detection. In Proceedings of the 13th International Workshop on Semantic Evaluation, pages 722–726, Minneapolis, Minnesota, USA. Association for Computational Linguistics. find
- Muhammad Okky Ibrohim and Indra Budi. 2019. Multi-label Hate Speech and Abusive Language Detection in Indonesian Twitter. In Proceedings of the Third Workshop on Abusive Language Online, pages 46–57. find
- David Jurgens, Libby Hemphill, and Eshwar Chandrasekharan. 2019. A just and comprehensive strategy for using NLP to address online abuse. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 3658– 3666, Florence, Italy. Association for Computational Linguistics. find
- Endang Wahyu Pamungkas and Viviana Patti. 2019. Cross-domain and cross-lingual abusive language detection: A hybrid approach with deep learning and a multilingual lexicon. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics: Student Research Workshop, pages 363–370. find
- Mladen Karan and Jan Šnajder. 2018. Cross-domain detection of abusive language online. In Proceedings of the 2nd Workshop on Abusive Language Online (ALW2), pages 132–137, Brussels, Belgium. Association for Computational Linguistics. find
- Orestis Papakyriakopoulos, Simon Hegelich, Juan Carlos Medina Serrano, and Fabienne Marco. 2020. Bias in word embeddings. In FAT* ’20: Conference on Fairness, Accountability, and Transparency, Barcelona, Spain, January 27-30, 2020, pages 446– 457. ACM. find
- Rohan Kshirsagar, Tyrus Cukuvac, Kathy McKeown, and Susan McGregor. 2018. Predictive embeddings for hate speech detection on twitter. In Proceedings of the 2nd Workshop on Abusive Language Online (ALW2), pages 26–32, Brussels, Belgium. Association for Computational Linguistics. find
- Fabio Poletto, Valerio Basile, Manuela Sanguinetti, Cristina Bosco, and Viviana Patti. 2020. Resources and Benchmark Corpora for Hate Speech Detection: a Systematic Review. Language Resources and Evaluation, 54(3):1–47. find
- Jinhyuk Lee, Wonjin Yoon, Sungdong Kim, Donghyeon Kim, Sunkyu Kim, Chan Ho So, and Jaewoo Kang. 2019. BioBERT: a pre-trained biomedical language representation model for biomedical text mining. Bioinformatics, 36(4):1234–1240. find our card
- Marco Polignano, Pierpaolo Basile, Marco de Gemmis, and Giovanni Semeraro. 2019. Hate speech detection through alberto italian language understanding model. In Proceedings of the 3rd Workshop on Natural Language for Artificial Intelligence co-located with the 18th International Conference of the Italian Association for Artificial Intelligence (AIIA 2019), Rende, Italy, November 19th-22nd, 2019, volume 2521 of CEUR Workshop Proceedings. CEUR-WS.org. find
- Ping Liu, Wen Li, and Liang Zou. 2019. NULI at SemEval-2019 task 6: Transfer learning for offensive language detection using bidirectional transformers. In Proceedings of the 13th International Workshop on Semantic Evaluation, pages 87– 91, Minneapolis, Minnesota, USA. Association for Computational Linguistics. find our card
- Manoel Horta Ribeiro, Pedro H Calais, Yuri A Santos, Virgı́lio AF Almeida, and Wagner Meira Jr. 2018. Characterizing and detecting hateful users on twitter. In Twelfth International AAAI Conference on Web and Social Media. find
- Shervin Malmasi and Marcos Zampieri. 2018. Challenges in discriminating profanity from hate speech. Journal of Experimental & Theoretical Artificial Intelligence, 30(2):187–202. find
- Marian-Andrei Rizoiu, Tianyu Wang, Gabriela Ferraro, and Hanna Suominen. 2019. Transfer learning for hate speech detection in social media. arXiv preprint arXiv:1906.03829. ↗
- J Nathan Matias. 2019. Preventing harassment and increasing group participation through social norms in 2,190 online science discussions. Proceedings of the National Academy of Sciences, 116(20):9785–9789. find
- Maarten Sap, Dallas Card, Saadia Gabriel, Yejin Choi, and Noah A. Smith. 2019. The risk of racial bias in hate speech detection. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1668–1678, Florence, Italy. Association for Computational Linguistics. ↗ our card
- Flavio Merenda, Claudia Zaghi, Tommaso Caselli, and Malvina Nissim. 2018. Source-driven Representations for Hate Speech Detection. In Proceedings of the 5th Italian Conference on Computational Linguistics (CLiC-it 2018), Turin, Italy. find
This page in Markdown → https://md.research.elamur.ai/free/en/papers/caselli-2021-hatebert-retraining-bert-abusive-language/