Hallucination Detection: A Probabilistic Framework Using Embeddings Distance Analysis

Emanuele Ricco, Lorenzo Cima, Roberto Di Pietro
2/10/2025
cs.CLcs.AIcs.CY

No confident code implementation found for this paper.

Abstract

Hallucinations are one of the major issues affecting LLMs, hindering their wide adoption in production systems. While current research solutions for detecting hallucinations are mainly based on heuristics, in this paper we introduce a mathematically sound methodology to reason about hallucination, and leverage it to build a tool to detect hallucinations. To the best of our knowledge, we are the first to show that hallucinated content has structural differences with respect to correct content. To prove this result, we resort to the Minkowski distances in the embedding space. Our findings demonstrate statistically significant differences in the embedding distance distributions, that are also scale free -- they qualitatively hold regardless of the distance norm used and the number of keywords, questions, or responses. We leverage these structural differences to develop a tool to detect hallucinated responses, achieving an accuracy of 66\% for a specific configuration of system parameters -- comparable with the best results in the field. In conclusion, the suggested methodology is promising and novel, possibly paving the way for further research in the domain, also along the directions highlighted in our future work.

View on arXivView PDF

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{ricco2025hallucination,
  title  = {Hallucination Detection: A Probabilistic Framework Using Embeddings Distance Analysis},
  author = {Emanuele Ricco and Lorenzo Cima and Roberto Di Pietro},
  year   = {2025},
  eprint = {2502.08663},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.08663v1}
}

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/2502.08663.svg)](https://codeofpaper.com/paper/2502.08663)

Discussion