{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/on-early-detection-of-hallucinations-in","title":"On Early Detection of Hallucinations in Factual Question Answering","arxiv_id":"2312.14183","date":"2023-12-19","proceeding":null,"authors":["Ben Snyder","Marius Moisescu","Muhammad Bilal Zafar"],"abstract":"While large language models (LLMs) have taken great strides towards helping humans with a plethora of tasks, hallucinations remain a major impediment towards gaining user trust. The fluency and coherence of model generations even when hallucinating makes detection a difficult task. In this work, we explore if the artifacts associated with the model generations can provide hints that the generation will contain hallucinations. Specifically, we probe LLMs at 1) the inputs via Integrated Gradients based token attribution, 2) the outputs via the Softmax probabilities, and 3) the internal state via self-attention and fully-connected layer activations for signs of hallucinations on open-ended question answering tasks. Our results show that the distributions of these artifacts tend to differ between hallucinated and non-hallucinated generations. Building on this insight, we train binary classifiers that use these artifacts as input features to classify model generations into hallucinations and non-hallucinations. These hallucination classifiers achieve up to $0.80$ AUROC. We also show that tokens preceding a hallucination can already predict the subsequent hallucination even before it occurs.","url_abs":"https://arxiv.org/abs/2312.14183v3","url_pdf":"https://arxiv.org/pdf/2312.14183v3.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"on-early-detection-of-hallucinations-in","repo_url":"https://github.com/amazon-science/llm-hallucinations-factual-qa","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"hallucination","task_name":"Hallucination"},{"task_slug":"open-question","task_name":"Open-Ended Question Answering"},{"task_slug":"question-answering","task_name":"Question Answering"}],"methods":[{"method_slug":"softmax","method_name":"Softmax"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2312.14183","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2312.14183"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/amazon-science/llm-hallucinations-factual-qa","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran":4,"unverified":2},"by_repo_kind":{"official":{"samples":6,"ran":4,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"dda2b409090219b0","entry":"collect_entry","repo":"amazon-science/llm-hallucinations-factual-qa","repo_kind":"official","path":"trex_parser.py","file_url":"https://github.com/amazon-science/llm-hallucinations-factual-qa/blob/HEAD/trex_parser.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"dda2b409090219b0"}},{"code_sha256_prefix":"5dd1176e0c6702d1","entry":"extract_all_triples","repo":"amazon-science/llm-hallucinations-factual-qa","repo_kind":"official","path":"trex_parser.py","file_url":"https://github.com/amazon-science/llm-hallucinations-factual-qa/blob/HEAD/trex_parser.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"5dd1176e0c6702d1"}},{"code_sha256_prefix":"5662ca5e5553beeb","entry":"filter_subj_obj","repo":"amazon-science/llm-hallucinations-factual-qa","repo_kind":"official","path":"trex_parser.py","file_url":"https://github.com/amazon-science/llm-hallucinations-factual-qa/blob/HEAD/trex_parser.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"5662ca5e5553beeb"}},{"code_sha256_prefix":"68b60a9367249cc7","entry":"get_next_token","repo":"amazon-science/llm-hallucinations-factual-qa","repo_kind":"official","path":"result_collector.py","file_url":"https://github.com/amazon-science/llm-hallucinations-factual-qa/blob/HEAD/result_collector.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"68b60a9367249cc7"}},{"code_sha256_prefix":"03559f369dd0f078","entry":"generate_response","repo":"amazon-science/llm-hallucinations-factual-qa","repo_kind":"official","path":"result_collector.py","file_url":"https://github.com/amazon-science/llm-hallucinations-factual-qa/blob/HEAD/result_collector.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"03559f369dd0f078"}},{"code_sha256_prefix":"975098b74738f343","entry":"load_data","repo":"amazon-science/llm-hallucinations-factual-qa","repo_kind":"official","path":"result_collector.py","file_url":"https://github.com/amazon-science/llm-hallucinations-factual-qa/blob/HEAD/result_collector.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"975098b74738f343"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}