Our new X account is live! Follow @wizwand_team for updates
WorkDL logo mark

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

About

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.

Shaolei Zhang, Tian Yu, Yang Feng• 2024

Related benchmarks

TaskDatasetResultRank
Multiple-ChoiceTruthfulQA
MC1 Accuracy54.22
83
Question AnsweringTruthfulQA
Truthful*Inf Score65.45
42
Question AnsweringTruthfulQA MC1
MC1 Accuracy54.22
24
Multiple-choice tasksNatural Questions
Accuracy59.6
3
Multiple-choice tasksTriviaQA
Accuracy66.79
3
Multiple-choice tasksFACTOR
Accuracy (news)65.83
3
Showing 6 of 6 rows

Other info

Code

Follow for update