Abstract
Large Language Models (LLMs) are increasingly being used in real-world applications. However, concerns about the reliability of the content they generate persist, as it frequently deviates from factual correctness or exhibits deficiencies in logical reasoning. This paper proposes a novel decoding strategy aimed at enhancing both factual accuracy and inferential reasoning without requiring any modifications to the architecture or pre-trained parameters of LLMs. Our approach adjusts next-token probabilities by analyzing the trajectory of logits from lower to higher layers in Transformers and applying linear regression. We find that this Decoding by Logit Trajectory-based approach (DeLTa) effectively reinforces factuality and reasoning while mitigating incorrect generation. Experiments on TruthfulQA demonstrate that DeLTa attains up to a 4.9% improvement over the baseline. Furthermore, it enhances performance by up to 8.1% on StrategyQA and 7.3% on GSM8K, both of which demand strong reasoning capabilities.
1. Introduction
Despite their impressive capabilities, Large Language Models (LLMs) are notorious for "hallucinating" factual errors and stumbling over multi-step logical reasoning. While methods like fine-tuning or Retrieval-Augmented Generation (RAG) attempt to address these issues, they are often computationally expensive or require external infrastructure.
DeLTa (Decoding by Logit Trajectory-based approach) introduces a training-free decoding strategy that significantly reduces hallucinations and improves reasoning. By treating the progression of "logits" (raw prediction scores) across Transformer layers as a time-series, DeLTa uses linear regression to extrapolate to a "virtual" future layer, sharpening the model's final token selection without requiring extra data or parameter updates.
2. Methodology
DeLTa treats the progression of logits across the Transformer's layers as a trajectory. The process involves four key steps:
- Logit Trajectory Analysis: For a given sequence, the system monitors the logits produced by a range of layers, from an intermediate layer $N_{mid}$ to the final layer $N$.
- Linear Regression Fitting: Researchers observed that for correct tokens, these logits often follow a predictable upward trend in the later stages of the model. DeLTa fits a simple linear regression line to these layer-wise logits.
- Virtual Layer Extrapolation: Using the regression model, DeLTa calculates predicted logits for a "virtual" layer $L$ that exists slightly beyond the actual final layer (e.g., a theoretical 33rd layer for a 32-layer model).
- Candidate Filtering: To prevent the extrapolation of noise, a filtering mechanism ($V_{head}$) is applied, only considering tokens that already possess a reasonably high probability in the final layer.
3. Empirical Analysis: The Linearity of Truth
A striking insight of this research is that logit trajectories become remarkably linear in the final layers of the Transformer. The coefficient of determination ($R^2$)—a measure of how well a linear model fits the data—approaches 0.9 near the final layers across various models and benchmarks. This suggests that as the model converges on an answer, the internal representation moves in a mathematically predictable direction.
Unlike previous methods like DoLa, which contrast the final layer against a single earlier layer, DeLTa utilizes a window of layers. This makes the decoding process more robust to specific architectural variations. Furthermore, the optimal "virtual layer" $L$ can be tuned: for some tasks, extrapolating beyond the final layer works best, while for others, a value slightly before the final layer acts as a "smoothing" agent to filter out last-minute noise.
4. Experimental Results
DeLTa was evaluated using Qwen2.5-7B, Mistral-7B-v0.1, and Llama-3.1-8B across several benchmarks:
- Factuality: On TruthfulQA, DeLTa improved Llama-3.1-8B's performance by 4.9% over the baseline. It also showed consistent gains on TriviaQA and Natural Questions (NQ).
- Reasoning: The improvements in reasoning were even more pronounced. Performance on StrategyQA increased by up to 8.1%, and the math-heavy GSM8K saw a 7.3% boost.
- Efficiency: While DeLTa increases latency (approximately 1.4x for Qwen2.5), it remains more practical than multi-step prompting or RAG for many real-time applications.
5. Conclusion and Future Work
DeLTa demonstrates that the internal "logic" of an LLM's final layers is highly linear and can be exploited to improve output quality. While currently focused on English and 7B-8B parameter models, future work will explore whether these linear dynamics hold at massive scales (70B+) and in multilingual settings. Additionally, investigating non-linear models for the deeper, non-linear layers of the Transformer may yield further improvements in decoding-time interventions.
Summary updated