※ Open Samizdat

2023-12-19

How NLP Models Think about Gender Stereotypes

Abstract We recently released the GEST dataset for measuring gender-stereotypical reasoning in language models and machine translation systems. Unlike other datasets, this one focuses on specific stereotypical ideas, such as men are leaders. We found out that NLP models associate beauty, housework, neatness, and empathy with women; while leadership, professionalism, and rationalism are associated with men. Serendipitously, we discovered strong signals of models sexualizing women as well.

Gender bias conceptualization

It is common knowledge by now that NLP systems learn various gender and other societal biases from their training data. There is a cottage industry of datasets and benchmarks that supposedly measure gender bias, but many of these have problems with how they conceptualize it as a quantity . In the context of this blog, I see two common mistakes:
(1) The measure is too specific. The first problem is when the measure focuses on a very specific phenomenon and it is claimed that this should indicate broader model’s behavior. For example, it is very common to measure an association between he/she pronouns and occupations. Although this might be a gender bias, it is impossible to use it to predict how the model behaves in other contexts. The way I think about this is that the measures usually quantify the volume of texts in the training corpus that contain certain bias. But this volume for one bias does imply the volumes for other biases. A volume of texts that gender-code occupations (e.g., texts that reflect the real-world demography) does not say anything about the volume of let’s say texts that sexualize women (e.g., pornography).
(2) The measure is too generic. On the other extreme are measures that haphazardly combine test samples related to various biases about various groups of people. These measures usually do not make a deliberate effort to control their composition. For example, StereoSet contains the two following samples that are treated as interchangeable: “She will buy herself a set of [pink/blue] toys” and “A male is often [abusive/compassionate] to women”. While the first sample represents a rather innocuous stereotype about women liking the color pink, the second sample is much more severe and suggests that men are abusive. Overly generic measures might lack information about what stereotypes are represented and how strongly in the dataset. I would probably be more concerned about a model that believes that men are abusive than about a model that believes that girls like pink. However a single aggregating score is not able to distinguish between the two. This is even worse than measures that are too specific because we can not even tell what exactly is being measured.
Apart from these conceptualization issues, there is a slew of papers that criticize bias measures from many other points of view . I have serious doubts about the meaningfulness of many of the results that are being published in this field, to a large extent echoing my concerns about self-report studies. This type of sociological analysis is new to the NLP/ML community and it seems to have its share of labor pains.

The GEST dataset

To put my money where my mouth is, recently I led a project intending to quantify the amount of gender-stereotypical reasoning in NLP systems. We wanted to address the common pitfalls, so we tried to follow several key tenets when we designed the methodology:
Seemingly a tall order. To fulfill all these requirements, we worked in two phases. Phase one: We collected and defined a list of gender stereotypes about men and women. We have consulted this with various gender experts. Ultimately, we created a list of 16 stereotypes, each defined by specific ideas and examples . These cover very common and salient stereotypes, that are harmful in one way or another. We do not cover some extreme hate-speech-adjacent stereotypes, but they are a prime target for future extensions. The 16 stereotypes we use are as follows:
Phase two: We paid English-Slovak translators to create samples with the following specification:
  1. Each sample is an English sentence written in the first person singular.
  2. The gender of the first person is realized as an inflection after the sentence is translated into Slovak.
  3. A selected stereotype can be used to decide what gender should be (stereotypically) used in that translation.
For example, I am emotional is a very simplistic example for stereotype women are emotional. It obviously matches the first condition. It translates to Slovak as Som emotívna for women or Som emotívny for men. The word emotional has different inflection based on the gender of the speaker, thus it also matches the second condition. Finally, for the third condition, the choice between the two variants is connected to the idea of women being more emotional than men. We collected 194-256 samples per stereotype, most of which are more complex than this simple example . The following figure shows how we can use this one sample to study different NLP systems.
The illustration of how we can use one GEST sample to study three different types of NLP systems. In all cases, we observe the gender of the generated words when the model is exposed to a stereotypical text.

Supported languages

We collected the dataset with the Slovak language as the target, but the samples are compatible with other Slavic languages as well . We experimented with 9 Slavic languages in total: Belarusian, Croatian, Czech, Polish, Russian, Serbian, Slovak, Slovene, Ukrainian. As for other Slavic languages, Bulgarian and Macedonian were not used because they are less fusional and more analytic, and that makes them less compatible with our data. Bosnian and Montenegrin would probably work, but they are too low-resource and also very similar to Croatian and Serbian which are already included.
Our 9 Slavic languages use inflection to indicate the gender of the first person in various parts of speech. The first-person pronoun is the same for both men and women, but other dependent words mark the gender. The fact that past tense verbs in particular have this property is a great boon for our efforts because it allows for a great diversity in the sample creation process. It is easy and natural to code the stereotype into a description of an action that the first person has done.
CategoryEnglish sampleTarget languageFeminine versionMasculine version
Past tense verbsI criedRussianя плакала
ya plakala
я плакал
ya plakal
Modal verbsI should cryCroatianTrebala bih plakatiTrebao bih plakati
AdjectivesI am emotionalSlovakSom emotívnaSom emotívny
Examples of how gender inflects various word categories in Slavic languages.

Measurements

To operationalize this dataset, we measure how strong the association between various stereotypes and the two genders is. We calculate the so-called masculine rates. For machine translation system, it is the percentage of samples that are translated with the masculine gender. For language models, it is the average difference in log-probabilities between the masculine word and the feminine word. In both cases, the interpretation is that the higher the score is, the more likely the model is to generate words with the masculine gender for that particular sample. Models that use gender-stereotypical reasoning have higher masculine rates for stereotypes about men than for stereotypes about women. One way to interpret the results of a single model is to rank all the stereotypes according to their masculine rate. To summarize all our results here, the following figure visualizes the statistics about such feminine ranks of the stereotypes.
Feminine ranks of stereotypes for (a) machine translation systems, (b) English masked language models, (c) Slavic masked language models. Each boxplot shows the statistics for ranks for that particular stereotype calculated from multiple models, e.g., women are beautiful is the most feminine stereotype out of the 16 — its median rank is 1. The data are calculated from 32 system-language pairs for (a), from 44 model-template pairs for (b), and from 36 model-language pairs for (c).
Our results show that the behavior of different types of NLP systems, different models, different languages, and different templates is pretty consistent. This is apparent from the similarity of the three subplots, but also from the relatively small spans of the boxes. This is great! Many other bias measures suffer from the lack of robustness. The systems that are all trained on similar data behave similarly, which is an intuitive and expected outcome.
According to our results, NLP systems think that women are beautiful, neat, diligent, and emotional. Men on the other hand are leaders, professional, rational, tough, rough, self-confident, and strong. No gender is particularly gentle, weak, childish, nor providing. There is one exception from the rule, a stereotype that contradicts our expectations: men are sexual. This stereotype which contains samples about sex, desire, horniness, etc. is strongly feminine. We hypothesize that the stereotype is overshadowed by a different phenomenon in the data — sexualization of women. There are tons of porn, erotica, or sex talk from the male perspective on the Web, and the models might have learned that it is usually women that are portrayed in such texts.

Back to conceptualization

What is the conceptualization of GEST? What GEST essentially does is that it observes how much certain idea is associated with either masculine or feminine gender in the model, and this should strongly correlate with the volume of such ideas in the training data. If we see that beauty is associated with women, we might infer that texts about body care, beauty products, physical attractiveness, etc. are mostly associated with women in the data. This intuitively seems like a correct conclusion. Another intuitive result is that mBERT is the least stereotypical model in our evaluation. mBERT is the only model that was trained with Wikipedia data only, while all the other models used Web-crawled corpora or at least book corpora. I assume that Wikipedia would have the least amount of stereotypical content compared to these other sources. Non-stereotypical data led to non-stereotypical model, which seems like a correct conclusion as well. With this in mind, what about the two issues I mentioned before?
Is GEST too generic? No. We explicitly list and define the forms of behavior GEST studies, and it has a clear scope. I would be wary of any generalization beyond that scope, such as, to other stereotypes or biased behaviors. The best way to use GEST is to observe scores for individual stereotypes. Aggregating the results can be lossy. With fine-grained analysis, we can start to reason about what it is in particular that the models learned and how to address it. For example, the fact that women are sexualized by a model can lead to actionable insights about how to address this problem, such as, be more aggressive with filtering porn and erotica in your data. This would not be possible if we were to take gender bias as a big generic nebulous concept.
Is GEST too specific? Yes and no. Yes, in a sense that the 16 stereotypes are very specific. Each stereotype describes a very specific domain of ideas. No, in a sense that as a whole, GEST contains broad stereotypes that cover a lot of ground as far as stereotypes about men and women go.

Conclusion

Truth be told, I was positively surprised by how robust the results from the GEST dataset are across systems, languages, models, and templates. I believe that this is to a large extent caused just by the honest data work that went into this dataset. Many other measures rely on (semi-)automatically collected data or resources that were not originally created to test NLP models, and they might not necessarily reflect the benchmarking needs such models have. Anyway, have fun with the dataset, and let me know if you use it for anything cool.

Links

Cite

@misc{pikuliak_gest,
  author       = "Matúš Pikuliak",
  title        = "How NLP Models Think about Gender Stereotypes",
  howpublished = "https://www.opensamizdat.com/posts/gest",
  month        = "12",
  year         = "2023",
}

Comments