Identifying and Adapting Transformer-Components Responsible for Gender Bias in an English Language Model

Abhijith Chintam, Rahel Beloch, Willem H. Zuidema, Michael Hanna, Oskar van der Wal · DOI

TL;DR

This paper tackles the challenge of identifying and mitigating gender bias in language models. The authors introduce a novel, efficient method called DiffMask+ for pinpointing specific components within a model responsible for bias, and demonstrate that fine-tuning these identified components can significantly reduce gender bias with minimal impact on overall language modeling performance.

What Problem Does This Paper Address?

Large language models (LLMs) are known to absorb and even amplify societal biases present in their training data, with gender bias being a prominent example. This bias can lead to harmful outcomes when these models are deployed in real-world applications. While methods exist to detect and mitigate these biases, there's a significant gap in understanding how these biases are implemented within the complex internal workings of LLMs and how to efficiently modify them without degrading their general language capabilities. Existing methods for identifying bias-causing components are often computationally expensive or lack a clear causal link to the observed behavior.

Methods

The paper explores three primary methods for identifying components responsible for gender bias in the GPT-2 small model:

  • Causal Mediation Analysis (CMA): This method, based on intervening in model component activations and observing behavioral changes, aims to establish a causal link between internal mechanisms and model output. The authors use a "Natural Indirect Effect" (NIE) to quantify a component's importance.
  • Automated Circuit Discovery (ACDC): This approach views LLMs as computational graphs and seeks to identify subgraphs (circuits) responsible for specific behaviors. It iteratively tests model edges, removing those that can be ablated without affecting task performance.
  • DiffMask+ (Novel Method): This is the paper's main contribution, combining elements of CMA and differentiable masking. It learns a "stochastic mask" over model components, indicating their importance for bias. Crucially, DiffMask+ is designed to be computationally efficient and identifies a single, generalizable set of components across the entire dataset, unlike methods that might produce input-specific masks.

Datasets

The following datasets were used:

  • Professions Dataset: Used for identifying bias-relevant components. This dataset contains templated sentences (e.g., "The {profession} said that") designed to elicit gender-stereotypical continuations from LLMs.
  • BUG Dataset: A balanced version of this dataset, containing natural sentences with gendered pronouns, was used for fine-tuning.
  • WinoBias and CrowS-Pairs (updated version): Used for measuring gender bias in fine-tuned models. These datasets are designed to test for stereotypical associations.
  • WikiText-103: Used to evaluate general language modeling performance (perplexity).
  • BLiMP (including AGA and SVA subtasks): Used to assess linguistic adequacy and ensure fine-tuning doesn't harm specific language abilities.

Key Insights and Ideas

  • Overlapping Components, Divergent Costs: Despite significant differences in computational requirements, CMA, ACDC, and DiffMask+ largely identify overlapping sets of attention heads responsible for gender bias, primarily in the later layers of the GPT-2 model. This suggests a convergence on critical components, even with vastly different approaches.
  • Efficiency Matters: DiffMask+ offers a computationally more feasible alternative to ACDC for identifying bias-related components, making it more practical for large-scale analysis.
  • Targeted Fine-Tuning Works: Fine-tuning only the identified bias-relevant components (especially attention heads) is effective in mitigating gender bias without substantially degrading general language modeling performance.
  • Dataset Sensitivity: The choice of dataset significantly influences which components are identified as bias-related. This highlights the importance of carefully selecting and developing representative datasets for both bias discovery and mitigation.
  • Bias Measurement is Tricky: The paper underscores the difficulty in defining and measuring bias, noting inconsistencies across different bias metrics, likely due to implicit vs. explicit biases and varying dataset constructions.

Key Results

  • Bias Reduction: Fine-tuning models using components identified by CMA and DiffMask+ significantly reduced gender bias on the CrowS-Pairs and Professions datasets. The DiffMask+ model, in particular, achieved a notable reduction in stereotype score.
  • Performance Maintenance: Targeted fine-tuning of attention heads resulted in minimal degradation of general language modeling performance (measured by WikiText perplexity) and linguistic adequacy (measured by BLiMP).
  • Computational Efficiency: DiffMask+ was found to be significantly more computationally efficient than ACDC.
  • Full Model Fine-Tuning Trade-offs: Fine-tuning the entire model or large portions of it led to more significant bias reduction but also resulted in a greater drop in general language modeling performance and higher variance in results.

Limitations and Future Work

  • Dataset Limitations: The authors acknowledge that using template-based datasets for component identification and fine-tuning might limit the generalizability of the findings to real-world scenarios. They emphasize the need for diverse and representative datasets.
  • Bias Measurement Inconsistencies: The observed discrepancies across different bias metrics suggest that current measures may capture different facets of bias, and further research is needed to develop more robust and reliable evaluation methods.
  • Future Directions: The authors suggest comparing their methods with other promising techniques like concept erasure and "self-debiasing." They also advocate for extending this work to larger language models, other forms of bias beyond binary gender in English, and developing better methodologies for operationalizing bias in diverse contexts.

Summary updated

BibTeX
@inproceedings{chintam2023identifying,
  author = {Abhijith Chintam and Rahel Beloch and Willem H. Zuidema and Michael Hanna and Oskar van der Wal},
  title = {{Identifying and Adapting Transformer-Components Responsible for Gender Bias in an English Language Model}},
  booktitle = {BlackboxNLP @ EMNLP},
  year = {2023},
  doi = {10.18653/v1/2023.blackboxnlp-1.29},
}
Figure