UTNLP at S em E val-2021 Task 5: A Comparative Analysis of Toxic Span Detection using Attention-based, Named Entity Recognition, and Ensemble Models (2021)

Abstract: Detecting which parts of a sentence contribute to that sentence’s toxicity—rather than providing a sentence-level verdict of hatefulness— would increase the interpretability of models and allow human moderators to better understand the outputs of the system. This paper presents our team’s, UTNLP, methodology and results in the SemEval-2021 shared task 5 on toxic spans detection. We test multiple models and contextual embeddings and report the best setting out of all. The experiments start with keyword-based models and are followed by attention-based, named entity- based, transformers-based, and ensemble models. Our best approach, an ensemble model, achieves an F1 of 0.684 in the competition’s evaluation phase.

## introduction when social media platforms were first introduced, they allowed users to post content on any topic they wished, without restricting the type of content they were allowed to put out. this absence of restrictions, along with the anonymity of users through these platforms @xcite , resulted in the spread of offensive language and hate speech online. while one might think there are only a small number of users who produce these types of hateful content, it has been shown that if social media platforms are left unmoderated, over time, the language of the community as a whole will change such that it highly correlates with the speech of hateful users rather than non-hateful ones @xcite . given the huge number of social media postings every day, manual moderation of these platforms is not a possibility. as a result, many researchers began to study automatic hate speech detection. most studies on hate speech detection only provide labels at the sentence level, showing whether the construct as a whole is toxic or not. but these types of models, offer little explanation as to why the class was predicted, making it hard for human moderators to interpret the results @xcite . in an attempt to solve the aforementioned issue, we took part in semeval-2021 shared task 5 @xcite , where we aim to detect which spans of a sentence cause it to become toxic. our contributions are as follows: we begin our experimentation by evaluating a random baseline. next, we test keyword-based methods, trying to find if toxic spans often include words that are known as hateful or negative in available word lists. we then test attention-based models, building on the hypothesis that what the attention model learns to focus on when detecting toxic speech, are the toxic spans. afterwards, we look at the issue as a named entity recognition problem, by considering toxic as a named entity category. finally, we fine tune t5-base and explore the possibility of looking at the task as a text-to-text problem. we compare different neural network architectures and embeddings, and report the model with the best performance. additionally, we experiment with some hand-crafted features and evaluate their effectiveness in detecting toxic spans. our best result, an ensemble of named-entity-based models, achieves an f1 of 0.684. ## related work in this section we provide a brief overview of studies on hate and toxic speech detection, followed by work on span detection in different sub-fields. ## data in this section, we will provide a brief description of the datasets utilized in this study. we will begin with our main dataset in which span-level toxicity has been labeled (3.1), next we look at other datasets that were used to better train our models, namely the hate word list that was used (3.2.1) and the sentence-level hate speech data (3.2.2). ## methodology in this study we have tested and compared various models to perform toxic span detection. in this section we will go over the structure and hyperparameters of these models. the codes of all models are publicly available on github foot_0 . ## results in this section we will report the results of the models introduced in the previous section (4) on the toxic span detection task. per the competition evaluation instructions, for all models the f1 score is reported.