{"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/haloscope-harnessing-unlabeled-llm","title":"HaloScope: Harnessing Unlabeled LLM Generations for Hallucination Detection","arxiv_id":"2409.17504","date":"2024-09-26","proceeding":null,"authors":["Xuefeng Du","Chaowei Xiao","Yixuan Li"],"abstract":"The surge in applications of large language models (LLMs) has prompted concerns about the generation of misleading or fabricated information, known as hallucinations. Therefore, detecting hallucinations has become critical to maintaining trust in LLM-generated content. A primary challenge in learning a truthfulness classifier is the lack of a large amount of labeled truthful and hallucinated data. To address the challenge, we introduce HaloScope, a novel learning framework that leverages the unlabeled LLM generations in the wild for hallucination detection. Such unlabeled data arises freely upon deploying LLMs in the open world, and consists of both truthful and hallucinated information. To harness the unlabeled data, we present an automated membership estimation score for distinguishing between truthful and untruthful generations within unlabeled mixture data, thereby enabling the training of a binary truthfulness classifier on top. Importantly, our framework does not require extra data collection and human annotations, offering strong flexibility and practicality for real-world applications. Extensive experiments show that HaloScope can achieve superior hallucination detection performance, outperforming the competitive rivals by a significant margin. Code is available at https://github.com/deeplearningwisc/haloscope.","url_abs":"https://arxiv.org/abs/2409.17504v1","url_pdf":"https://arxiv.org/pdf/2409.17504v1.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":[],"tasks":[{"task_slug":"hallucination","task_name":"Hallucination"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2409.17504","atlas_url":"https://app.syntology.ai/?focus=2409.17504","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2409.17504"}},"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":"deterministic:regex_extraction","url":"https://github.com/deeplearning-wisc/haloscope","reach":{"status":"ok"}}],"summary":{"ran_fixture":2,"ran":9,"ran_draft_wrong":2,"ran_honours":1,"unverified":2},"by_repo_kind":{"found_in_text":{"samples":16,"ran":14,"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":16,"samples":[{"code_sha256_prefix":"30d7eec482ebf6b1","entry":"repeat_kv","repo":"deeplearning-wisc/haloscope","repo_kind":"found_in_text","path":"llama_iti/modeling_llama.py","file_url":"https://github.com/deeplearning-wisc/haloscope/blob/HEAD/llama_iti/modeling_llama.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":2,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"30d7eec482ebf6b1"}},{"code_sha256_prefix":"31f45aff0c4290a2","entry":"accuracy","repo":"deeplearning-wisc/haloscope","repo_kind":"found_in_text","path":"linear_probe.py","file_url":"https://github.com/deeplearning-wisc/haloscope/blob/HEAD/linear_probe.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":"31f45aff0c4290a2"}},{"code_sha256_prefix":"d61c483a3c2b3156","entry":"apply_rotary_pos_emb","repo":"deeplearning-wisc/haloscope","repo_kind":"found_in_text","path":"llama_iti/modeling_llama.py","file_url":"https://github.com/deeplearning-wisc/haloscope/blob/HEAD/llama_iti/modeling_llama.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d61c483a3c2b3156"}},{"code_sha256_prefix":"0f87c7b11ad6cedb","entry":"cluster_acc","repo":"deeplearning-wisc/haloscope","repo_kind":"found_in_text","path":"ylib/ytool.py","file_url":"https://github.com/deeplearning-wisc/haloscope/blob/HEAD/ylib/ytool.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":"0f87c7b11ad6cedb"}},{"code_sha256_prefix":"507f475feb734647","entry":"compute_intermediate_size","repo":"deeplearning-wisc/haloscope","repo_kind":"found_in_text","path":"llama_iti/convert_llama_weights_to_hf.py","file_url":"https://github.com/deeplearning-wisc/haloscope/blob/HEAD/llama_iti/convert_llama_weights_to_hf.py","link_basis":"harvester_set","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":"507f475feb734647"}},{"code_sha256_prefix":"2b0f9e1f6130bf16","entry":"format_truthfulqa","repo":"deeplearning-wisc/haloscope","repo_kind":"found_in_text","path":"utils.py","file_url":"https://github.com/deeplearning-wisc/haloscope/blob/HEAD/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":"2b0f9e1f6130bf16"}},{"code_sha256_prefix":"d3900ac9d63a27db","entry":"format_truthfulqa_end_q","repo":"deeplearning-wisc/haloscope","repo_kind":"found_in_text","path":"utils.py","file_url":"https://github.com/deeplearning-wisc/haloscope/blob/HEAD/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":"d3900ac9d63a27db"}},{"code_sha256_prefix":"1134ab62338793e2","entry":"fpr_and_fdr_at_recall","repo":"deeplearning-wisc/haloscope","repo_kind":"found_in_text","path":"metric_utils.py","file_url":"https://github.com/deeplearning-wisc/haloscope/blob/HEAD/metric_utils.py","link_basis":"harvester_set","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":"1134ab62338793e2"}},{"code_sha256_prefix":"9b1abfca5a67be06","entry":"get_measures","repo":"deeplearning-wisc/haloscope","repo_kind":"found_in_text","path":"metric_utils.py","file_url":"https://github.com/deeplearning-wisc/haloscope/blob/HEAD/metric_utils.py","link_basis":"harvester_set","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":"9b1abfca5a67be06"}},{"code_sha256_prefix":"c5bcf01d18bba63d","entry":"read_json","repo":"deeplearning-wisc/haloscope","repo_kind":"found_in_text","path":"llama_iti/convert_llama_weights_to_hf.py","file_url":"https://github.com/deeplearning-wisc/haloscope/blob/HEAD/llama_iti/convert_llama_weights_to_hf.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"c5bcf01d18bba63d"}},{"code_sha256_prefix":"b99eea6376d1e212","entry":"rotate_half","repo":"deeplearning-wisc/haloscope","repo_kind":"found_in_text","path":"llama_iti/modeling_llama.py","file_url":"https://github.com/deeplearning-wisc/haloscope/blob/HEAD/llama_iti/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":"a44a1925c2c778ba","entry":"set_optimizer","repo":"deeplearning-wisc/haloscope","repo_kind":"found_in_text","path":"linear_probe.py","file_url":"https://github.com/deeplearning-wisc/haloscope/blob/HEAD/linear_probe.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":"a44a1925c2c778ba"}},{"code_sha256_prefix":"d4acb3120a027622","entry":"stable_cumsum","repo":"deeplearning-wisc/haloscope","repo_kind":"found_in_text","path":"metric_utils.py","file_url":"https://github.com/deeplearning-wisc/haloscope/blob/HEAD/metric_utils.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d4acb3120a027622"}},{"code_sha256_prefix":"e01d82ee5f1bfbdd","entry":"train","repo":"deeplearning-wisc/haloscope","repo_kind":"found_in_text","path":"linear_probe.py","file_url":"https://github.com/deeplearning-wisc/haloscope/blob/HEAD/linear_probe.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":"e01d82ee5f1bfbdd"}},{"code_sha256_prefix":"86d6684648b96be2","entry":"tokenized_tqa","repo":"deeplearning-wisc/haloscope","repo_kind":"found_in_text","path":"utils.py","file_url":"https://github.com/deeplearning-wisc/haloscope/blob/HEAD/utils.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":"86d6684648b96be2"}},{"code_sha256_prefix":"4681d3d61616d9e0","entry":"write_model","repo":"deeplearning-wisc/haloscope","repo_kind":"found_in_text","path":"llama_iti/convert_llama_weights_to_hf.py","file_url":"https://github.com/deeplearning-wisc/haloscope/blob/HEAD/llama_iti/convert_llama_weights_to_hf.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":"4681d3d61616d9e0"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}