Large language models (LLMs) have shown substantial capacity for generating fluent, contextually appropriate responses. However, they can produce hallucinated outputs, especially when a user query includes one or more false premises-claims that contradict established facts. Such premises can mislead LLMs into offering fabricated or misleading details. Existing approaches include pretraining, fine-tuning, and inference-time techniques that often rely on access to logits or address hallucinations after they occur. These methods tend to be computationally expensive, require extensive training data, or lack proactive mechanisms to prevent hallucination before generation, limiting their efficiency in real-time applications. We propose a retrieval-based framework that identifies and addresses false premises before generation. Our method first transforms a user's query into a logical representation, then applies retrieval-augmented generation (RAG) to assess the validity of each premise using factual sources. Finally, we incorporate the verification results into the LLM's prompt to maintain factual consistency in the final output. Experiments show that this approach effectively reduces hallucinations, improves factual accuracy, and does not require access to model logits or large-scale fine-tuning.
翻译:大型语言模型(LLM)已展现出生成流畅且语境恰当回应的强大能力。然而,当用户查询包含一个或多个错误前提——即与既定事实相矛盾的断言时,它们可能产生幻觉输出。此类前提可能误导LLM生成捏造或具有误导性的细节。现有方法包括预训练、微调和推理时技术,这些方法通常依赖于访问模型logits或在幻觉发生后进行处理。这些方法往往计算成本高昂、需要大量训练数据,或缺乏在生成前主动防止幻觉的机制,从而限制了其在实时应用中的效率。我们提出一种基于检索的框架,可在生成前识别并处理错误前提。我们的方法首先将用户查询转化为逻辑表示,然后应用检索增强生成(RAG)技术,依据事实来源评估每个前提的有效性。最后,我们将验证结果整合到LLM的提示中,以确保最终输出的事实一致性。实验表明,该方法能有效减少幻觉、提高事实准确性,且无需访问模型logits或进行大规模微调。