Developing a Reliable, Fast, General-Purpose Hallucination Detection and Mitigation Service

Song Wang, Xun Wang, Jie Mei, Yujia Xie, Si-Qing Chen, Wayne Xiong

Introduction

As Large Language Models (LLMs) transition from experimental tools to core components of business infrastructure, the issue of "hallucinations"—outputs that are factually incorrect or unsupported by the input—has become a primary barrier to reliability. While high-end models like GPT-4 can be prompted to identify these errors, the latency and cost associated with using such models for real-time verification in production environments are often prohibitive.

Microsoft researchers have introduced a production-ready framework designed to detect and remediate hallucinations in real-time. By combining specialized small models into a Gradient Boosting ensemble, the system achieves high accuracy with significantly lower latency and cost than standalone LLM-based checking.

The Detection-Mitigation Pipeline

The proposed system utilizes a three-stage pipeline: Multi-source Detection, Iterative Rewriting, and Multi-source Verification. This workflow ensures that hallucinations are not only identified but corrected and re-verified before reaching the end user.

The three-stage pipeline for hallucination detection, rewriting, and verification.

1. Multi-source Detection Ensemble

Rather than relying on a single general-purpose model, the system uses a Gradient Boosting Decision Tree (GBDT) to aggregate signals from three specialized components:

  • Named Entity Recognition (NER): This component cross-references entities (such as people, places, and dates) in the output against the source document to ensure consistency.
  • Natural Language Inference (NLI): A DeBERTa-based model determines if the source text logically entails the generated sentences.
  • Span-Based Detection (SBD): This token-level model identifies the exact phrases or "spans" that are hallucinated, providing high-granularity feedback.

2. Targeted Rewriting

Once a hallucination is flagged, the system employs GPT-4 for mitigation. The researchers evaluated two strategies:

  • Exhaustive (v1): Utilizes full Chain-of-Thought (CoT) reasoning for a complete rewrite. While effective (66% mitigation rate), it is slower.
  • Targeted (v2): Focuses exclusively on the hallucinated sentences identified by the detection ensemble. This approach significantly reduces token usage and latency while still fixing nearly 45% of errors.

3. Multi-source Verification

To prevent the introduction of new errors during the rewriting phase, the corrected text is passed back through the detection ensemble for a final check.

Performance and Results

The specialized models (NLI and SBD) demonstrate significant efficiency gains, with latencies of 1.2s–1.3s on a V100 GPU, compared to 7.9s for a GPT-4-based check.

Comparative performance of detection methods on internal and public benchmarks.

As shown in the performance data, the Span-Based Detection (SBD) model is a standout performer, achieving an F1 score of 79.88 on the public SummAC benchmark, outperforming standard NLI approaches. In live traffic monitoring, the ensemble reached over 80% precision, matching the judgment of GPT-4 while maintaining the speed required for production services.

Key Insights

  • Granularity is Critical: Token-level detection (SBD) provides the precise feedback necessary for efficient, targeted rewriting.
  • Specialized Critics: LLMs often struggle with self-correction, frequently "believing" their own outputs. Using smaller, objective "critic" models like DeBERTa for detection is often more effective than asking the LLM to check itself.
  • Precision Tuning: The use of a GBDT allows the system to be tuned for high precision, ensuring a low "trigger rate" to avoid unnecessary or intrusive corrections in user-facing applications.

Limitations and Future Directions

While the framework is highly effective for intrinsic hallucinations (errors checkable against a provided document), it does not yet address extrinsic hallucinations, which involve fabricated facts not mentioned in the source at all. Future work will focus on integrating retrieval-based approaches for world-knowledge verification, expanding multilingual support, and optimizing the processing of very long documents.

Summary updated

BibTeX
@inproceedings{wang2025developing,
  author = {Song Wang and Xun Wang and Jie Mei and Yujia Xie and Si-Qing Chen and Wayne Xiong},
  title = {{Developing a Reliable, Fast, General-Purpose Hallucination Detection and Mitigation Service}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2025},
  doi = {10.18653/v1/2025.naacl-industry.72},
}
Figure