- The paper introduces FEPoID, a novel criterion that automatically identifies optimal intermediate layers by leveraging intrinsic dimension curves for enhanced hallucination detection.
- The paper rigorously benchmarks various selection methods, demonstrating that FEPoID outperforms traditional criteria by achieving near-oracle AUROC performance across diverse LLMs and tasks.
- The paper presents First-Sentence Truncation (FST) as a simple, effective heuristic that mitigates end-of-sequence noise, thereby further boosting detection performance.
Automatic Layer Selection for Hallucination Detection: A Comprehensive Analysis
Introduction
The issue of hallucinationโoutputting fluent yet factually incorrect or inconsistent generationsโremains a significant bottleneck in the deployment and reliability of LLMs. Hidden-state probing methods, which extract fixed representations from an LLM (keeping model weights frozen) and train a lightweight classifier (e.g., an MLP) for hallucination detection, have gained traction due to their flexibility and efficiency. Empirical evidence indicates that hallucination-related signals are not most salient in the final output layer but are instead strongly encoded in intermediate layers. However, principled, efficient, and generalizable criteria for automatically selecting such layers are lacking. This work offers a systematic evaluation of existing and novel criteria for automatic layer selection, introduces the First Effective Peak of Intrinsic Dimension (FEPoID) criterion, and proposes a practical token position heuristicโFirst-Sentence Truncation (FST)โthat amplifies detection performance.




Figure 1: Hallucination detection performance under a unified experimental setting. FEPoID consistently outperforms the last-layer heuristic, and its combination with truncation yields further gains across models.
Layer Selection in Hallucination Detection
Problem Motivation
Layer selection is nontrivial since the optimal probing layer (in terms of AUROC for hallucination detection) demonstrably varies across models, datasets, and tasks, and is rarely the output layer. Exhaustively evaluating every candidate layer is computationally impractical, while using simplistic middle or preset heuristics leads to suboptimal results. The core research question: Can an automatic, training-free criterion reliably identify layers encoding maximal hallucination-related information under the hidden-state probing paradigm?
Criteria and Hypotheses
The paper systematically benchmarks several criteria inspired by different representational hypotheses:
- Information-theoretic: RankMe score quantifies rank/linearity of embeddings.
- Gradient-based: Probe validation loss, relative gradient norm (RGN), and signal-to-noise ratio (SNR) capture trainability and robustness.
- Geometric/structural: Curvature measures trajectory complexity, and Intrinsic Dimension (ID) quantifies information capacity.
However, none of these approaches consistently yield layers that match oracle performance (the highest possible AUROC achievable with post hoc selection).
FEPoID: A New Criterion
FEPoID (First Effective Peak of Intrinsic Dimension) leverages the observation that ID curves across a network often show a multimodal structure: an early (intermediate) peak associated with semantic abstraction, and a late peak proximate to output layers dominated by surface information. FEPoID formalizes the selection of the first robust (within a forward window) local maximum of the ID curve as the optimal probing layer. This method is training-free, data-agnostic, architecture-agnostic, and introduces minimal computational overhead, outperforming all prior baselines across diverse LLMs and tasks.







Figure 2: Layer-wise AUROC and intrinsic dimension across QA datasetsโFEPoID consistently selects layers near the oracle optima, highlighting robustness for practical use.
Token Position Heuristics: Weakness of the Last-Token and FST
Problem with the Last-Token Representation
Standard practice for hidden-state probing is to extract a representation at the last generated token, justified by maximal receptive field in autoregressive models. However, this approach is vulnerable to end-of-sequence noise, including semantic drift, inconsistent continuations, and degenerate repetition, especially in models that do not emit precise <eos> tokens.
Figure 3: Generation behaviors in LLaMA-Instruct and Mistral-Instruct models without FST: LLaMA-Instruct more frequently produces noisy or inconsistent continuations post-answer.
First-Sentence Truncation (FST)
The authors propose FST: truncating generated responses at the end of the first sentence and extracting hidden states from the corresponding token. This rule-based, supervision-free heuristic consistently produces more discriminative class structure and improves performance for all hallucination detection methods, reducing contamination from noise introduced in late-stage generation.
Figure 4: AUROC improvements achieved by applying FST relative to the standard last generated token heuristic across all methods.
Empirical Results and Analysis
Numerical Results
- QA and Summarization Benchmarks: FEPoID achieves highest or near-highest AUROC on all tested datasets and LLMs, outperforming baselines rooted in validation loss, RGN, SNR, RankMe, Curvature, ID, LID, EigenScore, and surface/likelihood-based heuristics.
- Computational Efficiency: FEPoID's computation time is significantly lower than that of gradient-based or validation-loss methods, making it practical for large-scale or production deployments.
- Robustness: FEPoID is invariant to the forward horizon hyperparameter w within a reasonable range, and generalizes to models of various scales, instruction-tuned and base, as well as to tasks beyond text (e.g., ViT-based image modeling).
Figure 5: The AUROC gap between the layer selected by each criterion and the oracle best layerโfor FEPoID, the gap is consistently minimal, while other methods yield larger, more variable disparities.
Practical and Theoretical Implications
The work substantiates the claim that automatic layer selection is essential for unlocking the full potential of latent representations for factuality/semantic tasks, and that representation quality does not monotonically increase with depth. The ID curve structure provides a theoretically grounded signal for extracting maximal abstract semantic content. FST, as a simple truncation heuristic, highlights the need to reconsider assumptions on context completeness and noise when extracting representations for any downstream classification or calibration task in LLMs.







Figure 6: Layer-wise AUROC and intrinsic dimension (with FST) across QA datasetsโFEPoID (diamonds) consistently tracks the actual best-performing layer (stars).
Generalization and Extension
The FEPoID framework is validated on vision tasks: in ViT image classification, it reliably picks high-performing layers corresponding to the last (penultimate) transformer block, paralleling the findings from language modeling. This supports FEPoID's generality for layer selection across modalities and tasks that favor semantic abstraction.
Conclusion
This work provides the first systematic, cross-model, and cross-task evaluation of automatic layer-selection criteria for hidden-state probing in hallucination detection. Prior layer-selection rules, including validation loss, gradient-based, information-theoretic, and geometric criteria, fail to reliably identify optimal layers. FEPoIDโa training-free and computationally lightweight criterion based on intrinsic dimension curvesโconsistently selects near-optimal intermediate layers. First-Sentence Truncation further enhances representation quality by precluding end-of-sequence noise without requiring external supervision. Together, these contributions offer a principled, practical blueprint for robust, modular hallucination detectionโand more generally, for extracting task-relevant representations from LLMsโwithout model modification or costly validation.
Future directions include extending the approach to more abstract tasks and modalities and formalizing the theoretical connections between intrinsic dimension dynamics, semantic abstraction, and downstream discriminability.