Large language models (LLMs) sometimes generate convincingly written but factually incorrect content, commonly referred to as hallucinations. We introduce an algorithm, Magic Numbers (MN), which is compatible with any LLM or LLM API that outputs token probabilities (at the time of writing, only certain GPT-models). It uses combinations of perplexity and logit entropy to detect and fix hallucinations in real time. We show that MN can detect hallucinations in GPT–4o with only a negligible addition to the computational cost. Our experiments use two frameworks for hallucination measurement. HaluBench (which focusses on question-answering) and HHEM (which targets summarization tasks). The results indicate that Magic Numbers can improve the veracity of GPT–4o in various question-answer tasks and also improve the factual consistency in text summarisation.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Magic Numbers:

  • Hasse J. Hällström

摘要

Large language models (LLMs) sometimes generate convincingly written but factually incorrect content, commonly referred to as hallucinations. We introduce an algorithm, Magic Numbers (MN), which is compatible with any LLM or LLM API that outputs token probabilities (at the time of writing, only certain GPT-models). It uses combinations of perplexity and logit entropy to detect and fix hallucinations in real time. We show that MN can detect hallucinations in GPT–4o with only a negligible addition to the computational cost. Our experiments use two frameworks for hallucination measurement. HaluBench (which focusses on question-answering) and HHEM (which targets summarization tasks). The results indicate that Magic Numbers can improve the veracity of GPT–4o in various question-answer tasks and also improve the factual consistency in text summarisation.