HALLUCANA: Fixing LLM Hallucination with A Canary Lookahead

Tianyi Li, Erenay Dayanik, Shubhi Tyagi, Andrea PierleoniNAACL 2025

Abstract

HALLUCANA is a novel "canary lookahead" decoding strategy that detects and prevents LLM hallucinations in real-time by tapping into the model's internal hidden states. Unlike existing methods that require expensive multiple drafts or external knowledge retrieval, HALLUCANA identifies "critical time steps" during generation to intervene selectively, improving generation quality by up to 2.5x while using 6x less compute than state-of-the-art baselines.

Introduction

Large Language Models (LLMs) are notorious for "hallucinating"—assertively stating facts that are simply untrue. This is particularly problematic in long-form, knowledge-intensive tasks like writing biographies. Current solutions generally fall into two camps: black-box consistency checks (e.g., SelfCheckGPT), which are computationally expensive, and retrieval-augmented methods, which add complexity and rely on external data. HALLUCANA introduces a "white-box," knowledge-free approach to detect hallucinations before or as they happen, using only the model's internal signals.

Methodology: The Canary Lookahead

HALLUCANA introduces a two-phase mechanism to monitor and guide the decoding process:

  1. Pre-hoc Scorer ($CL_0$): Before generation begins, the system examines the hidden states of the input prompt. If the internal representation suggests unfamiliarity with the topic, the model can choose to abstain immediately.
  2. Ad-hoc Scorer ($CL_x$): During generation, a logit entropy heuristic identifies "critical time steps"—moments of high uncertainty. At these steps, the system performs a Canary Lookahead, exploring the top-$K$ most likely next tokens and decoding $N$ steps ahead for each. A 3-layer MLP faithfulness classifier scores these branches based on internal hidden states, vetoing low-scoring paths.
Overview of the HALLUCANA decoding process, illustrating critical time steps and the lookahead mechanism.

Experimental Results

The primary evaluation was conducted on the FActScore benchmark, focusing on biography generation. HALLUCANA demonstrated significant improvements in both quality and efficiency.

  • Quality Boost: The combined $CL_0 + CL_x$ strategy improved the Generation Quality Index ($GQI_{0.2}$) to 1.69, a nearly 2.5x increase over vanilla greedy decoding (0.68).
  • Efficiency: Compared to the state-of-the-art SelfCheckGPT, HALLUCANA consumed over 6x less compute, as it avoids generating multiple full-length drafts. This is reflected in the significantly lower $TpF$ (Tokens per Fact) metric.
  • Robustness: The internal factuality representation proved robust across different architectures, including Falcon-7b and Flan-UL2.
Performance comparison of HALLUCANA against baselines on the FActScore benchmark.

Key Insights

A central finding of this work is that LLMs possess an internal "self-awareness" of their own hallucinations; the signal for factuality is encoded in hidden states even when the output text appears confident. Furthermore, the authors established a link between "context familiarity" in pre-training corpora and the model's ability to remain factual. By intervening selectively at high-entropy steps, HALLUCANA maintains fluency while effectively purging hallucinatory paths without requiring external knowledge bases.

Conclusion and Future Work

HALLUCANA proves that internal hidden states can act as a "canary" to warn of impending errors. While currently built on greedy decoding and requiring white-box access to model weights, future work may integrate this strategy with advanced search algorithms or explore its applicability to complex reasoning and mathematical tasks.

Summary updated

BibTeX
@inproceedings{li2025hallucana,
  author = {Tianyi Li and Erenay Dayanik and Shubhi Tyagi and Andrea Pierleoni},
  title = {{HALLUCANA: Fixing LLM Hallucination with A Canary Lookahead}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2025},
  doi = {10.18653/v1/2025.findings-naacl.12},
}
Figure