Introduction
Large Language Models (LLMs) frequently exhibit "hallucinations," generating factually incorrect statements with high confidence. Recent advancements in contrastive decoding, such as DoLa, attempt to mitigate this by contrasting the "mature" output of the final transformer layer with "premature" outputs from earlier layers. However, this approach assumes the final layer is sufficiently mature and that the selection of the premature layer—often based on Jensen-Shannon Divergence (JSD) relative to the final layer—is unbiased. This paper introduces a novel decoding strategy that addresses these limitations through logit extrapolation and entropy-guided layer selection.
Methodology
The proposed framework enhances the inference pipeline by simulating deeper model representations and improving the selection of contrasting layers.
Logit Extrapolation
To address cases where the final layer has not yet reached a stable factual distribution, the authors implement logit extrapolation. By analyzing the trajectory of token probabilities across the final layers, the method uses linear regression to project these values into a "virtual" deeper layer. This extrapolation is applied only to "critical" tokens that exhibit monotonic probability trends, ensuring stability and reducing noise.
Entropy-Guided Layer Selection
Traditional methods select premature layers based on their divergence from the final layer. If the final layer is already hallucinating, this selection becomes flawed. The authors instead utilize Shannon entropy to decouple the selection process.
- For factual prompts, the layer with the maximum entropy (highest uncertainty) is selected as the premature contrast.
- For open-ended prompts, the layer with the minimum entropy is chosen. This selection occurs within specific layer "buckets" to maintain meaningful contrastive signals.
Analysis of Model Dynamics
The motivation for this approach stems from observations of how entropy and distribution divergence evolve across layers.
As illustrated in the analysis above, the rate of entropy change varies significantly by dataset. In benchmarks like TruthfulQA, the model's predictions continue to shift significantly even in the final layers, indicating that the "mature" distribution has not fully stabilized. Furthermore, the JSD analysis highlights the risk of relying solely on the final layer for contrastive selection, as the relationship between layers can be inconsistent.
Experimental Results
The method was evaluated on LLaMA models (7B to 65B) across several benchmarks, including TruthfulQA, FACTOR, StrategyQA, and GSM8K.
- Factuality: On TruthfulQA (MC1), the method achieved 36.1% accuracy with LLaMA-7B, significantly outperforming DoLa (32.2%) and standard greedy decoding (25.6%).
- Reasoning: In multi-step reasoning tasks like StrategyQA, the approach improved accuracy to 74.3% for LLaMA-33B.
- Efficiency: The implementation is computationally efficient, incurring only a 1.08x latency overhead compared to standard greedy search.
Conclusion
Entropy Guided Extrapolative Decoding provides a robust mechanism for improving LLM factuality by leveraging internal model dynamics. By extrapolating beyond the physical layers and using entropy to guide layer selection, the method effectively steers the model toward more truthful generations without the need for external knowledge retrieval or significant computational cost. Future work may explore the integration of this technique with Retrieval-Augmented Generation (RAG) to further enhance factual grounding.
Summary updated