Skip to content

maylad31/no_hallucination

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

no_hallucination

Detecting Hallucinations in LLMs: Perplexity, Entailment, and Entropy 🌐

When working with large language models (LLMs), detecting hallucinations—misleading or false information generated—can be a challenge. Instead of relying on just one response or using another LLM as a judge, I've developed a multi-layered approach using perplexity, entailment, and discrete semantic entropy to identify potential hallucinations more accurately.

Perplexity measures the uncertainty of the best response generated. A high perplexity score often signals potential ambiguity or less confident answers. Entailment checks the consistency across multiple responses to the same prompt. If the responses contradict each other, it’s a strong sign of possible hallucination. Discrete Entropy of Clusters quantifies how spread out the generated responses are across different clusters. The greater the entropy, the more diverse (and potentially unreliable) the responses. By combining these three metrics, we can identify hallucinations and improve the reliability of the model. This approach goes beyond simply using a second LLM as a judge and offers a more nuanced, data-driven strategy.

What are your thoughts on using this multi-metric system for hallucination detection? If you have an interesting project, you may connect with me on https://www.linkedin.com/in/mayankladdha31/

Releases

No releases published

Packages

No packages published

Languages