Why and How LLMs Hallucinate: Connecting the Dots with Subsequence Associations
Yiyou Sun, Yu Gai, Lijie Chen, Abhilasha Ravichander, Yejin Choi, Dawn Song
TL;DR
This work addresses the pervasive issue of hallucinations in large language models by introducing a subsequence association framework that traces outputs to triggering input subsequences. It shows decoder-only transformers encode subsequence embeddings and map these via linear components to next-token logits, enabling a cross-context causal tracing approach. The authors develop a reproducibility-focused tracing algorithm (SAT) that identifies dominant triggering subsequences by sampling diversified inputs and using beam search, and demonstrate that SAT outperforms standard attribution methods while correlating with training-corpus statistics (Dolma/Dolma-1.7). The results establish a unified lens on hallucinations, offer a practical tracing tool, and reveal that both small and large models rely on specific subsequences that reflect their training data, with potential implications for mitigation and debugging.
Abstract
Large language models (LLMs) frequently generate hallucinations-content that deviates from factual accuracy or provided context-posing challenges for diagnosis due to the complex interplay of underlying causes. This paper introduces a subsequence association framework to systematically trace and understand hallucinations. Our key insight is that hallucinations arise when dominant hallucinatory associations outweigh faithful ones. Through theoretical and empirical analyses, we demonstrate that decoder-only transformers effectively function as subsequence embedding models, with linear layers encoding input-output associations. We propose a tracing algorithm that identifies causal subsequences by analyzing hallucination probabilities across randomized input contexts. Experiments show our method outperforms standard attribution techniques in identifying hallucination causes and aligns with evidence from the model's training corpus. This work provides a unified perspective on hallucinations and a robust framework for their tracing and analysis.
