Gender-tuning: Empowering Fine-tuning for Debiasing Pre-trained Language Models (2023)

Abstract: Recent studies have revealed that the widely-used Pre-trained Language Models (PLMs) propagate societal biases from the large unmoderated pre-training corpora. Existing solutions require debiasing training processes and datasets for debiasing, which are resource-intensive and costly. Furthermore, these methods hurt the PLMs’ performance on downstream tasks. In this study, we propose Gender-tuning, which debiases the PLMs through fine-tuning on downstream tasks’ datasets. For this aim, Gender-tuning integrates Masked Language Modeling (MLM) training objectives into fine-tuning’s training process. Comprehensive experiments show that Gender-tuning outperforms the state-of-the-art baselines in terms of average gender bias scores in PLMs while improving PLMs’ performance on downstream tasks solely using the downstream tasks’ dataset. Also, Gender-tuning is a deployable debiasing tool for any PLM that works with original fine-tuning.

## introduction pre-trained language models (plms) have achieved state-of-the-art performance across various tasks in natural language processing @xcite @xcite . one of the crucial reasons for this success is pretraining on large-scale corpora, which is collected from unmoderated sources such as the internet. prior studies @xcite @xcite @xcite have shown that plms capture a significant amount of social biases existing in the pretraining corpus. for instance, they showed that the plms learned that the word "he" is closer to the word "engineer" because of the frequent cooccurrence of this combination in the training corpora, which is known as social gender biases. since plms are increasingly deployed in real-world sce-narios, there is a serious concern that they propagate discriminative prediction and unfairness. several solutions for mitigating the social biases have been proposed, including: using banned word lists @xcite , building deliberated training datasets @xcite , balancing the biased and unbiased terms in the training dataset @xcite , debiasing embedding spaces @xcite , and self-debiasing in text generation @xcite . although all these solutions have shown different levels of success, they tend to limit the plms' ability @xcite . for example, the banned words solution prevent gaining knowledge of topics related to banned words. also, some of them hurt the plms' performance on downstream tasks. furthermore, dataset curation and pre-training are two resourceintensive tasks needed for most of the above solutions @xcite . in this study, we address the challenges mentioned above by proposing an effective approach named gender-tuning for debiasing the plms through fine-tuning on downstream tasks' datasets. for this goal, gender-tuning perturbs the training examples by first finding the gender-words in the training examples based on a given gender-word list. then gender-tuning replaces them with the new words to interrupt the association between the gender-words and other words in the training examples ( to evaluate the effectiveness of our proposed method, we conducted comprehensive experiments following two state-of-the-art debiasing baselines: sent_debias (sent-d) @xcite and fairfil (fairf) @xcite . the results show that gender-tuning outperforms both baselines in terms of the average gender-bias scores in the bert model while improving its performance on the downstream tasks. in addition, we reported the performance of gender-tuning applied to the roberta that shows considerable improvement. finally, our ablation studies demonstrate that all components of gender-tuning, including two training phases and joint loss, play an essential role in achieving success. ## methodology we propose a novel debiasing approach, named gender-tuning (figure 1 ), that performs the debiasing process and fine-tuning simultaneously on the downstream tasks' dataset. for this aim, gender-tuning integrates two training objectives: 1) masked language modeling (mlm) training objective for gender-word perturbation and 2) finetuning for classification. in each training batch, gender-tuning works as follows: gender-tuning uses mlm to perturb training examples by masking the existing gender-word(s) foot_0 . the mlm training objective is to predict masked token(s) with a mean cross-entropy loss that we denote as perturbation-loss (l perturb ). the training examples with predicted tokens, called genderperturbed examples ( the gender-tuning training objective is to minimize joint-loss to ensure that the label of the perturbed example is the same as the label of the original training example. in the following, we present how joint-loss impacts the training process of gender-tuning in each training batch: suppose the mlm predicts an incorrect token. for instance, the example: "the film affirms the power of the [actress]" changes to "the film affirms the power of the [trauma]". in this example, the predicted word [trauma] is a non-related genderword that raises perturbation-loss value (l @xmath0. in this case, even if fine-tuning classifies the perturbed example correctly, joint-loss is still big enough to force gender-tuning to continue training. also, suppose gender-tuning creates social gender bias through gender perturbation. for instance, the example: "angry black [actor]" changes to "angry black [woman]" that "woman" and "actor" are not close semantically that raises perturbation-loss moreover, we observed that sometimes example perturbation changes the concept/label of training examples. for instance, the input: "[he] is an excellent [actor] (label: positive)" changes to "[she] is a wonderful [murderer] (label: positive)", and fine-tuning classification output is correct (l f ine-tuning ≈ 0). in this example, the predicted word [murderer] is conceptually far from gender-related words @xcite . so, perturbation loss becomes significant, which creates a big value for joint-loss to force gender-tuning to continue training. finally, we found examples that mlm replaces the gender-word with the [unk] token. in these examples, the perturbation-loss is close to zero (l perturb ≈ 0) and the output of the finetuning classifier is incorrect (l f ine-@xmath1. in this case, the joint-loss is big enough to continue training and provide a new chance for mlm to predict a meaningful token instead of a [unk]. more analysis of our perturbation strategy can be found in section 4.1 and ## experimental setup to evaluate our proposed method, we conduct experiments by following the evaluation process of the two state-of-the-art baselines (sent-d and fairf) such as the bias evaluation metric (seat), applied plms, and downstream tasks' datasets. 2 we report the seat effect size (e-size), average absolute e-size, and classification accuracy on downstream tasks for three different setups: 1) origin: fine-tuning the plms on the downstream task datasets using huggingface transformers code @xcite . 2) gender-tuning random : instead of replacing the gender-words in an training example, gender-tuning random replaces a certain percentage of an input tokens randomly (5% of each input sequence). 3) gender-tuning: the proposed method. we used the same hyperparameter for all three setups for a fair comparison. ## results and discussion training input perturbed type label with [his] usual intelligence and subtlety. with [the] usual intelligence and subtlety. neutral 1 by casting an [actress] whose face projects by casting an [image] whose face projects that [woman] 's doubts and yearnings , that [person] 's doubts and yearnings , neutral 1 it succeeds. it succeeds. certainly has a new career ahead of [him] if certainly has a new career ahead of [her] if convert-gender 1 [he] so chooses. [she] so chooses. by [men] of marginal intelligence , with by [people] of marginal intelligence , with neutral 0 reactionary ideas. reactionary ideas. why this distinguished [actor] would stoop so low. why this distinguished [man] would stoop so low. same-gender 0 it is very awful --and oozing with creepy [men]. it is very awful --and oozing with creepy [unk] . deleting 0 proves once again [he] hasn't lost. proves once again [he] hasn't lost . identical 1 for three experiment setups (section 3) and two state-of-the-art baselines. the results show that gender-tuning outperforms the baselines regarding the average absolute effect size for both plms on all datasets. also, in contrast with the baselines, gender-tuning improves the accuracy of both plms on all downstream tasks. it shows that the proposed method preserves the useful semantic information of the training data after debiasing. the gender-tuning random results show an inconsistent effect on the bias scores. although gendertuning random improves the plms' accuracy on the downstream tasks, it significantly magnifies the bias score in the bert model on sst-2 and cola. also, it slightly reduces the average bias score in the roberta on all datasets and in bert on the qnli. ## ablation we conduct the ablation experiments to demonstrate the effectiveness of gender-tuning components, including 1) joint-training process and 2) joint-loss in gender-tuning's debiasing performance ( in both plms, results illustrate that gendertuning is more effective for reducing the average gender bias than in two ablation experiments. the two ablation experiments magnify the bias scores noticeably, while gender-tuning gains the smallest seat absolute effect size, especially in the bert model. results also show that the ablation experiment setups that do not benefit from jointloss cannot update the mlm and plm when the output of the fine-tuning classification is correct (l f ine-tuning ≈ 0), even though the correct output likely bases on the gender biases in the plms. ## conclusion we propose a novel approach for debiasing plms through fine-tuning on downstream tasks' datasets. the proposed method is an aggregation of biasword perturbation using mlm and fine-tuning classification. in this study, we evaluated our proposed method on gender biases and named it gendertuning. comprehensive experiments prove that gender-tuning outperforms two state-of-the-art debiasing methods while improving the performance of the plms on downstream tasks. the key advantage of our approach is using the fine-tuning setting that allows the training process to be carried out without needing additional training processes or datasets. also, it makes gender-tuning a plug-andplay debiasing tool deployable to any plms.