An Analysis of Social Biases Present in BERT Variants Across Multiple Languages
Abstract
Although large pre-trained language models have achieved great success in many
NLP tasks, it has been shown that they reflect human biases from their pre-training corpora.
This bias may lead to undesirable outcomes when these models are applied in real-world settings.
In this paper, we investigate the bias present in monolingual BERT models across a diverse set of languages (English, Greek, and
Persian).
While recent research has mostly focused on gender-related biases, we analyze religious and ethnic biases as well and propose a template-based method to measure any kind of bias, based on sentence pseudo-likelihood, that can handle morphologically complex languages with gender-based adjective declensions.
We analyze each monolingual model via this method and visualize cultural similarities and differences across different dimensions of bias.
Ultimately, we conclude that current methods of probing for bias are highly language-dependent, necessitating cultural insights regarding the unique ways bias is expressed in each language and culture (e.g. through coded language, synecdoche, and other similar linguistic concepts).
We also hypothesize that higher measured social biases in the nonEnglish BERT models correlate with user-generated content in their training.
Introduction
Recent research in large pre-trained language models has shown that these models inherit human biases and prejudices present in their pre-training corpora [1; 2; 3; 4, inter alia ].
Examples of potentially undesirable biases that the models learn are associations between profession and gender, certain ethnic groups and propensity for violence and general cultural stereotypes (see Figure 1 for an example).
Studying these biases is important because the stereotypical associations that the model has learned may lead to biased real-world outcomes.
This paper focuses on analyzing monolingual
BERT models for languages other than English, but the proposed methods are applicable to any masked language model (MLM).
One of the issues with existing research into biases of models for different languages is that the languages selected all exist within the same cultural sphere, typically languages like French and German [5].
However, despite the linguistic differences present in these languages, the gap between the underlying cultures is quite small, given their geographic proximity.
In our analysis, we incorporate pre-trained BERT models trained on different languages from outside the European cultural sphere (English, Greek, and Persian).
The majority of existing research into bias analyzes gender bias, particularly with regards to professions and other similar attributes [6; 7].
There is also some other research targeting ethnic bias [8].
In this paper, we investigate broader biases such as race, ethnicity, and religion across monolingual language models.
One would expect different cultures to be biased against different cultural groups, and this would be reflected in the models trained on texts produced by these cultural groups.
For example, bias in the Anglosphere against Muslims is a well studied phenomenon, and it has been shown that models trained on English language texts inherit this bias [9].
Bias in monolingual models of other languages however has not been well studied in the literature.
To sum up, our contributions in this paper are as follows.
We investigate bias in diverse monolingual BERT models, including a language from outside the European cultural sphere of influence ( Persian)
We investigate more complex dimensions of sociolinguistic bias rather than only the binary gender bias which most recent literature has focused on.
We propose a method based on sentence pseudo-likelihoods that allows investigating bias in monolingual MLMs for languages that are morphologically complex and decline according to gender via a novel templating language, where existing word-probability-based probing methods are inadequate.
Related Work
Methods of Measuring Bias The most closely related methods for measuring bias to the one proposed in this paper are proposed in [10] and [8].
In [10], the existing CrowS-Pairs [11] bias benchmark is translated into French.
Both the original benchmark and the translated benchmark use a similar sentence scoring system as in this paper.
However, the translated benchmark avoids issues of gender-based declension of adjectives, instead preferring to rewrite the sentence to avoid the adjective entirely (via periphrasis).
In this paper, we experiment with a declension-adjusted minimal pair/set of sentences , where multiple words in the sentence are potentially modified to result in grammatical sentences in both the male and female cases.
Cross-lingual and Cross-cultural Analysis While a huge amount of research has been done on
English texts, few papers have studied the extent to which word embeddings capture the intrinsic bias in models for other languages.
[12] proposes a debiasing method and applies it to the Multilingual
BERT (M-BERT) model, and shows that English training data can help mitigate gender bias in
M-BERT in the Chinese language.
[13] measures profession bias in multilingual word embeddings (using both fastText and M-BERT embeddings) with inBias , a proposed evaluation metric that uses pairs of male/female occupation terms (e.g. “doctor” and “doctora” in Spanish) to measure gender bias.
They also introduce a new dataset, MIBs , by manually collecting pairs of gender and profession words in English, French, Spanish, and German languages.
While these papers are analyzing models for different languages, these languages all exist in the same cultural sphere.
In [8], the authors study how ethnic bias varies across models for different languages with different cultures (inc. Korean, English, Turkish, etc.) using monolingual BERT models.
The authors claim that different amount of ethnic biases across these languages reflects the historical and social context of the countries.
The authors propose two debiasing techniques as well as a metric called Categorical Bias score in order to measure the ethnic bias.
For measuring ethnic bias, the authors use a simple “People from [X]” template, where X is a country.
In our investigation, we expand on this approach, using a broader scope of terms (including demonyms in our analysis, rather than just the aforementioned periphrastic construction).
Bias Analysis
In this section, we introduce the models, datasets, and evaluation metrics we use to investigate the biases present in BERT models across different languages.
In the context of this paper, “investigating bias” refers to systematically probing monolingual BERT models for disparities in the probabilities they produce for contexts that include mentions of protected classes (e.g. race, gender, ethnicity, religion), where otherwise the context does not imply one class or another.
A perfectly unbiased model would produce equal probabilities regardless of the class mentioned.
We label the disparity between produced probabilities as “bias”, aligning with the notion that the use of these models, which produce these unequal probabilities and therefore whose contextual embeddings encode these disparities, for downstream tasks would lead to unequal real-world outcomes.
3.1 Models
In this analysis three models are used, each a version of BERT trained on a large monolingual corpus in each language.
The three models used are BERT, GreekBERT, and ParsBERT.
The English
BERT [14] as mentioned is the standard BERT model trained by Google.
This model is pre-trained on two corpora:
BooksCorpus and English Wikipedia.
GreekBERT [15] is trained on the Greek
Wikipedia, the Greek portion of Oscar [16] (a filtered and cleaned multilingual version of the Common
Crawl dataset), and the Greek portion of the European Parliament Proceedings Parallel Corpus [17].
ParsBERT [18] is trained on the Persian Wikipedia, MirasText [19], Persian Ted Talk transcriptions, a set of Persian books, as well as several other large Persian websites.
As opposed to the original BERT, both GreekBERT and ParsBERT are trained on user-generated (forum/social-media type) content.
3.2 Dataset
In this study, we created several lists of terms relating to protected classes that may trigger bias (nationality, race, gender), as well as lists of terms to use to probe for the biases associated with the aforementioned terms (negative adjectives, professions, etc.).
The former category is referred to as “bias attribute terms”, while the latter is referred to as “concept words”.
These lists of words are then used in combination with handwritten templates to probe the model for bias.
This template-based approach with word lists is more flexible for examining model bias against a broad range of groups simultaneously, compared to the benchmark dataset that deals with only pairs of sentences (e.g. [11]).
In addition to templates, for the analysis of bias in GreekBERT, a small corpus of templates was created by crawling the subreddit “/r/greece” on Reddit.
The discourse on this subreddit represents highly-colloquial Greek and concerns many diverse contexts and conversation topics.
As such, we felt it would be an effective way to probe bias in contexts that would more closely mirror the actual use of GreekBERT in analyzing real-world user-generated texts.
3.3 Evaluation Metrics
Sentence Probabilities (PL)
The first metric used in this analysis is the probability of a sentence given a certain context.
Sets of sentences were created which differ only by a single bias attribute term, where bias is defined as the difference between the sentence probabilities for those sentences in the same set.
A novel templating language which takes into account noun gender when replacing words was used to decline sentences correctly such that they remain grammatical.
This was used for Greek, the only language of the three tested that has grammatical gender.
An ideal model would assign similar probabilities regardless of the bias attribute term present in the sentence.
However,
MLMs like BERT are not able to directly provide the probability of a whole sentence, but only the probability of the masked token, since they are not true language models.
As such, we used the scheme provided by [20] to produce pseudo-likelihoods (PLs) for each sentence using the formula
[Equation]
where W is a sequence of tokens and P MLM is the probability of the masked token ( w t ) given the context ( W \ t ) using the MLM.
Categorical Bias (CB Score)
Another metric we report, as an aggregate metric over the entire set of templates, is an adaptation of the “Categorical Bias” score (CB score) [21].
This score is used to aggregate the amount of bias across multiple templates (slight variations in wording grouped together) and bias attribute term sets and is defined as follows:
[Equation]
where T is the set of all templates, N is the set of all bias attribute terms (e.g. ethnicity, religion, race),
A is the set of all concept words (e.g. negative adjectives), and P is the probability of the sentence (given t , a , and n ).
This allows us to directly compare the “amount” of bias for each language model in each type of bias category.
The final metrics we discuss are the distribution difference and normalized word probability .
The distribution difference is calculated between different pairs of masked terms when looking at the probabilities of the attribute word (adapted from [7]) and normalized word probability is a way to adjust for certain bias attribute terms being less likely to be predicted.
The evaluations and discussions on these metrics’ limitations are reported in Appendix A.3 and A.4, respectively.
Experimental Results
In this section, we represent the qualitative and quantitative experimental evaluations.
More detailed discussions about the qualitative results are provided in Section 5.
4.1 Sentence Pseudo-Likelihood Scores
In this subsection, we highlight some particularly interesting results of the bias visualizations, with more results shown in the Appendix (Sections A.1 to A.5).
In the Figures 2 to 4, the “[MASK]” terms correspond to the aforementioned “bias attribute terms” (e.g. nationality, race, gender terms, etc.).
The pseudo-likelihood (PL) scores for the sentence completed with each bias attribute term are normalized to sum to one.
The template label at the bottom of these visualizations is provided as a sample of what the templates look like, but in reality, the visualizations are an aggregation of several similarly-worded templates to reduce the variability of the results.
4.2 Categorical Bias
The aggregated CB scores for each of the categories of biased examined are shown in Table 1a.
The
English model as mentioned previously shows the least amount of variation, with the lowest CB scores.
You may find a more detailed breakdown in Appendix A.2.
[Table]
[Table]
[Table]
Table 1b includes the CB scores for the templates collected from the Reddit corpus.
These templates concern gender bias and are mostly consistent with the regular template CB values for gender (Persian with the lowest, Greek with the highest).
Observations and Discussion
Miscellaneous Observations One observation we noted generally was higher bias in the nonEnglish models , both in the visualizations and the aggregated CB scores.
We hypothesize this difference stems from the fact that the English BERT model was trained on only BookCorpus and English Wikipedia.
In contrast, both ParsBERT and GreekBERT were additionally trained on usergenerated content, as mentioned previously, in the form of Oscar, the filtered version of the Common Crawl dataset for each language.
The link between user-generated content and higher levels of bias has been noted previously in the literature [1].
In Figure 2, we note that the English and Greek models have a much stronger association with the word “hysterical” and women than the Persian model.
This is likely explained by the historical use of the word against women predominantly in the West, while the equivalent term in Iran is not used in the same way or in such a prevalent manner.
We also note a stronger association between indecision and women for the Greek model especially, as well as for the Persian model, but not as much for the
English model, again likely reflective of culture-specific stereotypes.
Figure 3 represents how the Persian model has a strong bias against Judaism, which can possibly be explained through historical context with Israel.
Similarly, both the English and Greek models have significant associations between Islam and violence, which could potentially be explained by narratives regarding Islam in popular discourse in the West.
In Figure 5, we observe a bias in both the Greek and English models against Hinduism as a religion in the left part, which did not align with our expectations regarding cultural bias.
Furthermore, the Persian model is actually the one to show the largest bias against Islam.
As well, we note the aforementioned evidence of the Persian model’s negative associations with Judaism.
In Figure 2, in the bottom visualization, we observe a difference in the associations of the model with the concept of sexism.
It seems that in the English model, the association is between “sexism” and Asians as well as Americans broadly, while in the Greek and Persian models, the association is stronger with Chinese people specifically.
We also note an association with Ukrainians in the Greek model.
Moreover, when using the “People from [X]”-style template, as shown in right part of Figure 5, there is a strong association between sexism and the Middle East in the English model, but this association is entirely nonexistent in both the Persian and Greek models. This could again be the result of links in the popular discourse of the Anglosphere.
In Figure 6, we note that the association between manipulation and women is far stronger in Greek than in English and Persian, with English showing almost an exact 50/50 split.
In the Persian model, women are still more associated with manipulation, but not to the same extent as in the Greek model.
For the use of violence, it is interesting to note that in all three models men are more associated with violence (the left figure).
This aligns reasonably well with culture-specific tropes and associations between genders and characteristics (e.g. the trope that women are more manipulative than men, but men are more outright violent).
Associations between Ukrainians and Violence One interesting association that we noticed was between Ukrainians and adjectives relating to violence (see Figure 7).
This was observed in both the English and Greek BERT models, particularly in the Greek model.
We hypothesize that this link relates to media coverage of the conflicts in Ukraine dominating the news at particular points in time, leading the models to associate this specific ethnic group and these negative adjectives.
This points to a limitation of this type of bias probing used in our analysis, which is that it only demonstrates associations between terms.
Specifically, these associations do not encode directionality , or any indication of being the victims vs. the perpetrators .
Differences between “[X]ians” vs. “People from [X]” An interesting result that we observed arose from the difference between using demonyms directly versus the periphrasis “Person from [X]” or “People from [X]” in Figure 4.
We observed different bias distributions arising from these two cases.
Existing papers in the literature (e.g. [21]) use the periphrastic form, but we argue that they are not capturing the entirety of the ethnic bias the model can express through this wording, and are likely using the periphrastic form simply for translation simplicity.
Some of this divergence can potentially be explained through the contexts in which the specific constructions are likely to appear.
For example, in the results for the Persian model we see that the term “Americans” carries large connotations for the negative adjective word set, however “people from the United States” does not.
In popular media in Iran, “Americans” is mostly used as a form of synecdoche to refer to the US government.
Similarly, the Persian model is also much more sensitive to the phrasing “people from Israel”, rather than the Persian language equivalent of “Israelis”.
This can likely be explained through the fact that the demonym is not used as much to refer to people from Israel in Iran, but rather what is preferred is using either the nation term (the term “Israel” directly) or “Jews” via synecdoche (whereas this more general term is used to refer to Jews in the state of Israel specifically). In general, the fact that the bias distributions differ depending on the format of the probe seems somewhat counter-intuitive, especially when it comes to expressions that a human would consider equivalent (“person from the USA” and “American”). However, given that the representation of terms is informed by the contexts in which they appear, it makes sense that different wordings would produce different bias associations. This fragility of the bias probing is important for downstream practitioners to be aware of, as the wording they use will make a difference in the resulting bias in the model.
Negation Through the use of a gendered template utilizing negation (see Figure 8 among others) it was observed that the BERT models do not particularly seem to understand negation, especially the non-English models.
In effect, the models contradicted themselves, by providing higher probabilities to “men” in both the original and negated templates.
This is consistent with the existing body of knowledge demonstrating that Transformer-based language models do not have a good grasp on negation [22; 23, inter alia ].
The models saw the profession terms and simply assigned high probability to men despite the negative, despite the fact that to be logically consistent the probabilities should have been inverted, at least to some extent.
It was observed that non-English models seemingly exhibited less of an “understanding of negation” than the English model (see Figure 8).
Conclusion
In this paper 2 , we investigated the bias present in BERT models across diverse languages including
English, Greek, and Persian, rather than just a few languages from the same cultural sphere.
While the focus of this project was on analyzing gender, religion, and ethnic bias types, the evaluation methods we used are not limited to these social biases.
Our template set structures and sentence pseudo-likelihood-based scoring can be used for any type of bias.
This sentence scoring allows for bias investigation in languages with more complex accordance rules than English, that have adjectives that decline for gender for instance, where the standard word-probability scoring method would be unable to score fairly.
In this study, we observed that cultural differences, the dominant religion, and the history of countries (e.g. wars) strongly affect the bias the models learn from a given language corpus.
This explains why directly translating benchmarks (mostly originally written in English, with an Anglophone cultural context in mind) across languages is not necessarily a useful measure of the bias present in a given language model.
It was observed that bias probes tend to be relatively “fragile”, in terms of their sensitivity to exact wording, in ways that may be contrary to human expectations that a model be invariant to equivalent wordings.
To most effectively investigate bias in a given language model, cultural experts seem to be necessary to provide input on how to best craft probing tasks, as oftentimes bias is expressed through coded language and synecdoche, where straight translation of bias benchmarks from other languages will not detect it.
A Appendix A.1 More Pseudo-Likelihood Visualizations
More visualizations of the gender, religion, and ethnic bias can be observed in Figure 9, Figure 10, and Figure 11, respectively.
[Table]
A.2 Categorical Bias Scores
The detailed breakdown of CB scores is represeted in Table 2.
You can observe that Greek and
Persian BERT models tend to have more bias compared toth the English model.
A.3 Distribution Differences
The distribution difference (KL-divergence) is one of the metrics we use for measuring bias (adapted from [7]).
This metric can be calculated as: p dist ( Americans ) =
p ( [MASK] | Americans are [MASK]. ) , where p dist is the distribution of probabilities over the model’s entire vocabulary, for the masked term.
We then use these values to compute the pairwise KL-divergence between the distributions generated for all pairs of masked terms (e.g. Americans, Canadians, Germans, etc.).
We eventually report the largest KL-divergences.
This method avoids the use of concept word sets, instead looking at the distribution produced by the probabilities across the whole of the model’s vocabulary.
Tabledemonstrates the distribution difference values for all our experimental template sets in each bias type.
These distribution divergences represent the largest pairwise KL-divergence of any two terms in the bias attribute term set.
[Table]
[Table]
Overall, the Categorical Bias score (based on the variance, outlined in Section 3.3) seems to be a more effective indicator of bias than this KL-divergence-based metric, as it seems to more closely reflect the bias we observed in the visualizations.
From a theoretical perspective, the distribution difference over all attribute masks seems to be more weakly justified than over a specific set of attribute words (i.e. how the CB score works).
The reason for this is that if there is a female context, certain terms such as “mother”, “girl”, “she”, “her”, etc. should indeed be higher in the ranking over the model’s entire vocabulary.
As such, the distributional metric would appear to show bias in this context compared to the male context, however in reality it would not actually be reflective of the type of negative bias we are probing for, and would actually reflect a very natural association between the female context and words relating to the female gender.
A.4 Normalized Word Probability Scores
We conducted some experiments using word probabilities directly with normalization to adjust for certain bias attribute terms being less likely to be predicted by the model in general.
A concrete example of how the probability would be normalized is:
[Equation]
whereby the denominator is the probability that the model predicts “Americans” (the bias attribute term) for the position [MASK] 1 regardless of the concept word used (“rude”).
The intuition was that this would adjust for the fact that certain terms are more or less likely to be predicted regardless of the biased context.
Unfortunately, this method of normalization in practice performed extremely poorly.
With rare words, the model is unable to provide accurate low probabilities for them (this is mentioned as the “model calibration issue” in the literature [24, inter alia ]).
As such, the denominator with rare words would be extremely small, causing the normalized probability to blow up and dominate over other terms.
Furthermore, the word-scoring approach cannot handle gender-declined adjectives, a feature of Greek, so this approach was abandoned in favor of the more-consistent sentence PL scoring.
Some results using these scores are presented in Table
. A.5 Fine-grained bias word analysis in ethnicity bias
As indicated in Tables 2 and 3, we had two sets of experiments for measuring the ethnic bias in languages.
We selected some more important, coarse-grained ethnicities in order to get a better visualization.
Also, we picked more than 100 fine-grained ethnicities for more detailed analysis.
We report the top-5 most probable ethnic groups in Table 4 ( Warning: potentially offensive language ).
[Table]
Related bias attribute terms (using the geographical proximities) are represented in same colors.
It can be observed that models have definitely a high bias against African, Asian, and Middle East countries.
Also, the Greek model shows a bias against Greece neighbouring countries, i.e. North
Macedonia and Albania.