Introduction
Large Language Models (LLMs) frequently suffer from "hallucinations"—generating text that is linguistically fluent but factually incorrect or contextually inconsistent. This phenomenon often stems from the nature of standard autoregressive decoding, where the model can be "distracted" by statistical biases in training data or the inherent randomness of sampling, leading it to overlook critical information from earlier parts of a prompt as generation progresses.
Existing solutions like Retrieval-Augmented Generation (RAG) or extensive fine-tuning are resource-intensive. This research introduces a novel, training-free decoding strategy that treats LLM generation as an Absorbing Markov Chain (AMC). By quantifying information flow and identifying where it is lost, this method ensures "informative coherence" throughout the text-generation process without requiring additional data or model updates.
Methodology: Generation as an Absorbing Markov Chain
The core innovation lies in modeling the LLM's inference process as an AMC to track how information travels from the initial prompt to the final generated token.
- Information as a Path: Instead of focusing solely on the immediate preceding context, the framework views generation as information traveling along various paths from the first token to the last.
- The Absorbing State: The last generated token is conceptualized as an "absorbing state"—a state in a Markov chain that, once reached, cannot be left.
- Fundamental Matrix ($N$): Using the AMC framework, the researchers calculate a fundamental matrix representing the expected number of times the process visits each transient state (token) before absorption.
- Information Score and Loss:
- Information Score ($S$): Measures the "criticality" of a token based on its reachability; tokens that are difficult to reach from predecessors are deemed highly informative.
- Information Loss ($\mathcal{L}_{info}$): Quantifies how much the significance of a contextual token diminishes by the time it reaches the final token.
- Probability Adjustment: During decoding, the model adjusts the next-token probability distribution by adding a weighted sum of predicted distributions from all possible prefix contexts, penalized by their calculated information loss. This steers the model toward tokens that preserve the original context's meaning.
Experimental Evaluation
The proposed method was evaluated on several prominent benchmarks designed to test factuality and hallucination:
- FACTOR (News & Wiki): Tests the model's ability to recognize factual vs. non-factual continuations of a prefix.
- HaluEval: A large-scale collection of generated and human-annotated hallucinated samples.
- TruthfulQA: Designed to trick models into mimicking human falsehoods, evaluated via multiple-choice and open-ended generation.
Key Results
The AMC-based decoding strategy consistently outperformed competitive baselines such as DoLa (Decoding by Contrasting Layers) and Activation Decoding (AD) across various model architectures.
Key findings include:
- LLaMA3-8B on FACTOR News: Accuracy improved from 60.3% (standard) to 64.3%.
- TruthfulQA (MC3): On the LLaMA2-13B-chat model, the method improved the score to 27.2, while the DoLa baseline caused a performance drop to 22.9.
- Model Agnosticism: Because the method operates on output probability distributions (logits) rather than internal hidden states, it can be applied to any LLM (e.g., LLaMA, Qwen) without access to specific weights.
Discussion and Limitations
While the AMC approach significantly improves factual accuracy, it introduces certain challenges. Calculating the fundamental matrix involves matrix inversion, which may become a computational bottleneck as context windows grow. Additionally, the method relies on a hyperparameter ($\lambda$) to control probability adjustment, which currently requires manual tuning per task. Future work will explore automated parameter setting and scaling the Markovian approach for extremely long-form generation where information decay is most prevalent.
Summary updated