CausalGaze: Unveiling Hallucinations via Counterfactual Graph Intervention in Large Language Models
Organizations: College of Electronic Engineering, National University of Defense Technology · Anhui Province Key Laboratory of Cyberspace Security Situation Awareness and Evaluation · Institute of Computer Application, China Academy of Engineering Physics
Abstract
Despite the groundbreaking advancements made by large language models (LLMs), hallucination remains a critical bottleneck for their deployment in high-stakes domains. Existing classification-based methods mainly rely on static and passive signals from internal states, which often captures the noise and spurious correlations, while overlooking the underlying causal mechanisms. To address this limitation, we shift the paradigm from passive observation to active intervention by introducing CausalGaze, a novel hallucination detection framework based on structural causal models (SCMs). CausalGaze models LLMs' internal states as dynamic causal graphs and employs counterfactual interventions to disentangle causal reasoning paths from incidental noise, thereby enhancing model interpretability. Extensive experiments across four datasets and three widely used LLMs demonstrate the effectiveness of CausalGaze, especially achieving 3.3% improvement in AUROC on the TruthfulQA dataset compared to state-of-the-art baselines.
Figures & tables
| LLMs | Methods | TruthfulQA | TriviaQA | SciQ | HaluEval | ||||
|---|---|---|---|---|---|---|---|---|---|
| AUROC | F1-Score | AUROC | F1-Score | AUROC | F1-Score | AUROC | F1-Score | ||
| Llama2-7B | SelfCheckGPT | 0.5295 | 0.5345 | 0.7322 | 0.7296 | 0.6790 | 0.6830 | 0.6670 | 0.6591 |
| EigenScore | 0.5193 | 0.5286 | 0.7398 | 0.7443 | 0.5960 | 0.6008 | 0.5960 | 0.5880 | |
| Perplexity | 0.5677 | 0.6034 | 0.7213 | 0.6995 | 0.5260 | 0.5256 | 0.5260 | 0.5020 | |
| LN-Entropy | 0.6151 | 0.6187 | 0.7091 | 0.7332 | 0.5760 | 0.5826 | 0.6678 | 0.6544 | |
| Semantic Entropy | 0.6217 | 0.6145 | 0.7321 | 0.7209 | 0.6820 | 0.6797 | 0.6820 | 0.6865 | |
| Projection Layer | Dimension | TruthfulQA | TriviaQA | SciQ | Halueval | ||||
|---|---|---|---|---|---|---|---|---|---|
| AUROC | F1-Score | AUROC | F1-Score | AUROC | F1-Score | AUROC | F1-Score | ||
| w/o | 4096 | 0.6069 | 0.6469 | 0.5898 | 0.5318 | 0.5889 | 0.6559 | 0.5530 | 0.6676 |
| with | 64 | 0.8712 | 0.7818 | 0.8719 | 0.7809 | 0.8301 | 0.7773 | 0.8989 | 0.6322 |
| 128 | 0.8805 | 0.8189 | 0.8614 | 0.7786 | 0.8390 | 0.7701 | 0.9280 | 0.8001 | |
| 256 | 0.8413 | 0.7822 | 0.8840 | 0.8011 | 0.8324 | 0.7462 | 0.8837 | 0.7093 | |
| 512 | 0.8807 | 0.8018 | 0.8849 | 0.7956 | 0.8267 | 0.7333 | 0.8168 | 0.7698 | |
| Model | Variant | TruthfulQA | TriviaQA | SciQ | HaluEval |
|---|---|---|---|---|---|
| Llama2-7B | CausalGaze | 0.8189 | 0.7786 | 0.7701 | 0.8001 |
| w/o Gradient | 0.7720 | 0.7763 | 0.7549 | 0.6316 | |
| Random Gradient | 0.7811 | 0.7656 | 0.7319 | 0.6630 | |
| MLP( ) | 0.7793 | 0.7674 | 0.7540 | 0.7241 | |
| Qwen2-7B | CausalGaze | 0.8071 | 0.8280 | 0.8283 | 0.8360 |
| w/o Gradient | 0.7660 | 0.8240 | 0.8400 | 0.8033 |
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
| Methods | TruthfulQA | TriviaQA | SciQ | HaluEval |
|---|---|---|---|---|
| Lookback Lens | 0.603 / 0.633 | 0.771 / 0.781 | 0.726 / 0.731 | 0.752 /0 .795 |
| Factoscope | 0.552 / 0.584 | 0.714 / 0.760 | 0.682 / 0.702 | 0.742 / 0.788 |
| TAD | 0.804 / 0.832 | 0.844 / 0.849 | 0.815 / 0.833 | 0.874 / 0.856 |
| CausalGaze | 0.881 / 0.852 | 0.861 / 0.895 | 0.839 / 0.855 | 0.928 / 0.938 |
| LLMs | Projection Layer | Dimension | TruthfulQA | TriviaQA | SciQ | Halueval | ||||
|---|---|---|---|---|---|---|---|---|---|---|
| AUROC | F1-Score | AUROC | F1-Score | AUROC | F1-Score | AUROC | F1-Score | |||
| Qwen2-7B | w/o | 3584 | 0.5925 | 0.5663 | 0.6043 | 0.5728 | 0.5964 | 0.6459 | 0.5620 | 0.6588 |
| with | 64 | 0.8330 | 0.7845 | 0.8764 | 0.7890 | 0.8976 | 0.8423 | 0.8946 | 0.7892 | |
| 128 | 0.8680 | 0.8071 | 0.9106 | 0.8280 | 0.9328 | 0.8283 | 0.9220 | 0.8360 | ||
| 256 | 0.8357 | 0.7786 | 0.8873 | 0.8130 | 0.8741 | 0.7740 | 0.8863 | 0.7538 | ||
| 512 | 0.8588 | 0.7943 | 0.8743 | 0.7924 | 0.8661 | 0.7548 | 0.8750 | 0.7630 | ||
| LLMs | Layer Number | TruthfulQA | TriviaQA | SciQ | Halueval | ||||
|---|---|---|---|---|---|---|---|---|---|
| AUROC | F1-Score | AUROC | F1-Score | AUROC | F1-Score | AUROC | F1-Score | ||
| Qwen2-7B | 16 | 0.8718 | 0.7836 | 0.9005 | 0.8194 | 0.9114 | 0.8445 | 0.9260 | 0.8004 |
| 20 | 0.8776 | 0.7893 | 0.9125 | 0.8304 | 0.9268 | 0.8675 | 0.9335 | 0.8421 | |
| 24 | 0.8892 | 0.7747 | 0.8994 | 0.7961 | 0.8993 | 0.8593 | 0.9154 | 0.8266 | |
| 28 | 0.8757 | 0.7694 | 0.8873 | 0.7868 | 0.8858 | 0.8495 | 0.9255 | 0.8273 | |
| 32 | 0.8680 | 0.8071 | 0.9106 | 0.8280 | 0.9328 | 0.8283 | 0.9220 | 0.8360 | |
| Method | Input memory | Model parameters | Inference latency |
|---|---|---|---|
| SAPLMA | 608KB | 109K | 0.307ms |
| HaluGNN | 614KB | 213K | 0.903ms |
| SelfCheckGPT | 608KB | - | 10.32s |
| CausalGaze | 614KB | 575K | 1.731ms |
LLM Hallucination Detection
Large language model hallucination detection identifies unsupported, incorrect, or fabricated claims in model outputs and traces.
See all 208 papers