Mechanistic Understanding and Mitigation of Language Model Non-Factual Hallucinations

Lei Yu, Meng Cao, Jackie Chi Kit Cheung, Yue Dong
3/27/2024
cs.CLcs.AI

No official code found. Best implementation: jadeleiyu/lm_hallucination_mechanisms (3 stars, last commit 2024-11-14).

Abstract

State-of-the-art language models (LMs) sometimes generate non-factual hallucinations that misalign with world knowledge. To explore the mechanistic causes of these hallucinations, we create diagnostic datasets with subject-relation queries and adapt interpretability methods to trace hallucinations through internal model representations. We discover two general and distinct mechanistic causes of hallucinations shared across LMs (Llama-2, Pythia, GPT-J): 1) knowledge enrichment hallucinations: insufficient subject attribute knowledge in lower layer MLPs, and 2) answer extraction hallucinations: failure to select the correct object attribute in upper layer attention heads. We also found these two internal mechanistic causes of hallucinations are reflected in external manifestations. Based on insights from our mechanistic analysis, we propose a novel hallucination mitigation method through targeted restoration of the LM's internal fact recall pipeline, demonstrating superior performance compared to baselines.

View on arXivView PDF

Code Implementations(1)

30PythonApr 24, 20231 years ago

Similar Papers

Cite this paper

@article{yu2024mechanistic,
  title  = {Mechanistic Understanding and Mitigation of Language Model Non-Factual Hallucinations},
  author = {Lei Yu and Meng Cao and Jackie Chi Kit Cheung and Yue Dong},
  year   = {2024},
  eprint = {2403.18167},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2403.18167v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2403.18167.svg)](https://codeofpaper.com/paper/2403.18167)

Discussion