Organizations: Beijing Advanced Innovation Center for Future Blockchain and Privacy Computing, School of Artificial Intelligence, Beihang University, Beijing, China. · State Key Laboratory of Virtual Reality Technology and Systems, Beihang University, Beijing, China. · Beijing Academy of Blockchain and Edge Computing, Beijing, China. · Renmin University of China, Beijing, China.
Large Language Models (LLMs) are powerful and widely adopted, but their practical impact is limited by the well-known hallucination phenomenon. While recent hallucination detection methods have made notable progress, we find most of them overlook the dynamic nature and underlying mechanisms of it. To address this gap, we propose HalluSAE, a phase transition-inspired framework that models hallucination as a critical shift in the model's latent dynamics. By modeling the generation process as a trajectory through a potential energy landscape, HalluSAE identifies critical transition zones and attributes factual errors to specific high-energy sparse features. Our approach consists of three stages: (1) Potential Energy Empowered Phase Zone Localization via sparse autoencoders and a geometric potential energy metric; (2) Hallucination-related Sparse Feature Attribution using contrastive logit attribution; and (3) Probing-based Causal Hallucination Detection through linear probes on disentangled features. Extensive experiments on Gemma-2-9B demonstrate that HalluSAE achieves state-of-the-art hallucination detection performance.
Figures & tables
Figure 1: Illustration of Phase Transition in LLM’s reasoning trajectories. The trajectories in potential energy space reveal three phases: early stability (Phase I), critical transition (Phase II, yellow highlight), and sustained error plateau (Phase III). Factual generation (blue) maintains low energy throughout, while hallucination (gradient color) undergoes abrupt energy increase ( ΔE ) during the transition zone, entering a persistent high-energy state.
Figure 2: Illustration of the Exploratory Experimental Design. We conduct two complementary experiments: Exp 1 investigates layer-wise energy distribution by dividing 42 layers into Early/Middle/Late groups and comparing GPE differences; Exp 2 identifies microscopic feature-level contributions by analyzing differential features that exhibit high activation in hallucination samples but low activation in factual samples.
Figure 3: Experimental Results on Hallucination Dynamics. (a) Layer-wise energy distribution (grouped analysis). Grouped box plots reveal that hallucination samples’ GPE exhibits significant escalation from Early to Late layer groups (*** p<0.001 ). Error bars indicate 95% confidence intervals (bootstrap, n=200 per group). (b) Sparse feature contribution analysis. Cumulative energy contribution curve demonstrates that a small fraction of differential features account for the majority of total energy increase, exhibiting a highly skewed distribution. Gray bars represent individual feature energy contributions.
In-Distribution (HaluEval)
Out-of-Distribution (TriviaQA)
Category
Method
AUC ↑
Acc. ↑
Recall ↑
AUC ↑
Acc. ↑
Recall ↑
Uncertainty
LN-Entropy
54.93
56.50
65.12
70.94
65.75
66.50
Semantic Entropy
62.77
67.98
55.45
71.85
69.21
71.88
Consistency
Lexical Similarity
64.25
62.50
59.00
65.40
64.25
53.50
SelfCheckGPT
63.78
64.12
56.23
63.53
61.51
57.12
Internal State
EigenScore
60.53
59.50
77.13
61.51
60.25
66.50
Table 1: Comparison Results of Hallucination Detection Performance Across Benchmarks. We compare our method against eight representative baselines spanning four paradigms. Results are grouped by in-distribution (HaluEval) and out-of-distribution (TriviaQA) settings. Best results are highlighted in gray. All metrics are reported as percentages, with AUC as the primary ranking metric.
Figure 4: Examples of Samples with High-Activation on Identified Sparse Features. Each feature exhibits stable and interpretable error patterns: L27-9659 shows fixed year substitution (always outputs “1993”), L28-87984 demonstrates numerical shift patterns (+4 years, -0.2 billion), L23-71479 drives domain-specific entity confusion (Tesla/Edison, Newton/Einstein), and L24-35793 triggers cross-domain celebrity substitution (Tolkien/Rowling, Jobs/Gates).
Feature ID
Hal./Fact. Ratio
Top-10 Purity
Mean Activation
L27-9659
22.92
10/10 (100%)
8.03
L28-87984
81.52
10/10 (100%)
8.54
L23-71479
16.57
9/10 (90%)
7.80
L24-35793
12.41
10/10 (100%)
6.86
Table 2: Identified High-Purity Hallucination-Driving Features
Strategy
Layer Range
# Layers
# Feat.
ID AUC
OOD AUC
Δ vs Ours
Random-13
Random 13 layers
13
100
0.83
0.76
-4.0%
Early-13
L0–12 (Stable)
13
100
0.81
0.73
-7.0%
Late-13
L29–41 (Plateau)
13
100
0.88
0.78
-2.0%
All-42
L0–41 (Full model)
42
420
0.91
0.79
-0.1%
Ours
L23–35 (Transition)
13
100
0.93
0.80
Baseline
Our method achieves comparable OOD performance to All-42 while using 4.2 × fewer features.
Table 3: Ablation Results on Layer Selection Strategy. Comparison of detection performance across different layer selection strategies using a fixed feature budget of 100 dimensions. The transition zone (L23–35) achieves optimal performance with minimal features, demonstrating the effectiveness of our energy-based localization method.
Figure 5: Illustration of Layer-wise Energy Difference Evolution Across All 42 Layers. Geometric Potential Energy (GPE) difference (Hallucination - Factual) reveals three distinct phases: stable period (L0–22, near-zero difference with random fluctuations), transition zone (L23–35, sharp 20.7-fold escalation highlighted by shaded region), and plateau period (L36–41, sustained high-energy state). Error bars represent 95% confidence intervals (bootstrap, n =900 per group).
Method
Purity
AUC
Accuracy
ID
OOD
ID
OOD
Wrong-only DLA
73%
0.88
0.79
81.2%
74.5%
Correct-only DLA
68%
0.87
0.77
79.8%
72.1%
Random Selection
51%
0.76
0.68
70.3%
65.2%
C-DLA (Ours)
89%
0.93
0.80
85.6%
78.3%
Table 4: Ablation Results on Feature Attribution Methods. Comprehensive evaluation using Top-100 features in transition zone (L23–35). All methods use identical layer ranges and feature budgets.
Configuration
Layers
# Feat.
AUC
ID
OOD
Baseline
All-42
420
0.63
0.63
+Stage I only
L23–35
130
0.71
0.64
+Stage II only
All-42
420
0.85
0.78
Full (I+II)
L23–35
100
0.93
0.80
Table 5: Results of Joint Ablation Study. Evaluating the synergistic effects of Stage I and Stage II.
Figure 6: Illustration of Cumulative C-DLA Contribution Curve (Pareto Distribution). The top-0.1% features (131 out of 131,072) account for 41.1% of total attribution. The top-1% (1,310) cover 62.5%. The sharp elbow indicates extreme inequality in feature importance (Gini coefficient = 0.912 vs random baseline 0.414). Gray bars represent individual feature contributions, while the red curve shows cumulative percentage.
Appendix figures & tables14 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 7: Data Cleaning Pipeline. Five-stage workflow from raw data to curated dataset.
Attribute
HaluEval
TriviaQA
Total samples
1,800
4,000
Hallucination / Factual
900 / 900
2,000 / 2,000
Question length (avg.)
8.5 words
12.3 words
Answer length (avg.)
4.9 tokens
1.5 words
Initial pool size
1,876
4,092
Removed ambiguous cases
76 (4.0%)
92 (2.2%)
Appendix
Table 6: Dataset Statistics and Comparison
Gemma Scope SAE Details
Hardware Configuration
Dimension
131,072
GPU
8× NVIDIA RTX 4090
Overcompleteness
36.6×
VRAM per GPU
48GB
Activation
JumpReLU
Framework
PyTorch 2.1.0
Sparsity ( L0 )
25–42
CUDA Version
12.1
Hook position
resid_post
Precision
Float32 (Gemma) / FP16 (SAE)
Reconstruction MSE
< 0.01
Random Seed
42
Appendix
Table 7: Detailed Hardware and Memory Configuration
The University of Texas at Dallas, Richardson, TX 75080, USA · National Institute of Standards and Technology, Gaithersburg, USA · Carnegie Mellon University, PA, USA