Abstract
Large Language Models (LLMs) often hallucinate even when they possess the correct underlying knowledge. This paper introduces END (cross-layer Entropy eNhanced Decoding), a training-free method that monitors how the probability of individual tokens evolves across model layers to identify and amplify factual content. By targeting tokens that exhibit a sharp growth trend in confidence across layers—a characteristic of factual knowledge injection—END significantly improves truthfulness and informativeness without sacrificing general reasoning capabilities.
Introduction
The "hallucination" problem remains a significant challenge for LLMs, where models generate plausible but false information. Recent research suggests that LLMs often "know" the truth in their intermediate layers but fail to surface it in the final output, or struggle to distinguish factual "hard" tokens (e.g., specific names or dates) from "soft" functional tokens (e.g., prepositions).
Previous approaches like DoLA attempted to mitigate this by contrasting a single "mature" layer with the final layer. However, factual knowledge does not "mature" at the same layer for every token. A fixed layer selection is often too coarse. This paper proposes a more granular, token-wise approach to detect factual reserves.
Methodology: Cross-layer Entropy eNhanced Decoding (END)
The core innovation of END is the analysis of the "growth trajectory" of candidate tokens as they pass through the transformer stack. The method follows a four-step process:
- Extract Logits: For candidate tokens, prediction probabilities are extracted across multiple layers, typically from the middle to the top of the stack.
- Cross-Layer Distribution: These values are normalized to create a probability distribution across the layers for each specific token.
- Calculate Cross-Layer Entropy:
- Low Entropy: Tokens whose probability starts low and spikes sharply in final layers exhibit low cross-layer entropy. This "sharp growing trend" is identified as a signature of factual knowledge injection.
- High Entropy: Tokens with flat or fluctuating probabilities across layers (common for functional words) exhibit high entropy.
- Adjust Prediction: The final output distribution is adjusted to favor tokens with low cross-layer entropy, effectively "listening" to tokens that show a late-stage surge in confidence.
END is training-free and can be integrated into existing LLMs during the decoding phase.
Experimental Evaluation
The authors evaluated END on several benchmarks, including TruthfulQA, FACTOR (Expert, News, Wiki), and standard short-form QA datasets like TriviaQA and Natural Questions (NQ).
Key Results
END consistently outperformed standard greedy decoding and state-of-the-art methods like DoLA:
- TruthfulQA: On Llama-2-7B, END improved the TruthInfo score by 21.79%* over greedy decoding.
- Informativeness: It reduced the "rejection rate" (non-answers) from 20.32% to 5.51% on Llama-2-7B, making the model more useful.
- Generalization: Performance was maintained or slightly improved on TriviaQA and NQ, proving factuality gains do not come at the cost of core knowledge.
- Scalability: Gains were consistent across Llama-2 (7B to 70B), Mistral, and Qwen architectures.
Discussion and Insights
The most significant finding is the "Factual Signature": factual tokens (names, dates, locations) exhibit a unique behavior where their probability "explodes" in the final layers, whereas functional tokens stabilize much earlier. By calculating entropy per token rather than picking a fixed layer, END achieves higher precision.
Limitations
- Knowledge Gap: END amplifies existing internal knowledge; it cannot correct facts the model never learned or learned incorrectly.
- Computational Overhead: While efficient, calculating entropy for token subsets introduces a slight decoding slowdown compared to greedy search, though it remains competitive with previous layer-contrast methods.
Conclusion
END provides a robust, training-free mechanism to enhance LLM factuality by leveraging the internal dynamics of token probability growth. By identifying the unique cross-layer signature of factual information, it allows models to be both more truthful and more informative.
Summary updated