Share your thoughts, 1 month free Claude Pro on usSee more
WorkDL logo mark

Lookback Lens: Detecting and Mitigating Contextual Hallucinations in Large Language Models Using Only Attention Maps

About

When asked to summarize articles or answer questions given a passage, large language models (LLMs) can hallucinate details and respond with unsubstantiated answers that are inaccurate with respect to the input context. This paper describes a simple approach for detecting such contextual hallucinations. We hypothesize that contextual hallucinations are related to the extent to which an LLM attends to information in the provided context versus its own generations. Based on this intuition, we propose a simple hallucination detection model whose input features are given by the ratio of attention weights on the context versus newly generated tokens (for each attention head). We find that a linear classifier based on these lookback ratio features is as effective as a richer detector that utilizes the entire hidden states of an LLM or a text-based entailment model. The lookback ratio-based detector -- Lookback Lens -- is found to transfer across tasks and even models, allowing a detector that is trained on a 7B model to be applied (without retraining) to a larger 13B model. We further apply this detector to mitigate contextual hallucinations, and find that a simple classifier-guided decoding approach is able to reduce the amount of hallucination, for example by 9.6% in the XSum summarization task.

Yung-Sung Chuang, Linlu Qiu, Cheng-Yu Hsieh, Ranjay Krishna, Yoon Kim, James Glass• 2024

Related benchmarks

TaskDatasetResultRank
Commonsense ReasoningHellaSwag
Accuracy85.5
1891
Question AnsweringOpenBookQA
Accuracy61.6
465
Hallucination DetectionTriviaQA
AUROC0.868
438
Hallucination DetectionTruthfulQA
AUC (ROC)0.804
102
Hallucination DetectionGSM8K
AUROC84.3
93
Hallucination DetectionNQ-Open
AUROC0.816
61
Medical LLM Risk TriageRETINA-SAFE Stage-1
Unsafe Recall96.02
60
Long-form generationLong-form generation ID
PRR0.22
38
Short-form generationShort-form generation ID
PRR34
38
Hallucination DetectionRAGTruth RT-QA 1.0 (test)
F1 Score0.7832
30
Showing 10 of 32 rows

Other info

Follow for update