{"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/pollmgraph-unraveling-hallucinations-in-large","title":"PoLLMgraph: Unraveling Hallucinations in Large Language Models via State Transition Dynamics","arxiv_id":"2404.04722","date":"2024-04-06","proceeding":null,"authors":["Derui Zhu","Dingfan Chen","Qing Li","Zongxiong Chen","Lei Ma","Jens Grossklags","Mario Fritz"],"abstract":"Despite tremendous advancements in large language models (LLMs) over recent years, a notably urgent challenge for their practical deployment is the phenomenon of hallucination, where the model fabricates facts and produces non-factual statements. In response, we propose PoLLMgraph, a Polygraph for LLMs, as an effective model-based white-box detection and forecasting approach. PoLLMgraph distinctly differs from the large body of existing research that concentrates on addressing such challenges through black-box evaluations. In particular, we demonstrate that hallucination can be effectively detected by analyzing the LLM's internal state transition dynamics during generation via tractable probabilistic models. Experimental results on various open-source LLMs confirm the efficacy of PoLLMgraph, outperforming state-of-the-art methods by a considerable margin, evidenced by over 20% improvement in AUC-ROC on common benchmarking datasets like TruthfulQA. Our work paves a new way for model-based white-box analysis of LLMs, motivating the research community to further explore, understand, and refine the intricate dynamics of LLM behaviors.","url_abs":"https://arxiv.org/abs/2404.04722v1","url_pdf":"https://arxiv.org/pdf/2404.04722v1.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":"pollmgraph-unraveling-hallucinations-in-large","repo_url":"https://github.com/hitum-dev/pollmgraph","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"none","reach":{"status":"ok"}}],"tasks":[{"task_slug":"benchmarking","task_name":"Benchmarking"},{"task_slug":"hallucination","task_name":"Hallucination"},{"task_slug":"truthfulqa","task_name":"TruthfulQA"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2404.04722","atlas_url":"https://app.syntology.ai/?focus=2404.04722","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2404.04722"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/hitum-dev/pollmgraph","reach":{"status":"ok"}}],"summary":{"ran_draft_wrong":2,"ran":4,"unverified":1},"by_repo_kind":{"official":{"samples":7,"ran":6,"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":7,"samples":[{"code_sha256_prefix":"373a7df152e5a1a5","entry":"apply_rotary_pos_emb","repo":"hitum-dev/pollmgraph","repo_kind":"official","path":"pollmgraph/utils/llama/modeling_llama.py","file_url":"https://github.com/hitum-dev/pollmgraph/blob/HEAD/pollmgraph/utils/llama/modeling_llama.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"373a7df152e5a1a5"}},{"code_sha256_prefix":"88e1dd10e08fefe6","entry":"compute_A12","repo":"hitum-dev/pollmgraph","repo_kind":"official","path":"density_analysis.py","file_url":"https://github.com/hitum-dev/pollmgraph/blob/HEAD/density_analysis.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"88e1dd10e08fefe6"}},{"code_sha256_prefix":"df98b811f5abc633","entry":"get_llama_logits","repo":"hitum-dev/pollmgraph","repo_kind":"official","path":"pollmgraph/utils/activation_utils.py","file_url":"https://github.com/hitum-dev/pollmgraph/blob/HEAD/pollmgraph/utils/activation_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"df98b811f5abc633"}},{"code_sha256_prefix":"ba188de27ad6929a","entry":"get_llama_probs","repo":"hitum-dev/pollmgraph","repo_kind":"official","path":"pollmgraph/utils/activation_utils.py","file_url":"https://github.com/hitum-dev/pollmgraph/blob/HEAD/pollmgraph/utils/activation_utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ba188de27ad6929a"}},{"code_sha256_prefix":"370e90d190281329","entry":"load_lists","repo":"hitum-dev/pollmgraph","repo_kind":"official","path":"pollmgraph/utils/interfaces.py","file_url":"https://github.com/hitum-dev/pollmgraph/blob/HEAD/pollmgraph/utils/interfaces.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"370e90d190281329"}},{"code_sha256_prefix":"b99eea6376d1e212","entry":"rotate_half","repo":"hitum-dev/pollmgraph","repo_kind":"official","path":"pollmgraph/utils/llama/modeling_llama.py","file_url":"https://github.com/hitum-dev/pollmgraph/blob/HEAD/pollmgraph/utils/llama/modeling_llama.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b99eea6376d1e212"}},{"code_sha256_prefix":"88258cda6a0ef5ab","entry":"probabilistic_model_checking","repo":"hitum-dev/pollmgraph","repo_kind":"official","path":"pollmgraph/utils/probabilistic_model_checking/runtime_pmc.py","file_url":"https://github.com/hitum-dev/pollmgraph/blob/HEAD/pollmgraph/utils/probabilistic_model_checking/runtime_pmc.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"88258cda6a0ef5ab"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}