Institut für Maschinelle Sprachverarbeitung Universität Stuttgart Pfaffenwaldring 5B D-70569 Stuttgart MASTER THESIS Gender Bias in German Masked Language Models: Measurement, Mitigation, and the Role of Gender-Inclusive Language Paula Villavecchia Skrebba Study program: M.Sc. Computational Linguistics Examiners: Dr. Agnieszka Faleńska Prof. Dr. Sebastian Padó Supervisor: Dr. Agnieszka Faleńska Start date: 01.12.2024 End date: 01.06.2025 Erklärung (Statement of Authorship) Hiermit erkläre ich, dass ich die vorliegende Arbeit selbstständig verfasst habe und dabei keine andere als die angegebene Literatur verwendet habe. Alle Zitate und sinngemäßen Entlehnungen sind als solche unter genauer Angabe der Quelle gekennzeichnet. Die eingereichte Arbeit ist weder vollständig noch in wesentlichen Teilen Gegenstand eines anderen Prüfungsverfahrens gewesen. Sie ist weder vollständig noch in Teilen bereits veröffentlicht. Die beigefügte elektronische Version stimmt mit dem Druckexemplar überein.1 (Paula Villavecchia Skrebba) 1Non-binding translation for convenience: This thesis is the result of my own independent work, and any material from work of others which is used either verbatim or indirectly in the text is credited to the author including details about the exact source in the text. This work has not been part of any other previous examination, neither completely nor in parts. It has neither completely nor partially been published before. The submitted electronic version is identical to this print version. Contents 1 Introduction 6 2 Background and Related Work 8 2.1 Gender Bias . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2.2 Masked Language Modeling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.2.1 BERT: A Brief Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 2.2.2 Model Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.2.3 Gender Bias in BERT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.3 Related Work: Measuring Gender Bias . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.3.1 Measuring Gender Bias in Text . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.3.2 Measuring Gender Bias in Language Models . . . . . . . . . . . . . . . . . . 13 2.4 Related Work: Debiasing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.4.1 Debiasing Word Embeddings . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.4.2 Debiasing with Counterfactual Data Substitution . . . . . . . . . . . . . . . 16 2.4.3 Paraphrasing Corpora with Gender-inclusive Language . . . . . . . . . . . . 17 2.4.4 Impact of Gender-inclusive Language on Language Models . . . . . . . . . . 17 3 RQ1: Can the Results from Bartl et al. (2020) for English be replicated? 19 3.1 Measuring Gender Bias with Association-based Method . . . . . . . . . . . . . . . 19 3.1.1 Experimental Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.1.2 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.2 Debiasing using Counterfactual Data Substitution . . . . . . . . . . . . . . . . . . 23 3.2.1 Experimental Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 3.2.2 Debiasing Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 3.3 Additional Analysis of the Methodology from Bartl et al. (2020) . . . . . . . . . . 26 3.3.1 Adapting Masking Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . 26 3.3.2 Randomness in Debiasing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 3.3.3 Assessing Overall Quality of Debiased BERT . . . . . . . . . . . . . . . . . 27 2 3.3.4 Influence of Amount of Epochs on Debiasing . . . . . . . . . . . . . . . . . 28 3.3.5 Results with adapted Methodology . . . . . . . . . . . . . . . . . . . . . . . 30 3.4 Measuring Gender Bias with Perplexity-based Method . . . . . . . . . . . . . . . . 32 3.4.1 Experimental Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 3.4.2 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 3.5 Conclusions for RQ1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 4 RQ2: Are German Masked Language Models Biased? 36 4.1 Measuring Gender Bias with Association-based Method . . . . . . . . . . . . . . . 36 4.1.1 Experimental Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 4.1.2 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 4.2 Measuring Gender Bias with Perplexity-based Method . . . . . . . . . . . . . . . . 40 4.2.1 Experimental Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 4.2.2 Results on Regular Professions . . . . . . . . . . . . . . . . . . . . . . . . . 41 4.2.3 Results on Token-balanced Professions . . . . . . . . . . . . . . . . . . . . . 42 4.2.4 Results on Gender-inclusive Professions . . . . . . . . . . . . . . . . . . . . 43 4.3 Conclusions for RQ2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 5 RQ3: How to develop Debiasing Methods specifically for German? 45 5.1 Debiasing using Counterfactual Data Substitution . . . . . . . . . . . . . . . . . . 46 5.1.1 Experimental Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 5.1.2 Assessing Overall Quality of Debiased DBMDZ BERT . . . . . . . . . . . . 47 5.1.3 Debiasing Results on Regular Professions . . . . . . . . . . . . . . . . . . . 48 5.1.4 Debiasing Results on Gender-inclusive Professions . . . . . . . . . . . . . . 50 5.2 Debiasing using Gender-inclusive Language . . . . . . . . . . . . . . . . . . . . . . 51 5.2.1 Experimental Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 5.2.2 Assessing Overall Quality of Debiased DBMDZ BERT . . . . . . . . . . . . 53 5.2.3 Debiasing Results on Regular Professions . . . . . . . . . . . . . . . . . . . 55 5.2.4 Debiasing Results on Gender-inclusive Professions . . . . . . . . . . . . . . 57 5.3 Conclusions for RQ3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 3 6 RQ4: Do findings for German generalize across state-of-the-art Masked Lan- guage Models? 60 6.1 Measuring Gender Bias in German Masked Language Models . . . . . . . . . . . . 60 6.1.1 Experimental Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 6.1.2 Results on Gender-inclusive Professions . . . . . . . . . . . . . . . . . . . . 61 6.2 Debiasing using Gender-inclusive Language in German Masked Language Models . 64 6.2.1 Experimental Setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 6.2.2 Assessing overall Quality of Debiased German Masked Language Models . . 65 6.2.3 Debiasing Results on Gender-inclusive Professions . . . . . . . . . . . . . . 66 6.3 Conclusions for RQ4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 7 Discussion and Limitations 71 8 Conclusion 75 References 78 A Appendix 83 4 Abstract Gender bias in language models poses significant challenges for fair AI systems, particu- larly in languages with complex grammatical structures. This thesis investigates gender bias in German masked language models and develops targeted mitigation strategies that account for German’s unique morphological characteristics. Using both association-based and perplexity- based measurement methods, I systematically evaluate gender bias patterns across multiple German BERT variants and examine the effectiveness of different debiasing approaches. My research first investigates how gender bias patterns can be detected in German masked lan- guage models, leading to the creation of different profession template variants to address the complexities of German’s grammatical gender system. Through this systematic approach, I demonstrate that German masked language models exhibit fundamentally different gender bias patterns compared to English BERT, with structural bias from German’s grammatical gender system masking underlying patterns of genuine societal gender biases. Through compre- hensive analysis of regular, token-balanced, and gender-inclusive profession templates, I reveal that the feminine suffix in German female professions introduces a systematic bias against men. Only gender-inclusive templates successfully reveal societal gender bias patterns at the word level. Regarding the mitigation of gender bias, my findings reveal that while the Counterfactual Data Substitution approach fails to mitigate gender bias in German, fine-tuning on gender- inclusive language effectively reduces gender bias, particularly at the sentence level. This novel debiasing approach proves more suitable for German’s morphological structure, improving lan- guage model fairness. Additionally, my work establishes that gender bias patterns and debias- ing effectiveness vary significantly across different German language models, highlighting the need for model-specific approaches when aiming for successful gender bias mitigation. This research contributes methodological improvements to gender bias measurement in a morpho- logically rich language like German, demonstrates that debiasing methods effective for English cannot be successfully transferred to German, and establishes gender-inclusive language as an effective debiasing strategy. The findings emphasize that creating fair multilingual AI systems requires language-specific approaches that consider grammatical structures and morphological features rather than universal solutions. 5 1 Introduction Beliefs about gender roles are widespread and deeply embedded in our society, often reinforcing the belief that women are or should be subordinate to men (Formanowicz and Hansen, 2022). Research also suggests that gender perceptions are skewed, meaning that people tend to view men and women in ways that are shaped by traditional and unequal societal norms. For instance, Bailey et al. (2024) argue that men are more commonly perceived as the default representation of “person”, whereas women are more closely associated with their gender. These perceptions are further reflected in the finding that 90% of the global population exhibits at least some level of bias against gender equality (Albu, 2020). Such gender biases can manifest in the stereotypical belief that men are better suited for leadership roles, that caregiving is primarily a woman’s responsibility, or that women’s contributions are less valuable in certain professional or public domains. The perpetuation of these biases is deeply connected to how language affects human cognition and social perception. Language does not only reflect reality—it actively shapes it by influencing how we categorize the world around us (Blodgett et al., 2020). When society consistently uses generic masculine forms or male-defaulting language, marginalized groups become linguistically invisible, reinforcing their exclusion from daily discourse. The recognition of these biases in language and the importance of gender-inclusive language has been significantly advanced by the LGBTQ+ community, which has highlighted how traditional binary language can exclude, marginalize, or erase non-binary and gender-diverse individuals, emphasizing the need to move beyond binary gender assumptions in everyday communication. Such biased patterns in language extend into the field of Natural Language Processing (NLP), where language models—AI systems trained to understand and generate human language by learn- ing statistical patterns from large text corpora— inevitably acquire the societal gender biases present in their training data. Biased training data can result in these language models associat- ing professions like nurse predominantly with female terms (e.g., she and woman) and technical professions like engineer merely with male terms such as he and man. While it may be natural for language models to learn these patterns from data, the problem arises when these biased as- sociations are transmitted to applications such as hiring systems or educational tools, where they reinforce these societal inequalities and cause real-world harm. For example, in a recruiting and resume screening for a technical job, language models may prioritize resumes from men over women due to learned associations between male terms and technical professions. Hence, societal gender biases in language can lead to concrete discriminatory scenarios which make the detection and mitigation of gender bias crucial for ethical, fair, and responsible AI systems. Gender bias and its mitigation have been studied extensively for English, where effective mea- surement and debiasing methods have been proposed. A pivotal study by Bartl et al. (2020) explored gender bias in BERT, a popular language model introduced by Devlin et al. (2019), by 6 examining its associations between gendered person words and job professions in both English and German. Their findings show a strong association of female terms with female-dominated profes- sions (e.g., housekeeper or nurse) and male terms with male-dominated professions such as car- penter or bus mechanic. Such patterns reveal that BERT has learned and encoded societal gender biases from its training data. To mitigate such biases, Bartl et al. (2020) applied debiasing tech- niques like Counterfactual Data Substitution (CDS) and fine-tuned BERT on a gender-swapped corpus, which successfully reduced these biased patterns. While a debiasing method like CDS successfully mitigated gender bias in English, it could not be applied to German due to its complex grammatical structure. German’s gender-marked nouns, adjectives, and determiners — as well as its rich morphology — create unique challenges to detect gender bias, since grammatical gender can obscure the semantic properties of words. Research by Gonen and Goldberg (2019) demonstrates that language models tend to group words based on shared grammatical gender rather than semantic similarity, creating artificial associations that complicate bias measurement. Further, Bartl et al. (2020) noted that their debiasing method did not work for German, and since then, no effective solution for German gender bias mitigation has been developed. This persistent research gap highlights the ongoing need for language-specific bias mitigation strategies. To address this gap, the present thesis develops and evaluates methods for gender bias measurement and mitigation that account for the unique linguistic characteristics of the German language. My approach involves adapting existing gender bias measurement techniques, exploring novel approaches using gender-inclusive language for mitigating gender-biased patterns, and eval- uating the effectiveness of different debiasing strategies across multiple German masked language models. In addressing these challenges, I explore the following research questions: RQ1: Can the Results from Bartl et al. (2020) for English be replicated? RQ2: Are German Masked Language Models Biased? RQ3: How to develop Debiasing Methods specifically for German? RQ4: Do findings for German generalize across state-of-the-art Masked Language Models? To tackle these research questions, I employ measurements for gender bias at the word- and sentence level and evaluate two debiasing strategies: Counterfactual Data Substitution (CDS) adapted for German and a novel approach using gender-inclusive language. I evaluate these methods across multiple German masked language models to assess the generalizability of my findings. The thesis is structured as follows: Chapter 2 provides theoretical background on gender bias and BERT with masked language modeling, and reviews related work on gender bias measurement and debiasing techniques. Chapters 3-6 present my experimental work addressing each research question, with Chapter 7 discussing the broader implications of my findings and potential directions for future research. Chapter 8 concludes my thesis. 7 2 Background and Related Work This chapter establishes the theoretical foundation for investigating gender bias in language models. The study of gender bias in natural language processing (NLP) requires understanding both the societal origins of bias and how these biases manifest in AI systems. I begin by defining gender bias and its manifestation in society and language models, then examine masked language modeling with particular attention to BERT and its German variants. The chapter then reviews existing methodologies for measuring gender bias before examining previous work on debiasing strategies. 2.1 Gender Bias Generally speaking, bias arises when judgments or associations are influenced by stereotypes or societal norms rather than objective or equal standards. Bias can occur in various forms, including gender, racial, and cultural stereotypes (Derner et al., 2024). In the context of gender bias, biased patterns manifest as the tendency to associate certain roles, traits, or professions disproportionately with a specific gender, often reinforcing traditional or unequal gender norms (Kaneko et al., 2022). Such biases are particularly harmful because language shapes and maintains social hierarchies (Blodgett et al., 2020), creating representational harm by misrepresenting or erasing certain groups from daily language use. Research shows that biased language can reinforce stereotypical thinking patterns and limit how individuals conceptualize gender roles and possibilities (Blodgett et al., 2020), while inclusive language can promote more equitable attitudes and broaden perceptions of what is possible for different groups. For example, when job advertisements consistently use masculine language or when media coverage focuses disproportionately on male experts, these patterns reinforce the perception that certain roles belong primarily to men. These representational biases limit how people envision their possibilities, influence societal expectations, and contribute to the systematic exclusion of underrepresented groups from various areas of public life. Such societal gender biases extend into the field of Natural Language Processing (NLP), where language models trained on large text corpora unintentionally learn and perpetuate societal stereo- types. Since language models acquire knowledge through statistical patterns from text, they in- evitably internalize and perpetuate the biases present in their training data, making the under- standing of language model training mechanisms essential for investigating how gender biases are learned and how they can be measured and mitigated, with this work focusing particularly on masked language models. 8 2.2 Masked Language Modeling A language model in natural language processing (NLP) is a statistical or machine learning model that predicts the next word in a sequence given the previous words (Jurafsky and Martin, 2025). Masked Language Modeling (MLM) represents a specific type of language modeling objective where tokens in the input sentence are randomly masked, and the model is trained to reconstruct these masked tokens by considering the words before and after the masked token (bidirectional context) (Devlin et al., 2019). This is represented as: P (wi|w1, w2, ..., wi−1, wi+1, ..., wn) (1) ,where P is the probability, wi is the word at position i and n is the total number of words Unlike unidirectional language models, which only consider previous words, this bidirectional ap- proach gives the language model a broader range of contextual understanding by incorporating the full context surrounding a masked token (Devlin et al., 2019). 2.2.1 BERT: A Brief Introduction BERT (Bidirectional Encoder Representations from Transformers) is a pre-trained language model proposed by Devlin et al. (2019), trained on BookCorpus (Zhu et al., 2015), a dataset consisting of 11,038 unpublished books and English Wikipedia. BERT implements the Masked Language Modeling objective by randomly masking 15% of the input tokens during pre-training, with 80% being replaced by a special mask token [MASK], 10% by random words, and 10% are left unchanged. There are several variations of BERT, which share the same underlying BERT architecture but differ in their pre-training corpora, parameter sizes, and training approaches. BERT for German. The success of BERT for English has led to the development of language- specific variants trained on monolingual corpora, which can better capture language-specific pat- terns such as morphological complexity and grammatical structures. The development of multiple German BERT variants reflects the unique challenges of adapting BERT to German’s rich morpho- logical structure, including compound words, case inflections, and grammatical gender marking. Several German BERT variants have been developed accordingly, including DBMDZ BERT de- veloped by the MDZ Digital Library team at the Bavarian State Library2, the German GOOGLE BERT developed by deepset3, German DISTILBERT proposed by Sanh et al. (2019) and G-BERT and GELECTRA, both proposed by Chan et al. (2020). Each German BERT variant is trained on different German corpora, resulting in masked language models that capture distinct linguistic patterns and potential gender biases. Additionally, these masked language models were trained 2https://github.com/dbmdz/berts 3https://huggingface.co/google-bert/bert-base-german-cased 9 https://github.com/dbmdz/berts https://huggingface.co/google-bert/bert-base-german-cased using different approaches, with none of them having undergone systematic gender bias mitiga- tion procedures during pre-training, meaning they inherit whatever biases were present in their respective training data. 2.2.2 Model Architecture BERT utilizes the multi-layer bidirectional Transformer architecture proposed by Vaswani et al. (2017), specifically the encoder component. The encoder transforms input tokens into contextu- alized representations, capturing the context of each token with respect to the entire sequence. BERT uses the self-attention mechanism, which allows BERT to determine how much each word in a sentence should influence the understanding of every other word, enabling the model to capture meaningful relationships regardless of the distance between words. The BERT-base model consists of 12 Transformer layers with 12 attention heads and 768 hidden dimensions, which results in a total of approximately 110M parameters (Devlin et al., 2019). Each input token is represented as the sum of token, segment, and position embeddings, allowing BERT to understand word mean- ing, sentence structure, and token position. Further, BERT uses Next Sentence Prediction (NSP) to understand relationships between sentences. In NSP, two masked sentences are randomly con- catenated as inputs during pre-training, in which BERT has to predict if the two sentences are following each other or not (Devlin et al., 2019). Tokenization. Before BERT can process text input, raw text must be converted into numerical representations through tokenization. BERT employs WordPiece tokenization (Wu et al., 2016), a subword tokenization algorithm that balances vocabulary size with the ability to handle out-of- vocabulary words. Unlike word-level tokenization, which treats each word as a single unit, Word- Piece breaks down words into smaller subword units based on frequency patterns observed in the training corpus. Common words are typically kept as single tokens, while rare or compound words are split into meaningful subword tokens. For example, the word ‘playing’ might be tokenized as [‘play’, ‘##ing’], where the ‘##’ prefix indicates the continuation of a subword token. This approach allows BERT to handle previously unseen words by combining known subword tokens, making it particularly effective for morphologically rich languages like German, where compound words and inflected forms are common. Tokenization differs significantly between English and German BERT models due to linguistic differences. German’s extensive compound words (e.g., Haushälterin ‘female housekeeper’ and rich morphology result in different subword splits compared to English. While the word ‘housekeeper’ remains a single token in English BERT, Haushälterin will be split into [‘Haus’, ‘##hälter’, ‘##in’] in German BERT. These differences complicate bias measurement, as traditional word-level bias detection methods cannot even capture complete words like Haushälterin when they are split 10 across multiple subword tokens. Since many words—particularly in morphologically rich languages like German—are split into several subword tokens, word-level approaches fundamentally misalign with how BERT actually processes and represents language, necessitating token-aware methods for meaningful analysis of gender bias. Fine-tuning. Once pre-trained through masked language modeling, BERT can be adapted to downstream tasks through fine-tuning. BERT can be fine-tuned on several specific downstream tasks, such as text classification, where text is categorized into predefined classes (Sun et al., 2019) and named entity recognition for identifying and classifying named entities (Li et al., 2020). Other downstream tasks include question answering (Qu et al., 2019), involving answer extraction from text passages, and sentiment analysis, involving the analysis of expressed emotions or opinions in text (Xu et al., 2019). 2.2.3 Gender Bias in BERT Building upon the exploration of societal gender stereotypes in Section 2.1, I shift the focus now to examining how these gender biases are encoded and propagated in BERT. Since BERT is trained on large text corpora, it learns the patterns which are reflected from the training data, such as gender biases. Biased patterns in the training data can result in the model associating certain professions with gendered terms — such as linking nurse predominantly with female terms (e.g., she, woman) and doctor with male terms such as he or man: “She works as a [MASK] in the hospital.” → BERT predicts ‘nurse’ “He works as a [MASK] in the hospital.” → BERT predicts ‘doctor’ While it is natural for language models to learn these patterns from their training data, the problem arises when these biased associations are transferred to downstream NLP applications. For example, in co-reference resolution tasks, BERT-based language models might incorrectly resolve pronouns based on gender stereotypes rather than contextual information. In a sentence like “The doctor told the nurse that she should perform an operation on the patient”, a biased language model might assume ‘she’ refers to the nurse rather than considering both possibilities (‘doctor’ and ‘nurse’), perpetuating the stereotype that nurses are typically female. Grammatical Gender in German These gender associations become even more complex in German due to its grammatical gender system. Unlike English, where most profession terms like ‘teacher’ or ‘doctor’ are grammatically gender-neutral, German explicitly marks gender in pro- fession terms (Bartl et al., 2020). The masculine form (e.g., Lehrer ‘male teacher’ or Arzt ‘male doctor’) is typically considered the default, while the feminine form is created by adding the suffix 11 -in (e.g., Lehrerin ‘female teacher’ or Ärztin ‘female doctor’). This explicit gender marking ex- tends to determiners and adjectives that must agree with the noun’s gender (e.g., ein guter Lehrer ‘a good male teacher’ vs. eine gute Lehrerin ‘a good female teacher’). These linguistic features of German create unique challenges for measuring and mitigating gender bias in language models. When BERT encodes these gender biases and spreads them through its contextual word embeddings (Kurita et al., 2019), these biases are further reinforced by the inherent gender distinctions embedded in German morphology. In general, the presence of gender bias in language models becomes problematic when BERT-based applications are used in real-world situations, leading to the perpetuation of stereotypes and reinforcement of societal inequalities. The increasing integration of these models across diverse applications, particularly in languages with grammatical gender like German, highlights the need for robust methods to measure and mitigate gender bias, which will be examined in the next chapter. 2.3 Related Work: Measuring Gender Bias Building on the understanding that language models like BERT learn and propagate biases from their training data, researchers have developed methodologies to measure these gender biases. Recent work in this area has produced two distinct measurement approaches: methods that analyze bias directly in text corpora, and methods that evaluate how language models encode bias in their internal representations. Measuring gender bias in text involves identifying biased patterns in the original data, while methods for measuring gender bias in language models reveals how these patterns are internalized and reinforced in the model’s predictions and representations (Derner et al., 2024). 2.3.1 Measuring Gender Bias in Text Gender Bias in Occupations. For measuring gender bias specifically in English occupations, Ju et al. (2024) conduct a corpus statistical analysis of Wikipedia and Pushshift.io Reddit and use information theoretic techniques to show that there is a relationship between mentioning the gender of an occupation and genderedness of the occupation. They found evidence that gender is more likely to be mentioned for woman-dominated occupations (e.g., ‘male nurse’) than for man- dominated ones (e.g., ‘female engineer’). These findings suggest that woman-dominated occupations are already perceived as “more gendered” and people tend to specify gender more frequently in these cases, implying that femaleness in occupations is treated as more marked. While this highlights gendered patterns in English, it is unclear how such biases manifest in languages like German, where grammatical gender and suffixes like -in explicitly mark femaleness in occupations. 12 Gender Bias in Gendered Text. The findings from Ju et al. (2024) emphasize the importance of addressing how gendered patterns, like explicit gender marking in German, influence bias mea- surements in other languages than English. Building on this, existing methodologies for detecting gender bias in gendered languages tried to adapt to such complexities. For example, Derner et al. (2024) introduce an approach using language models to analyze gender representation in Spanish corpora. The language models gpt-4-turbo-preview, gpt-4o, and gpt-4-turbo, all available through OpenAI API4, are prompted to identify and classify gendered nouns and pronouns related to hu- man entities. Four benchmark datasets have been evaluated and revealed gender disparities, with male-to-female ratios ranging from 4:1 to 6:1. To the best of my knowledge, similar systematic bias analysis for German text has not been conducted, despite German’s linguistic features like gram- matical gender and compound words. While these methods reveal gender bias patterns within text corpora themselves, understanding how these biases transfer to trained language models requires a different set of measurement approaches. 2.3.2 Measuring Gender Bias in Language Models Building on text-based bias evaluation, this section examines methodologies for measuring gender bias within trained language models. These approaches face unique challenges in German due to its rich compound formation and grammatical gender features. For example, a study by Gonen et al. (2019) discovered that language models tend to cluster words with identical grammatical gender together, regardless of their semantic relationships. This happens because in languages with grammatical gender, the surrounding elements like articles and adjectives must match the gender of the noun, creating similar linguistic environments for words sharing the same grammatical gender category. Association-based Bias Measurement. To measure gender bias in language models, the Word Embedding Association Test (WEAT) by Caliskan et al. (2017) has been widely used for English. WEAT operates on word embeddings—numerical vector representations of words that capture se- mantic relationships and meanings based on their contextual usage—testing whether target words (e.g., gender-denoting person words like she or he) are more closely associated with specific at- tribute concepts (e.g., profession-related words like nurse, carpenter, doctor and teacher). Building on WEAT, Kurita et al. (2019) developed an association-based method for masked language mod- els that measures gender bias by computing how strongly the language model associates gendered person words with professions. This approach computes gender bias by measuring the influence of the attribute (A) on the likelihood of the target (T), expressed as P (T | A), which indicates the association between the target and the attribute. The method calculates an association score by 4OpenAI API. 13 https://platform.openai.com/docs/overview comparing the probability of a target word (person word) in two scenarios: first, when the profes- sion is present in the sentence (target probability pT ), and second, when the profession is masked, providing a “neutral context” (prior probability pprior). The complete procedure for calculating association scores is outlined in Table 1. 1. Take a sentence with a target and attribute word “He is a kindergarten teacher.” 2. Mask the target word “[MASK] is a kindergarten teacher.” 3. Obtain the probability of the target word in the sentence pT = P (he = [MASK]|sent) 4. Mask both target and attribute word. In compounds, mask each component separately. “[MASK] is a [MASK] [MASK].” 5. Obtain the prior probability, i.e. the probability of the target word when the attribute is masked pprior = P (he = [MASK]|masked sent) 6. Calculate the association by dividing the target probability by the prior and take the natural logarithm log pT pprior Table 1: Association score calculation procedure from Kurita et al. (2019), as implemented by Bartl et al. (2020). A positive association score indicates higher association in context than in the neutral context. For example, if the person word he receives a higher probability in “He is a kindergarten teacher” compared to “He is a [MASK] [MASK]”, this suggests an association between male person words and the profession ‘kindergarten teacher’. To measure gender bias in German, Bartl et al. (2020) adapted this WEAT-based association method and measured gender bias in English BERT and in the German BERT model DBMDZ BERT developed by the MDZ Digital Library team at the Bavarian State Library5. They found that methods effective for English often fail with German because grammatical gender agreement between person words and professions complicates bias measurement. The research from Bartl et al. (2020) revealed that female professions in German consistently show higher gender associations than male professions, reflecting the linguistic markedness of feminine forms (suffix -in) compared to the default masculine forms — a grammatical feature rather than a reflection of gender bias. However, Gonen and Goldberg (2019) demonstrated that association-based metrics like WEAT, which measure bias through word-level projections and similarities, fail to capture the full extent of gender bias in embeddings. Their findings show that even after debiasing according to these met- 5https://github.com/dbmdz/berts 14 https://github.com/dbmdz/berts rics, bias information remains embedded in the relationships between words and can be recovered through clustering and neighbor-based analysis. The authors argue that “algorithmic discrimina- tion is more likely to happen by associating one implicitly gendered term with other implicitly gendered terms, or picking up on gender-specific regularities in the corpus”, which suggests that gender bias manifests in contextual patterns and sequential dependencies that association-based metrics on the word level do not capture. These findings highlight that comprehensive gender bias evaluation requires moving beyond word-level associations to examine how language models process gendered content in complete sentences. Sentence-level Bias Measurement. Complementary to word-level approaches, researchers have developed methods for measuring bias by comparing sentence likelihoods. Masked Language Models present a unique challenge for this task, as they directly predict only masked tokens rather than assigning probabilities to complete sequences (Kauf and Ivanova, 2023). Salazar et al. (2020) introduced the pseudo-log-likelihood (PLL-original) score which approximates log-likelihood by masking each token in a sentence individually, scoring it based on the remaining context, and summing these scores. However, for multi-token words like souvenir [‘so’, ‘##uven’, ‘##ir’], each subword token is scored separately, without considering that these subword tokens belong to the same word. To address this issue, Kauf and Ivanova (2023) have proposed the improved metric PLL-word- l2r (l2r: left-to-right) where target tokens are masked along with all subword tokens to its right, helping language models treat multi-token words as complete units. Their research shows that PLL- word-l2r outperforms PLL-original and represents a better suited metric for evaluating sentence PLL under a masked language model, such as BERT. Although this approach has been tested only on English text, it could be especially valuable for gender bias measurement in German where gender marking tokens like the suffix -in would remain linked to their corresponding profession terms. 2.4 Related Work: Debiasing Having established methods to measure gender bias in text and in language models, I now turn to approaches for mitigating these biases. Early debiasing research focused primarily on word embed- dings before extending to contextualized language models like BERT. Research on debiasing has developed along several complementary directions, including pre-processing methods that mod- ify training data and post-processing methods that adjust the output or representations of the language models after training (Blodgett et al., 2020). 15 2.4.1 Debiasing Word Embeddings Foundational work by Bolukbasi et al. (2016) established post-processing debiasing methods for word embeddings. Their analysis of Word2Vec embeddings revealed gender stereotypes, such as the analogy “he is to computer programmer as she is to homemaker”. The authors identified that gender bias is captured by a single direction in the embedding space, enabling them to distin- guish between gender-neutral words (e.g., receptionist, nurse) and inherently gendered words (e.g., queen, king). Based on this geometric insight, Bolukbasi et al. (2016) developed two projection- based debiasing algorithms: hard debiasing, which completely removes the gender component from gender-neutral words by projecting them to be orthogonal to the gender direction while preserving it for gendered words, and soft debiasing, which reduces but does not eliminate gender associations. Their hard debiasing approach successfully reduced gender stereotypes in analogy tasks, transform- ing biased associations like ‘he:doctor’ and ‘she:nurse’ to more balanced ones like ‘he:doctor’ and ‘she:physician’. While effective for word embeddings, these geometric debiasing approaches face challenges when applied to contextualized language models like BERT, where word representations vary by context. Gonen and Goldberg (2019) further demonstrated that such post-processing methods may only provide superficial improvements while deeper biases remain embedded in the representations. This limitation, combined with Gonen et al. (2019)’s finding that modifying the training data is more effective than post-processing approaches, motivated the development of data-based pre- processing methods for contextualized language models. 2.4.2 Debiasing with Counterfactual Data Substitution Data-based alternatives that modify training data to mitigate gender bias are Counterfactual Data Augmentation (CDA) and Counterfactual Data Substitution (CDS) proposed by Maudslay et al. (2019). CDS swaps the gender of person words in a training corpus in order to counterbalance gender bias (e.g., he → she, man → woman), while CDA duplicates the training corpus and swaps all inherently gendered words in the copy. CDS randomly substitutes potentially biased text to avoid corpus duplication, making it computationally more efficient than CDA. The authors demonstrated that both CDA and CDS variants outperformed projection-based methods on non- biased gender analogy tasks and proposed a novel “Names Intervention” technique that increases the number of words by systematically pairing male and female names, which proved to be the only approach capable of mitigating indirect gender bias. In parallel work, Webster et al. (2018) present Gendered Ambiguous Pronouns (GAP), a gender- balanced corpus of 8,908 pronoun-name pairs from 4,454 contexts sampled from Wikipedia. The corpus presents natural examples with ambiguous pronouns (e.g., he, she, his, her) and has a 1:1 ratio of feminine and masculine pronouns. Primarily, GAP has been developed for coreference 16 resolution systems, in which the task is to determine whether a given pronoun refers to a specific entity in the text (e.g., determining if she refers to Constance in “Constance offers to repair his car in a few days when she is free from her science classes at school”). Each example in the corpus presents a context where gender ambiguity could potentially influence model predictions, making it particularly suitable for addressing gender bias in language models. Leveraging these resources, Bartl et al. (2020) applied CDS to the GAP corpus and used the gender-swapped corpus to fine-tune English BERT, demonstrating effective gender bias mitigation. However, these methods rely on predefined lists of gendered word pairs and simple word-swapping techniques, limiting their applicability to languages with complex grammatical gender systems like German. While German also operates on a gender binary for person words, its grammatical gender system and gender-specific morphological features (such as the feminine suffix -in and gender agreement across determiners and adjectives) present distinct challenges for bias mitigation that cannot be addressed through simple pronoun and word swapping alone. 2.4.3 Paraphrasing Corpora with Gender-inclusive Language While methods like CDS focus on swapping gendered person words (e.g., pronouns), an alternative approach involves paraphrasing corpora to incorporate gender-inclusive language forms. Gender- inclusive language refers to communication that avoids bias toward a particular gender and includes all genders rather than defaulting to masculine forms or binary gender assumptions. The develop- ment and promotion of gender-inclusive language has been significantly driven by the LGBTQ+ community, which has demonstrated how traditional language practices exclude or marginalize non-binary and gender-diverse individuals. Examples for gender-inclusive language include using they as a singular pronoun instead of he or she or addressing groups as everyone rather than ladies and gentlemen. Strategies to embrace gender-inclusive language have been proposed by Formanowicz and Hansen (2022). To reduce gender bias, they suggest several linguistic modifications to promote gender equality, such as neutralization, eliminating unnecessary gender references, and altering word order. Neutralization involves removing or replacing gendered terms with gender-neutral al- ternatives that do not specify or imply a particular gender. For example, replacing gendered job titles like fireman with gender-neutral terms such as firefighter can reduce bias. Additionally, para- phrasing sentences to use inclusive phrases, such as Good evening everyone instead of Good evening ladies and gentlemen can prevent the activation of binary gender constructs. 2.4.4 Impact of Gender-inclusive Language on Language Models Building on these gender-inclusive language principles, researchers have begun creating datasets that contain gender-inclusive language in German. To further explore the impact of gender-inclusive 17 language in German, Waldis et al. (2024) present the Lou dataset which contains parallel an- notated gender-inclusive reformulations for German text classification covering seven tasks. The Lou dataset offers various gender-inclusive strategies for German (e.g., the use of ‘GenderStern’ as in Lehrer*innen ‘teachers’, ‘Neutral’ as in Lehrende Personen, ‘GenderDoppelpunkt’ as in Lehrer:innen, etc.). 16 monolingual and multilingual language models have been evaluated on Lou, showing that gender-fair language does affect the predictions by flipping labels, reducing cer- tainty, and altering attention patterns. The work from Waldis et al. (2024) demonstrate that while predictions on individual instances may change, the overall performance rankings of language mod- els remain consistent whether tested on original or gender-inclusive reformulations. These findings suggest that existing benchmarks and evaluation methodologies remain reliable even as language evolves to become more inclusive. The foundational work by Bartl et al. (2020) remains highly relevant for contemporary gen- der bias research in language models. Their study systematically investigates gender bias in En- glish BERT using the association-based method, demonstrating clear biased patterns where female terms strongly associated with female-dominated professions (such as nurse and housekeeper) while male terms showed stronger associations with male-dominated professions (like carpenter and bus mechanic). Crucially, they successfully developed and applied Counterfactual Data Substitution (CDS) to mitigate these biases in English BERT by fine-tuning the language model on the GAP corpus to which gender-swapping has been applied to. However, their attempt to extend this debi- asing approach to German failed due to the language’s complex grammatical structure, including gender-marked morphology and grammatical gender agreement. Moreover, their analysis of Ger- man BERT revealed that female associations were consistently higher across all profession groups in the baseline model, yet debiasing this pronounced bias pattern was not attempted due to the methodological challenges posed by German’s linguistic complexity. This limitation highlights a critical research gap: while effective debiasing methods existed for English, no comparable solutions were available for morphologically rich languages like German. Given the continued widespread use of BERT-based models and the persistent need for language-specific bias mitigation strategies, replicating and extending their methodology provides essential groundwork for developing effective German debiasing approaches. 18 3 RQ1: Can the Results from Bartl et al. (2020) for English be replicated? In this chapter, I systematically replicate and analyze the methodology proposed by Bartl et al. (2020) for English, with the ultimate goal of adapting and extending their approach to German in subsequent chapters. I begin by reproducing their association-based method for measuring gen- der bias, followed by implementing their Counterfactual Data Substitution (CDS) approach for bias mitigation. I then conduct additional analyses to better understand factors influencing the effectiveness of their methodology, including variations in their masking procedure, assessment of overall model quality after debiasing, and examination of how randomness and training dura- tion affect debiasing outcomes. Finally, I introduce the perplexity-based method as an alternative measurement of gender bias. 3.1 Measuring Gender Bias with Association-based Method The association-based method for measuring gender bias, as described in Section 2.3.2, is imple- mented by Bartl et al. (2020) through the creation of the template-based corpus Bias Evaluation Corpus with Professions (BEC-Pro). They mask target words and attribute words in the corpus’ sentences to create two scenarios, as illustrated in Table 2. In this setting, target words (T) are person words, consisting of male-associated words (e.g., man, he, father) and female-associated terms (e.g., woman, she, mother), and attribute words (A) are professions, e.g., nurse, carpenter, engineer and teacher. If a profession contains more than one word, all words of the respective phrase are masked individually. original He is a kindergarten teacher. T masked [MASK] is a kindergarten teacher. T+A masked [MASK] is a [MASK] [MASK]. Table 2: Masking example of the BEC-Pro corpus in English from Bartl et al. (2020) The masked sentences from the BEC-Pro corpus are used to measure gender bias by comparing how likely the masked person word is in two scenarios. In both scenarios, the target word (person word) is masked, and the language model is asked to predict what word should fill this MASK. The first scenario is ‘T masked’, where the profession is present (giving us the target probability pT ), and the second is ‘T+A masked’, in which the profession is masked (giving us the prior probability pprior). With the profession being masked (‘T+A masked’), its influence is removed from the sentence, providing a “neutral context”. The association score is then calculated following the procedure outlined in Section 2.3.2, with a positive score indicating a higher association in context 19 than in the “neutral context” (e.g., the person word he gets assigned a higher probability in the sentence where the profession kindergarten teacher is present compared to when the profession is not present). Bias Patterns. Gender bias arises when the language model makes different predictions based on gender, specifically when P (Tfemale | A) ̸= P (Tmale | A). This comparison reveals whether the predictions of the language model are influenced by gender stereotypes. Table 3 outlines the expected association patterns that would indicate the presence or absence of gender bias across three different profession groups. Profession Group Gender Bias Present Gender Bias Absent Female-dominated Higher association scores for fe- male person words Similar association scores Male-dominated Higher association scores for male person words Similar association scores Gender-balanced Unequal association scores Approx. equal association scores Table 3: Expected association patterns indicating presence or absence of societal gender bias in a language model across three profession groups. Table 3 presents an intuitive framework for detecting gender bias patterns in association scores. However, Bartl et al. (2020) employ a different definition, focusing merely on the sign of association scores. In their framework, gender bias is present when there are positive association scores for female/male person words in female/male-dominated professions, and negative association scores for female/male person words in male/female-dominated professions. No gender bias is indicated when both association scores of female and male person words have approximately the same value, typically located around zero. While both approaches capture gender bias, the framework pre- sented in Table 3 emphasizes the relative differences between male and female associations rather than absolute score values, providing a more comprehensive view of gender bias patterns across profession groups. In the following section, I present the experimental setup used to implement the association-based method for measuring gender bias. 3.1.1 Experimental Setup To replicate the association-based method from Bartl et al. (2020), I follow their experimental setup as described below6. For their experiments, they use BERT by Devlin et al. (2019), a bidi- rectional transformer-based language model (as described in Section 2.2.1). Specifically, they use 6My code and implementations are available at: https://github.com/paulavilla64/gender-bias-german-mlm 20 https://github.com/paulavilla64/gender-bias-german-mlm the pre-trained uncased BERT-base model7 for English, which will be referred to as ‘BERT’ from now. Bartl et al. (2020) create the template-based corpus BEC-Pro for English and German to identify existing gender bias in BERT, using the association-based method. BEC-Pro is constructed using 5 sentence templates, 18 person words (), and 20 professions () across 3 profession groups (female-dominated, male-dominated and gender-balanced), resulting in 5400 sentences, created from the templates illustrated in Table 4. For example, template 4 in Table 4 generates the English sentence ‘[My mother], the [carpenter], had a good day at work’ and the German sentence ‘[Meine Mutter], die [Schreinerin], hatte einen guten Arbeitstag’. English German 1 is a . ist . 2 works as a . arbeitet als . 3 applied for the position of . hat sich auf die Stelle als beworben. 4 , the , had a good day at work. , die/der , hatte einen guten Arbeitstag. 5 wants to become a . will werden. Table 4: Sentence patterns for English and German for template-based corpus BEC-Pro from Bartl et al. (2020). Bartl et al. (2020) selected the professions and profession groups according to data from the U.S. Bureau of Labor Statistics (2020)8, which provides detailed information on gender and race partici- pation across various professions. The focus lies especially on professions that had more than 50,000 employed individuals across the United States. Three profession groups (female-dominated, male- dominated, and gender-balanced) have been identified with 20 professions each. The professions with the highest female participation rates (ranging from 88.3% to 98.7%) have been assigned to the group ‘female-dominated’, professions with the lowest female participation rates (ranging from 0.7% to 3.3%) form the group ‘male-dominated’ and professions with approximately equal gender repre- sentation (with female participation between 48.5% and 53.3%) build the group ‘gender-balanced’. This selection approach ensures that professions across the full spectrum of gender representa- tion in the U.S. workforce are captured, allowing for a comparison between female-dominated, male-dominated, and gender-balanced profession fields. For German, the English professions have been translated into both their masculine and feminine German counterparts, e.g., Kindergärtner and Kindergärtnerin for ‘kindergarten teacher’. The full list of German professions alongside their English original counterparts can be found in the Tables 17-19 in the Appendix. 3.1.2 Results Table 5 presents both the original results from Bartl et al. (2020) and my replication results, showing mean pre-association scores for the baseline BERT model (before fine-tuning) between 7bert-base-uncased available at HuggingFace. 8U.S. Bureau of Labour Statistics: https://www.bls.gov/cps/cpsaat11.htm 21 https://huggingface.co/google-bert/bert-base-uncased https://www.bls.gov/cps/cpsaat11.htm person words and professions across profession groups. The table includes standard deviations for the replicated scores and comprehensive statistical analysis using the Wilcoxon signed-rank test (W ). The Wilcoxon test statistic represents the sum of positive ranks when comparing female and male person words across profession groups. This statistic forms the basis for calculating both the p-value and the effect size r, with lower W values (relative to what would be expected by chance) indicating stronger gender differences. The effect size r is calculated following Rosenthal (1986) and Field et al. (2012), indicating the meaningfulness of the p-value. pre-associations Wilcoxon test original replicated jobs person mean mean SD W p r F f 0.50 0.50 1.31 60,655 4.11e-74 0.70 m -0.68 -0.68 1.53 M f -0.83 -0.83 1.24 16,633 8.83e-126 0.92 m 0.16 0.16 1.10 B f -0.35 -0.35 1.29 97,158 9.99e-42 0.52 m 0.05 0.05 1.12 Table 5: Original Results from Bartl et al. (2020) and replicated results for English pre-association scores with statistical analysis. For jobs, F=female, M=male, B=balanced and person words (f=female, m=male). All differences between female and male person words were statistically sig- nificant (p > 0.05). Table design slightly adapted. The pre-association values in Table 5 are identical between the original study and my replica- tion, confirming successful replication of the baseline predictions of BERT. Gender bias is clearly present across all profession groups, as defined by the gender bias patterns in Table 3. For female- dominated professions (F), association scores are substantially higher for female person words (0.50) than for male person words (-0.68). Conversely, for male-dominated professions (M), male person words show higher associations (0.16) compared to female person words (-0.83). Notably, even in gender-balanced professions (B), gender bias is evident through unequal association scores between genders. Female person words show negative associations (-0.35) while male person words show slightly positive associations (0.05). This suggests that people working in professions with balanced gender representation are more likely to be associated with male-associated terms in the language model’s representations. These findings also align with Bartl et al. (2020)’s bias definition, as the results show positive associations for female person words in female-dominated professions, positive associations for male person words in male-dominated professions, and negative cross-gender associations. All differences between female and male person words are highly statistically significant (p < 0.05) with values 22 for effect sizes indicating medium to large effects across all profession groups. This confirms that these gender biases represent genuine patterns in the language model’s representations rather than random fluctuations in the data. The pre-association values in both tables are identical, confirming successful replication of the initial state. 3.2 Debiasing using Counterfactual Data Substitution To mitigate the gender bias found in BERT, I apply Counterfactual Data Substitution (CDS) to the GAP corpus, see Section 2.4.2. CDS works by swapping gender-specific terms in the training data, creating a gender-balanced corpus that is supposed to counterbalance the language model’s learned biases. This approach exposes the language model to gender-swapped sentences during fine-tuning, which should lead to more gender-balanced predictions. Debiasing Patterns. Successful debiasing occurs when the predictions of the language model show reduced influence from gender stereotypes, ideally approaching P (Tfemale|A) ≈ P (Tmale|A), meaning the probability of predicting female person words given a profession should approximately equal the probability of predicting male person words given the same profession. Table 6 outlines the expected changes in association patterns after fine-tuning BERT on the gender-swapped GAP corpus. These patterns demonstrate how effective debiasing is observed through the decrease in the gap between female and male association scores, with smaller gaps indicating more balanced gender representations across all profession categories regardless of their traditional gender stereotypes. Profession Group Before Debiasing (Baseline) After Debiasing (Fine-tuned) Female-dominated Higher pre-association scores for female person words More balanced post-association scores (Gap decreases) Male-dominated Higher pre-association scores for male person words More balanced post-association scores (Gap decreases) Gender-balanced Unequal pre-association scores Approx. equal post-association scores (Gap decreases) Table 6: Expected changes in association patterns across three profession groups after applying debiasing methods to a language model. The ‘Gap’ refers to the absolute difference between female and male association scores. 3.2.1 Experimental Setup I employ the GAP corpus (Section 2.4.2) containing 13,436 sentences for the debiasing process. The fine-tuning data consists of a gender-swapped version of GAP where all gendered pronouns and 23 names have been replaced with their counterparts (e.g., he � she, John � Mary). I fine-tune the pre-trained BERT model on this gender-swapped corpus and subsequently re-evaluate its gender bias using the same BEC-Pro corpus employed for baseline measurements. Implementation Details. To fine-tune BERT, the Huggingface Transformers library (Wolf et al., 2020) for PyTorch was used, with a fixed random seed of 42 for reproducibility (Adams, 2010). BERT has been fine-tuned on the gender-swapped corpus for 3 epochs with a learning rate of 2e-5 and the AdamW optimizer with an epsilon of 1e-8. The fine-tuning used a batch size of 1 and implemented gradient clipping at 1.0 to prevent exploding gradients. Each sentence in the corpus was tokenized by the BERT tokenizer and masking has been applied to the BEC-Pro corpus (see Section 3.1) to follow BERT’s Masked Language Modeling objective. 3.2.2 Debiasing Results Table 7 shows the original results from Bartl et al. (2020) and Table 8 presents my replication results with the mean pre- and post-association scores between person words and professions across profession groups. The ‘Gap’ column in Table 8 with the replicated results represents the absolute difference between female and male person word associations (|female − male|). This measures the magnitude of the gender disparity regardless of which gender is favored. Lower values indicate more balanced gender associations, while higher values indicate stronger gender bias. The tables include a statistical analysis using the Wilcoxon signed-rank test (W ). Unlike the previous analysis where the Wilcoxon test compared female and male person words, here the Wilcoxon test is applied to compare pre- and post-associations for each profession group. pre post diff Wilcoxon test jobs person mean mean mean W p r F f 0.50 0.36 -0.14 96,428 2e-16 -0.32 m -0.68 -0.14 0.55 M f -0.83 0.13 0.96 395,974 2e-16 -0.58 m 0.16 0.21 0.05 B f -0.35 0.20 0.55 359,188 2e-16 -0.47 m 0.05 0.07 0.01 Table 7: Results from Bartl et al. (2020) for English association scores before (pre) and after fine-tuning (post) BERT. The ‘diff’ column shows the change in scores after fine-tuning. For jobs, F=female, M=male, B=balanced. Table design slightly adapted. 24 The Wilcoxon test statistic represents the sum of positive ranks when comparing pre- and post- association scores. This statistic forms the basis for calculating both the p-value and the effect size, with lower W values (relative to what would be expected by chance) indicating stronger differences between pre- and post-associations. pre post Wilcoxon test jobs person mean Gap mean Gap W p r F f 0.50 1.18 0.26* 0.63 768,766 0.06 -0.04 m -0.68 -0.37* M f -0.83 0.99 0.23 0.22 480,045 9.74e-51 -0.35 m 0.16 0.01 B f -0.35 0.40 0.18 0.32 685,498 1.46e-08 -0.13 m 0.05 -0.14 Table 8: Replicated results for English association scores before (pre) and after (post) fine-tuning BERT on the GAP corpus. For jobs, F=female, M=male, B=balanced and person words (f=female, m=male). The ‘Gap’ column represents the absolute difference between female and male person word associations. The asterisk (*) indicates a non-statistically significant difference between pre- and post-association scores (p > 0.05). All differences between female and male person words in pre-associations are statistically significant (p < 0.05). After applying Counterfactual Data Substitution and fine-tuning BERT, the post-association scores in my replication (Table 8) show notable shifts toward gender balance, though with some differences from the original study (Table 7). In female-dominated professions (F), the gap be- tween female and male associations narrows from 1.18 to 0.63, demonstrating successful debiasing, though not being statistically significant. For male-dominated professions (M), the effect is even more prominent, with a gap of 0.99 decreasing to 0.22. Gender-balanced professions (B) show an interesting pattern shift, with female association scores increasing (from -0.35 to 0.18) while male associations unexpectedly decrease slightly (from 0.05 to -0.14), yet the overall gap still decreases from 0.40 to 0.32. As outlined in Table 6, successful debiasing should result in more balanced asso- ciations between female and male person words across all profession groups, and the results largely confirm this pattern. In the following section, I conduct an additional analysis of the methodol- ogy from Bartl et al. (2020) to understand why the post-association scores differ and to further investigate the replicability of their method. 25 3.3 Additional Analysis of the Methodology from Bartl et al. (2020) While the previous sections focused on replicating the original study by Bartl et al. (2020), this section presents an additional analysis of their methodology to enhance the understanding of the debiasing process and its effects. I examine several aspects that were not fully explored in the original work: adapting the masking procedure to better handle PAD tokens and compound words, evaluating the role of randomness in the debiasing outcomes, assessing whether fine-tuning negatively impacts the overall quality of the BERT model, analyzing how the number of fine-tuning epochs influences the effectiveness of debiasing, and finally presenting my association scores with these methodological improvements. 3.3.1 Adapting Masking Procedure As demonstrated in Table 2, when a profession consists of multiple words (e.g., kindergarten teacher), Bartl et al. (2020) mask each constituent word individually, resulting in multiple MASK tokens for a single compound profession. This approach has an impact on the computation of asso- ciation scores shown in Table 1. The association score calculation relies on probability ratios, and sentences containing more tokens (including MASK tokens) inherently have lower prior probabili- ties, which inflates their association scores. Since the number of MASK tokens should not influence the measurement of gender bias, I adapted their masking procedure to consistently use a single MASK token for compound professions. This modification ensures methodological consistency and comparability within the same template, regardless of whether a profession is expressed as a single word or a compound. Additionally, I identified and addressed an important detail in the token labeling process. In the original implementation, PAD tokens (which are used to ensure equal sentence length in batched processing) were labeled as MASK tokens. I refined the approach by correctly relabeling these tokens as PAD instead of MASK, ensuring that only the actual profession words were being masked and evaluated during the association score calculations. This adjustment further improves the precision of the association-based method to measure gender bias and eliminates a potential source of variability in the results. 3.3.2 Randomness in Debiasing In their original study, Bartl et al. (2020) conducted all fine-tuning experiments using a single random seed (42) for initializing model parameters. This approach, while common in machine learning research (Adams, 2010), fails to address how different random initializations influence the results. To investigate this limitation, I replicated their debiasing procedure using multiple random seeds (42, 116, 387, 1980) and compared the resulting averaged association scores in Figure 1. 26 Figure 1: Mean post-association scores from BERT with different random seeds by profession group, fine-tuned on the gender-swapped GAP corpus. For pre-associations, the choice of random seed has no impact, as expected, since these measure- ments are taken before any fine-tuning is happening. However, Figure 1 shows that post-association scores vary across different random seeds. The post-association scores reported in the original study fall within the range of my experiments with different seeds. This means that their reported re- sults represent just one of many possible outcomes that could have occurred with different random initializations. This variability reveals an important instability in the methodology used by Bartl et al. (2020). The differences in post-association scores that occur when only changing the random seed show that conclusions drawn from a single experimental run can be unreliable. As Reimers and Gurevych (2018) demonstrated, evaluating machine learning approaches based on individual performance scores often leads to misleading interpretations about the effectiveness of a perfor- mance. For more robust evaluation of debiasing methods, multiple runs with different random seeds is needed to give a more complete picture of a method’s performance and stability. Using multiple random seeds during fine-tuning would prevent overconfidence in debiasing results that might be influenced more by random chance than by the actual effectiveness of the method. My analysis clearly shows that randomness does affect the results of the debiasing method by Bartl et al. (2020), highlighting the need for reproducibility in gender bias research. 3.3.3 Assessing Overall Quality of Debiased BERT While debiasing BERT is one of the primary goals of the methodology proposed by Bartl et al. (2020), it is equally important to ensure that the fine-tuning process does not degrade the model’s 27 overall language modeling capabilities. To answer the question of whether debiasing is harming BERT’s overall quality, I evaluated the fine-tuned BERT model using perplexity as an evaluation metric. For this purpose, perplexity evaluates how well the model predicts masked tokens from a given dataset, with lower perplexity indicating better performance by assigning higher probabilities to the correct words. The model provides predictions for the masked tokens and then the loss is computed on the masked positions. This loss is converted to perplexity, using the formula proposed by Salazar et al. (2020) in 2: Perplexity = eCrossEntropyLoss (2) I report baseline perplexity (the model’s performance before fine-tuning) and final validation per- plexity (the model’s performance on unseen data after fine-tuning) using the validation dataset AG News9 by Zhang et al. (2015). AG News is sourced from Common Crawl10 and offers a collection of news articles categorized into four classes (World, Sports, Business, and Science/Technology), providing diverse real-world sentences for evaluating general language understanding capabilities. The AG News dataset is down-sampled to match the number of sentences in the GAP corpus, en- suring fair and direct comparability between the fine-tuning and validation datasets. Specifically, I measure the perplexity of BERT for different random seeds and across epochs before (epoch 0) and after fine-tuning on the GAP corpus (epoch 3), as illustrated in Figure 2. The perplexity results in Figure 2 demonstrate that fine-tuned BERT slightly improves its quality across all random seeds, with the averaged perplexity values decreasing from 27.54 to 26.37. This indicates that fine-tuning BERT on the gender-swapped GAP corpus does not harm the model’s language modeling performance, but instead enhances it slightly. However, the results show some variability across random seeds: for instance, seed 116 achieves its lowest perplexity of 24.79 early at epoch 1, while seed 1980 shows an outlier behavior, peaking in perplexity at epoch 2 before improving again. These variations highlight that random factors during training (e.g., random weight initialization and data sampling during training) can lead to different results even with identical model architecture and training data. Overall, the results show that fine-tuning BERT on the gender-balanced GAP corpus not only mitigates gender bias but also slightly improves the model’s general language modeling capabilities. 3.3.4 Influence of Amount of Epochs on Debiasing An important aspect when fine-tuning language models is determining the optimal number of fine- tuning epochs - too few may result in incomplete learning, while too many can lead to overfitting (Jurafsky and Martin, 2025). To analyze the influence of amount of epochs and when to stop fine-tuning for optimal debiasing, I analyzed how post-associations evolve across epochs when 9Available at HuggingFace: https://huggingface.co/datasets/sh0416/ag news 10Common Crawl: https://commoncrawl.org/ 28 https://huggingface.co/datasets/sh0416/ag_news https://commoncrawl.org/ Figure 2: Evaluation of overall quality of BERT with perplexity across different random seeds and epochs, fine-tuned on the gender-swapped GAP corpus. Validation set: AG news from Common Crawl. fine-tuning BERT on the gender-balanced GAP corpus. Figure 3 shows the mean post-association scores for male and female person words across three fine-tuning epochs, separated by profession group: Figure 3: Mean post-association scores from BERT across epochs by profession group and gender of person words. In Figure 3, epoch 0 represents the baseline before fine-tuning, showing substantial gender biases across all profession groups as demonstrated by the largest gap between male and female association 29 scores. The continuing trend of post-associations across epochs reveals that bias is mitigated already after the first epoch of fine-tuning. For male-dominated professions (M), the gap between female and male association scores narrows dramatically from epoch 0 to epoch 1. Similarly, in female- dominated professions (F), the initial gap is significantly reduced after just one epoch. For gender- balanced professions (B), the effect is even stronger, with female and male associations reaching almost the same score after the first epoch. Interestingly, continuing fine-tuning beyond epoch 1 does not lead to further improvements in terms of gender balance. This pattern suggests that the debiasing method proposed by Bartl et al. (2020), while effective, is somewhat unstable with respect to training duration. The optimal stopping point appears to be after the first epoch, when association scores are closest to zero and the gap between male and female associations is minimized across all profession groups. However, future work should investigate whether the optimal stopping point might actually occur after more than three epochs. 3.3.5 Results with adapted Methodology Based on the analysis of the original methodology from Bartl et al. (2020) in the previous sub- sections, I implemented significant improvements in my experimental approach. First, I modified the masking procedure to treat compound profession terms as single units rather than masking each constituent word individually, ensuring fair comparison across profession types regardless of whether they are expressed as single or multi-word terms. I also refined the token labeling process by correctly identifying padding tokens as PAD rather than MASK, ensuring that only the profession-related tokens were considered in the masked language modeling predictions. Sec- ond, I addressed the impact of randomness by utilizing four different random seeds (42, 116, 387, and 1980) and averaging the results for all fine-tuning experiments, which provides more reliable and reproducible outcomes. Table 9 presents the association scores obtained with this adapted association-based methodology. After applying Counterfactual Data Substitution and fine-tuning BERT with the adaptations presented above, the new results in Table 9 reveal slightly different patterns compared to my earlier replication (Table 8). First, the pre-association scores differ due to modifications in the masking procedure, with smaller initial biases observed for gender-balanced professions (B) but notably larger gaps in female-dominated professions (F). Nonetheless, gender bias is clearly present across profession groups as defined by the gender bias patterns in Table 3. The associations for female person words in female-dominated professions (F) are higher than the associations for male person words and vice versa. Even in gender-balanced professions (B), the associations still exhibit a notable gap between female and male person words. Looking at the post-associations, it can be shown that for female-dominated professions (F), the gap between female and male associations is reduced from 1.48 to 0.68, indicating significant 30 pre post Wilcoxon test jobs person mean Gap mean Gap W p r F f 0.65 1.48 0.05 0.68 616,030 1.19e-18 -0.21 m -0.83 -0.63 M f -0.87 1.01 -0.10 0.06 636,688 3.31e-15 -0.19 m 0.14 -0.16 B f -0.21 0.31 -0.08 0.28 645,977 8.82e-14 -0.18 m 0.10 -0.36 Table 9: BERT model results for English pre- and post association scores, fine-tuned on GAP corpus: averaged values from four random seeds (42, 116, 387, 1980) across professions (F=female, M=male, B=balanced) and person words (f=female, m=male). The ‘Gap’ column represents the absolute difference between female and male association scores. All differences between female and male person words in pre-associations and between pre- and post-fine-tuning scores are statistically significant (p < 0.05). debiasing effects. For male-dominated professions (M), the impact is even more dramatic, with the large initial gap of 1.01 diminishing to a gap of 0.06, demonstrating highly effective debiasing which confirms the expected changes in association patterns after fine-tuning BERT, as illustrated in Table 6. For gender-balanced professions (B), the gap between genders shows a minor reduction (from 0.31 to 0.28), indicating that while the debiasing effect is less pronounced than in gendered professions, it still aligns with the expected pattern of bias mitigation. While the methodology has been adapted, the updated results still match with the expected association patterns indicating presence of gender bias in Table 3 and expected changes in association patterns for successful debiasing in Table 6. The results demonstrate that the Counterfactual Data Substitution approach successfully mitigates gender bias in BERT, particularly for gendered professions (F and M) where substantial reductions in gaps between genders are achieved. The association-based methodology provides valuable insights but has limitations since it only measures word-level relationships between person words and professions. While this method uses full sentences as context, it ultimately focuses on individual word predictions, computing the probability of specific gendered person words within these sentences and calculating the strength of semantic connections between these terms in the model’s representation space. However, it may be influenced by factors unrelated to gender bias, such as word structure (single words vs. compound words). To address these limitations and gain a more comprehensive understanding of the manifestation of gender bias in a language model, in the following section I introduce the perplexity-based method as a complementary approach that measures gender bias at the sentence level rather than at the word level, capturing how the model processes complete gendered sentences 31 holistically. 3.4 Measuring Gender Bias with Perplexity-based Method The perplexity-based method operates at the sentence level, evaluating how gender bias manifests in the model’s holistic predictions of complete sentences. This method measures the difference in perplexity between identical sentences that differ only in gendered person words, such as he or she. For this purpose, perplexity reflects how “surprising” or improbable a sentence is to the language model based on its training data, where lower perplexity indicates that the language model finds the sequence more probable. Similar to the association-based method, this approach uses the same BEC-Pro corpus with sentence templates containing female-gendered or male-gendered sentences (e.g., She is a carpenter vs. He is a carpenter). Male perplexity is calculated for sentences with ‘Gender = male’, and female perplexity for sentences with ‘Gender = female’. However, a key difference is that no tokens are masked in this method. Instead, the language model evaluates the probability of the entire sentence as is, calculating the loss over all tokens and converting this loss to perplexity using the formula in equation 2. Bias and Debiasing patterns. To quantify gender bias with the perplexity-based method, I compute a Bias Score as the difference between female and male perplexity in 3: Bias Score = Female Perplexity − Male Perplexity (3) A positive Bias Score (Female Perplexity > Male Perplexity) indicates the model finds female- gendered sentences more surprising than their male counterparts, suggesting bias against women (e.g., She is a carpenter has a higher perplexity than He is a carpenter). Conversely, a negative score indicates bias against men. Table 10 outlines both the expected perplexity patterns that would indicate the presence of gender bias across the three profession groups and the expected changes in these patterns after successful debiasing through fine-tuning on the gender-swapped GAP corpus: 3.4.1 Experimental Setup The experimental setup for the perplexity-based method follows the same approach used for the association-based method, presented in Section 3.1.1. I use BERT, which is fine-tuned on the gender-swapped GAP corpus, and evaluate gender bias using the BEC-Pro corpus to determine whether gender bias is present and if debiasing was successful. For each sentence in the corpus, I compute the perplexity by calculating the cross-entropy loss over all tokens and converting this loss to perplexity using equation 2. This allows for direct comparison of how “surprising” the model finds equivalent sentences with female vs. male person words. 32 Profession Group Before Debiasing (Baseline) After Debiasing (Fine-tuned) Female-dominated Lower perplexity for female person words (negative bias score) More balanced perplexity scores (bias score ≈ 0) Male-dominated Lower perplexity for male person words (positive bias score) More balanced perplexity scores (bias score ≈ 0) Gender-balanced Unequal perplexity scores (non-zero bias score) Approx. equal perplexity scores (bias score ≈ 0) Table 10: Expected perplexity patterns before debiasing (showing presence of societal gender bias) and after successful debiasing across the three profession groups. 3.4.2 Results Figure 4 presents the perplexity-based gender bias measurements across three profession groups before and after fine-tuning BERT on the gender-swapped GAP corpus. The baseline BERT model exhibits evidence of an overall gender bias against women, with consistently higher perplexity for female-gendered sentences across all profession categories. For female-dominated professions (F), the model unexpectedly shows higher perplexity for female sentences with a positive bias score, indicating bias against women—contrary to the expected perplexity patterns indicating bias against men in female-dominated professions, outlined in Table 10. Male-dominated professions (M) demonstrate the expected pattern: lower perplexity for male sentences and a positive bias score, confirming bias against women in traditionally male professions. Gender-balanced professions (B) also display unequal perplexity scores between genders with a slightly positive bias score, revealing bias against women even in gender-balanced professional contexts. After fine-tuning BERT on the gender-swapped GAP corpus, two significant changes emerge: (1) overall perplexity decreases for both male and female sentences across all profession groups, confirming the improved language modeling capabilities previously established in Section 3.3.3; and (2) bias scores consistently approach zero while perplexity scores become more balanced across all profession categories, aligning with the successful debiasing criteria specified in Table 10. The bias score distribution graph further highlights these improvements, showing the fine-tuned model’s dis- tribution with a pronounced peak centered near zero, indicating that most sentences achieve nearly identical perplexity regardless of gender. The results provide evidence that the Counterfactual Data Substitution approach effectively mitigates gender bias in BERT as measured by perplexity. Comparison of methods. Comparing results from both measurement methods reveals inter- esting insights into bias detection and mitigation. In baseline measurements, the association-based method consistently identifies gender bias across all profession categories, demonstrating clear patterns of societal gender bias. This method operates at the word level, measuring conditional 33 Figure 4: Perplexity-based gender bias measurement by profession group for BERT, fine-tuned on the gender-swapped GAP corpus. probabilities between specific gendered person words and professions by analyzing the model’s masked language modeling predictions, directly reflecting workforce statistics and societal gender distributions. Meanwhile, the perplexity-based method operates at the sentence level, revealing how the model holistically evaluates complete gendered sentences rather than individual word pre- dictions. This method only partially aligns with association-based findings—detecting expected bias in male-dominated and gender-balanced professions, but showing counterintuitive results for female-dominated professions where bias manifested against women rather than men. The fact that the perplexity-based method reveals bias against women even in female-dominated professions sug- gests a potential underlying bias against women in BERT on the sentence level. 34 After fine-tuning, both methods lead to similar conclusions regarding successful debiasing ef- fects. The association-based method shows a substantial decrease of gaps in association scores on the word level, while the perplexity-based method demonstrates bias scores approaching zero across all categories on the sentence level. This parallel improvement across distinct measurement methods provides stronger evidence for the effectiveness of the Counterfactual Data Substitution approach. 3.5 Conclusions for RQ1 The investigation of the first research question — whether the results from Bartl et al. (2020) can be replicated — leads to several important conclusions. While the general finding that Counterfactual Data Substitution can mitigate gender bias in English BERT is replicable, my additional analysis identified several methodological considerations that impact the reliability and interpretation of the results. First, the masking procedure used in the original study introduces an unintended bias in the association scores for professions consisting of multiple words. By masking each constituent word individually, multi-word professions inherently receive higher association scores than single- word professions, which distorts the bias measurements. My adaptation to consistently use a single MASK token for all professions provides a methodological consistent and comparable approach. I also corrected the token labeling by ensuring padding tokens were properly labeled as PAD rather than MASK, which further improves the accuracy of the association measurements. Second, randomness affects the outcomes of fine-tuning. Therefore, I use four random seeds (42, 116, 387, and 1980) for all language models and upcoming experiments and report the averaged results to obtain a more reliable estimate of the performance of the language model. This approach addresses the instability in fine-tuning that the original study does not account for, enhancing the robustness of my findings. Third, my analysis suggests that the optimal number of fine-tuning epochs for fine- tuning may occur earlier than expected, with the first epoch showing the highest bias reduction, though future work should investigate extended fine-tuning beyond three epochs to determine if continued improvements are possible. Additionally, the comparison between association-based and perplexity-based methods revealed that gender bias is detected differently depending on the measurement technique used. For baseline measurements, the association-based method consistently shows societal gender bias at the word level across all profession groups by calculating conditional probabilities that quantify the strength of association between specific gendered person words and professions. This method directly reflects workforce statistics and societal gender distributions in the BERT’s word-level representations. In contrast, the sentence-level perplexity-based method, which evaluates how the model holistically processes complete gendered sentences rather than making individual word predictions, detected expected societal gender bias patterns only in male-dominated and gender-balanced professions, but not in female-dominated professions where results contradicted expectations of bias against 35 men. This surprising finding suggests that BERT may be exhibiting a general bias against women on the sentence level despite the profession group, possibly because BERT was pre-trained on data containing a higher frequency of male-gendered sentences, making female-gendered sentences appear more surprising or improbable to BERT regardless of the profession type. After fine-tuning, both methods confirm successful debiasing, with word-level associations be- coming more balanced and sentence-level bias scores approaching zero, despite these measurement differences at baseline. These comparative findings highlight the importance of employing multi- ple measurement methodologies when evaluating gender bias, as different approaches may capture distinct aspects of gender bias in BERT. The discrepancies observed suggest that relying on a single method may provide an incomplete picture of how gender bias manifests in language mod- els. Therefore, I have improved my methodological approach by not only maintaining the previous enhancements but also introducing the perplexity-based measurement as an additional method for assessing gender bias. 4 RQ2: Are German Masked Language Models Biased? Having established a robust methodological framework for detecting gender bias in English BERT, I now turn to a more specific context. The present section narrows the focus to examine whether German masked language models exhibit similar patterns of gender bias as observed in English BERT. For this investigation, both the association-based and perplexity-based methods will be employed to provide a comparable assessment that captures different aspects of bias manifestations in German masked language models. 4.1 Measuring Gender Bias with Association-based Method Bartl et al. (2020) previously measured gender bias in German language models using the association- based method and reported higher overall pre-associations compared to English scores, with notably higher female associations than male associations. They attributed this difference to the German grammatical structure, specifically the presence of the gender-marking suffix -in for female pro- fessions (e.g., Schreinerin ‘female carpenter’) compared to the unmarked male form Schreiner ‘male carpenter’. Based on the consistenly higher female associations across all profession groups, they concluded that the associations do not capture societal gender bias, suggesting that what appears as bias might merely reflect linguistic features rather than societal gender bias. However, I believe further investigation is needed to determine whether genuine gender bias exists in Ger- man masked language models beyond these structural differences. To investigate this question, I apply the association-based method described in Section 3.1 with my adapted methodological 36 improvements. This analysis aims to determine if gender bias patterns in German language mod- els align with those identified in English BERT, orientating on the expected association patterns summarized in Table 3, where societal gender bias is observed when (1) female-dominated pro- fessions show higher association scores for female person words than for male person words, (2) male-dominated professions show higher association scores for male person words than for female person words, and (3) gender-balanced professions show unequal association scores between female and male person words. Conversely, gender bias is considered absent when association scores are similar or approximately equal for both female and male person words across all profession groups. 4.1.1 Experimental Setup For my investigation of gender bias in German masked language models, I use the German BERT model DBMDZ BERT11, which was also used by Bartl et al. (2020) in their bias evaluation. I conduct the evaluation using the German version of the template-based BEC-Pro corpus (BEC- Pro DE ) provided by Bartl et al. (2020) and presented in Section 3.1.1. In addition to using their regular profession templates for German, I have developed two modified template sets that specifically control for different aspects of German grammatical gender which may confound bias measurements: ‘token-balanced templates’ and ‘gender-inclusive templates’. Token-balanced templates. A methodological challenge unique to gendered languages like German in the measurement of gender bias is the token imbalance between male and female profession terms. According to Bartl et al. (2020), this imbalance in tokens influences the likelihood calculation of person words, resulting in systematically higher association scores for female person words across all profession groups regardless of actual societal gender distribution. This creates a critical variable that must be addressed to identify actual gender bias. To tackle this issue and ensure fair comparison with English professions (where masculine and female forms typically have equal token counts), I have extracted a subset of 30 German professions from the original set of 60 in the BEC-Pro DE corpus. This subset includes only professions that exhibit identical token counts for both gendered forms in German, which I refer to as ‘token-balanced templates’ (see Table 20 in the Appendix). Based on the token-balanced template, I propose the following hypothesis: Hypothesis 1: The token-balanced profession templates will reveal societal gender bias patterns in German masked language models on the word level that correspond to the expected associa- tion patterns in Table 3, making it possible to observe genuine societal gender bias rather than consequences of token imbalance. 11bert-base-german-cased available at HuggingFace. 37 https://huggingface.co/dbmdz/bert-base-german-cased Gender-inclusive templates. Beyond token imbalance, another linguistic feature requiring further investigation is the explicit gender marking in German profession terms, particularly the feminine suffix -in in professions like Schreinerin vs. Schreiner. Language models trained on text with gendered professions may show inflated female associations because they’ve learned to strongly associate the -in suffix with female professions, potentially reflecting this consistent structural pat- tern rather than an underlying general bias against men. To isolate this effect, I have paraphrased the BEC-Pro DE corpus using gender-inclusive language forms for all professions (see Table 21 in the Appendix). These forms employ gender-inclusive terms that can be used for any gender, such as Verkaufskraft ‘salesperson’ instead of the gendered alternatives Verkäufer/Verkäuferin. These gender-inclusive terms are inherently token-balanced since the same word form is used for all gen- ders, similar to English profession terms. The creation of these templates leads to the following hypothesis: Hypothesis 2: The gender-inclusive profession templates will reveal societal gender bias patterns in German language models on the word level that correspond to the expected association patterns in Table 3, demonstrating that societal gender bias persists even when explicit grammatical gender marking is removed. 4.1.2 Results Table 11 presents pre-association scores for DBMDZ BERT across profession groups and the three profession templates: regular, token-balanced, and gender-inclusive. For regular professions, the expected gender bias patterns outlined in Table 3 are not observed. Instead, female associations score slightly higher across all profession groups, regardless of societal gender distribution. While this aligns with the findings of Bartl et al. (2020), the gap between genders is lower in my study, due to my methodological adaptations. This indicates that the regular templates do not reveal societal gender bias in DBMDZ BERT but instead show a slight systematic bias favoring female person words over male ones. When examining token-balanced professions, where male and female professions have identical token counts, the association patterns show minimal change compared to the regular profession templates. Female associations continue to be higher across all profession groups, with the only exception of female-dominated professions (F), where the difference in associations between female and male person words lack statistical significance. However, these differences between the two templates are very small, indicating that token-balanced templates also fail to demonstrate societal gender bias. The persistence of this pattern suggests that token imbalance cannot account for the elevated female associations observed in the DBMDZ BERT model. Based on these findings, I must reject Hypothesis 1, as token-balanced templates do not reveal the expected gender bias patterns at the word level, which would indicate genuine societal gender bias in the language model. 38 pre-associations regular token-balanced gender-inclusive jobs person mean Gap mean Gap mean Gap F f 0.18 0.06 0.04 0.04 -0.33 0.04 m 0.12 0.08 -0.37 M f 0.30 0.10 0.27