farquhar-et-al-2024-detecting-hallucinations-in-large-language-models-using-semantic-entropy-ara

Branch-local ARA HTML rendering

PAPER.md

---

type: agent_native_research_artifact

date: 2026-05-12

source_title: "Farquhar et al. - 2024 - Detecting hallucinations in large language models using semantic entropy"

source_note: "wiki/sources/Farquhar et al. - 2024 - Detecting hallucinations in large language models using semantic entropy.md"

source_path: "raw/Farquhar et al. - 2024 - Detecting hallucinations in large language models using semantic entropy.pdf"

rawmarkdown_path: ""

grounding_status: "pdf_first_pages"

branch: ai-data-extraction

status: automated-level-3

quality_label: automated-level-3

readthrough_status: automated-readthrough-complete

readthrough_date: 2026-05-12

---

Farquhar et al. - 2024 - Detecting hallucinations in large language models using semantic entropy

Retrieval Contract

Use this ARA as the first branch-local agent-facing layer for the source. Verify important claims against `evidence/README.md`, the branch source note, the raw Markdown sidecar when available, and the PDF.

Source Grounding

Abstracted Contribution

Article

Detecting hallucinations in large language

models using semantic entropy

https://doi.org/10.1038/s41586-024-07421-0

Sebastian Farquhar1,2 ✉, Jannik Kossen1,2, Lorenz Kuhn1,2 & Yarin Gal1

Received: 17 July 2023

Accepted: 12 April 2024

Published online: 19 June 2024

Open access

Check for updates

Large language model (LLM) systems, such as ChatGPT1 or Gemini2, can show

impressive reasoning and question-answering capabilities but often ‘hallucinate’

false outputs and unsubstantiated answers3,4. Answering unreliably or without the

necessary information prevents adoption in diverse fields, with problems including

fabrication of legal precedents5 or untrue facts in news articles6 and even posing a

risk to human life in medical domains such as radiology7. Encouraging truthfulness

through supervision or reinforcement has been only partially successful8. Researchers

need a general method for detecting hallucinations in LLMs that works even with new

and unseen questions to which humans might not know the answer. Here we develop

new methods grounded in statistics, proposing entropy-based uncertainty estimators

for LLMs to detect a subset of hallucinations—confabulations—which are arbitrary and

incorrect generations. Our method addresses the fact that one idea can be expressed

in many ways by computing uncertainty at the level of meaning rather than specific

sequences of words. Our method works across datasets and tasks without a priori

knowledge of the task, requires no task-specific data and robustly generalizes to new

tasks not seen before. By detecting when a prompt is likely to produce a confabulation,

our method helps users understand when they must take extra care with LLMs and

opens up new possibilities for using LLMs that are otherwise prevented by their

unrelia

Branch Use

This artifact was generated to make every PDF in the AI Data Extraction branch retrievable through a consistent ARA framework. It is a Level 1 scaffold unless later files in this folder document deeper curation.

Main Concept Links

Layer Index

logic/claims.md

Claims

logic/problem.md

Problem

This ARA preserves a branch-local retrieval entry point for `Farquhar et al. - 2024 - Detecting hallucinations in large language models using semantic entropy`.

Provisional Role

logic/concepts.md

Concepts

logic/method_and_design.md

Method And Design

Source Identity

Design Classification

Data, Sample, Or Source Material

aim to ‘learn’ how to detect confabulations from a set of example demonstrations. Our method is unsupervised, meaning that we do not need labelled examples of confabulations. By contrast, supervised methods detect confabulations by learning patterns behind examples of confabulations, assuming that future questions preserve these patterns. But this assumption is often untrue in new situations or with confabulations that human overseers are unable to identify (compare Fig. 17 of ref. 24). As a strong supervised baseline, we compare to an embedding regression method inspired by ref. 24 which trains a logistic regression classifier to predict whether the model correctly answered a question on the basis of the final ‘embedding’ (hidden state) of the LLM. We also use the P(True) method24 which looks at the probability with which an LLM predicts that the next token is ‘True’ when few-shot prompted to compare a main answer with ‘brainstormed’ alternatives. Confabulations contribute substantially to incorrect answers given by language models. We show that semantic entropy can be used to predict many incorrect model answers and to improve question-answering accuracy by refusing to answer those questions the model is uncertain about. Corresponding to these two uses, we evaluate two main metrics. First, the widely used area under the receiver operating characteristic (AUROC) curve for the binary event that a given answer is incorrect. This measure captures both precision and recall and ranges from 0 to 1, with 1 representing a perfect classifier and 0.5 representing an un-informative classifier. We also show a new measure, the area under the ‘rejection accuracy’ curve (AURAC). This studies the case in which the confabulation detection score is used to refuse to answer the questions judged most likely to cause confabulations. Rejection accuracy is the accuracy of the answers of the model on the remaining questions and the area under this curve is a summary statistic over many thresholds (representative threshold accuracies are provided in Supplementary Material). The AURAC captures the accuracy improvement which users would experience if semantic entropy was used to filter out questions causing the highest entropy.

Method Workflow

This source was read from the branch-local PDF or Markdown sidecar and mapped for AI data extraction relevance. Treat this as an automated read-through card: useful for routing, but not a replacement for close reading when citing exact methods.

Outcomes Or Analytic Targets

Baselines. In addition to reporting results for semantic entropy, discrete semantic entropy and naive entropy, we consider two strong baselines. Embedding regression is a supervised baseline inspired by the P(IK) method24. In that paper, the authors fine-tune their proprietary LLM on a dataset of questions to predict whether the model would have been correct. This requires access to a dataset of ground-truth answers to the questions. Rather than fine-tuning the entire LLM in this way, we simply

What To Verify Before Citation-Grade Use

logic/methods_variables_outcomes.md

Methods Variables Outcomes

Extraction-Relevant Constructs

Variables And Measures To Source-Check

Extracted Evidence Sentences

necessary information prevents adoption in diverse fields, with problems including

fabrication of legal precedents5 or untrue facts in news articles6 and even posing a

risk to human life in medical domains such as radiology7.

need a general method for detecting hallucinations in LLMs that works even with new

and unseen questions to which humans might not know the answer.

new methods grounded in statistics, proposing entropy-based uncertainty estimators

for LLMs to detect a subset of hallucinations—confabulations—which are arbitrary and

incorrect generations.

our method helps users understand when they must take extra care with LLMs and

opens up new possibilities for using LLMs that are otherwise prevented by their

unreliability.

‘Hallucinations’ are a critical problem9 for natural language generation systems using large language models (LLMs), such as ChatGPT1 or

Gemini2, because users cannot trust that any given output is correct.

that is nonsensical or unfaithful to the provided source content”9–11

but they have come to include a vast array of failures of faithfulness

and factuality.

‘confabulations’12 for which LLMs fluently make claims that are both

wrong and arbitrary—by which we mean that the answer is sensitive

to irrelevant details such as random seed.

medical question “What is the target of Sotorasib?” an LLM confabulates by sometimes answering KRASG12 ‘C’ (correct) and other times

KRASG12 ‘D’ (incorrect) despite identical instructions.

this from cases in which a similar ‘symptom’ is caused by the following

different mechanisms: when LLMs are consistently wrong as a result of

being trained on erroneous data such as common misconceptions13;

when the LLM ‘lies’ in pursuit of a reward14; or systematic failures of

reasoning or generalization.

because it does not help when LLM outputs are systematically bad.

state-of-the-art LLMs, revealing that confabulations are a great source of

error at present.

arbitrary and ungrounded answers.

systems built on LLMs to avoid answering questions likely to cause

confabulations, to make users aware of the unreliability of answers

to a question or to supplement the LLM with more grounded search

or retrieval.

logic/source_scope.md

Source Scope

Strong Uses

Weak Uses

Transfer Boundaries

Citation-Grade Verification Needs

logic/experiments.md

Methods And Evidence Role

evidence/README.md

Evidence README

Source Pointer

Current Evidence State

This ARA has a scaffold-level evidence layer. Use the PDF or raw Markdown for quotation, numeric extraction, inclusion/exclusion decisions, and final manuscript claims.

Initial Excerpt

Article

Detecting hallucinations in large language

models using semantic entropy

https://doi.org/10.1038/s41586-024-07421-0

Sebastian Farquhar1,2 ✉, Jannik Kossen1,2, Lorenz Kuhn1,2 & Yarin Gal1

Received: 17 July 2023

Accepted: 12 April 2024

Published online: 19 June 2024

Open access

Check for updates

Large language model (LLM) systems, such as ChatGPT1 or Gemini2, can show

impressive reasoning and question-answering capabilities but often ‘hallucinate’

false outputs and unsubstantiated answers3,4. Answering unreliably or without the

necessary information prevents adoption in diverse fields, with problems including

fabrication of legal precedents5 or untrue facts in news articles6 and even posing a

risk to human life in medical domains such as radiology7. Encouraging truthfulness

through supervision or reinforcement has been only partially successful8. Researchers

need a general method for detecting hallucinations in LLMs that works even with new

and unseen questions to which humans might not know the answer. Here we develop

new methods grounded in statistics, proposing entropy-based uncertainty estimators

for LLMs to detect a subset of hallucinations—confabulations—which are arbitrary and

incorrect generations. Our method addresses the fact that one idea can be expressed

in many ways by computing uncertainty at the level of meaning rather than specific

sequences of words. Our method works across datasets and tasks without a priori

knowledge of the task, requires no task-specific data and robustly generalizes to new

tasks not seen before. By detecting when a prompt is likely to produce a confabulation,

our method helps users understand when they must take extra care with LLMs and

opens up new possibilities for using LLMs that are otherwise prevented by their

unrelia

evidence/passages/readthrough_key_passages.md

Read-Through Key Passages

Abstract Or Opening

Detecting hallucinations in large language models using semantic entropy https://doi.org/10.1038/s41586-024-07421-0

Methods

aim to ‘learn’ how to detect confabulations from a set of example demonstrations. Our method is unsupervised, meaning that we do not need labelled examples of confabulations. By contrast, supervised methods detect confabulations by learning patterns behind examples of confabulations, assuming that future questions preserve these patterns. But this assumption is often untrue in new situations or with confabulations that human overseers are unable to identify (compare Fig. 17 of ref. 24). As a strong supervised baseline, we compare to an embedding regression method inspired by ref. 24 which trains a logistic regression classifier to predict whether the model correctly answered a question on the basis of the final ‘embedding’ (hidden state) of the LLM. We also use the P(True) method24 which looks at the probability with which an LLM predicts that the next token is ‘True’ when few-shot prompted to compare a main answer with ‘brainstormed’ alternatives. Confabulations contribute substantially to incorrect answers given by language models. We show that semantic entropy can be used to predict many incorrect model answers and to improve question-answering accuracy by refusing to answer those questions the model is uncertain about. Corresponding to these two uses, we evaluate two main metrics. First, the widely used area under the receiver operating characteristic (AUROC) curve for the binary event that a given answer is incorrect. This measure captures both precision and recall and ranges from 0 to 1, with 1 representing a perfect classifier and 0.5 representing an un-informative classifier. We also show a new measure, the area under the ‘rejection accuracy’ curve (AURAC). This studies the case in which the confabulation detection score is used to refuse to answer the questions judged most likely to cause confabulations. Rejection accuracy is the accuracy of the answers of the model on the remaining questions and the area under this curve is a summary statistic over many thresholds (representative threshold accuracies are provided in Supplementary Material). The AURAC captures the accuracy improvement which users would experience if semantic entropy was used to filter out questions causing the highest entropy.

Results Or Findings

Baselines. In addition to reporting results for semantic entropy, discrete semantic entropy and naive entropy, we consider two strong baselines. Embedding regression is a supervised baseline inspired by the P(IK) method24. In that paper, the authors fine-tune their proprietary LLM on a dataset of questions to predict whether the model would have been correct. This requires access to a dataset of ground-truth answers to the questions. Rather than fine-tuning the entire LLM in this way, we simply

Discussion Or Conclusion

Acknowledgements We thank G. Irving, K. Perlin, J. Richens, L. Rimell and M. Turpin for their comments or discussion related to this work. We thank K. Handa for his help with the human evaluation of our automated accuracy assessment. We thank F. Bickford Smith and L. Melo for their code review. Y.G. is supported by a Turing AI Fellowship funded by the UK government’s Office for AI, through UK Research and Innovation (grant reference EP/V030302/1), and delivered by the Alan Turing Institute. Author contributions S.F. led the work from conception to completion and proposed using bidirectional entailment to cluster generations as a way of computing entropy in LLMs. He wrote the main text, most of the Methods and Supplementary Information and prepared most of the figures. J.K. improved the mathematical formalization of semantic entropy; led the extension of semantic entropy to sentence- and paragraph-length generations; wrote the code for, and carried out, all the experiments and evaluations; wrote much of the Methods and Supplementary Information and prepared drafts of many figures; and gave critical feedback on the main text. L.K. developed the initial mathematical formalization of semantic entropy; wrote code for, and carried out, the initial experiments around semantic entropy and its variants which demonstrated the promise of the idea and helped narrow down possible research avenues to explore; and gave critical feedback on the main text. Y.G. ideated the project, proposing the idea to differentiate semantic and syntactic diversity as a tool for detecting hallucinations, provided high-level guidance on the research and gave critical feedback on the main text; he runs the research laboratory in which the work was carried out. Competing interests S.F. is currently employed by Google DeepMind and L.K. by OpenAI. For both, this paper was written under their University of Oxford affiliation. The remaining authors declare no competing interests. Additional information Supplementary information The online version contains supplementary material available at https://doi.org/10.1038/s41586-024-07421-0. Correspondence and requests for materials should be addressed to Sebastian Farquhar. Peer review information Nature thanks Mirella Lapata and the other, anonymous, reviewer(s) for their contribution to the peer review of this work. Reprints and permissions information

Limitations

Metrics and accuracy measurements. We use three main metrics to evaluate our method: AUROC, rejection accuracy and AURAC. Each of these is grounded in an automated factuality estimation measurement relative to the reference answers provided by the datasets that we use. AUROC, rejection accuracy and AURAC. First, we use the AUROC curve, which measures the reliability of a classifier accounting for both precision and recall. The AUROC can be interpreted as the probability that a randomly chosen correct answer has been assigned a higher confidence score than a randomly chosen incorrect answer. For a perfect classifier, this is 1. Second, we compute the ‘rejection accuracy at X%’, which is the question-answering accuracy of the model on the most-confident X% of the inputs as identified by the respective uncertainty method. If an uncertainty method works well, predictions on the confident subset should be more accurate than predictions on the excluded subset and the rejection accuracy should increase as we reject more inputs. To summarize this statistic we compute the AURAC—the total area enclosed by the accuracies at all cut-off percentages X%. This should increase towards 1 as given uncertainty method becomes more accurate and better at detecting likely-inaccurate responses but it is more sensitive to the overall accuracy of the model than the AUROC metric. In Supplementary Note 5, we provide the unaggregated rejection accuracies for sentence-length generations. Assessing accuracy. For the short-phrase-length generation setting presented in Supplementary Note 7, we simply assess the accuracy of the generations by checking if the F1 score of the commonly used SQuAD metric exceeds 0.5. There are limitations to such simple scoring rules63 but this method is widely used in practice and its error is comparatively small on these standard datasets. For our default scenario, the longer sentence-length generations, this measure fails, as the overlap between the short reference answer and our long model answer is invariably too small. For sentence-length generations, we therefore automatically determine whether an answer to the question is correct or incorrect by using GPT-4 to compare the given answer to the reference answer. We use the template: We are assessing the quality of answers to the following question: {question} The expected answer is: {reference answer} The

evidence/tables/readthrough_evidence_map.md

Read-Through Evidence Map

| Field | Automated read-through value |

|---|---|

| Source PDF | `raw/Farquhar et al. - 2024 - Detecting hallucinations in large language models using semantic entropy.pdf` |

| Raw Markdown | `missing` |

| Grounding | `pdftotext-full` |

| Provisional design | `needs-further-coding` |

| Branch role | `branch-adjacent context` |

| Top terms | llm (63), gpt-4 (18), large language model (5), chatgpt (4) |

| Verification status | Needs human source-checking before exact citation |

level1_report.md

Level 1 Report

level3_report.md

Level 3 Report

- `evidence/passages/readthrough_key_passages.md`

- `evidence/tables/readthrough_evidence_map.md`

- `logic/method_and_design.md`

- `logic/methods_variables_outcomes.md`

- `logic/source_scope.md`

readthrough_result.md

Read-Through Result

Source Identity Check

Content Read-Through

The source was read through using full PDF text when available, with Markdown sidecar fallback. It was selected because it matched automated data extraction, LLM/AI evidence synthesis, screening, annotation, or related review-automation terms.

Methods And Design Check

Results Or Findings Check

Baselines. In addition to reporting results for semantic entropy, discrete semantic entropy and naive entropy, we consider two strong baselines. Embedding regression is a supervised baseline inspired by the P(IK) method24. In that paper, the authors fine-tune their proprietary LLM on a dataset of questions to predict whether the model would have been correct. This requires access to a dataset of ground-truth answers to the questions. Rather than fine-tuning the entire LLM in this way, we simply

Theory And Concept Check

Noise Removed

This pass did not preserve title-page boilerplate as claims. It wrote concise method/scope/evidence files and left exact quotation to source checking.

Open Verification Needs

Final Read-Through Status

`automated-readthrough-complete`; do not treat as `curated-level-3`.