LT @ H elsinki at S em E val-2020 Task 12: Multilingual or Language-specific BERT ? (2020)

Abstract: This paper presents the different models submitted by the LT@Helsinki team for the SemEval 2020 Shared Task 12. Our team participated in sub-tasks A and C; titled offensive language identification and offense target identification, respectively. In both cases we used the so-called Bidirectional Encoder Representation from Transformer (BERT), a model pre-trained by Google and fine-tuned by us on the OLID and SOLID datasets. The results show that offensive tweet classification is one of several language-based tasks where BERT can achieve state-of-the-art results.

## introduction the number of social media users has reached 3.5 billion, and an average of 6,000 tweets are generated every second @xcite . with such a large volume of tweets, it seems inevitable that some use offensive language. a study from 2014 found that 67% of social media users had been exposed to online hate, and 21% had been the target of online hate @xcite . the usual approach on social media sites is to forbid hate speech in the terms of service and to censor any inappropriate content detected by their algorithms, but still, companies like facebook or twitter have been harshly criticized for not doing enough @xcite . this criticism has forced companies to try and find accurate and scalable solutions that solve the problem of offensive language detection using automated methods. workshops dealing with offensive language, such as trac @xcite , ta-cos @xcite , or alw1 @xcite , as well as shared tasks like germeval @xcite , trac-1 @xcite , and offenseval 2019 @xcite , are becoming more and more prevalent. the task we address here, semeval 2020 task 12 @xcite , is titled multilingual offensive language identification in social media and is divided into the following sub-tasks: a. offensive language identification in several languages (arabic, danish, english, greek, turkish): whether a tweet is offensive or not. b. categorization of offense types: whether an offensive tweet is targeted or untargeted. c. offense target identification: whether a targeted offensive tweet is directed towards an individual, a group or otherwise. in this paper the system created by the lt@helsinki team for sub-tasks a and c will be described. in sub-task a we participated in all the language tracks. for sub-task c the only language available was english. we qualified as second in sub-task c and our submission for sub-task a ranked first for danish, seventh for greek, eighteenth for turkish, and forty-sixth for arabic. in all submissions we used bert-base models @xcite fine-tuned on each dataset provided by the task organizers. we also experimented with random forest with tf-idf and other kinds of features, but the results on the development set were not as good as with transfer learning techniques based on pre-trained language models. we discovered that, at least for this data, the language-specific model worked better than the multilingual. ## background all the data used to train our classifiers was provided by the offenseval organizers @xcite . the tweets were retrieved from the twitter search api and manually labeled by at least two human annotators. as a pre-processing step, they desensitized all tweets replacing usernames and website urls by general tokens. the following datasets were used for the offensive language identification problem: some of the algorithms that can be found in the literature are random forest @xcite , logistic regression @xcite , and support vector machine @xcite , as well as deep learning approaches like convolutional neural networks @xcite or convolutional-gru @xcite . however, in 2018 deep pre-trained language models obtained state-of-the-art results in several nlp downstream tasks, text classification being one of them. in particular, google's bidirectional encoder representations from transformers (bert) @xcite stood above the rest for being deeply bidirectional and using the novel self-attention layers from the transformer model @xcite , which allows it to better understand a word's context by looking at both its left and right neighbours. bert provides out-of-the-box pre-trained monolingual and multilingual models that, after massive training on general corpora, can be fine-tuned with a small amount of task-specific data and still offer excellent performance. the results published in offenseval's previous edition @xcite proved that bert is well suited for the offensive language detection task, since it was the chosen method of most of the top teams, including the winners of subtasks a @xcite and c @xcite . for the danish dataset (sigurbergsson and derczynski, 2020) we used nordic bert foot_0 , which is pretrained on danish wikipedia texts, danish text from common crawl, danish opensubtitles, and text from popular danish online forums. all in all, the training corpus consists of over 90m sentences and almost 20m unique tokens. for the other languages we used the standard bert-base models @xcite with no further pre-training and only the provided datasets for each language, i.e. arabic @xcite , greek @xcite . in sub-task c, since the language was english it was possible to use the offensive language identification dataset (olid), provided by the organizers of offenseval 2019. despite consisting of different sub-tasks, all of them shared the same dataset that was annotated according to a three-level hierarchical model, so that each sub-task could use as dataset a subset of the previous sub-task's dataset. first, all tweets were labeled as either offensive (off) or not offensive (not). then, for sub-task b, all the offensive tweets were labeled as targeted (tin) or untargeted insults (unt). and finally, for the last sub-task, the third level of the hierarchy labeled targeted insults based on who was the recipient of the offense: an individual (ind), a group (grp) or a different kind of entity (oth). to illustrate this, figure 2 displays olid's label distribution. the corpus from sub-task c in offenseval 2019 contains 4,089 english tweets, of which 3,876 originally belonged to the training set and the remaining 213 to the test set (figure 2 ). we also had at our disposal over 9m english tweets provided by the offenseval 2020 organizers @xcite . however, these were processed by unsupervised learning methods instead of human annotators, which is why on this occasion each tweet was not associated with a label but given two values: (1) the confidence that it belongs to a specific class and (2) its standard deviation. ## system overview and experimental setup in this section we discuss the system we created and setup we used for subtask a and subtask c. ## results for danish, using nordic bert for the final submission, we obtained an accuracy of 92.38% and f1score of 81.18% (figure 1 a ). the confusion matrix shows that only 9 out of 34 offensive tweets (off) were misclassified, and 16 out of 294 not offensive tweets (not) were wrongly classified as offensive. regarding the other languages, for greek we obtained an f1-score of 82.6%, 77.2% for turkish, and 73.1% for arabic. in sub-task c our submission ranked second with an accuracy of 79.74% and f1-score of 66.99%. the relatively low f1-score is due to the high numbers of misclassifications of the minority class (only 33 oth instances were correctly classified out of 82) (see figure 1 b). despite our efforts in balancing the dataset, it seems like the skewed class distribution inevitably added bias to the model. it is impressive how good bert performed overall even though we applied very few pre-processing steps to the data. moreover, the results obtained on previously unseen data indicate that none of our models were heavily overfitted. ## conclusions our scores on evaluation data show that models pre-trained on general corpora can obtain competitive results when there is very little data available, as was the case of the danish sub-task where we obtained the best results. bert performed well on both tasks, but there is still room for improvement. in the future, we intend to experiment with those languages that we could not focus on this time. it should be noted that multilingual bert works best with languages similar to english @xcite so it is very likely that the other languages would have benefited from the use of language-specific models even more than danish as danish is the language most similar to english in comparison to greek, turkish, and arabic. a more thorough comparison between multilingual and language-specific bert would yield more definitive answers as to whether language-specific is always best or whether that is language-dependent. further examination and use of emotion-laden words in offensive texts could also help with the detection of offensive texts. examining other baseline methods and combining them into an ensemble model with majority voting is another approach to consider for future work. with regards to the class imbalance problem, other techniques such as adjusting the classification thresholds or enriching the dataset with back and forth machine translation of the minority class could prove to be useful.