Detecting Errors in Large Language Model Responses: The Incremental Predictive Value of Hidden States
Organizations: Beijing Institute of Computer Technology and Application, Beijing, China
Abstract
Although large language models support a wide range of tasks, hallucinations remain a major obstacle to user trust. When a model generates an answer, both its internal processing and final output vary with the question. Internal states are often expected to offer richer signals for hallucination detection. However, studies using these states typically report their standalone discrimination performance, while output-side comparisons often use simple baselines with weaker modeling capacity. We integrate output-side information available at inference time into a combined baseline and compare detection performance before and after adding hidden states under identical data splits and evaluation rules. Experiments cover open-ended generation and constrained multiple-choice tasks across different models. Adding hidden states improves AUROC by approximately 0.004 and 0.039 on the two tasks, respectively. Hidden states thus provide additional predictive information, but strong standalone detection performance can still yield only limited additional gains.
Figures & tables
| Symbol | Meaning |
|---|---|
| Error label: 1 for an erroneous response and 0 otherwise | |
| Output-side information included in this study, including prompt-side controls | |
| Information block ( ); its predictor in performance comparisons | |
| Hidden representation from a prespecified layer and pooling rule; its predictor when standalone performance is reported | |
| Combined baseline constructed from the five information blocks | |
| Fused model adding the hidden-state readout to the combined baseline |
| Block | Category | H1 | MCQ |
|---|---|---|---|
| Answer identity | Eligible generated identifier strings | Selected answer letter | |
| Surface form | Length, format, identifier count and positions | Option lengths and lexical overlap | |
| Text content | Full generated text | Selected option text | |
| Generation and sampling signals | Token scores, cross-sample consistency, and explicit confidence | Candidate-answer scores and cross-sample statistics | |
| Prompt context | Prompt text, task family, and generation route | Question stem and all options |
| Model | Task | (95% CI) | |||
| Qwen | H1 | 0.9889 | 0.9438 | 0.9905 | |
| MCQ | 0.8198 | 0.8292 | 0.8487 | ||
| Llama | H1 | 0.9712 | 0.9148 | 0.9752 | |
| MCQ | 0.7465 | 0.7916 | 0.8061 | ||
| Task | Readout or representation | (95% CI) | |||
| H1 | L2, wide grid | 0.9889 | 0.9482 | 0.9910 |
| Model | source | (95% CI) | |||
|---|---|---|---|---|---|
| Qwen | Option text | 0.8198 | 0.8292 | 0.8487 | |
| Qwen | Full response | 0.8221 | 0.8292 | 0.8495 | |
| Qwen | Option + response | 0.8221 | 0.8292 | 0.8498 | |
| Llama | Option text | 0.7465 | 0.7916 | 0.8061 | |
| Llama | Full response | 0.7699 | 0.7916 | 0.8076 | |
| Llama | Option + response | 0.7689 | 0.7916 | 0.8075 |
Appendix figures & tables14 assets
Supplementary material from the paper’s appendix.
Appendix
| Block | H1 | MCQ |
|---|---|---|
| Text representation of eligible identifier strings in the response | Four-dimensional one-hot encoding of the selected answer letter A–D | |
| 9 surface and format features: length, line count, list structure, identifier count and positions | 6 surface features: selected-option length, relative option lengths, and lexical overlap | |
| Full generated text | Text of the selected option | |
| 14 features: identifier-token and response log-probabilities, entropy, ranks, length-normalized scores, cross-sample consistency, and explicit confidence | 6 features: margins and entropy over four candidate letters, full-vocabulary entropy, answer-token log-probability, and cross-sample consistency | |
| Prompt text with prespecified task-family and generation-route indicators | Question stem and all options, excluding the model’s selection |
| Item | Prespecified setting |
|---|---|
| Outer and inner splits | 5 outer folds and 3 inner folds; grouping depends on E1, E2, E3, or M2c |
| Base learner | L2 logistic regression, liblinear , maximum 2,000 iterations |
| Base-learner tuning | , selected by grouped inner cross-validation within outer training folds |
| Meta-learner | L2 logistic regression, , lbfgs , maximum 5,000 iterations, tolerance , intercept, no class weights |
| Meta-learner inputs | Base learners’ decision_function scores, without further standardization |
| Repetitions and seeds | 3 repetitions; outer-fold seed |
| Arm | Unit | Final | Analyzable | Ineligible | Groups | Errors (rate) |
|---|---|---|---|---|---|---|
| H1 | Generation | 9,264 | 8,664 | 600 | 1,508 | 693 (0.0800) |
| MCQ | Question | 1,751 | 1,750 | 1 | 1,750 | 318 (0.1817) |
| Purpose | Comparison setting | Analysis role |
|---|---|---|
| Dependence on generation and sampling signals | Path Cremoves from the baseline and fused model in both arms | Block-dependence diagnostic |
| Sensitivity to numerical handling | Path Bretains information coverage and hidden states, reconstructing affected features through tail stabilization for comparison with path A | Protocol-deviation sensitivity |
| Performance without shared identifiers (E2) | Split by prompt–identifier co-occurrence components without using error labels; do not estimate performance if structural conditions fail | Prespecified generalization evaluation |
| Performance under changed vocabulary scope (E3) | Partition vocabulary by a fixed hash rule and redefine block-level labels and hidden states, yielding a separate estimand | Prespecified additional estimand |
| Sensitivity to grouping (M2c) | Construct label-dependent groups from prompts and fabricated identifiers; use only for sensitivity because bias direction is unknown | Grouping sensitivity |
| Dependence on identity and format cues | Compare full-text block with identity block and format block to check the task construct | Prespecified construct check |
| Path | Arm | (95% CI) | CI width | Precision | |||||
|---|---|---|---|---|---|---|---|---|---|
| A | H1 | 8,664 | 1,508 | 0.9889 | 0.9438 | 0.9905 | 0.00226 | Adequate | |
| A | MCQ | 1,750 | 1,750 | 0.8198 | 0.8292 | 0.8487 | 0.02001 | Adequate | |
| B | H1 | 8,664 | 1,508 | 0.9854 | 0.9438 | 0.9882 | 0.00319 | Adequate | |
| B | MCQ | 1,750 | 1,750 | 0.8219 | 0.8292 | 0.8492 | 0.01970 | Adequate | |
| C | H1 | 8,664 | 1,508 | 0.9853 | 0.9438 | 0.9891 | 0.00394 | Adequate | |
| C | MCQ | 1,750 | 1,750 | 0.5684 | 0.8292 | 0.8251 | 0.05969 | Insufficient |
| Path | Arm | CI width | Monte Carlo band for width | Precision |
|---|---|---|---|---|
| A | H1 | 0.00226 | Adequate | |
| A | MCQ | 0.02001 | Adequate | |
| B | H1 | 0.00319 | Adequate | |
| B | MCQ | 0.01970 | Adequate | |
| C | H1 | 0.00394 | Adequate | |
| C | MCQ | 0.05969 | Insufficient |
| Path / task | (95% CI) | |||
|---|---|---|---|---|
| A / H1 | 0.9712 | 0.9148 | 0.9752 | |
| A / MCQ | 0.7465 | 0.7916 | 0.8061 | |
| C / H1 | 0.9668 | 0.9148 | 0.9725 | |
| C / MCQ | 0.5595 | 0.7916 | 0.7816 |
| Arm and metric | ||||||
|---|---|---|---|---|---|---|
| H1 AUROC | 0.9826 | 0.6662 | 0.9286 | 0.8023 | 0.6456 | 0.9889 |
| H1 | 0.0063 | 0.3227 | 0.0603 | 0.1865 | 0.3433 | — |
| MCQ AUROC | 0.4884 | 0.5329 | 0.5304 | 0.8256 | 0.5783 | 0.8198 |
| MCQ | 0.3314 | 0.2868 | 0.2894 | 0.2415 | — |
| Path | Arm | iv-a min. bound (block) | M1b | lower bound | iv-b |
|---|---|---|---|---|---|
| A | H1 | ( ) | Pass | Fail | |
| A | MCQ | ( ) | Pass | Fail | |
| B | H1 | ( ) | Pass | Fail | |
| B | MCQ | ( ) | Pass | Fail | |
| C | H1 | ( ) | Pass | Fail | |
| C | MCQ | ( ) | Fail ( ) | Fail |
| Criterion | Arm | Decision | |||||
|---|---|---|---|---|---|---|---|
| M1b | H1 | 0.0036 | 0.2969 | 0.0500 | 0.1653 | 0.3188 | Pass |
| M1b | MCQ | 0.3007 | 0.2572 | 0.2603 | 0.2131 | Pass | |
| iv-a | H1 | 0.0048 | 0.2987 | 0.0514 | 0.1667 | 0.3204 | Pass |
| iv-a | MCQ | 0.3310 | 0.2866 | 0.2912 | 0.0145 | 0.2430 | Pass |
| Path | (95% CI) | M1b | iv-a | iv-b | |||
|---|---|---|---|---|---|---|---|
| A | 0.8094 | 0.8319 | 0.8379 | Not certified ( ) | Pass | Fail | |
| B | 0.8114 | 0.8319 | 0.8382 | Certified | Pass | Fail | |
| C | 0.7629 | 0.8319 | 0.8192 | Certified | Pass | Pass |
| Estimand | Path | (95% CI) | Non-inferiority Min. bound / threshold | Direct comparison Min. bound / threshold | Consistency bound / threshold | |
|---|---|---|---|---|---|---|
| E3 | A | 6,085 | ( ) | ( ) | ||
| E3 | B | 6,085 | ( ) | ( ) | ||
| E3 | C | 6,085 | ( ) | ( ) | ||
| M2c | A | 8,664 | ( ) | ( ) | ||
| M2c | B | 8,664 | ( ) | ( ) | ||
| M2c | C | 8,664 | ( ) | ( ) |
Language Model Error Detection
Language model error detection identifies unreliable answers, reasoning steps, and actions so systems can flag, verify, or repair them.
See all 90 papers