Monitoring Decoding: Mitigating Hallucination via Evaluating the Factuality of Partial Response during Generation

Yurui Chang, Bochuan Cao, Lu Lin

Introduction

Large Language Models (LLMs) frequently generate "hallucinations"—content that is linguistically fluent but factually incorrect. Traditional mitigation strategies often rely on post-hoc refinement, such as generating multiple full-length responses and selecting the most consistent one (Self-Consistency). However, these methods are computationally expensive and fail when a model is "confidently wrong," as sampling multiple responses simply reinforces the error.

Comparison between traditional Full-response Sampling and the proposed Selective-token Sampling (MD).

The Monitoring Decoding (MD) Framework

Monitoring Decoding (MD) addresses these issues by dynamically evaluating factuality during the generation process. Instead of regenerating entire sequences, MD applies surgical, tree-based revisions only to specific "hallucination-prone" tokens. This approach is based on the "Small Subset" hypothesis: the observation that only a tiny fraction of tokens (roughly 10% in some datasets) are responsible for a response's overall factuality.

1. In-process Detection

As the model generates a chunk of $m$ tokens, a monitor function evaluates their likelihood. This function compares the probability distribution of the target model (e.g., Llama-3-8B) against a stronger reference model (e.g., Llama-3-70B). If the target model exhibits over-confidence in a token that the reference model deems unlikely, the chunk is flagged as a potential hallucination.

2. Tree-based Revision

Once a hallucination is detected, MD triggers a localized search rather than a full restart. It samples $N$ alternative candidates for the problematic tokens, constructing a small search tree. The monitor function then prunes low-quality paths, retaining only the top $K$ most factual trajectories. Once a factual path is identified, the model resumes normal decoding.

The Monitoring Decoding (MD) framework, featuring in-process detection and tree-based token revision.

Experimental Evaluation

The framework was evaluated on four diverse benchmarks: TruthfulQA (misconceptions), TriviaQA (fact-based QA), NQ-Open (real-world queries), and GSM8K (math reasoning).

Key Results

  • Factuality Gains: MD consistently outperformed state-of-the-art baselines. For the Gemma-2-2b model, MD improved performance by 15% on TruthfulQA and 34.7% on NQ-Open compared to standard greedy decoding.
  • Efficiency & Latency: By intervening only when the monitor "raises an alarm," MD avoids the massive overhead of full-response sampling. MD achieved a latency of 113.78 ms/token, significantly faster than Fine-Grained Self-Consistency (316.72 ms/token).
  • Reasoning Preservation: On GSM8K, MD improved accuracy by 13.6% for Llama-2, proving that intervening in the decoding process can help models stay on track during complex Chain-of-Thought (CoT) reasoning steps.

Limitations and Future Work

MD's effectiveness is currently bounded by the knowledge of the reference model; if a fact is missing from both the target and the monitor, the hallucination may go undetected. Future research aims to integrate Retrieval-Augmented Generation (RAG) into the monitor function, allowing it to verify partial responses against external databases like Wikipedia in real-time.

Summary updated

BibTeX
@inproceedings{chang2025monitoring,
  author = {Yurui Chang and Bochuan Cao and Lu Lin},
  title = {{Monitoring Decoding: Mitigating Hallucination via Evaluating the Factuality of Partial Response during Generation}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure