Disentangling Biased Knowledge from Reasoning in Large Language Models via Machine Unlearning

Zheyuan Liu, Suraj Maharjan, Fanyou Wu, Rahil Parikh, Belhassen Bayar, Srinivasan H. Sengamedu, Meng JiangACL 2025

Abstract

Large Language Models (LLMs) are prone to inheriting societal biases from their vast training corpora. A significant challenge in mitigating these biases is "knowledge entanglement," where parameters encoding biased information are also critical for logical reasoning. We present Selective Disentanglement Unlearning (SDU), a framework designed to surgically remove biased knowledge without compromising reasoning capabilities. By identifying salient biased weights and applying targeted covariance-based updates, SDU achieves a 14.7% improvement in fairness accuracy and a 62.6% boost in reasoning performance relative to traditional unlearning baselines.

The Challenge of Knowledge Entanglement

LLMs are trained on diverse internet data, which inevitably includes toxic and stereotypical content. Attempting to "unlearn" this data often results in a significant drop in the model's utility. This is due to knowledge entanglement: the same neural parameters that store a stereotype (e.g., gender-based professional biases) are often the same ones used for mathematical reasoning or instruction following.

Traditional methods like Gradient Ascent act as a "sledgehammer," indiscriminately updating weights to minimize the likelihood of biased outputs. While this may reduce bias, it frequently "shatters" the model's logical circuits, leading to poor performance on unrelated reasoning tasks.

The Selective Disentanglement Unlearning (SDU) Framework

To address this, the SDU framework employs a three-stage surgical approach to isolate and neutralize biased parameters.

The three-stage SDU framework: Bias Weights Identification, Fair Knowledge Alignment, and Bias Knowledge Unlearning.

1. Bias Weights Identification

The process begins by creating a "shadow LLM"—a copy of the base model fine-tuned on a biased dataset. By comparing the shadow model to the original, researchers calculate Weight Saliency to identify which parameters are most sensitive to biased information. To prevent overfitting and ensure robustness, Weight Randomization is applied, injecting noise into the selection mask.

2. Fair Knowledge Alignment

The model is then exposed to "fair" datasets. The framework calculates the residual errors—the difference in internal layer activations when processing biased versus fair inputs. A covariance matrix is computed to map the relationships between these salient weights, providing a blueprint for the necessary adjustments.

3. Bias Knowledge Unlearning

In the final stage, a targeted update is applied exclusively to the salient weights identified in Stage 1. This update shifts the model's internal representations of biased prompts to align with fair representations, effectively "washing" the bias from the parameters while leaving the reasoning logic intact.

Experimental Evaluation

The SDU framework was evaluated using the BBQ (Bias Benchmark for QA) across categories such as age, gender, and religion. To monitor reasoning retention, the models were tested on benchmarks including MathQA, MMLU, PIQA, and GSM8K.

Key Results

Testing on models like Mistral-7B, Mixtral-8x7B, and Llama3-8B demonstrated the superiority of SDU over global unlearning methods.

Performance analysis of SDU across different saliency mask ratios, showing the balance between reasoning retention and fairness accuracy.
  • Fairness Gains: SDU consistently reached high fairness scores, achieving approximately 90.9% fairness accuracy on Mistral-7B.
  • Reasoning Retention: Unlike Gradient Ascent, which caused reasoning scores to plummet (e.g., from 52% to 35%), SDU maintained reasoning performance near the original baseline (~50.9%).
  • Efficiency: By targeting a small percentage of weights, SDU is significantly more computationally efficient than full-model retraining or standard safety alignment.

Discussion and Future Directions

A critical insight from this work is that bias is often localized within specific "salient" weights. SDU proves that surgical intervention is more effective than global updates. Furthermore, the use of weight randomization acts as a shield, preventing the model from merely memorizing fair answers and instead encouraging a generalized unlearning of the underlying bias.

However, limitations remain. The reliance on a "shadow model" increases initial computational overhead, and the method currently requires high-quality paired "biased" and "fair" datasets. Future research will explore the generalization of SDU to "out-of-distribution" biases not explicitly present in the unlearning data.

Conclusion

SDU represents a significant step forward in AI safety. By disentangling biased knowledge from reasoning, it allows for the creation of LLMs that are both fairer and smarter, overcoming the traditional trade-off between safety and performance.

Summary updated

BibTeX
@inproceedings{liu2025disentangling,
  author = {Zheyuan Liu and Suraj Maharjan and Fanyou Wu and Rahil Parikh and Belhassen Bayar and Srinivasan H. Sengamedu and Meng Jiang},
  title = {{Disentangling Biased Knowledge from Reasoning in Large Language Models via Machine Unlearning}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure