Abstract
Large Language Models (LLMs) often generate factually incorrect "hallucinations," limiting their reliability in knowledge-intensive tasks. While fine-tuning is a common mitigation strategy, it is computationally expensive and often inaccessible for closed-source models. We present Knowledge-Constrained Tree Search (KCTS), a plug-and-play decoding method that guides frozen LLMs to remain grounded in reference knowledge. By combining Monte-Carlo Tree Search (MCTS) with a novel token-level detector called Reward Inflection Point Approximation (RIPA), KCTS identifies and bypasses potential hallucinations during the generation process. Experimental results on Wizard of Wikipedia and CNN/Daily Mail benchmarks demonstrate that KCTS significantly improves factual consistency, outperforming existing decoding baselines and rivaling much larger models in groundedness.
Introduction
While LLMs are remarkably capable, they frequently generate plausible-sounding but factually incorrect information. The standard industry fix is Retrieval-Augmented Generation (RAG) combined with fine-tuning. However, fine-tuning is computationally expensive, impossible for closed-source API-based models, and often leads to "catastrophic forgetting." Existing decoding-time interventions often struggle because they are "short-sighted," picking tokens that seem safe locally but force the model into a factual corner later in the sentence.
Methods
To address these challenges, we introduce two primary components:
- KCTS (Knowledge-Constrained Tree Search): Instead of picking the most likely next token (greedy decoding), KCTS uses MCTS to "look ahead." It runs multiple simulations for each decoding step to estimate the "future reward," effectively asking if a token choice will allow the model to stay factual until the end of the sequence.
- RIPA (Reward Inflection Point Approximation): Sequence-level fact-checkers are common but insufficient for token-by-token guidance. RIPA is a novel token-level classifier that identifies the "inflection point"—the exact token where a generation begins to veer away from the reference knowledge.
To train RIPA without expensive human labels, we utilized Knowledge Shuffle (swapping correct knowledge for irrelevant facts) and Partial Hallucination (forcing the model to complete sentences based on incorrect premises), creating a synthetic dataset of ~40k examples.
Experimental Results
We evaluated KCTS on two major benchmarks for factual consistency: Wizard of Wikipedia (WoW) for knowledge-grounded dialogue and CNN/Daily Mail (CNN/DM) for abstractive summarization.
On the WoW dataset, KCTS achieved a groundedness score (via UniEval) of 91.78, significantly outperforming standard decoding baselines like FUDGE (83.53) and NADO (81.10).
In human evaluations on the CNN/DM task, KCTS-guided models were rated as more grounded (2.97/3.0) than even ChatGPT (2.93/3.0), despite using a much smaller base model (Flan-T5-XL). This suggests that intelligent search-based decoding can effectively bridge the gap between small specialized models and massive general-purpose LLMs.
Key Insights
- The Hallucination Snowball: Hallucinations often start with a single unsupported claim that forces the model to generate further lies to maintain internal consistency. RIPA is designed to catch the very first "flake" of that snowball.
- Search vs. Weighting: Standard weighted decoding acts like a filter, whereas KCTS acts like a navigator. By using MCTS, the system can bypass "trap" tokens that look good locally but lead to factual contradictions later.
- Model Agnosticism: Because KCTS works at the decoding layer, it can be wrapped around any model (Flan-T5, Llama, or GPT-3.5 via logit biases) as a plug-and-play safety layer.
Limitations and Future Work
The primary hurdle for KCTS is inference latency; MCTS requires multiple forward passes per token, making it slower than greedy decoding. Future work will focus on "early-stopping" heuristics to prune the search tree. Additionally, KCTS assumes the provided knowledge is correct and does not address errors introduced by faulty retrieval systems.
Summary updated