Existing hallucination detection methods for large language models (LLMs) rely on external verification at inference time, requiring gold answers, retrieval systems, or auxiliary judge models. We ask whether this external supervision can instead be distilled into the model's own representations during training, enabling hallucination detection from internal activations alone at inference time. We introduce a weak supervision framework that combines three complementary grounding signals: substring matching, sentence embedding similarity, and an LLM as a judge verdict to label generated responses as grounded or hallucinated without human annotation. Using this framework, we construct a 15000-sample dataset from SQuAD v2 (10500 train/development samples and a separate 5000-sample test set), where each example pairs a LLaMA-2-7B generated answer with its full per-layer hidden states and structured hallucination labels. We then train five probing classifiers: ProbeMLP (M0), LayerWiseMLP (M1), CrossLayerTransformer (M2), HierarchicalTransformer (M3), and CrossLayerAttentionTransformerV2 (M4), directly on these hidden states, treating external grounding signals as training-time supervision only. Our central hypothesis is that hallucination detection signals can be distilled into transformer representations, enabling internal detection without any external verification at inference time. Results support this hypothesis. Transformer-based probes achieve the strongest discrimination, with M2 performing best on 5-fold average AUC/F1, and M3 performing best on both single-fold validation and held-out test evaluation. We also benchmark inference efficiency: probe latency ranges from 0.15 to 5.62 ms (batched) and 1.55 to 6.66 ms (single sample), while end-to-end generation plus probe throughput remains approximately 0.231 queries per second, indicating negligible practical overhead.
Figures & tables
Model
AUC
F1
ECE
Acc
M0: ProbeMLP
0.7560 ± 0.0079
0.4969 ± 0.0069
0.2370 ± 0.0583
0.6687
M1: LayerWiseMLP
0.7999 ± 0.0105
0.5403 ± 0.0103
0.2258 ± 0.0434
0.7064
M2: CrossLayerTransformer
0.8515 ± 0.0054
0.6096 ± 0.0154
0.1721 ± 0.0600
0.7851
M3: HierarchicalTransformer
0.8490 ± 0.0089
0.5898 ± 0.0219
0.1845 ± 0.0791
0.7689
M4: CrossLayerAttentionTransformerV2
0.8275 ± 0.0066
0.5845 ± 0.0142
0.1231 ± 0.0461
0.7920
Table 1: 5-fold cross-validation performance (mean ± std) across the five trained architectures (M0–M4). All probes are trained on yjudge labels. Higher AUC/F1/Acc and lower ECE are better.
Table 2: Single-fold validation metrics from best-checkpoint analysis. Here, τ∗ denotes the threshold maximizing validation F1.
Model
AUC
PR-AUC
F1
Acc
ECE
Best F1
τ∗
M0: ProbeMLP
0.7441
0.5124
0.5316
0.6712
0.2092
0.5351
0.5468
M1: LayerWiseMLP
0.8074
0.6070
0.6025
0.7514
0.1430
0.6084
0.4581
M2: CrossLayerTransformer
0.8490
0.6960
0.6475
0.7742
0.1747
0.6600
0.6453
M3: HierarchicalTransformer
0.8577
0.7057
0.6644
0.8040
0.1025
0.6653
0.4729
M4: CrossLayerAttentionTransformerV2
0.8294
0.6454
0.6236
0.7822
0.1136
0.6282
0.3646
Table 3: Final held-out test-set results (5,000 rows) on the held-out test dataset. Here, τ∗ is the threshold that maximizes F1 on the evaluation sweep.
Model
Batch lat. (ms)
Single lat. (ms)
Samples/s
GPU mem (MB)
M0: ProbeMLP
0.15
1.66
6687.96
584.51
M1: LayerWiseMLP
0.19
1.55
5362.70
589.26
M2: CrossLayerTransformer
5.62
6.66
177.83
629.25
M3: HierarchicalTransformer
2.59
4.02
385.43
628.68
M4: CrossLayerAttentionTransformerV2
1.34
4.68
745.58
603.66
Table 4: Probe-only benchmark with hidden states precomputed. “Batch lat.” denotes amortized latency under batched inference; “Single lat.” denotes one-sample latency.
Model
Gen. (s)
Probe (ms)
Total (s)
Total q/s
Avg prob.
M0: ProbeMLP
4.3313
1.262
4.3325
0.231
0.549
M1: LayerWiseMLP
4.3313
1.584
4.3329
0.231
0.489
M2: CrossLayerTransformer
4.3313
6.709
4.3380
0.231
0.470
M3: HierarchicalTransformer
4.3313
3.637
4.3349
0.231
0.456
M4: CrossLayerAttentionTransformerV2
4.3313
4.758
4.3360
0.231
0.332
Table 5: End-to-end deployment-style benchmark including generation, hidden-state extraction, and probe scoring. “Avg prob.” is the mean predicted hallucination probability over the benchmark set.
Method
AUC
F1
Acc
Cosine Similarity (Max)
0.4110
0.4269
0.5146
Mean Similarity
0.4092
0.4220
0.4900
Softmax Similarity
0.4105
0.4254
0.5068
Token F1 Similarity
0.4222
0.3652
0.3116
Best Probe (M3: HierarchicalTransformer)
0.8577
0.7057
0.6644
Table 6: Output-level similarity baselines and best probe result on the held-out 5,000-row test set.
Model ID
Acc
Best F1
ROC-AUC
PR-AUC
ECE
M0
0.8925
0.8262
0.9528
0.8880
0.1145
M1
0.8127
0.6357
0.8655
0.6760
0.1515
M2
0.8641
0.7520
0.9255
0.8123
0.1754
M3
0.7472
0.6959
0.8954
0.7520
0.2484
M4
0.8702
0.7396
0.9187
0.7976
0.1265
Table 7: Diagnostic metrics computed on the full training-data evaluation run ( eval 10 , 10k samples). These are not held-out test metrics and should not be interpreted as final generalization performance.
Figure 1: PR (top left), ROC (top right), and predicted logit distribution (bottom) from full train/development-pool diagnostic inference. These plots are intended for qualitative comparison only and do not reflect held-out test evaluation.