macech at S em E val-2021 Task 5: Toxic Spans Detection (2021)

Abstract: Toxic language is often present in online forums, especially when politics and other polarizing topics arise, and can lead to people becoming discouraged from joining or continuing conversations. In this paper, we use data consisting of comments with the indices of toxic text labelled to train an RNN to deter-mine which parts of the comments make them toxic, which could aid online moderators. We compare results using both the original dataset and an augmented set, as well as GRU versus LSTM RNN models.

## introduction in this digital era we live in, almost everyone is communicating online. as of january 2021, facebook, youtube, and whatsapp each have over 2 billion users, which means many differing viewpoints and perspectives being shared @xcite . with such a huge exchange of ideas, there is bound to be some toxicity within the comments. aside from discouraging users to continue with or join conversations, toxic comments can also taint users' perceptions on news sites @xcite . thus it is important to moderate online conversations without fully censoring users. while forums typically rely on human moderators, with such vast amounts of data coming in, it can be difficult for humans to keep up @xcite . advances in deep learning and machine learning is making text processing a viable option to replace, or at least assist, human moderators clean up comment sections @xcite . some methods rely on simply classifying whether a comment is toxic or not, but identifying what parts of the text are actually toxic can assist moderators and provide insight into what makes language toxic. the semeval task 5 aims to evaluate systems that detect toxic spans wihtin text using datasets where spans within the comments are labelled as toxic, differing from previously released datasets where whole comments were labelled as toxic or non-toxic @xcite . this is inherently a natural language processing task, similar to text classification and sentiment analysis. this study focuses on training a recurrent neural network to determine the indices of a given string that represent the toxic portions of a comment. recurrent neural networks are classically used for natural language and sequence labelling task, and one could view this task as a form of sequence labelling. the goal of sequence labelling is, given a sequence as input, assign a sequence of labels. because recurrent neural networks (rnns) are flexible in their use of context information and can recognize sequential patterns, they are an attractive and commonly used choice in sequence labelling @xcite . this paper approaches the task at hand with a sequence labelling methodology, applying an rnn and comparing the use of gated reccurent unit (gru) and long-short term memory unit (lstm) layers in the rnn. ## related work aggression in text is complex, often clouded by sarcasm or including repeat words that cause a model to incorrectly identify words as toxic. a study by vaidya, mai, and ning found that comments including identities, such as lgbtq+, black, muslim, and/or jewish identities, often resulted in false positives for toxic comments, so this was a bias we wanted to be aware of in our study @xcite . detecting toxic spans is not as common of a task as toxic comment detection or sentiment analysis. many studies surrounding toxic comments have been completed largely in part due to the availability of a large corpora of data released by the wikimedia foundation, as well as several kaggle competitions hosted by google jigsaw. other studies generally take a text classification approach similar to sentiment analysis, which as previously mentioned, is not exactly the task at hand @xcite . one of the comparisons made in this research is between gru and lstm recurrent models. generally, lstm units have issues with vanishing gradients when text sequences are too long, so grus are used instead. gru controls the flow of information like the lstm unit, but without the use of a memory unit @xcite . previous research has shown gru outperforms lstm for all depths in speech recognition. the same study determined that bi-directional rnn models consistently outperform uni-directional models and found that models with 5 or more recurrent layers did not improve the results @xcite . as a result, in our research, we compare gru and lstm models to find if gru will consistently outperform lstm in a sequence labelling task, as opposed to speech recognition, and use bi-directional rnn models with fewer recurrent layers, as they were not shown to have any benefit. this paper will also compare the results of augmented and non-augmented datasets to determine if the use of synonyms will improve the performance after training. ## experimental results in this section, we discuss the results from the two experiments -gru vs lstm models and augmented vs original data used in training. we use f1 scores to compare the two different models and types of data sets. the f1 scores, discussed later on, are a combination of both the predictions from the trained models and the comments that are predicted using common toxic words (which will henceforth be referenced as "guessed comments" for lack of better terms). the guessed comments do have a slight effect on the final results which will be described in this section 4.1 evaluation metric each model's performance was evaluated using an f1 score, as described in (martino et al., 2019). if the system is represented by a i , the return set from the system is s t a i , t represents a post or comment, and g represents the ground truth annotations for post t, then f1 score of a system is defined as: @xmath0, an instance where there are no toxic spans present, then f t 1 (a i , g) = 1 if no toxic spans are predicted, and f t 1 (a i , g) = 0 otherwise. to obtain the final f1 score for a particular system, the f1 scores are averaged over all posts t. ## conclusion we experimented with several different rnn models and ultimately utilized the results from bidirectional gru and lstm models. it was found that the gru model slightly outperforms the lstm model for this test case. as was found by gruber and jockisch, gru cells can be better for detecting true negatives and since 93% of the words in the training dataset we used were nontoxic words, it follows that gru cells may outperform lstm cells in cases where there are more negative instances than postive in the datasets. it would be interesting to explore if using both a gru cell and an lstm cell in a model would further increase performance, with gru focusing on less prevalent content and true negatives, and lstm focusing on high prevalent content and true positives. in the exploration of the use of augmented data, we found that not only did the models trained on augmented data perform worse than those trained on the original dataset, but they were also much slower to train. we compared if the f1 scores for observations with a single toxic word were higher for the models trained with augmented data, since only comments with a single toxic word present were augmented, but still the original datasets outperformed the augmented datasets. because the augmented data does not improve results, we can continue to use the original dataset to cut down on computation time. we also found that the f1 scores resulting from the augmented data training did not react as greatly to changes in the learning rates as the original datasets did, which may be interesting to explore further.