Analysing Moral Bias in Finetuned LLMs through Mechanistic Interpretability

· Source: cs.CL updates on arXiv.org · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Natural Language Processing, Mechanistic Interpretability · Depth: Expert, extended

Summary

A study analyzed moral bias, specifically the Knobe effect, in finetuned large language models (LLMs) using mechanistic interpretability. Researchers applied Layer-Patching analysis across Llama-3.1-8B, Mistral-7B-v0.1, and Gemma-2-9b. They found that finetuning consistently amplifies the Knobe effect, causing LLMs to attribute significantly higher intentionality to negative side effects than positive ones, mirroring human cognitive bias. Pretrained models exhibited minimal bias. This moral bias was localized to specific mid-to-late Transformer layers. Critically, patching activations from the corresponding pretrained model into these few layers effectively mitigated the bias, reducing the intentionality attribution gap from 1.6 to 0.0 in Llama-3.1-8B and Mistral-7B-v0.1, and from 3.83 to 0.03 in Gemma-2-9b, without retraining. An ablation study confirmed the bias is induced by finetuning, not model scale, though its magnitude increases with model size.

Key takeaway

For Machine Learning Engineers deploying finetuned LLMs in ethical reasoning tasks, you should actively assess and mitigate moral biases like the Knobe effect. Your finetuned models likely internalize human biases, localizing them in mid-to-late layers. Consider implementing Layer-Patching techniques to selectively remove these biases post-training, using pretrained model activations. This approach offers a precise way to enhance model fairness without costly retraining, ensuring more aligned and responsible AI systems.

Key insights

Finetuning introduces human-like moral biases in LLMs, which are localizable and mitigable via mechanistic interpretability.

Principles

Method

The Layer-Patching algorithm selectively overwrites finetuned model residual activations with those from the pretrained version at specific layers during inference, without altering model parameters or requiring retraining.

In practice

Topics

Code references

Best for: Research Scientist, CTO, VP of Engineering/Data, AI Scientist, Machine Learning Engineer, AI Ethicist

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by cs.CL updates on arXiv.org.