NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Elucidating Mechanisms of Demographic Bias in LLMs for Healthcare

Hiba Ahsan, Arnab Sen Sharma, Silvio Amir, David Bau, Byron Wallace2025

Abstract

Large Language Models (LLMs) are increasingly used for clinical tasks. In this work, we adopt tools from mechanistic interpretability to unveil sociodemographic representations and biases within LLMs in the context of healthcare. Specifically, we ask: Can we identify activations within LLMs that encode sociodemographic information (e.g., gender, race)? We find that, in three open-weight LLMs, gender information is highly localized in MLP layers and can be reliably manipulated at inference time via patching. Such interventions can surgically alter generated clinical vignettes for specific conditions and also influence downstream clinical predictions which correlate with gender, e.g., patient risk of depression. We find that representation of patient race is somewhat more distributed, but can also be intervened upon to a degree. To our knowledge, this is the first application of mechanistic interpretability methods to LLMs for healthcare.

Introduction

As Large Language Models (LLMs) are integrated into healthcare systems, concerns regarding their "black box" nature and inherent biases have intensified. Previous research has demonstrated that models like GPT-4 exhibit significant "demographic stereotyping"—for instance, generating female patients for rheumatoid arthritis vignettes 97% of the time, a figure that far exceeds real-world prevalence. While these biases are evident in model outputs, the internal mechanisms driving them have remained poorly understood. This paper addresses this gap by investigating whether demographic information is localized within specific layers of the model and whether these activations can be manipulated to expose implicit biases in clinical decision-making.

Methodology: Activation Patching

The authors employ Mechanistic Interpretability, specifically a technique called Activation Patching, to locate and intervene upon demographic encodings. The process involves identifying internal activations that represent specific demographics by comparing a "source" prompt (e.g., "The patient is Male") with a "target" prompt (e.g., a clinical vignette typically associated with female patients).

Overview of activation patching for clinical tasks, demonstrating how patching a "male" activation can flip the generated patient identity and downstream risk assessment.

By "patching" activations from the source into the target's forward pass at specific layers and tokens, the researchers can measure a "rewrite score"—the change in probability of the model generating a specific demographic token. To ensure reliability, these activations were often amplified by a scaling factor ($c$). The study tested several open-weight models, including OLMo (7B and 32B), Llama-3.1 (8B), and Gemma-2 (9B).

Localization of Demographic Information

A key finding of this research is that gender information is highly localized within the model's architecture. In models like OLMo-7B and Llama-3.1-8B, patching a single MLP layer (e.g., layer 18 in OLMo-7B) was sufficient to flip the generated gender in 100% of clinical vignettes for conditions like Multiple Sclerosis and Sarcoidosis.

Heatmap illustrating the localization of demographic information at specific layers and tokens during the model's forward pass.

In contrast, the representation of race was found to be more distributed across early and middle layers, requiring a "sliding window" of multiple layers for effective intervention. Interestingly, the researchers found that "maleness" activations extracted from medical contexts generalized to non-medical scenarios, suggesting that LLMs utilize a consistent internal representation for gender across diverse domains.

Impact on Clinical Decision-Making

The study further demonstrated that these internal demographic representations directly influence clinical reasoning. By patching "female" or "Black" activations into demographic-neutral clinical notes, the researchers observed significant shifts in the model's risk assessments. For example, using OLMo-7B, "female-patched" patients saw a 3.5% increase in predicted depression risk, while "Black-patched" patients saw an 8.25% increase, despite the clinical notes being otherwise identical. Furthermore, demographic patching significantly altered the ranking of correct diagnoses in expert-created medical cases ($p < 0.05$), proving that internal biases can interfere with diagnostic accuracy.

Conclusion and Future Work

This work provides a foundational step in understanding the mechanical roots of bias in healthcare LLMs. By identifying specific "bias centers," researchers can move toward developing surgical debiasing techniques that do not require full model retraining. However, limitations remain, including the study's focus on binary gender and the restriction to open-weight models. Future research should explore non-binary identities and investigate how prompt sensitivity affects the localization of these representations.

Summary updated

BibTeX
@misc{ahsan2025elucidating,
  author = {Hiba Ahsan and Arnab Sen Sharma and Silvio Amir and David Bau and Byron Wallace},
  title = {{Elucidating Mechanisms of Demographic Bias in LLMs for Healthcare}},
  year = {2025},
  doi = {10.18653/v1/2025.findings-emnlp.789},
}
Figure