Gender Bias in Masked Language Models for Multiple Languages (2022)

Abstract: Masked Language Models (MLMs) pre-trained by predicting masked tokens on large corpora have been used successfully in natural language processing tasks for a variety of languages. Unfortunately, it was reported that MLMs also learn discriminative biases regarding attributes such as gender and race. Because most studies have focused on MLMs in English, the bias of MLMs in other languages has rarely been investigated. Manual annotation of evaluation data for languages other than English has been challenging due to the cost and difficulty in recruiting annotators. Moreover, the existing bias evaluation methods require the stereotypical sentence pairs consisting of the same context with attribute words (e.g. He/She is a nurse).We propose Multilingual Bias Evaluation (MBE) score, to evaluate bias in various languages using only English attribute word lists and parallel corpora between the target language and English without requiring manually annotated data. We evaluated MLMs in eight languages using the MBE and confirmed that gender-related biases are encoded in MLMs for all those languages. We manually created datasets for gender bias in Japanese and Russian to evaluate the validity of the MBE.The results show that the bias scores reported by the MBE significantly correlates with that computed from the above manually created datasets and the existing English datasets for gender bias.

## introduction masked language models (mlms) @xcite , which are pre-trained on large corpora, have been used successfully in natural language processing tasks for various languages @xcite @xcite . unfortunately, it has been reported that mlms also learn social biases regarding attributes such as gender, religion, and race @xcite @xcite . the bias in mlms is evaluated by the imbalance of the likelihood between pairs of sentences associated with an attribute that has a common context (e.g. he/she is a nurse). @xcite masked the modified tokens (e.g. he, she), and @xcite masked the unmodified tokens (e.g. is, a, nurse) one word at a time and calculated the likelihood from their predictions to evaluate the bias. @xcite evaluated the bias using the average of the likelihoods of all tokens without masking the mlm. despite the numerous studies of social bias in mlms covering english, social biases in mlms for other languages remain understudied @xcite @xcite . to realise the diverse and inclusive social and cultural impact of ai, we believe it is important to establish tools for detecting and mitigating unfair social biases in mlms, not only for english but for all languages. however, the significant manual annotation effort, the costs and difficulties in recruiting qualified annotators remain major challenges when creating bias evaluation benchmarks for target languages. for example, existing bias evaluation benchmarks such as crows-pairs (cp; @xcite and stere-oset (ss; @xcite require humanwritten sentences (or pairs of sentences) eliciting different types of social biases expressed in the target language. however, scaling up this approach to all languages is challenging because recruiting a sufficiently large pool of annotators to cover the different types of social biases in those languages is difficult. because of the above-mentioned challenges, bias evaluation datasets and studies outside english remain under-developed. to address this problem, we propose multilin-figure 1 : the bias evaluation method using a parallel corpus between english and the target language and an english female and male words list. matrix values in step 2 are the similarities between male and female sentences. as for step 1, we do not require any knowledge about the target language or manual annotations because we use only the existing english attribute word lists and parallel corpora between english and the target language. this is attractive from a data availability point of view, which makes our proposed method easily extendable to different languages. @xcite found that the frequency of the words associated with the male gender to be significantly higher than that for the female gender in the data used to train mlms. they showed that these frequency-related biases are encoded into mlms, and independently of whether a sentence contains a stereotypical or antistereotypical context, an mlm that is biased towards the male gender, on average, assigns higher likelihood scores to sentences that contain masculine words than feminine words 3 . inspired by this finding, in step 2, we calculate the likelihood scores assigned by an mlm under evaluation to sentences that contain male and female related words in different contexts (e.g. he is a baseball player and she is a nurse). step 3 of our proposed method performs the computation of the bias score considering the similarity between the contexts in sentence pairs that contain male and female related words. the more similar the sentence pairs are, the more similar the estimates would be compared to the bias evaluation measures that require identical contexts. therefore, we weight the bias score estimates by the similarity of the sentence pairs using the sentence representations obtained from the mlm under evaluation. we ignore dissimilar sentence pairs and compute the bias score from the similar sen-tence pairs, which is defined as the percentage of sentence pairs where the sentence containing the masculine words is assigned a higher likelihood than the sentence containing the feminine words. bias in mlm is thought to depend on both the mlm and the evaluation data, so in this paper, we are investigating both using two corpora for english mlms. using the proposed method, we evaluated gender bias in mlms in eight other languages: german, japanese, arabic, spanish, portuguese, russian, indonesian, and chinese. prior work investigating social biases in mlms for english have shown that different types and levels of biases are shown by different mlms even for the same language @xcite . we defer covering different mlms across multiple languages to future work and focus on establishing mbe as an evaluation measure that can be used for such a study. our evaluations show that all mlms learn gender-related biases in all languages studied. to further validate mbe, we conduct a metaevaluation where we use an existing manually annotated english bias evaluation dataset and two additional datasets we annotate in this work covering gender-related biases in japanese and russian languages. the bias scores computed using mbe show significantly high correlations with human bias annotations on both datasets (cp and ss), showing its validity for multiple languages as a gender bias evaluation method. furthermore, we show that mbe is superior to methods using machine translations to evaluate bias in non-english languages. we also show that bias evaluation methods based on templates and word lists significantly overestimate the bias in mlms due to the unnaturalness of the created templates. our analyses on the effects of english names on gender information and preservation of gender information in parallel corpora suggest that bias can be evaluated reasonably even with some loss of gender information. ## related work in the study of bias in english mlms, @xcite and @xcite use a pair of artificial sentences created using manually written templates. however, template-based evaluation is problematic because it uses an artificial context that does not reflect the natural usage and distribution of words in the target language. to solve this problem, @xcite and nangia et al. in prior work on mlms, social biases for languages other than english have rarely been investigated. @xcite investigated ethnic bias in monolingual mlm in six languages by extending the templates to other languages using machine translation. the biases of mlms have been evaluated using templates for english and chinese @xcite and for english and german @xcite . @xcite investigated the gender bias of a classifier that predicts the occupation from resumes using multilingual word embeddings and multilingual mlm embedding in spanish, german and french. they evaluated bias by using machine translation on the english data, when an mlm is used to create feature representations in a specific task. however, this setting is different from that of our study, where we evaluate the bias of mlms independently of a specific task. moreover, the above studies do not discuss or propose methods on how to create evaluation data that can be applied to many languages. @xcite . unlike the contextual word embeddings produced by mlms, evaluating social biases in static word embeddings is relatively less complicated because it can often be done using word lists without requiring annotated sentences. in static word embeddings, bias has been investigated in various languages besides english due to this ease of annotating evaluation data. @xcite translated the english word lists into six languages and evaluated the bias of the word embeddings. @xcite proposed an evaluation metric for languages that require gender morphological agreement, such as in spanish and french. friedman et al. (2019) quantified the gender bias of word embeddings to understand cultural contexts with large-scale data, and used it to characterize the statistical gender gap in education, politics, economics, and health in us states and several countries. @xcite proposed a debiasing method by constructing the same bias space for multiple languages, and adapted it to three indian languages. other bias studies have been conducted for specific languages @xcite @xcite ; chávez mulsa and spanakis, 2020), but they are not easily transferable to novel languages. ## bias evaluation for multiple languages our proposed mbe score evaluates the gender bias of the target language under evaluation in three steps (see figure 1 ). in step 1, we first define the set of english sentences e and the set of target language sentences t of the parallel corpus, where n is the data size, and (e i , t i ) is a parallel sentence pair. let v f (e.g. she, woman, female) be the list of female words and v m (e.g. he, man, male) be the list of male words in english. we then extract sentences that contain a female or a male word from e. sentences that contain both male and female words are excluded. let us denote the set of sentences extracted for a female or a male word w by φ(w). let e @xmath0. the set of sentences in the target language of the source sentences included in e f and e m is denoted by t f and t m , respectively. it is assumed that gender information is retained in the parallel corpus, and whether this is actually the case is verified later. in step 2, we compute the likelihood for the full sentences in t f and t m . let us consider a target sentence @xmath1, w 2 , . . . , w |t | , containing length |t | sequence of tokens w i . we calculate the likelihood with all unmasked likelihood with attention weights (aula; kaneko and bollegala, 2021c) which evaluates the bias by considering the weight of mlm attention as the importance of tokens. given an mlm with pre-trained parameters θ, which we must evaluate it for its gender bias, let us denote the probability p mlm (w i |t ; θ) assigned by the mlm to a token w i conditioned on all the tokens of t . aula predicts all of the tokens in t using the attention weights to evaluate social biases considering the relative importance of words in a sentence, which is given by (1). here, α i is the average of all multi-head attentions associated with w i . in step 3, by comparing the likelihoods of female and male sentences returned by aula, we calculate the bias score as the weighted average of the similarities of contexts using the sentence representations produced by the mlm under evaluation. specifically, we use the percentage of male (t m ) sentences (e.g. he is a baseball player) preferred by the mlm over female (t f ) ones (e.g. she is a nurse) to define the corresponding multilingual bias evaluation measure (mbe bias score) as follows: here, i is the indicator function, which returns 1 if its argument is true and 0 otherwise. c(t m , t f ) uses the average of the last layer in mlm for all tokens except special tokens to compute the sentence embeddings of t m and t f respectively and computes the cosine similarity of these embeddings. according to this evaluation measure, values close to 50 indicate that the mlm under evaluation is neither females nor males biased, hence, it can be regarded as unbiased. on the other hand, values below 50 indicate a bias towards the male group and above 50 towards the female group. we report a statistically significant difference comparing to the model with randomly assigned results of the indicator function i in equation 2 and random. the mcnemar's test was used by classifying into four categories: only mlm was biased, only random was biased, both were unbiased, and both were biased. we use the statistically significant difference to determine if there is a bias. ## gender bias in masked language models ## meta-evaluation we perform a meta-evaluation to validate mbe scores against human bias ratings. in §5.1 we measure the correlation between mbe scores and existing measures on cp and ss, which are manu- ## bias in personal names one of the most significant differences in the frequency of words used in each language that affects gender bias is the names of people. in bias evaluation, male and female names are used to identify the gender @xcite . however, when names are transliterated from english to the target language, those transliterated names might be infrequent in the target language and might not be gender representative. to study the effect of this issue on gender bias evaluation, we conduct the following experiment. first, for the japanese and russian target languages, we replace the transliterated english names in the cp data with native japanese and russian names of the same gender. next, we compare the bias scores with those before the replacement in tables 4 and 5 . we extracted the top 10 most popular names among japanese foot_28 and russians foot_29 for both genders, and randomly substituted them with the transliterated english names. for example, we rewrite "シェリーはナースです" → "美咲はナースで す" ("shelly is a nurse" → "misaki is a nurse"). ## preserving gender in parallel corpora step 1 of the proposed method requires that gender information in english (source) sentence matches that with the target translation in the parallel data. to test for this, we examine the proportion of sentences in which the corresponding translated words of english "she" and "he" appear to determine whether female or male gender information is retained. we use the news corpus and select japanese and russian, which had no bias, and german and portuguese, which had significant biases ( figure 2 shows the percentage of sentences where gender was retained for male and female sentences in the target languages 35 . for german, portuguese, and russian, gender is retained in more than 80% of the sentences. this suggests that when the the percentage of gender-preserved sentences is large, it does not affect the mbe score. in japanese, gender information is retained in only about 60% of sentences, which is much lower than in other languages. this may be because japanese is a nullsubject language that allows independent clauses to omit explicit subjects. in fact, in some cases, gender words were omitted in the parallel corpus, for example "he owns a grocery store and runs a motorcycle rental business." was translated to "自 分の食料品店を持ち、 レンタルバイクビジ ネスも営んでいる。 (owns a grocery store and runs a rental motorcycle business.)". contrarily, from the results in ## conclusion in this paper, we showed that a bias evaluation data and evaluation of mlms for discriminatory bias can be systematically created as long as there is a parallel corpus of english and the target language and a list of female and male words in english. our meta-evaluation proved that the proposed multilingual bias evaluation method could perform correct evaluation comparing against method using manually created data, at least for russian, japanese, and english. the experimental results show that gender bias exists in all eight languages of our experiments. we also showed that the proposed method is supe-rior to the methods that use machine translation to translate the english bias evaluation data into the target language and the methods that use templates and word lists.