[Paper Review] Measuring Bias in Contextualized Word Representations
This paper proposes a template-based method to measure bias in BERT by querying its masked language modeling head to compute log probability ratios between gendered targets (e.g., 'he' vs. 'she') for specific attributes (e.g., 'programmer'). The method outperforms traditional cosine-based approaches in consistency with human biases and reveals strong male-gendered associations in occupational and trait-related attributes, with 88.5% of high-paying jobs showing stronger association with 'he'.
Contextual word embeddings such as BERT have achieved state of the art performance in numerous NLP tasks. Since they are optimized to capture the statistical properties of training data, they tend to pick up on and amplify social stereotypes present in the data as well. In this study, we (1)~propose a template-based method to quantify bias in BERT; (2)~show that this method obtains more consistent results in capturing social biases than the traditional cosine based method; and (3)~conduct a case study, evaluating gender bias in a downstream task of Gender Pronoun Resolution. Although our case study focuses on gender bias, the proposed technique is generalizable to unveiling other biases, including in multiclass settings, such as racial and religious biases.
Motivation & Objective
- To develop a more consistent and reliable method for measuring bias in contextualized word embeddings like BERT, which traditional cosine-based methods fail to capture reliably.
- To investigate how intrinsic biases in BERT—particularly gender bias—manifest in downstream tasks such as gendered pronoun resolution.
- To quantify the extent of gender bias in BERT for occupational titles, personality traits, and job skills using real-world datasets.
- To demonstrate that bias measured via the proposed method correlates strongly with downstream task performance, highlighting risks in real-world NLP applications.
Proposed method
- Construct simple template sentences such as ‘[MASK] is a [ATTRIBUTE]’ where [MASK] is replaced with target pronouns (e.g., ‘he’ or ‘she’) to query BERT’s masked language modeling predictions.
- Compute the conditional probability $ p_{tgt} = P([MASK] = \text{target} \mid \text{sentence}) $ for the target word given the attribute.
- Compute the prior probability $ p_{prior} = P([MASK] = \text{target} \mid \text{sentence with both targets and attribute masked}) $ to normalize for model bias toward the target.
- Calculate the log probability bias score as $ \log{\frac{p_{tgt}}{p_{prior}}} $, which measures the relative association strength between a target and an attribute.
- Use this normalized score to compare associations between two targets (e.g., 'he' vs. 'she') and compute the difference as the final bias score.
- Apply the method across multiple datasets: Employee Salary (high-paying jobs), Positive/Negative Traits, and O*NET (skills), using consistent templates.
Experimental results
Research questions
- RQ1Can a template-based, masked language modeling approach provide a more consistent and reliable measure of bias in BERT compared to traditional cosine-based methods?
- RQ2To what extent does BERT exhibit gender bias in its associations with occupational titles, personality traits, and job skills?
- RQ3How does the intrinsic bias measured by the proposed method correlate with performance in a downstream task like gendered pronoun resolution?
- RQ4Does the proposed method reveal more nuanced or fine-grained bias patterns than prior approaches in multiclass or stereotyped attribute settings?
Key findings
- The proposed log probability bias score method demonstrated greater consistency with human-annotated biases than the traditional WEAT/cosine-based method, especially in contextualized embeddings.
- 88.5% of the top 1,000 high-paying jobs from the Montgomery County Employee Salary dataset showed stronger association with the male pronoun 'he' than 'she'.
- 80.0% of positive personality traits and 78.9% of negative traits were more strongly associated with 'he' than 'she', indicating pervasive gendered associations.
- 84.0% of O*NET technology skills showed stronger association with 'he' than 'she', suggesting bias extends to technical competencies.
- The intrinsic bias measured by the proposed method showed a strong, significant correlation with performance degradation in the gendered pronoun resolution task, indicating real-world downstream impact.
- The method successfully exposed bias across diverse attribute types, including occupational prestige, personality traits, and skills, demonstrating generalizability beyond binary gender stereotypes.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.