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

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

arXiv:2407.07071 · 2026-07-27 공개 · arXiv · PDF

large-language-models hallucination-detection summarization llm-decoding attention-maps attention-weights contextual-hallucinations lookback-ratio

Abstract

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.

한국어 요약

한 줄 요약

Lookback Lens는 주의 맵 기반 lookback ratio를 사용해 LLM의 문맥적 환상 생성을 탐지하고 완화하는 간단한 분류기이다.

핵심 기여도

핵심 아이디어

기존 연구는 주로 LLM의 내부 표현(은닉 상태, MLP 출력 등)을 사용해 환상을 탐지했으나, 이 논문은 주의 맵에 집중한다. 저자들은 문맥적 환상이 모델이 입력 문맥 대비 생성 토큰에 더 많은 주의를 할 때 발생한다고 가정하고, 이를 **lookback ratio**로 정량화한다. 이 비율은 각 주의 헤드에서 문맥 토큰과 생성 토큰의 주의 가중치 비율로 계산된다. lookback ratio를 입력으로 하는 **선형 분류기**인 Lookback Lens는 복잡한 모델 없이도 뛰어난 성능을 보인다. 특히, lookback ratio는 모델 간 이전이 가능해, 7B 모델에서 학습한 분류기를 13B 모델에 바로 적용할 수 있다.

기술적 접근법

주요 결과

의의 및 한계

Lookback Lens는 복잡한 모델 없이도 LLM의 환상을 탐지하고 완화할 수 있는 **가벼운 솔루션**을 제시한다. 특히, 주의 맵 기반의 lookback ratio는 모델 간 이전이 가능해, 다양한 LLM에 즉시 적용할 수 있다. 이는 RAG와 같은 실제 응용에서 즉각적인 활용 가능성을 열어준다. 그러나 lookback ratio가 모든 환상 유형을 포괄하지는 못하며, 일부 복잡한 문맥에서는 한계가 있을 수 있다. 또한, lookback ratio는 모델의 주의 메커니즘에 의존하므로, 주의 기반 모델이 아닌 다른 아키텍처에서는 효과가 줄어들 수 있다.

실용적 활용

Lookback Lens는 **문서 기반 질문 응답**, **요약 생성**, **RAG 시스템** 등에서 LLM의 환상을 실시간으로 탐지하고 완화할 수 있다. 특히, 모델 간 이전이 가능하므로, 다양한 규모의 LLM에 즉시 적용할 수 있어 **산업적 활용성**이 높다.