Lone Pine at S em E val-2021 Task 5: Fine-Grained Detection of Hate Speech Using BERT oxic (2021)

Abstract: This paper describes our approach to the Toxic Spans Detection problem (SemEval-2021 Task 5). We propose BERToxic, a system that fine-tunes a pre-trained BERT model to locate toxic text spans in a given text and utilizes additional post-processing steps to refine the boundaries. The post-processing steps involve (1) labeling character offsets between consecutive toxic tokens as toxic and (2) assigning a toxic label to words that have at least one token labeled as toxic. Through experiments, we show that these two post-processing steps improve the performance of our model by 4.16% on the test set. We also studied the effects of data augmentation and ensemble modeling strategies on our system. Our system significantly outperformed the provided baseline and achieved an F1-score of 0.683, placing Lone Pine in the 17th place out of 91 teams in the competition. Our code is made available at https://github.com/Yakoob-Khan/Toxic-Spans-Detection

## introduction the promotion of respectful discourse has always been a core tenet of civilized societies. the cambridge dictionary defines hate speech as "public speech that expresses hate or encourages violence towards a person or group based on something such as race, religion, sex, or sexual orientation." online platforms enable malicious actors to hide behind a cloak of anonymity and surreptitiously post toxic comments that are a "menace to democratic values, social stability and peace" (united nations). to combat this problem, such platforms often employ human moderators to address offensive content that goes against community standards. however, moderators are unable to manually keep pace with the large volume of user-generated content today. this motivates the development of natural language processing systems to automatically detect hate speech and ensure that online platforms remain healthy and inclusive for all. there has been extensive research on hate speech detection, with the creation of large datasets @xcite and the use of pre-trained text representations @xcite for varied modeling approaches. competitions on offensive language identification @xcite have further attracted attention to this topic. prior work has hitherto focused on classification at the document-level based on various taxonomies, such as whether a given text contains offensive language or if it is targeted towards an individual or group. this line of inquiry does not identify the toxic spans that ascribe a text as hate speech. doing so will assist human moderators to efficiently locate offensive content in long posts and elucidate further insight into hate speech explainability. this motivated the toxic spans detection task @xcite where systems are asked to extract the list of toxic spans that attribute to a text's toxicity. consider the following example foot_0 : text because he's a moron and bigot. it's not any more complicated than that. @xcite @xcite @xcite @xcite @xcite ## experiments the following sections describe the experimental set-up of our work. ## results on the following page, figure 2 visualizes the precision-recall curves foot_2 of all the models and an interesting observation we noted from the error analysis revealed that the system lacked nuance as it would sometimes classify toxic words used in neutral contexts (example 2). it is also worth mentioning that there was considerable noise in the ground truth annotations. our manual inspections concurred with the model's predictions that some words and phrases were used in offensive contexts but the annotators thought they were neutral (example 3 and 4). furthermore, we observed some inconsistencies in the labeling scheme as some annotations spanned entire sentences (example 5) while others only highlighted a few words in the sentence. these issues point to the subjective nature of hate speech and the challenges involved in its fine-grained classification. finally, the ensemble modeling strategies we explored did not outperform the standalone bert model. the late fusion technique performed slightly better than the spacy baseline, but it seemed that the sequence classifier made errors on similar parts of the input space as the token classifier. the multi-task learning approach underperformed compared to late fusion, suggesting that the sequence labeling and classification tasks are not closely related enough to benefit their joint training. ## conclusion and future work in this work, we have proposed bertoxic, an empirically powerful system that performed finegrained detection of hate speech. we found that our exploration of data augmentation and ensemble modeling strategies did not outperform the standalone model. the error analysis revealed that bert lacked nuance in understanding the use of offensive words in neutral contexts and encountered boundary detection issues when faced with noisy ground truth annotations. future avenues of work could address these limitations and explore other transformer-based models to develop more robust hate speech detectors. we hope that our findings inspire more creative approaches towards fine-grained detection of hate speech so that online discourse can remain healthy and inclusive for all.