AI & Society
In a 2023 study, BERT achieved a 96% F1 score at detecting online hate speech

In a 2023 paper published in Applied Artificial Intelligence, a peer-reviewed journal, researchers from King Abdulaziz University and the University of Tabuk tested two ways to find hate speech in online text. The tests used a combined balanced dataset assembled from available hate speech datasets. One approach used BERT, a large pretrained language model. The other approach fed domain-specific word embeddings, numeric representations of word meaning, into a bidirectional LSTM, a neural network that reads text in both directions. BERT achieved a 96% F1 score, and the domain-specific model achieved 93%. As a general measure, an F1 score balances precision, the share of flagged posts that were truly hateful, with recall, the share of true hate speech that was caught.
Why did the domain-specific model come close to BERT?
The paper notes that hate communities often use abbreviations, intentional misspellings, and coded words to avoid detection. The domain-specific word embeddings were trained on text from the same domain, so they can attach the negative meaning a word carries in hate speech. The authors say this helps detect coded words. BERT was trained on a much larger text corpus and scored higher, but the smaller domain-specific approach stayed close. The authors concluded that pretrained model performance is influenced by training data size, and they attributed the close result for the domain-specific approach to its training on same-domain data.
What is an F1 score?
An F1 score balances precision and recall. Precision is the share of flagged posts that were actually hateful, and recall is the share of true hate speech that the model caught.
What is BERT?
BERT is a large language model that has been trained on huge collections of text. In this study, the researchers used it to decide whether a piece of text was hate speech or not.
What is a word embedding?
A word embedding is a numeric representation of a word's meaning. Words with similar meanings get similar representations. The domain-specific embeddings in this study were learned from hate speech data, which the authors say helped assign negative domain meanings to coded words.
Limits and what's next
The abstract does not state limitations of the study. It closes with the authors' view that building large pretrained models from rich domain-specific social media content would be useful.
Source: Hind Saleh et al., “Detection of Hate Speech using BERT and Hate Speech Word Embedding with Deep Model,” Applied Artificial Intelligence, 2023.