What changed? Investigating Debiasing Methods using Causal Mediation Analysis

Sullam Jeoung, Jana Diesner

Abstract

Previous work has examined how debiasing language models affect downstream tasks, specifically, how debiasing techniques influence task performance and whether debiased models also make impartial predictions in downstream tasks or not. However, what we don't understand well yet is why debiasing methods have varying impacts on downstream tasks and how debiasing techniques affect internal components of language models, i.e., neurons, layers, and attentions. In this paper, we decompose the internal mechanisms of debiasing language models with respect to gender by applying causal mediation analysis to understand the influence of debiasing methods on toxicity detection as a downstream task. Our findings suggest a need to test the effectiveness of debiasing methods with different bias metrics, and to focus on changes in the behavior of certain components of the models, e.g., first two layers of language models, and attention heads.

Introduction

The AI community has developed several techniques to reduce social biases in Large Language Models (LLMs). However, these methods often produce inconsistent results: a model might look "fair" on one benchmark but fail on a downstream task like toxicity detection. This research addresses the critical gap in understanding why these changes occur by moving beyond black-box measurements to investigate how debiasing affects internal components like specific neurons, layers, and attention heads.

Methods and Datasets

The study employs Causal Mediation Analysis (CMA) to untangle information flow within BERT and GPT-2. By performing interventions—such as swapping gendered terms in prompts—the researchers calculate the Direct Effect (input change on output) and Indirect Effect (change mediated by internal components).

Two debiasing methods were evaluated:

  1. Counterfactual Data Augmentation (CDA): Re-training on balanced datasets with swapped gendered terms.
  2. Dropout Debiasing: Increasing dropout rates to prevent over-reliance on biased associations.

Evaluation used bias benchmarks (CrowS-Pairs, SEAT, WinoBias) and downstream toxicity detection tasks (Jigsaw, RtGender).

Key Insights: Peeking Under the Hood

Bias is a Front-Loaded Problem

Causal analysis revealed that neurons responsible for the strongest gender-bias effects are concentrated in the first two layers (Layers 0 and 1), including the word embedding layer. This indicates that biased associations are formed very early in the model's processing pipeline.

Indirect effect of top neurons across layers, showing a peak in early layers (0-1).

Attention Heads as Gatekeepers

Debiasing fundamentally alters how attention heads weight gender-associated terms. In debiased models, attention heads "attend" differently to occupational terms (e.g., "driver", "housekeeper") based on the gendered pronoun used, effectively changing the internal logic of the model.

Visualization of attention head weights across different model configurations.

The Impact of Fine-tuning and Metric Variance

Fine-tuning on downstream tasks like Jigsaw Toxicity Detection sometimes reduced bias more effectively than dedicated debiasing techniques, though results were dataset-dependent. Furthermore, the study found that metrics often disagree; a model might improve on CrowS-Pairs (e.g., BERT baseline 57.25 dropping to 55.34 with CDA) while remaining biased on SEAT.

Conclusion

By providing a roadmap for internal model analysis, this work encourages moving beyond surface-level metrics toward surgical debiasing interventions. Future work should expand to non-binary identities, intersectional biases, and larger-scale models where bias locations may shift.

Summary updated

BibTeX
@misc{jeoung2022what,
  author = {Sullam Jeoung and Jana Diesner},
  title = {{What changed? Investigating Debiasing Methods using Causal Mediation Analysis}},
  year = {2022},
  eprint = {2206.00701},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2206.00701},
}
Figure