UIRISC at SemEval-2023 Task 10: Explainable Detection of Online Sexism by Ensembling Fine-tuning Language Models
Year: 2023

Abstract:
Under the umbrella of anonymous social networks, many women have suffered from abuse, discrimination, and other sexist expressions online. However, exsiting methods based on keyword filtering and matching performed poorly on online sexism detection, which lacked the capability to identify implicit stereotypes and discrimination. Therefore, this paper proposes a System of Ensembling Fine-tuning Models (SEFM) at SemEval-2023 Task 10: Explainable Detection of Online Sexism. We firstly use four task-adaptive pre-trained language models to flag all texts. Secondly, we alleviate the data imbalance from two perspectives: oversampling the labelled data and adjusting the loss function. Thirdly, we add indicators and feedback modules to enhance the overall performance. Our system attained macro F1 scores of 0.8538, 0.6619, and 0.4641 for Subtask A, B, and C, respectively. Our system exhibited strong performance across multiple tasks, with particularly noteworthy performance in Subtask B. Comparison experiments and ablation studies demonstrate the effectiveness of our system.

heading: 1 Introduction
text: Sexism refers to prejudice, stereotyping, or discrimination based on one’s gender or sex, typically against women(Wikipedia contributors, 2023). Sexist expressions cause gender stereotypes and discrimination, such as "whxxe" or "Husbands. Kill your piece of sxxt commie wives1". Especially with the widespread and fast propagation of social media, the negative impact of gender discrimination has been further exacerbated. Online sexist texts can not only affect the user experience and community environment but also lead to offline violence, persecution even crimes, which may cause
∗*Corresponding author 1This sentence was selected from the website by Semeval-
2023 Task 10’s organizers.
much harm to real society. It is essential to eliminate sexist expressions and build a harmonious community.
For this reason, many previous studies have focused on capturing offensive posts and comments(Chen et al., 2012; Davidson et al., 2017). These methods usually filtered texts by keywords matching e.g. lexicon-based models. However, the increasing number of active users made it ineffective of lexicon based methods. Moreover, many expressions do not contain indicative words e.g "bixxh", but they still convey strong sexism and prejudice as well, such as "I always cancel as soon as the driver accepts my ride is a female. Then immediately rebook1". They both in turn affect the performance of sexism detection.
In this paper, we propose a computational system named System of Ensembling Fine-tuning Models (SEFM) for Semeval-2023 Task 10: Explainable Detection of Online Sexism (EDOS)(Kirk et al., 2023). SEFM consists of three modules: Data Preprocessing, Sexsim Detection, and Ensembling. In the data preprocessing module, we extend the original dataset by Easy Data Augmentation (EDA). The sexism detection model includes three improvements to enhance the model effect: Sexism Indicator for subtask A (SIA), Feedback for subtask B (FB), and Fine-graind Indicator for subtask C (FIC). The codes will be open sourced2.
The rest of the paper is organized as follows: Section 2 gives a brief literature survey. Section 3 introduces our system. Section 4 describes the experimental setups, while Section 5 demonstrates the results and makes the analysis. Finally, we reach the conclusions in Section 6.

heading: 2 Background
text: Semeval-2023 holds Task 10: Explainable Detection of Online Sexism, which contains three sub-
2https://github.com/tianyumyum/UIRISCSemEval2023Task10
2082
tasks to flag what is sexist content and explain why it is sexist, which aims to approach explainable sexism detection via the granularity of classification labels3.

heading: 2.1 Task Introduction
text: As shown in Figure 1, EDOS is aimed at sexism detection that is more accurate as well as explainable, with fine-grained classifications for sexist content from Gab and Reddit.
• SUBTASK A - Binary Sexism Detection: the task requires a two-class classification that requires the system to predict whether a post is sexist or not based on the content.
• SUBTASK B - Category of Sexism: the task requires a four-category classification according to the degree of sexism on sexist posts, where the system must predict one of four categories: (1) threats, (2) derogation, (3) animosity, (4) prejudiced discussions.
• SUBTASK C - Fine-grained Vector of Sexism: for posts which are sexist,this task requires an 11-class classification, and the system must predict one of 11 fine-grained vectors, all based on the Task B classification.

heading: 2.2 Related Work
text: Many studies have focused on automated methods to effectively detect hate speech detection and sexism classification. Waseem and Hovy (2016) explored the role of extra-linguistic features with character n-grams in classifying tweets as racism, sexism, or neither. Badjatiya et al. (2017) tried various deep-learning approaches for the same threeway classification. Zhang and Luo (2018) explored
3https://codalab.lisn.upsaclay.fr/competitions/7124#
skipped CNN and a combination of CNN and GRU for hate speech detection. They presented the first attempt to categorize comments involving any type(s) of sexism in a multi-label way. Zia et al. (2022) employed pseudo-label fine-tuning of Transformer Language Models to detec automatic hate speech. Samory et al. (2021) applied psychological scales to detect different dimensions of sexism.
More recently, pre-trained language models(PLM) such as BERT(Devlin et al., 2018), ERNIE(Zhang et al., 2019), and GPT-3(Brown et al., 2020), have set the new state-of-the-art in hate speech detection and sexism classification tasks. It has also become a consensus to fine-tune large-scale PTMs for specific AI tasks, rather than learning models from scratch(Qiu et al., 2020). In order to adapt language models to domains and tasks, Gururangan et al. (2020) pre-trained different domain unlabeled data into RoBERTa model, whose performance exceeds RoBERTa in all tasks. So far, various efforts have been made to explore large-scale PTMs in text classification tasks(Tian et al., 2020; Rezaeinia et al., 2019).

heading: 3 System Overview
text: The framework of our system is shown in Figure 2, and the detailed description for each part is presented as follows.

heading: 3.1 Data Preprocessing
text: Considering the colloquial and non-standard characteristics of text originating from social media, we pre-processed the data according to the following steps.
• Removal of meaningless words
We identified certain words in the dataset that carried no actual meaning, such as "[URL]" and "[USER]", and proceeded to eliminate them. We carried out further experiments by eliminating stopwords, but observing a slight degradation in the performance.
• Emoji interpretion
We utilized the emoji library4 to retain the emotional content conveyed by emojis. By incorporating this information, we were able to enhance the accuracy and nuance of our insights into the emotional content of the text data.
4https://pypi.org/project/emoji/
• Data augmentation
Class distribution of the sample is unbalanced, which may lead to a significant bias in our detection model. To address this issue, we employed an oversampling approach. To prevent overfitting, we added slight random perturbations to each data expansion(Wei and Zou, 2019) 5, including (1) synonym replacement, (2) random insertion of synonyms, (3) random exchange of word order, and (4) random deletion of words.

heading: 3.2 Sexism Detection

heading: 3.2.1 Task-adaptive language model construction
text: To capture semantic information beyond the limitations of keyword matching, such as with W2V, our system employs deep learning networks. Finetuning different PLMs with varying hyperparameters and training strategies has gained popularity for its capability to extract and integrate contextual information, thereby enabling more precise language processing (Song et al., 2021; Yuan et al., 2022).
5https://github.com/jasonwei20/eda_nlp
Considering that direct exposure to more data without considering domain relevance is detrimental to the final task performance(Gururangan et al., 2020), we adopt task-adaptive pre-training (TAP) to boost our results. We use vast amounts of unlabelled data into Masked LM and next sentence prediction. Pre-training is continued with more task-relevant unlabeled data to output an adaptive pre-trained model for this task.

heading: 3.2.2 Sexism indicaror for subtask A
text: The EDOS task publisher provided public with the edos_labelled_individual_annotations.csv6. Disagreements may have arisen among the three annotators during the annotation process of the training set, potentially compromising the quality of the data. We observed that although each text was annotated by three annotators, only two of them flagged consistently for the some text.
Base on this dataset, we first labeled each text as either Gold or Silver. If the three annotators agreed, the data was considered Gold, and if there was disagreement, the data was considered Silver. Table 1 shows an example.
We designed an indicator to assign different weights to Gold and Silver during model training.
6https://github.com/rewire-online/edos/ tree/main/data
We then used these labeled texts as new input for training the pre-trained model, and compared the results with our previous approach.

heading: 3.2.3 FB and FIC module for subtask B and C
text: We noticed that subtask B and C shared the same training dataset and had identical task release and deadline dates. Therefore, besides improving the model architecture, we introduced new modules for subtask B and C respectively. For subtask B, we added a new module called FB (Feedback to B) to receive the results from subtask C detection. The entire process involved preprocessing the text, using task-adaptive pre-trained models to derive the results, and receiving feedback from subtask C. Finally, majority voting was performed on the output of the two branches to obtain the final output.
Similarly, for subtask C, we introduced the FIC (Fine-graind Indicator for subtask C) to receive the detection results from subtask B. One branch of subtask C involved an 11-class classification task, while the other branch refined the classification based on the subtask B results for explainability.

heading: 3.3 Loss Function
text: Loss function is used to evaluate the extent to which the predicted and true values of the model are not the same. For different models and different tasks, the choice of loss function has a great impact on the performance of the model. In this task, the focal loss function is used to better alleviate the problem of unbalanced number of sample categories.
BCE loss(o, t) = −1/n ∑
i
(t[i] ∗ log(o[i])
+(1− t[i]) ∗ log(1− o[i])) (1)
As shown in equation 1, we use balance factor to alleviate data imbalance in Balance Cross Entropy loss(BCE loss).
FL (pt) = −αt (1− pt)γ log (pt) (2)
Focal loss is specially designed for the one-stage detection algorithm, which reduces the loss weight of easy-to-distinguish negative examples. It increases the dynamic adjustment factor based on BCE loss to achieve the effect of difficult sample mining. We make the model more focused on hard-to-learn samples by setting γ value as 2 in the equation 2, thus the network will not be biased by too many negative examples.

heading: 4 Experiments

heading: 4.1 Dataset
text: SemEval-2023 Task 10 dataset(Kirk et al., 2023) comprises 14,000 annotated instances, yet suffers from imbalanced data distribution among the categories for all three subtasks. Subtask C, in particular, exhibits a significant class imbalance, with the label "3.4 condescending explanations or unwelcome advice" having only 54 instances in the training dataset. This could hinder the model’s ability to learn sufficient features for accurate predictions. Figure 3 illustrates the distribution of instances for each label in the training dataset.

heading: 4.2 Experiment Setup
text: We utilized the PyTorch library (Paszke et al., 2019) and the HuggingFace library (Wolf et al., 2020) our models and trained and tested them on Kaggle GPUs. We split the entire dataset into a 90%
training set and a 10% development set. We used the Adam optimizer with a learning rate of 1e-3 and a weight decay coefficient of 1e-6. The batch size was set to 16, and the models were trained for 2 epochs. We adopted accuracy, precision, recall, and macro f1 score as the evaluation metrics.

heading: 4.3 Baselines
text: To evaluate the performance of our system, we applied it to the following methods and compared the results before and after the application.
• BERT (Devlin et al., 2018) utilized masked language model to generate deep bidirectional linguistic representations and achieved SOTA performance in various downstream tasks.
• ALBERT (Lan et al., 2019) proposed an improvement on BERT by integrating two techniques, which contributes to a smaller number of parameters and faster training speed.
• RoBERTa (Liu et al., 2019) employs a larger number of model parameters, more training data, and a larger batch size.
• ERNIE2.0 (Sun et al., 2019) was able to extract valuable information, including vocabulary, syntactic, and semantic representations from the training corpus.

heading: 4.4 Ensemble
text: For the final output, we apply a majority voting to ensemble several models (Ganaie et al., 2022). Given that we employ data augmentation during data preprocessing, a single "rewire_id" can correspond to multiple similar texts after model detection. Majority voting aggregates the predictions of different outputs and determines the final label.

heading: 5 Results and Analysis
text: We submitted the scores predicted by the ensemble method introduced above. The official ranking is presented in Table 3. In subtask B, we ranked 12th, which verifies the validity of our system.

heading: 5.1 Comparison Experiments

heading: 5.1.1 Comparison on different models
text: Table 2 presents the results of online sexism detection. In our experiments, we evaluate the performance of our system by applying it to the following methods and comparing the Macro-F1 results before and after the application. We first test the four baselines on three subtasks, and then use the best settings with our system on four pre-trained models for comparison.

heading: 5.1.2 Comparison on different loss functions
text: To better evaluate the impact of Focal loss in the system, we experimented with three different loss functions. In order to better alleviate the problem of unbalanced number of sample categories, we used the focal loss function.
Among the three loss functions, BCEloss weighted loss alleviates the problem of number balance among samples and performs better than Cross Entropy loss (CEloss). Focal loss not only alleviates the problem of sample imbalance, but also
incorporates detection difficulty into the formula and performs the best among the three. The results are shown in Table 4.

heading: 5.1.3 Improvement by data augmentation
text: Data augmentation is a useful technique for increasing a model’s generalization capabilities and can also address many other challenges and problems, from overcoming a limited amount of training data to regularizing the objective (Bayer et al., 2021). In this task, data augmentation differs from the oversampling operation of directly copying the data by using insertion, deletion, and replacement operations on the sample data to avoid overfitting. The results are shown in Table 5.

heading: 5.2 Ablation Studies
text: To demonstrate the effectiveness of the Indicator and Feedback components, we also conducted ablation studies with the following experiments:
- SIA: removing the Indicator to A module, the train data is the official version without weighing
the confidence of label. - FB: removing the Feedback from B module, subtask B is directly divided into four categories, without ensemble the results from Task C.
- FIC: removing the Indicator to C module, subtask C selects from 11 vectors with the highest probability after the Softmax layer, without fusion of subtask B.
The ablation experiments for subtask A are shown in Table 6, and the ablation experiments for subtasks B and C are shown in Table 7.

heading: 5.3 Comparison on Ensemble Combination
text: To better explore the results of ensemble, we validated the four pre-trained models with different combinations. As shown in Table 8, the outputs after majority voting don’t show obvious improvements.
Since the pre-trained models are all BERTs or variants of BERTs with less complementarity between them, it is more difficult to achieve the improvement of results directly through ensembles.

heading: 5.4 Error Analysis

heading: 5.4.1 Diversity Analysis of Model Results
text: We analyzed our experimental results and found that ensembling exclusively BERT variants did not offer significant improvement over individual bestperforming variants. However, as Kuncheva and Whitaker (2003) point out, diversity among models is a crucial factor in explaining the performance gains achieved by ensembles. The idea for our measure came from the work of Hansen and Salamon (1990). We verified the relationship between diver-
sity and correctness using a measure of diversity based on the distribution of difficulty.
Let D = {D1, . . . , DL} represent a set of models and P = {P1, . . . , PL} denote the set of accuracy of models in D. We define a discrete random variable X that takes values in 0, 1/L, ..., 1 and indicates the proportion of classifiers in D that correctly classify a given input x inferred from texts.The experimental data for the error analysis were 2,000 validation set data in Subtask A and 486 data in Subtask B(Kirk et al., 2023).
As shown in Figure 4, Out of the 2,000 data points for Task A, 1,702 data points showed identical results across the four models, while just under 15% of the data points showed some level of divergence across the four models. For Task B, out of the 486 data points, 253 data points yielded identical results across the four models and 151 data points yielded identical results across the three
models. These results suggest that the four models produced very similar outputs.
Figure 5 displays X’s histogram for L = 4. High consistency of the models is observed when data is distributed at the ends.In Subtask A and Subtask B, our experiments showed that less than 14.9% of the data varied between the models in D. The difficulty θ is defined as Var(X), scaled into [0,1], where higher values indicate poor classifier team performance. θa = 0.7531 and θb = 0.1852 for Subtask A and Subtask B, respectively. These results suggest a lack of diversity in the models’ outputs in D, which may limit ensemble performance. Only 11 texts were corrected by the ensemble in Task A compared to the individual Roberta model results.

heading: 5.4.2 Case Studies
text: We analyzed the limitations of model predictions in D by examining texts that four models couldn’t classify. Examples in Table 9 show the models
struggle with typing errors, slang, spoken words, metaphors, and lengthy sentences. Colloquial expressions and metaphors in dataset texts make it hard for models to learn features. Ambiguous sentences in the dataset also challenge categorization.

heading: 6 Conclusions
text: This paper presents our system implementation submitted to the SemEval-2023 Task 10: Explanable Detection of Online Sexism. We propose an Ensemble Framework named System of Ensembling Fine-tuning Models (SEFM) that enhances system performance by pre-processing data, training Taskadaptive PLMs, and adding Indicator and FB modules. In the future, we plan to utilize the dataset further and improve our system by introducing the prompt module and fusion label vector to enhance the performance of online sexism detection.

heading: Acknowledgements
text: We would like to thank Zhengyi Zhao, who offered us invaluable advice on improving the experiments. Additionally, we extend our gratitude to Yaojie Lu for his insightful comments and suggestions, which greatly contributed to the completion of this paper.
This project was partially supported by National Natural Science Foundation of China (Grant number: 61976066), Beijing Natural Science Foundation (Grant number: 4212031), the Fundamental Research Fund for the Central Universities (Grant numbers: 3262023T19), and Research Funds for NSD Construction, University of International Relations (Grant numbers: 2021GA07).

heading: Future Work
text: In the future, we plan to utilize the dataset further and improve our system by introducing the prompt module and fusion label vector to enhance the performance of online sexism detection