Title: FACT: Mitigating Inconsistent Hallucinations in LLMs via Fact-Driven Alternating Code-Text Training
Venue: NeurIPS 2025
Accepted: yes
Keywords: Inconsistent Hallucination

Fact-Driven Code-Text

Alternating Training
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. 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 Fact-driven Alternating Code-text Training framework that alternates between 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.


Peer reviews:
{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThis paper introduces FACT, a novel training framework designed to mitigate inconsistent hallucinations in Large Language Models (LLMs). The core contribution is a training paradigm that alternates between text-to-code and code-to-text generation. The authors posit that by mapping fact-based natural language text to structured code representations (e.g., classes, objects, functions), the inherent logical consistency of programming languages can be transferred to the LLM's natural language outputs. Due to the absence of parallel ground-truth code, the method relies on generating pseudo-labels for the text-to-code task. The quality of this generated code is managed through a two-stage assessment process that checks for syntactic validity and semantic fidelity, the latter being measured by reconstructing the text from the code and comparing it to the original. The authors conduct experiments on three different LLMs across four datasets for question answering and summarization tasks, reporting that their method reduces hallucinations and improves overall task performance compared to several baselines.\n\nSTRENGTHS AND WEAKNESSES:\nThis paper addresses a problem of high significance and proposes an original, creative approach. However, its contributions are undermined by severe methodological weaknesses and a lack of empirical rigor.\n\n**Strengths:**\n\n1. The problem of mitigating hallucinations in LLMs is one of the most critical and timely challenges in the field. Developing methods to improve the faithfulness and logical consistency of LLMs is of paramount importance for their reliable deployment in real-world applications. The paper correctly identifies this significant research gap.\n2. The core idea of leveraging the structural properties of programming languages to enforce logical consistency in natural language is novel and thought-provoking. The proposed alternating code-text training paradigm is an unconventional and interesting method that moves beyond standard supervised fine-tuning or prompt engineering.\n3. The paper is generally well-written, clearly structured, and easy to follow. The authors effectively use figures to illustrate their proposed framework and the problem it aims to solve.\n\n\n**Weaknesses:**\n\n1.  The central premise—that mapping factual text to code imbues it with logical consistency—is presented as an intuitive observation rather than a well-grounded theory. The paper fails to provide a formal definition of \"fact-based text\" or a rigorous argument explaining *why* syntactic structure should translate to semantic consistency.\n2.  The methodology relies on a self-referential, circular loop of pseudo-labeling, where the model generates its own training data. This approach may reinforces the model's existing biases and flawed logical patterns, rather than correcting them. The quality assessment, which depends on a lexical overlap metric (ROUGE) for judging semantic fidelity, is superficial and insufficient to validate logical equivalence.\n3. The experimental evaluation is not sound. The authors explicitly state in their checklist (Q7) that they did not report error bars or perform statistical significance testing. The reported gains could very well be statistical noise, which renders the claims of superiority over baselines unconvincing.\n4. The paper repeatedly claims to be a \"task-agnostic\" framework. However, the evaluation is limited to summarization and question answering, two highly related tasks that often rely on extracting and reformulating factual information. There is no evidence to support the claim that this method would generalize to tasks with different structures, such as creative writing, dialogue, or reasoning. This overstatement of scope significantly diminishes the work's perceived contribution.\n\nQUESTIONS:\nMy assessment of this paper could improve if the authors can satisfactorily address the following fundamental questions:\n\n1. Can you provide multiple run results for your method and key baselines (especially SFT) using different random seeds and decoding methods (not just greedy decoding)? Demonstrating results with mean, standard deviation, and appropriate statistical significance tests is crucial to proving that the reported improvements are not accidental.\n2. Your method's success hinges on the initial filtering of \"fact-based text\" by GPT-3.5. This introduces opacity and potential bias. Could you (a) provide a formal, operational definition of \"fact-based text\"? And (b) provide a thorough analysis of the data that was kept versus discarded by the filter? This is crucial for understanding what your model is actually learning and for assessing the true generalizability of your approach.\n3. The pseudo-labeling process is circular, and its quality is assessed using ROUGE, a metric for lexical overlap, not logical fidelity. How do you ensure the model is learning true logical relationships rather than simply learning to generate code that is lexically easy to reconstruct? Can you propose or implement a stronger, more semantically-grounded validation metric for the generated code to justify that your training signal is meaningful?\n\nLIMITATIONS:\nNo. The authors include a \"Limitation\" section in Appendix D. However, the points discussed there (e.g., \"omissions\" in code, \"unclear expressions\") are relatively superficial implementation details. \nThe paper fails to acknowledge or discuss its most serious limitations, which can be referred to in Weaknesses and Questions.", "TITLE": "Official Review", "RECOMMENDATION": 4, "REVIEWER_CONFIDENCE": 4, "CLARITY": 2, "IMPACT": 2, "ORIGINALITY": 3, "DATE": "2025-06-03"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThis paper proposes a training method to reduce hallucinations in LLMs. The method FACT involves an alternating training paradigm between text-to-code and code-to-text. This is motivated by the fact that fact-based text have structural patterns that can be mapped into code functions similar to how math problems can mapped into code functions. A key point of this paper is that this method is task agnostic as compared to previous methods that manually create datasets for a specific domain i.e. legal domain when wanting to reduce hallucination. \n\nBecause there's no ground truth for this kindve data the authors then come up with a generate pseudo-labels to supervise model training and have some filtering checks to ensure they get high quality data. They create their dataset from Wikipedia and evaluate on Q/A and summarization tasks. They finetune three LLMs: Llama, Mistral and Qwen and find that their method reduces hallucination and improves on accuracy. \n\nThe contributions as I see it are\n1) The text-to-code and code-to-text training paradigm \n2) The methodology used to create this data\n\nSTRENGTHS AND WEAKNESSES:\nStrengths\n\n1) I think the paper is well motivated and the idea to map factual statements into the coding paradigm is very interesting to my knowledge novel. \n\n2) The experiments are well thought out and it seems the authors compare against the latest methods SymbCoT and Lookback. \n\n3) The fact that this method is task agnostic is great and if the dataset gets released publicly I think will be useful for the community\n\nWeaknesses\n\nMy overall concern with the paper is that there are parts that aren't clear but I think can be easily addressed. More specifically:\n\n1) The pseudo-labeling mechanism is a little unclear. Do you generate the data starting from the base model then train it and regenerate the data to improve it's quality or is it all in one pass?\n\n2) In Figure 4 it seems w/o Code2Text is the worst performing model but in the text in Line 252-253 you mention retaining only the\ncode-to-text pathway results in the largest increase in hallucination rate which seem contradictory. Also I would like to know why is this the case versus why text-to-code is more helpful.\n\n3) In Table 1 it seems SymbCoT and Lookback aren't as good as your more simpler baselines (SFT vs prompt) does this mean they are not strong enough baselines to compare against?\n\n4)  It was a little hard to follow the section on Semantic Fidelity via Reverse Reconstruction. Like what do we mean by reorganized template and substituting runtime values.\n\n5) It was a little unclear if after your training the inference takes in text as input and text as output or if it was a two pass inference where you first ask the model to generate the code then the text. Section Effectiveness of Structured Code-based Inference cleared it up but that part came later and caused some confusion.\n\nQUESTIONS:\nQuestions\n1) During the fact filtering stage what is considered an invalid sentence? I understand factual / non-factual sentence.\n\n2) Is ROUGE a strong enough metric for semantic fidelity versus using model-based metrics?\n\n3) It was mentioned that \"For any code that fails the syntactic validity check, we assign a fixed similarity score of Si = 0.1\". Why not just throw the data away?\n\nSuggestions\n1) I suggest you put the fact filtering performance that is listed in the appendix into the main text as that was a big question I had.\n\n2) There were some typos of Mistral vs Ministrel\n\nLIMITATIONS:\nyes", "TITLE": "Official Review", "RECOMMENDATION": 6, "REVIEWER_CONFIDENCE": 4, "CLARITY": 3, "IMPACT": 4, "ORIGINALITY": 4, "DATE": "2025-06-12"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThe paper proposes a Fact-driven Alternating Code-text Training approach (called FACT) to mitigate the hallucinations generated by the LLMs. The approach relies on the grounding that the intrinsic structural patterns in texts can directly be mapped into programmable constructs. The training regime includes both text-to-code and code-to-text predictions by the LLMs. In the absence of direct training supervision, the authors employ a pseudo-labeling technique that ensures syntactic correctness and semantic faithfulness of the original texts. The empirical studies carried out in the paper shows in the improvements in consistency even when trained with a smaller training set. The paper also demonstrates the versatility of the approach in terms of increased performance in summarization and QA tasks without any task supervision.\n\nSTRENGTHS AND WEAKNESSES:\nThe paper presents a task agnostic framework for mitigating hallucinations generated by LLMs through alternating code-text training. The current approach acts as a bridge between different modalities of inputs where unambiguous and clear representations can be obtained. The authors also minimize the extent of direct training supervision that exhibits emergent capabilities in unseen tasks. The authors make use of pseudo-labels for assisting in training supervision ensuring syntactic correctness and semantic faithfulness of the original texts. The paper attempts to address input-conflicting and context-conflicting hallucinations that are the most prevalent types of hallucinations generated by current LLMs. \n\nThe authors do not mention the selection criteria for the baseline LLMs. It is not clear why LLMs with lower number of parameters are chosen. The formulation of S_i lacks details and intuition. It is unclear why ROUGE-1 and ROUGE-L are combined, and not other variants of ROUGE. The details of the evaluation metrics are missing. The authors should give links to appropriate sections in Appendix. In the current version, it is missing. There are a few grammatical errors in the paper that needs thorough proof-read.\n\nQUESTIONS:\n1. The authors should mention the selection criteria of the LLMs.\n2. The formulation of S_i should be justified with appropriate reasons.\n3. The authors should give links to appropriate sections in Appendix (use \\ref in latex).\n4. The authors should add a section in the appendix detailing the evaluation metrics.\n\nLIMITATIONS:\nYes", "TITLE": "Official Review", "RECOMMENDATION": 5, "REVIEWER_CONFIDENCE": 4, "CLARITY": 3, "IMPACT": 3, "ORIGINALITY": 3, "DATE": "2025-07-02"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThe paper proposes a framework called Fact-driven Alternating Code-text Training (FACT) to address inconsistent hallucinations in large language models. The paper claims that there are two types of errors: input conflicting and context conflicting. To tackle this, the FACT framework trains the LLM by alternating two tasks, which are text-to-code and code-to-text. The core idea behind this is that factual text has an inherent structure that can be mapped to code. The experiment results show that such training method could reduce inconsistent hallucinations and improve overall performance on QA and summarization tasks.\n\nSTRENGTHS AND WEAKNESSES:\n## Strengths\n1. The paper proposes a novel framework that can reduce inconsistent hallucinations across a wide range of tasks.\n2. The experiment shows that the proposed FACT framework is effective, with clear hallucination reduction and task performance improvement.\n3. The method seems to be general as it works on 3 different large language models (Llama, Mistral and Qwen)\n\n## Weaknesses\n1. The FACT framework will likely work for clear and unambiguous facts. There could be corner cases that makes it hard to map it to the code. There could be ambiguity and figurative text.\n2. The method is hard to scale up. The training efficiency will be lowered when there are extra steps like defining a code-like structure, converting text to code and then evaluate their factual consistency.\n3. The tested datasets are a bit out dated. Newer and larger datasets are helpful to evaluate the effectiveness of the method (because the base models are relatively newer)\n\nQUESTIONS:\n1. How will this training method affect the model's other capabilities? Will there be performance drop?\n2. How will the system handle very complex factual relationships?\n3. How to make sure that the model can convert code back into text faithfully?\n\nLIMITATIONS:\nyes", "TITLE": "Official Review", "RECOMMENDATION": 5, "REVIEWER_CONFIDENCE": 3, "CLARITY": 3, "IMPACT": 3, "ORIGINALITY": 3, "DATE": "2025-07-03"}