HyperAIHyperAI

Command Palette

Search for a command to run...

5 months ago

TruthX: Alleviating Hallucinations by Editing Large Language Models in Truthful Space

Shaolei Zhang; Tian Yu; Yang Feng

TruthX: Alleviating Hallucinations by Editing Large Language Models in Truthful Space

Abstract

Large Language Models (LLMs) sometimes suffer from producing hallucinations, especially LLMs may generate untruthful responses despite knowing the correct knowledge. Activating the truthfulness within LLM is the key to fully unlocking LLM's knowledge potential. In this paper, we propose TruthX, an inference-time intervention method to activate the truthfulness of LLM by identifying and editing the features within LLM's internal representations that govern the truthfulness. TruthX employs an auto-encoder to map LLM's representations into semantic and truthful latent spaces respectively, and applies contrastive learning to identify a truthful editing direction within the truthful space. During inference, by editing LLM's internal representations in truthful space, TruthX effectively enhances the truthfulness of LLM. Experiments show that TruthX improves the truthfulness of 13 advanced LLMs by an average of 20% on TruthfulQA benchmark. Further analyses suggest that TruthX can control LLM to produce truthful or hallucinatory responses via editing only one vector in LLM's internal representations.

Code Repositories

ictnlp/truthx
Official
jax
Mentioned in GitHub

Benchmarks

BenchmarkMethodologyMetrics
question-answering-on-truthfulqaLLaMa-2-7B-Chat + TruthX
MC1: 0.54
MC2: 0.74
question-answering-on-truthfulqaMistral-7B-Instruct-v0.2 + TruthX
MC1: 0.56
MC2: 0.75

Build AI with AI

From idea to launch — accelerate your AI development with free AI co-coding, out-of-the-box environment and best price of GPUs.

AI Co-coding
Ready-to-use GPUs
Best Pricing
Get Started

Hyper Newsletters

Subscribe to our latest updates
We will deliver the latest updates of the week to your inbox at nine o'clock every Monday morning
Powered by MailChimp