SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2402.17811 · ACL · 2024

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

Yang Feng, Shaolei Zhang, Tian Yu

arXiv · PDF · Open in the Atlas

Code that ran

We lifted 3 functions out of this paper's own repositories and ran 2 of them in a sandbox. "Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results.

RepositoryRoleRan
ictnlp/truthx — 2 of 3
FunctionStatusWhere it lives
BaseVAE Ran ictnlp/truthx/truthx.py
pointer only (licence: GPL-3.0) · get_code("ab94575b236d35ac")
MLPAE Ran ictnlp/truthx/truthx.py
pointer only (licence: GPL-3.0) · get_code("e57e5eba258c91bf")
TruthX Not yet run ictnlp/truthx/truthx.py
pointer only (licence: GPL-3.0) · get_code("fd4f4ae6f89a683f")

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

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 Truth-fulQA 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 1 .

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2402.17811")
get_code_for_paper("2402.17811")
have("2402.17811")

Connect an agent — have() is free.