# Hallucination Is Linearly Decodable from Mid-Layer Hidden States in Quantized LLMs

DevFeed: [Hallucination Is Linearly Decodable from Mid-Layer Hidden States in Quantized LLMs](<https://devfeed.tech/articles/hallucination-is-linearly-decodable-from-mid-layer-hidden-states-in-quantized-llms-118232.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2606.02628>)

Author: Aizierjiang Aiersilan

Published: 2026-11-05T05:00:00Z

Content type: article

Language: en

Sources: [arXiv: Artificial Intelligence](<https://devfeed.tech/sources/arxiv-artificial-intelligence.md>)

Topics: [Deep neural networks](<https://devfeed.tech/topics/deep-neural-networks.md>), [Large Language Model](<https://devfeed.tech/topics/llm.md>), [quantization](<https://devfeed.tech/topics/quantization.md>), [Open Source Models & Datasets](<https://devfeed.tech/topics/open-source-models-datasets.md>), [llama](<https://devfeed.tech/topics/llama.md>), [qwen](<https://devfeed.tech/topics/qwen.md>)

Tags: [benchmarks](<https://devfeed.tech/tags/benchmarks.md>), [consistency](<https://devfeed.tech/tags/consistency.md>), [cs-ai](<https://devfeed.tech/tags/cs-ai.md>), [cs-cl](<https://devfeed.tech/tags/cs-cl.md>), [cs-et](<https://devfeed.tech/tags/cs-et.md>), [cs-lg](<https://devfeed.tech/tags/cs-lg.md>), [cs-ne](<https://devfeed.tech/tags/cs-ne.md>), [detection](<https://devfeed.tech/tags/detection.md>), [entropy](<https://devfeed.tech/tags/entropy.md>), [hidden-states](<https://devfeed.tech/tags/hidden-states.md>), [inside](<https://devfeed.tech/tags/inside.md>), [layer](<https://devfeed.tech/tags/layer.md>), [linear](<https://devfeed.tech/tags/linear.md>), [llama](<https://devfeed.tech/tags/llama.md>), [llama-3-1](<https://devfeed.tech/tags/llama-3-1.md>), [llms](<https://devfeed.tech/tags/llms.md>), [mistral](<https://devfeed.tech/tags/mistral.md>), [mlp](<https://devfeed.tech/tags/mlp.md>), [qa](<https://devfeed.tech/tags/qa.md>), [quantization](<https://devfeed.tech/tags/quantization.md>), [qwen](<https://devfeed.tech/tags/qwen.md>), [reproducibility](<https://devfeed.tech/tags/reproducibility.md>), [sampling](<https://devfeed.tech/tags/sampling.md>), [synthetic](<https://devfeed.tech/tags/synthetic.md>)

## AI overview

Across three 7B-8B instruction-tuned models in 4-bit NF4 quantization, a linear probe on a single mid-network hidden-state layer achieved 0.904-1.000 AUROC on held-out hallucination benchmarks. MLP probes rarely improved on linear probes by more than 0.01 AUROC, while sampling-based detectors reached at most 0.541 under the same protocol. Peak layers clustered around blocks 13-18 of 32 for Llama and Mistral, and 19-25 of 28 for Qwen. First-block attention entropy also provided a complementary signal on HaluEval-QA (0.866-0.941 AUROC) without additional inference cost. The authors attribute sampling methods' low scores to a mismatch between paired-label evaluation and the information those methods access, rather than an inherent limitation. The abstract reports code and data for reproduction on a single 8 GB GPU.

## Source excerpt

arXiv:2606.02628v1 Announce Type: cross Abstract: We investigate whether open-source LLMs encode a linearly separable truthfulness signal in their hidden states, and at which network depth this signal is strongest. Across three $7$B--$8$B instruction-tuned models (Llama-3.1-8B, Mistral-7B, Qwen2.5-7B) loaded in $4$-bit NF4 quantization, we extract per-layer hidden states on four hallucination benchmarks (TruthfulQA, HaluEval-QA, FEVER, and a controlled synthetic set) and compare four detection approaches: linear and MLP probes, INSIDE EigenScore, self-consistency, and attention entropy. A linear probe on a single mid-network layer achieves $0.904$--$1.000$ AUROC on held-out splits, while sampling-based detectors do not exceed $0.541$ AUROC under the same protocol. The truthfulness signal is approximately linear: MLP probes rarely surpass linear probes by more than $0.01$ AUROC. Peak probing layers fall in a consistent band across model families on natural-language benchmarks -- blocks~$13$--$18$ of~$32$ for Llama and Mistral, and blocks~$19$--$25$ of~$28$ for Qwen. First-block attention entropy provides a complementary signal in knowledge-grounded settings ($0.866$--$0.941$ AUROC on HaluEval-QA) at no additional inference cost. The low discriminability of sampling methods under this protocol reflects a structural mismatch between paired-label evaluation and the information these methods access, rather than an inherent limitation of those methods. Code and data are released for full reproducibility on a single $8$\,GB GPU.