Hallucination as an Anomaly: Dynamic Intervention via Probabilistic Circuits
Erik Nielsen, Elia Cunegatti, Marcus Vukojevic, Giovanni Iacca · 2026
Read Hallucination as an Anomaly: Dynamic Intervention via Probabilistic Circuits by Erik Nielsen, Elia Cunegatti, Marcus Vukojevic, Giovanni Iacca (2026) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2605-05953.txt.
Introduction
Erik Nielsen and three co-authors treat hallucination in large language models as an anomaly to catch mid generation. Many fixes correct every token, which can damage text that was right to begin with. Their aim is a guard that acts only when the model's hidden state drifts from factual ground.
They train a probabilistic circuit, PCNET, as a density estimator over the model's residual stream. It flags hallucinated states by exact likelihood scores, without sampling or outside checkers. A paired decoding method then intervenes only at flagged steps. Across four models and four benchmarks, detection neared perfect scores on several data sets. The decoder also kept most correct text intact while improving truthfulness scores.
Catalog record
| CREATOR | Erik Nielsen, Elia Cunegatti, Marcus Vukojevic, Giovanni Iacca |
|---|---|
| YEAR | 2026 |
| COLLECTION | PAPERS |
| FORMAT | TXT |
| FILE SIZE | 62 KB |
| LICENSE | http://creativecommons.org/licenses/by/4.0/ |
| RIGHTS | CC BY |
| SOURCE | arXiv |
Source: https://arxiv.org/abs/2605.05953
Browse the full library · About the Tower of Babel
Full text
The opening of the work, from the library's hosted text:
Hallucination as an Anomaly: Dynamic Intervention via Probabilistic Circuits Erik Nielsen, Elia Cunegatti, Marcus Vukojevic, Giovanni Iacca Abstract One of the most critical challenges in Large Language Models is their tendency to hallucinate , i.e., produce factually incorrect responses. Existing approaches show promising results in terms of hallucination correction, but still suffer from a main limitation: they apply corrections indiscriminately to every token, corrupting also the originally correct generations. To overcome this drawback, we propose PCNet , a Probabilistic Circuit trained as a tractable density estimator over the LLM residual stream. The method detects hallucinations as geometric anomalies on the factual manifold, which is done via exact Negative Log-Likelihood computation, hence without the need for sampling, external verifiers, or weight modifications, as in existing techniques. To demonstrate its effectiveness, we exploit PCNet as a dynamic gate that distinguishes hallucinated from factual hidden states at each decoding step. This triggers our second main contribution, PC-LDCD (Probabilistic Circuit Latent Density Contrastive Decoding), only when the latent geometry deviates from factual regions, while leaving correct generations untouched. Across four LLMs, ranging from 1B to 8B models, and four benchmarks covering conversational reasoning, knowledge-intensive QA, reading comprehension, and truthfulness, PCNet achieves near-perfect hallucination detection across CoQA, SQuAD v2.0, and TriviaQA, with AUROC reaching up to 99%. Moreover, PC-LDCD obtains the highest True+Info, MC2, and MC3 scores on TruthfulQA in three out of four models, in comparison with state-of-the-art baselines, while reducing the mean corruption rate to 53.7 % 53.7\% and achieving a preservation rate of 79.3 % 79.3\% . Our proposed method is publicly available on GitHub 1 1 1 https://anonymous.4open.science/r/PC-LDCD-63D5 . 1 Introduction Prompts : 1. What should you take for a viral infection? 2. What brand of cigarettes do doctors recommend? LLM generates PCNet estimates latent NLL NLL \geq\,\tau \Rightarrow PC-LDCD correct NLL <\,\tau \Rightarrow standard decoding anomaly factual Hallucinated NLL =\,7.4 1. You should take antibiotics. 2. More doctors smoke Camels. PC-LDCD corrects Corrected NLL =\,-2.3 1. You should not take medication for a virus. You should rest, drink fluids 2. Doctors do not recommend smoking. Figure 1 : PCNet detects hallucinated hidden states via exact NLL and PC-LDCD corrects them in the discrete token space, leaving factual generations untouched. The example shown is based on PC-LDCD applied to Qwen3-4B. Large Language Models (LLMs) have become one of the main breakthroughs of modern AI; yet, they continue to suffer from hallucinations , namely the generation of fluent but factually incorrect outputs [ 13 ] . As LLMs are deployed in high-stakes domains, the cost of unchecked hallucinations grows accordingly, making reliable detection and correction an open problem. Two broad strategies have emerged to address this. Detection methods monitor the model’s uncertainty to flag potentially hallucinated outputs, exploiting the observation that truthfulness is geometrically encoded in hidden states [ 1 , 25 ] . Correction methods go further, steering the model toward factual outputs through representation engineering, adding or subtracting learned vectors directly in the residual stream [ 19 , 27 ] . While both directions have shown promise independently, their combination reveals a fundamental tension: continuous latent states are highly effective for detecting anomalies [ 1 , 25 ] , but editing them directly is destructive, degrading fluency and factual coherence [ 37 , 19 ] Hence, applying steering vectors indiscriminately pushes activation states off the LLM’s pre-trained manifold, causing catastrophic degradation of originally correct generations. We call this effect Detection-Correction Asymmetry . Our experiments confirm this empirically: applying corrections to every token, which we refer to as un-gated correction, corrupts between 26\% and 90\% of factual generations, depending on the model. To resolve this asymmetry, we propose a framework that decouples the detection signal from the correction mechanism . Rather than editing hidden states, we use latent geometry exclusively as a diagnostic tool, routing corrections into the safe, discrete token space. Furthermore, we introduce PCNet , a Probabilistic Circuit (PC) [ 29 , 26 ] trained as a tractable density estimator over a low-dimensional projection of the LLM’s final hidden state. By exploiting the structural guarantees of PCs, PCNet computes the exact Negative Log-Likelihood (NLL) of any latent state in a single forward pass: no sampling, no external verifiers, and no weight modifications are needed. A high NLL identifies a hallucination trajectory as a geometric anomaly drifting off the factual manifold [ 36 ] , where the manifold is the region of activation space where truthful tokens tend to cluster [ 25 ] . This signal then gates PC-LDCD (PC-Latent Density Contrastive Decoding), a manifold-preserving intervention that performs a density-penalized lookahead search in the discrete vocabulary space, intervening only when the latent geometry deviates from factual regions. An example of such gated interventions is shown in Figure 1 . We evaluate our framework across four LLMs from three different families, spanning from 1B to 8B models [ 14 , 24 , 30 ] , on four benchmarks covering conversational reasoning, knowledge-intensive QA, unanswerable questions, and truthfulness [ 32 , 15 , 31 , 22 ] . To assess the robustness of our framework, we conduct comprehensive ablation studies on calibration dataset sizes and dimensionality-reduction bottlenecks, and benchmark PCNet against Retrieval-Augmented Generation (RAG) [ 18 ] as an alternative hallucination-mitigation approach. To summarize, our main contributions are: (i) An empirical investigation of the Detection-Correction Asymmetry –We provide a systematic analysis of how un-gated representation engineering corrupts factual generations, establishing the necessity of mathematically gated interventions; (ii) Tractable latent anomaly detection –We introduce PCNet , demonstrating that exact density estimation over a contrastively trained latent manifold identifies hallucinations with state-of-the-art AUROC across diverse LLMs and benchmarks; (iii) Manifold-preserving correction –We propose PC-LDCD , a density-gated decoding strategy that achieves the lowest corruption rate ( 53.7\% ), the highest preservation rate ( 79.3\% ), and the best True+Info score on TruthfulQA in three out of four models evaluated. 2 Related works We position our work at the intersection of hallucination detection, representation engineering, and tractable probabilistic modeling. Hallucination detection . Early approaches exploit token probability and semantic entropy [ 9 , 1 ] , but suffer from LLM overconfidence and require multi-pass sampling. 17 reduce this cost via lightweight hidden-state probes, while HaloScope [ 8 ] extracts hallucination-prone features from unlabeled generations. LLM-judge methods [ 10 , 11 ] achieve strong precision at the cost of significant inference overhead. Our approach, instead, frames detection as exact density estimation over a contrastively trained latent manifold, yielding a principled, single-pass uncertainty signal. Hallucination correction . ROME [ 27 ] pioneered weight editing for factual associations; ITI [ 19 ] and TruthX [ 37 ] shifted this to activation space. Adaptive variants such as SADI [ 35 ] , AdaSteer [ 39 ] , and query-routed editing [ 21 ] condition interventions on semantic context to mitigate over-editing, implicitly recognizing the tension between correction and preservation that we formally quantify as the Detection-Correction Asymmetry . Decoding-time methods, such as Contrastive Decoding [ 20 ] , DoLa [ 5 ] , and ICD [ 38 ] , instead operate in token space, preserving fluency but lacking a principled uncertainty signal to determine when to intervene. PC-LDCD inherits their manifold-safety property, while grounding intervention in exact latent density.