Real-Time Detection of Hallucinated Entities in Long-Form Generation

Oscar Balcells Obeso, Andy Arditi, Javier Ferrando, Joshua Freeman, Cameron Holmes, Neel Nanda · Submission to ICLR 2026 · Rejected

TL;DR

Detecting hallucinations in long-form LLM outputs has historically required slow, expensive multi-step pipelines that decompose text into claims and query the web post-generation. This paper frames hallucination detection as a streaming, token-level labeling problem focused on entities (e.g., names, dates, citations), using lightweight linear and LoRA probes attached directly to intermediate activations. These probes operate in the same forward pass with negligible latency, outperforming sampling-based baselines like semantic entropy (AUC 0.90 vs. 0.71 on Llama-3.3-70B) while enabling real-time generation interventions.

What Problem Does This Paper Address?

While hallucination detection works reasonably well for short factoid QA (where a 1–2 sentence answer is either right or wrong), real-world LLM deployments produce multi-paragraph text where correct and incorrect claims are tightly intertwined.

Existing long-form verification frameworks (such as SAFE or FActScore) require post-hoc claim extraction, external web searches, and secondary LLM evaluations. This multi-step process introduces high latency and cost, making real-time monitoring or streaming intervention impossible. The authors aim to bridge this gap by detecting hallucinations as tokens are generated, without external search or auxiliary models at inference time.

Methods

  1. Entity-Level Framing: Rather than decomposing sentences into abstract claims, the authors focus on factual entity spans (dates, people, organizations, citations). Entities have crisp token boundaries, naturally enabling token-level sequence classification.
  2. Automated Search-Grounded Labeling: To supervise token detectors, the authors use Claude 4 Sonnet with web search to extract entity spans from model completions and label them as Supported, Not Supported, or Insufficient Information.
  3. Internal Probes: The authors attach linear value heads to intermediate transformer activations ($\approx 95\%$ depth), optionally trained alongside low-rank adapters (LoRA).
  4. Span-Max Loss: Because errors often hide in only a few tokens of a multi-token span (e.g., just the year in "born on May 4, 1982"), standard token-level binary cross-entropy is combined with an annealed "span-max" loss that penalizes only the maximum-scoring token in a span.
  5. KL Regularization: When training LoRA probes alongside the base model, the authors apply a Kullback–Leibler (KL) divergence penalty against the original model’s logits. This prevents degradation of the model’s generation capabilities.
Model Hidden State (Layer ~0.95) ───► [LoRA + Value Head] ───► Token Hallucination Score (p_i)
                                                                        │
                                                     (If p_i > threshold t: Halt & Abstain)

Datasets

  • LongFact++: A newly introduced dataset that expands LongFact by $10\times$ (over 22,000 prompts in the training pool). It spans four verifiable domains: fine-grained topical questions, biographies, legal cases, and citation-dense academic queries.
  • LongFact & HealthBench: Used for evaluating long-form factual accuracy, including out-of-distribution medical dialogue (HealthBench).
  • TriviaQA: Used to evaluate short-form factual question answering.
  • MATH: Used to assess out-of-distribution generalization to multi-step reasoning without named entities.
  • SimpleQA: Used to evaluate real-time selective answering and abstention.

Key Insights and Ideas

  • Asymmetric Generalization: Probes trained purely on long-form text transfer effectively to short-form factoid QA ($<0.05$ AUC drop). However, probes trained only on short-form QA degrade significantly on long-form text ($\approx 0.10$ AUC drop). Long-form supervision is necessary for robust real-world detection.
  • Model-Agnostic Signals: Probes show remarkable cross-model generalization. Probes trained on one model family reliably flag hallucinations in completions from others (AUC drop within 0.02–0.04). Furthermore, probes trained on larger models make better universal detectors.
  • Beyond Named Entities: Despite receiving supervision strictly on entity spans, the probes successfully flag incorrect steps in mathematical reasoning tasks (MATH), suggesting internal activations reflect general correctness rather than just entity-specific features.
  • Tunable Behavior Preservation: Without regularization, LoRA probe training degrades generation quality (Arena-Hard win rates drop to 35.9%). Regularizing with KL divergence ($\lambda_{\text{KL}} = 0.5$) maintains baseline generation quality (52.8% win rate) and knowledge benchmarks (71.2% MMLU) while retaining strong detection performance (0.89 AUC).

Key Results

  • Long-Form Entity Detection: On Llama-3.3-70B, LoRA probes achieve 0.90 AUC on LongFact and 0.91 AUC on HealthBench, substantially outperforming token entropy (0.71 AUC), perplexity (0.71 AUC), and semantic entropy (0.71 AUC). Linear probes achieve 0.87 AUC.
  • Cross-Architecture Consistency: Similar performance patterns held across four other open model families: Llama-3.1-8B (0.89 AUC), Gemma-2-9B (0.87 AUC), Qwen-2.5-7B (0.89 AUC), and Mistral-Small-24B (0.89 AUC).
  • Real-Time Intervention: Using probe thresholds to halt and abstain ("I don't know") during generation on SimpleQA boosted Llama-3.3-70B's conditional accuracy from 27.9% to 50.4% ($t=0.5$).

Limitations and Future Work

  • Relational Hallucinations: The approach struggles when errors are relational—connecting two real entities with a false predicate—because there is no single hallucinated entity token to isolate.
  • Labeling Noise: Synthetic validation revealed that the automated Claude+Search labeling pipeline has an 80.6% recall and a 15.8% false positive rate, placing an upper bound on probe supervision.
  • Headroom for Safety-Critical Systems: Probes achieve $\approx 70\%$ recall at a 10% false positive rate ([email protected]$) on long-form text. In selective answering, significantly cutting hallucinations currently requires discarding $\approx 50\%$ of correct answers, leaving substantial room for improvement before production deployment.

Summary updated

BibTeX
@misc{obeso2025real,
  author = {Oscar Balcells Obeso and Andy Arditi and Javier Ferrando and Joshua Freeman and Cameron Holmes and Neel Nanda},
  title = {{Real-Time Detection of Hallucinated Entities in Long-Form Generation}},
  year = {2025},
  eprint = {2509.03531},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2509.03531},
}
Figure