FACT: Mitigating Inconsistent Hallucinations in LLMs via Fact-Driven Alternating Code-Text Training

Xinxin You, Qi-Xin Sun, Chen-Wei Yan, Xiao Zhang, Chen Ning +6 more
1/1/2025

No confident code implementation found for this paper.

Abstract

Inconsistent hallucinations remain a major challenge for large language models (LLMs), undermining the accuracy and reliability of fact-based reasoning in real-world applications. Existing approaches often rely on task-specific training or adaptation, such as hand-crafted synthetic datasets for domain tasks or solutions mainly focused on numerical reasoning, thereby limiting generalizability to broader, unseen NLP tasks.

Show full abstract

Inspired by the structural rigor and logical consistency of programming languages, we observe that fact-based texts can be mapped to programming structures due to their inherent patterns. We further propose FACT, a novel F act-driven A lternating C ode-text T raining framework that alternates be-tween text-to-code and code-to-text prediction. FACT is the first task-agnostic paradigm that embeds code and natural language in a shared semantic space, thereby transferring the logical consistency of code to LLM outputs in NLP tasks. Experiments show that with only a small subset of Wiki-40B-en for training, FACT reduces inconsistent hallucinations by 2.7%–8.0% and improves overall performance by 2.5%–6.1% in three leading LLMs and four diverse datasets covering QA and summarization tasks. This framework offers a new perspective on addressing challenging hallucinations in LLMs, contributing to more reliable AI.

DOISemantic Scholar

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{you2025fact,
  title  = {FACT: Mitigating Inconsistent Hallucinations in LLMs via Fact-Driven Alternating Code-Text Training},
  author = {Xinxin You and Qi-Xin Sun and Chen-Wei Yan and Xiao Zhang and Chen Ning and Xiang-Ling Fu and Si-Pu Liu and Guoping Hu and Shi-Jin Wang and Ji Wu and Xien Liu},
  year   = {2025},
  doi    = {10.52202/085713-4327},
  url    = {https://doi.org/10.52202/085713-4327},
  journal = {Neural Information Processing Systems}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/5bc957723c3a6fccb0cd4b7f74c74ff724fa2e88.svg)](https://codeofpaper.com/paper/5bc957723c3a6fccb0cd4b7f74c74ff724fa2e88)

Discussion