HalluZig: Hallucination Detection using Zigzag Persistence
Shreyas N. Samaga, Gilberto Gonzalez Arroyo, Tamal K. Dey
TL;DR
HalluZig addresses the reliability issue of LLMs by shifting focus from generated text to the dynamics of internal reasoning. It models layer-wise attention as a sequence of graphs and applies zigzag persistence to extract topological signatures from the evolution, vectorized via PersImg, PersEntropy, and Betti Curves, then classifies with a Random Forest. The approach yields state-of-the-art or near-state-of-the-art performance across generative and QA benchmarks, demonstrates cross-model generalization, and enables effective early detection from partial network depth (about 70%). This work highlights the value of topological, structural interpretability for safety monitoring in LLMs and opens doors to model-internal hallucination diagnostics that are robust across architectures.
Abstract
The factual reliability of Large Language Models (LLMs) remains a critical barrier to their adoption in high-stakes domains due to their propensity to hallucinate. Current detection methods often rely on surface-level signals from the model's output, overlooking the failures that occur within the model's internal reasoning process. In this paper, we introduce a new paradigm for hallucination detection by analyzing the dynamic topology of the evolution of model's layer-wise attention. We model the sequence of attention matrices as a zigzag graph filtration and use zigzag persistence, a tool from Topological Data Analysis, to extract a topological signature. Our core hypothesis is that factual and hallucinated generations exhibit distinct topological signatures. We validate our framework, HalluZig, on multiple benchmarks, demonstrating that it outperforms strong baselines. Furthermore, our analysis reveals that these topological signatures are generalizable across different models and hallucination detection is possible only using structural signatures from partial network depth.
