Debiasing LLMs by Masking Unfairness-Driving Attention Heads
Abstract
Large language models (LLMs) increasingly mediate decisions in domains where unfair treatment of demographic groups is unacceptable.Existing work probes when biased outputs appear, but gives little insight into the mechanisms that generate them, leaving existing mitigations largely fragile.In this paper, we conduct a systematic investigation of LLM unfairness and propose DIFFHEADS, a lightweight debiasing framework for LLMs.We first compare Direct-Answer (DA) prompting to Chain-of-Thought (CoT) prompting across eight representative open-and closedsource LLMs.DA will trigger the nature-bias component of the LLM and reduce measured unfairness by 391.9% -534.5% in both oneturn and two-turn dialogues.Next, we define a token-to-head contribution score that traces each token's influence back to individual attention heads.This reveals a small cluster of bias heads that activate under DA but stay largely dormant with CoT, providing the first causal link between prompting strategy and bias emergence.Finally, building on this, we propose DIFFHEADS that identifies bias heads through differential activation analysis between DA and CoT, and selectively masks only those heads.DIFFHEADS reduces unfairness by 49.4%, and 40.3% under DA and CoT, respectively, without harming model utility.Our code is available at https://github. com/GeniusHTX/DIFFHEADS.
Fields of Study & Subjects
Artificial Intelligence in Healthcare and Education
Ethics and Social Impacts of AI
Machine Learning in Healthcare
Publication details
- Journal / source
- Findings of the Association for Computational Linguistics: ACL 2026
- Publisher
- Association for Computational Linguistics
- Pages
- 37980–37992
- Publication date
- 1 January 2026
- Language
- EN