Prompting Fairness: Integrating Causality to Debias Large Language Models

Jingling Li, Zeyu Tang, Xiaoyu Liu, Peter Spirtes, Kun Zhang, Liu Leqi, Yang Liu

TL;DR

This paper introduces a formal, causality-guided framework to eliminate social biases in Large Language Models (LLMs) using purely prompting-based techniques. By mapping how demographic information flows through causal pathways to influence a model's output, the authors develop Dual Directional Prompting (DDP)—a method that systematically encourages fact-based reasoning while discouraging biased shortcuts, achieving state-of-the-art fairness across black-box models like GPT-4.

What Problem Does This Paper Address?

Large language models routinely inherit historical stereotypes and systemic biases from their massive text training corpora. When these models are deployed in high-stakes decision-making software (such as hiring pipelines or healthcare triage), these biases can lead to deeply unfair outcomes.

Because the most capable LLMs (like GPT-4 or Claude) are closed-source, researchers and engineers cannot directly alter their internal weights or fine-tune them easily. Prompting-based debiasing is often the only viable alternative. However, existing prompting techniques are largely ad-hoc and focus almost exclusively on discouraging biased reasoning (e.g., telling the model "do not be racist"). This paper addresses the critical gap of actively encouraging fact-based reasoning by leveraging causal inference to restructure how the model processes information.

Methods

The authors formalize the data-generating process of LLM training corpora and the internal reasoning process of LLMs using Directed Acyclic Graphs (DAGs). They model societal stereotypes not as inherent causal links, but as selection mechanisms ($S$) that distort data distribution (e.g., historical data disproportionately selecting men for CEO roles in text corpora).

To counteract this at inference time, they introduce Dual Directional Prompting (DDP), which unifies three distinct causality-driven strategies:

  1. Strategy I (Nudge Towards Social-Agnostic Facts): The prompt strips away demographic information to create a neutral "base question" (e.g., replacing gender pronouns or specific physical traits with neutral labels like "Person X"). The LLM answers this base question first, and its factual response is then prepended to the original question.
  2. Strategy II (Counteract Selection Bias): The prompt explicitly instructs the model to assume balanced demographic distributions (e.g., "Assume male and female are equally represented among teachers").
  3. Strategy III (Nudge Away from Social-Salient Text): The prompt explicitly instructs the model to disregard demographic shortcuts.
Figure 1: Panel (a): A biased answer may be due to the use of a gender shortcut, while a fact-based answer is made by considering proper world knowledge given the circumstances. Panel (b): we describe how to systematically generate prompts that encourage fact-based reasoning. We would like to note that using social category information does not necessarily indicate that the reasoning is biased: sometimes, certain social category information should be considered, e.g., gender in medical treatments. We call such dependence neutral dependence, while in this work, we focus on objectionable/problematic ones (Tang et al., 2024).

By combining these strategies, the authors mathematically prove (Theorem 3.1) that the model's final decision can be rendered conditionally independent of the protected social category.

Datasets

The framework was validated across multiple domains using three widely recognized bias benchmarks:

  • WinoBias: A dataset evaluating gender bias in coreference resolution tasks (e.g., matching pronouns to occupations like "doctor" or "nurse").
  • Bias Benchmark for QA (BBQ): A dataset testing whether an LLM's biases override factual context across 9 distinct social dimensions (Age, Disability, Gender Identity, Nationality, Physical Appearance, Race/Ethnicity, Religion, SES, and Sexual Orientation).
  • Discrim-Eval: A dataset containing 70 hypothetical decision-making scenarios (e.g., loan approvals) to measure demographic disparities based on age, gender, and race.

Key Insights and Ideas

  • Bias as a Selection Filter: Viewing bias through the lens of causal selection variables ($S$) allows the authors to treat debiasing as a missing-data or counter-selection problem, providing a rigorous mathematical foundation for prompt engineering.
  • Unlocking Latent World Knowledge: LLMs often possess the correct, unbiased world knowledge required to solve a problem, but get distracted by demographic shortcuts. Forcing the model to answer a neutral "base question" first acts as a mechanism to isolate and activate this objective knowledge.
  • The Synergy of "Do" and "Don't": Merely telling a model not to be biased leaves room for subtle correlations to leak through. True debiasing requires a dual approach: actively suppressing the biased pathway while simultaneously amplifying the factual pathway.
Figure 3: Causal graphs for different data generating processes. We use double-stroke contours to indicate selection variables, solid edges to represent causal relations among observed variables or internal representations, and dashed edges for those pertaining to selection mechanisms. Panel (a) presents the underlying data generating process of the training data corpus. Panel (b) presents a causal perspective on how LLM’s decisions are related to internal representations and modulated by external prompts. We highlight in light coral to denote pathways along which social category information can influence the LLM’s decision.

Key Results

Dual Directional Prompting (DDP) consistently outperformed standard zero-shot, Chain-of-Thought (CoT), and few-shot In-Context Learning (ICL) baselines:

  • WinoBias (Type I): For GPT-4, the accuracy gap between pro-stereotypical and anti-stereotypical sentences plummeted from 15.47% (Default) to a mere 2.17% using DDP, while maintaining high overall accuracy.
  • BBQ Benchmark: When evaluated on GPT-4 across subtle bias categories like physical appearance, socio-economic status (SES), and religion, DDP achieved the highest accuracy in 8 out of 9 social categories.
  • Discrim-Eval: Across four different open and closed models (Mistral-7B, GPT-3, GPT-3.5, GPT-4), injecting the "Fact" component (Strategy I) universally minimized demographic disparities in binary decision-making tasks.

Limitations and Future Work

  • Dependence on Model Capability: DDP relies on the LLM's underlying capacity to correctly answer the social-agnostic base question. If a smaller or weaker model lacks the necessary world knowledge to solve the neutral baseline task, DDP's effectiveness is bottlenecked.
  • Future Directions: The authors propose using DDP to automatically generate pairs of positive (unbiased) and negative (biased) responses. These pairs could serve as high-quality training data to optimize reward models for Reinforcement Learning from Human Feedback (RLHF), embedding fairness directly into the model weights during alignment phases.

Summary updated

BibTeX
@inproceedings{li2025prompting,
  author = {Jingling Li and Zeyu Tang and Xiaoyu Liu and Peter Spirtes and Kun Zhang and Liu Leqi and Yang Liu},
  title = {{Prompting Fairness: Integrating Causality to Debias Large Language Models}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=7GKbQ1WT1C},
}
Figure