Abstract
Large Language Models (LLMs) frequently hallucinate, often with high confidence. While Retrieval-Augmented Generation (RAG) aims to mitigate this by providing external context, it is difficult to determine if the model is utilizing that context correctly. This study introduces the "LLM Microscope" framework, which leverages mechanistic interpretability to analyze internal model activations. Our findings demonstrate that internal features—specifically from the first output token—can predict answer correctness with approximately 75% accuracy. Furthermore, we show that internal signals are superior to direct prompting for evaluating the efficacy of external context.
Introduction
The core challenge in deploying LLMs for factual tasks is trustworthiness. LLMs are notoriously poorly calibrated, often assigning high probabilities to incorrect answers. Traditional "self-evaluation" methods, where the model is asked to rate its own confidence, are frequently unreliable. In RAG systems, this manifests as two problems: knowing when a model is guessing (confidence estimation) and determining if retrieved context is actually useful (efficacy evaluation).
Methodology
The "LLM Microscope" treats the LLM as a biological specimen, using mechanistic interpretability tools to observe activity across its layers. The research focuses on two primary questions:
- RQ1 (Correctness): Can internal features predict if a final response will be correct? Researchers trained a Random Forest classifier on features including hidden states and outputs from "Logit Lens" and "Tuned Lens" techniques, which project intermediate activations into vocabulary space.
- RQ2 (Context Efficacy): How does the model handle external context? The authors introduced a new metric, $\Psi$ (Psi), which balances the Parametric Knowledge Score (PKS)—reliance on pre-trained weights—against the External Context Score (ECS)—alignment with provided context.
Experimental Setup
The study evaluated six models, including LLaMA 3 (8B), Qwen 2.5 (3B/7B), and Gemma 2 (9B), across the TriviaQA and MMLU benchmarks. To test context efficacy, the researchers used "polluted" contexts, including incorrect but plausible information and irrelevant data.
Key Findings
- The First Token Oracle: Activations from the very first output token are sufficient to predict the correctness of the entire response. This suggests the potential for "early auditing" to halt incorrect generations.
- Internals vs. Prompts: Internal activations, such as entropy in intermediate layers, remain high when a model struggles, even if the model's final output appears confident. Direct prompting often leads to overconfidence.
- The Context Paradox: Models can internally distinguish between relevant and irrelevant context but often fail to ignore misleading information during generation, likely due to instruction-tuning biases that favor following the prompt.
Key Results
Internal-state classifiers achieved over 75% accuracy and 70% AUC-ROC in predicting correctness across various models. Notably, the internals-based $\Psi$ metric significantly outperformed prompting baselines in identifying correct versus incorrect context, succeeding ~79-85% of the time compared to ~20% for prompting.
Conclusion
By analyzing LLMs through their internal states rather than treating them as black boxes, we can develop more robust, self-correcting AI systems. Future work will explore whether these internal signals remain as clear in long-form generation and complex reasoning tasks.
Summary updated