NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

PrefixNLI: Detecting Factual Inconsistencies as Soon as They Arise

Sapir Harary, Eran Hirsch, Aviv Slobodkin, David Wan, Mohit Bansal, Ido Dagan

Large Language Models (LLMs) are notorious for "hallucinating"—generating facts that sound plausible but aren't supported by the source text. While researchers have tried using Natural Language Inference (NLI) models to fact-check these outputs, they usually wait until a sentence is finished to blow the whistle. By then, the model has already committed to a false path.

A new paper, "PrefixNLI: Detecting Factual Inconsistencies as Soon as They Arise," proposes a shift in strategy: why wait for the end of the sentence when you can catch a factual error at the very first "unfaithful" token?

TL;DR

PrefixNLI introduces a framework for detecting factual inconsistencies in incomplete text fragments (prefixes) during the generation process. By training a specialized model, MiniTruePrefixes, and integrating it into a controlled decoding framework, the authors can steer LLMs toward truthfulness in real-time, allowing a 3B-parameter model to match the faithfulness of an 8B model while using half the memory.

What Problem Does This Paper Address?

LLMs generate text autoregressively—one token at a time. If a model starts a sentence with a factual error, every subsequent token is built on that false foundation.

Current solutions generally fall into two camps, both with flaws:

  1. Post-hoc Correction: You wait for the model to finish, then use an NLI model to check the sentence. If it's wrong, you edit it. This is slow and reactive.
  2. Lookahead Decoding: During generation, you "peek" into the future by greedily completing a sentence prefix and then scoring that completion. This is computationally expensive and noisy, as a "faithful" prefix might be penalized just because the random greedy completion was "unfaithful."

The gap here is the lack of an NLI model that understands prefixes. Standard NLI models are trained on complete sentences; when fed a fragment like "The capital of France is...", they often struggle because the input is linguistically incomplete.

Methods

The authors redefine the NLI task for prefixes: a text prefix is considered entailed if there exists at least one sensible completion that would be entailed by the source. If the prefix already contains a detail that contradicts the source, it's marked as non-entailed.

Key Innovations:

  • MiniTruePrefixes: A 1B-parameter model (based on LLaMA-3.2-1B-Instruct) specifically fine-tuned to judge these incomplete hypotheses.
  • Two-Stage Training: First, they train a summary-level NLI model (MiniTrue). Second, they adapt it for prefixes using a curated dataset where they've identified the exact "point of hallucination."
  • Controlled Decoding: During generation, the NLI model scores candidate next-tokens. If a token leads to a low entailment probability, the system applies a penalty to that token's logit (using a scaled log-odds transformation). This effectively "steers" the LLM away from lies before it finishes the word.

Datasets

The authors introduced two new prefix-level evaluation benchmarks:

  1. RAGTruthPrefixes: Derived from RAGTruth, featuring machine-generated responses with word-level manual annotations of hallucinations.
  2. SummEditsPrefixes: Derived from SummEdits, where they identified the first span that expresses inconsistent information.

For training, they adapted the TrueTeacher dataset. They used GPT-4 to pinpoint the exact hallucinated spans in unfaithful summaries, allowing them to create thousands of examples of "the moment the summary went wrong."

Key Insights and Ideas

  • The "Sensible Completion" Logic: By defining entailment as the possibility of a truthful ending, the authors provide a mathematically sound way to score fragments.
  • Efficiency over Brute Force: Unlike "lookahead" methods that generate entire dummy sentences for every candidate token, PrefixNLI performs a single forward pass on the prefix. This makes it 25.8x faster than prior lookahead approaches.
  • Closing the Scale Gap: One of the most striking findings is that a smaller model (3B) equipped with PrefixNLI can outperform a much larger vanilla model (8B) in faithfulness. This suggests that "smart decoding" might be more resource-efficient than simply "bigger parameters."
  • Prefix Incompleteness isn't the Enemy: Manual error analysis showed that only ~3-13% of errors were due to the prefix being "too short to judge." Most errors were "generic prediction errors," suggesting that the difficulty lies in the reasoning, not the length of the fragment.

Key Results

  • Intrinsic Performance: MiniTruePrefixes outperformed standard NLI baselines (like MiniCheck) by 5-14 F1 points on prefix-level entailment tasks.
  • Faithfulness Gains: When used for controlled decoding on the XSum dataset, it improved the faithfulness of LLaMA-3.2-8B by 5.5 points.
  • Speed: The system adds a moderate overhead (roughly 1.4x to 2.9x latency depending on model size), but remains vastly more practical than lookahead methods.
  • Quality Preservation: Metrics like ROUGE-L and MAUVE remained stable, proving that forcing the model to be truthful doesn't make it sound like a robot or lose the gist of the summary.

Limitations and Future Work

  • Logit Access: The method requires access to the model's internal logits. This means it cannot be used with "black box" APIs like the standard ChatGPT or Claude interfaces; it's currently restricted to open-weights or locally hosted models.
  • Domain Specificity: The study focused heavily on the News domain and English language. The authors note that extending this to multilingual settings and diverse tasks (like creative writing vs. technical RAG) is a necessary next step.
  • Granularity: Future work could explore applying the NLI check only at "semantic boundaries" (like punctuation or specific entities) to further reduce the computational cost without sacrificing accuracy.

Summary updated

BibTeX
@inproceedings{harary2026prefixnli,
  author = {Sapir Harary and Eran Hirsch and Aviv Slobodkin and David Wan and Mohit Bansal and Ido Dagan},
  title = {{PrefixNLI: Detecting Factual Inconsistencies as Soon as They Arise}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2026},
  doi = {10.18653/v1/2026.acl-long.63},
}
Figure