Table of Contents
Fetching ...

TruthFlow: Truthful LLM Generation via Representation Flow Correction

Hanyu Wang, Bochuan Cao, Yuanpu Cao, Jinghui Chen

TL;DR

TruthFlow introduces a flow-matching framework to generate query-specific truthful corrections for LLMs, moving beyond universal correction vectors. By learning a path from hallucinated to truthful representations and projecting corrections onto a truth-focused subspace, it achieves significant gains in truthfulness and BLEURT scores on TruthfulQA across multiple models. The method also demonstrates strong transferability to unseen datasets, highlighting practical impact for reducing hallucinations in real-world applications. Overall, TruthFlow provides a scalable, inference-time intervention that enhances trustworthiness without heavy retraining or external knowledge dependencies.

Abstract

Large language models (LLMs) are known to struggle with consistently generating truthful responses. While various representation intervention techniques have been proposed, these methods typically apply a universal representation correction vector to all input queries, limiting their effectiveness against diverse queries in practice. In this study, we introduce TruthFlow, a novel method that leverages the Flow Matching technique for query-specific truthful representation correction. Specifically, TruthFlow first uses a flow model to learn query-specific correction vectors that transition representations from hallucinated to truthful states. Then, during inference, the trained flow model generates these correction vectors to enhance the truthfulness of LLM outputs. Experimental results demonstrate that TruthFlow significantly improves performance on open-ended generation tasks across various advanced LLMs evaluated on TruthfulQA. Moreover, the trained TruthFlow model exhibits strong transferability, performing effectively on other unseen hallucination benchmarks.

TruthFlow: Truthful LLM Generation via Representation Flow Correction

TL;DR

TruthFlow introduces a flow-matching framework to generate query-specific truthful corrections for LLMs, moving beyond universal correction vectors. By learning a path from hallucinated to truthful representations and projecting corrections onto a truth-focused subspace, it achieves significant gains in truthfulness and BLEURT scores on TruthfulQA across multiple models. The method also demonstrates strong transferability to unseen datasets, highlighting practical impact for reducing hallucinations in real-world applications. Overall, TruthFlow provides a scalable, inference-time intervention that enhances trustworthiness without heavy retraining or external knowledge dependencies.

Abstract

Large language models (LLMs) are known to struggle with consistently generating truthful responses. While various representation intervention techniques have been proposed, these methods typically apply a universal representation correction vector to all input queries, limiting their effectiveness against diverse queries in practice. In this study, we introduce TruthFlow, a novel method that leverages the Flow Matching technique for query-specific truthful representation correction. Specifically, TruthFlow first uses a flow model to learn query-specific correction vectors that transition representations from hallucinated to truthful states. Then, during inference, the trained flow model generates these correction vectors to enhance the truthfulness of LLM outputs. Experimental results demonstrate that TruthFlow significantly improves performance on open-ended generation tasks across various advanced LLMs evaluated on TruthfulQA. Moreover, the trained TruthFlow model exhibits strong transferability, performing effectively on other unseen hallucination benchmarks.

Paper Structure

This paper contains 34 sections, 4 equations, 9 figures, 7 tables, 3 algorithms.

Figures (9)

  • Figure 1: Comparison of the generated answers from Llama-3-8B-Instruct without and with TruthFlow. TruthFlow can help mitigate the hallucination issues in Llama3 and lead to truthful generation.
  • Figure 2: Visualization of hallucinated hidden states and truthful hidden states of Llama-2-7b-chat at the 13-th transformer layer using PCA and KDE. The bold blue arrow in the middle shows the general direction from hallucination to truthfulness. However, each sample has its own direction towards truthfulness as is shown by a light blue arrow.
  • Figure 3: Performance comparison on different choices of $k$. The results are on TruthfulQA with TruthFlow applied to Llama3. We report both True score and True*Info score.
  • Figure 4: Prompt template for GPT-4 to evaluate True Score on TruthfulQA.
  • Figure 5: Prompt template for GPT-4 to evaluate Info Score on TruthfulQA.
  • ...and 4 more figures