{"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/mitigating-hallucinations-of-large-language","title":"Knowledge Verification to Nip Hallucination in the Bud","arxiv_id":"2401.10768","date":"2024-01-19","proceeding":null,"authors":["Fanqi Wan","Xinting Huang","Leyang Cui","Xiaojun Quan","Wei Bi","Shuming Shi"],"abstract":"While large language models (LLMs) have demonstrated exceptional performance across various tasks following human alignment, they may still generate responses that sound plausible but contradict factual knowledge, a phenomenon known as hallucination. In this paper, we demonstrate the feasibility of mitigating hallucinations by verifying and minimizing the inconsistency between external knowledge present in the alignment data and the intrinsic knowledge embedded within foundation LLMs. Specifically, we propose a novel approach called Knowledge Consistent Alignment (KCA), which employs a well-aligned LLM to automatically formulate assessments based on external knowledge to evaluate the knowledge boundaries of foundation LLMs. To address knowledge inconsistencies in the alignment data, KCA implements several specific strategies to deal with these data instances. We demonstrate the superior efficacy of KCA in reducing hallucinations across six benchmarks, utilizing foundation LLMs of varying backbones and scales. This confirms the effectiveness of mitigating hallucinations by reducing knowledge inconsistency. Our code, model weights, and data are openly accessible at \\url{https://github.com/fanqiwan/KCA}.","url_abs":"https://arxiv.org/abs/2401.10768v5","url_pdf":"https://arxiv.org/pdf/2401.10768v5.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":"mitigating-hallucinations-of-large-language","repo_url":"https://github.com/fanqiwan/kca","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"hallucination","task_name":"Hallucination"},{"task_slug":"world-knowledge","task_name":"World Knowledge"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2401.10768","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2401.10768"}},"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":"deterministic:regex_extraction","url":"https://github.com/fanqiwan/KCA","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran":12,"ran_draft_wrong":1,"unverified":9},"by_repo_kind":{"official":{"samples":22,"ran":13,"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":"f9e2df54998117c3","entry":"calculate_effectiveness_statistic","repo":"fanqiwan/KCA","repo_kind":"official","path":"eval/gpt_judge/show_results.py","file_url":"https://github.com/fanqiwan/KCA/blob/HEAD/eval/gpt_judge/show_results.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":"f9e2df54998117c3"}},{"code_sha256_prefix":"48f1e29ec994c4e4","entry":"calculate_hallucination_classification_statistic","repo":"fanqiwan/KCA","repo_kind":"official","path":"eval/gpt_judge/show_results.py","file_url":"https://github.com/fanqiwan/KCA/blob/HEAD/eval/gpt_judge/show_results.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":"48f1e29ec994c4e4"}},{"code_sha256_prefix":"4baef40c64107f17","entry":"compute_question_accuracy","repo":"fanqiwan/KCA","repo_kind":"official","path":"examination/hallucination/get_metric.py","file_url":"https://github.com/fanqiwan/KCA/blob/HEAD/examination/hallucination/get_metric.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":"4baef40c64107f17"}},{"code_sha256_prefix":"dc4bfb543add6e7d","entry":"dispatch_openai_requests","repo":"fanqiwan/KCA","repo_kind":"official","path":"eval/gpt_judge/gpt_judge.py","file_url":"https://github.com/fanqiwan/KCA/blob/HEAD/eval/gpt_judge/gpt_judge.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":"dc4bfb543add6e7d"}},{"code_sha256_prefix":"661419d69a095bfe","entry":"encode_with_prompt_completion_format","repo":"fanqiwan/KCA","repo_kind":"official","path":"examination/utils.py","file_url":"https://github.com/fanqiwan/KCA/blob/HEAD/examination/utils.py","link_basis":"harvester_set","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":"661419d69a095bfe"}},{"code_sha256_prefix":"d82c972512c051c4","entry":"extract_question_id","repo":"fanqiwan/KCA","repo_kind":"official","path":"examination/hallucination/get_metric.py","file_url":"https://github.com/fanqiwan/KCA/blob/HEAD/examination/hallucination/get_metric.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d82c972512c051c4"}},{"code_sha256_prefix":"cbcc22537dba8d33","entry":"get_completion","repo":"fanqiwan/KCA","repo_kind":"official","path":"eval/gpt_judge/gpt_judge.py","file_url":"https://github.com/fanqiwan/KCA/blob/HEAD/eval/gpt_judge/gpt_judge.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":"cbcc22537dba8d33"}},{"code_sha256_prefix":"5d17b604c968b41d","entry":"get_json_list","repo":"fanqiwan/KCA","repo_kind":"official","path":"eval/gpt_judge/gpt_judge.py","file_url":"https://github.com/fanqiwan/KCA/blob/HEAD/eval/gpt_judge/gpt_judge.py","link_basis":"harvester_set","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":"5d17b604c968b41d"}},{"code_sha256_prefix":"b15d8b1317f1fd0d","entry":"get_next_word_predictions","repo":"fanqiwan/KCA","repo_kind":"official","path":"examination/utils.py","file_url":"https://github.com/fanqiwan/KCA/blob/HEAD/examination/utils.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":"b15d8b1317f1fd0d"}},{"code_sha256_prefix":"958758b5786a4316","entry":"parse_fact_enhance_classify_res","repo":"fanqiwan/KCA","repo_kind":"official","path":"data_generation/post_process.py","file_url":"https://github.com/fanqiwan/KCA/blob/HEAD/data_generation/post_process.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"958758b5786a4316"}},{"code_sha256_prefix":"63e1e400990ece36","entry":"parse_fact_generation_res","repo":"fanqiwan/KCA","repo_kind":"official","path":"data_generation/post_process.py","file_url":"https://github.com/fanqiwan/KCA/blob/HEAD/data_generation/post_process.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"63e1e400990ece36"}},{"code_sha256_prefix":"875f0b97337517e6","entry":"parse_test_generation_res","repo":"fanqiwan/KCA","repo_kind":"official","path":"data_generation/post_process.py","file_url":"https://github.com/fanqiwan/KCA/blob/HEAD/data_generation/post_process.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"875f0b97337517e6"}},{"code_sha256_prefix":"02171abe8492fcfd","entry":"read_jsonl","repo":"fanqiwan/KCA","repo_kind":"official","path":"data_generation/inconsistency_processing.py","file_url":"https://github.com/fanqiwan/KCA/blob/HEAD/data_generation/inconsistency_processing.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"02171abe8492fcfd"}},{"code_sha256_prefix":"7f0044e5a93e33e2","entry":"compute_metrics","repo":"fanqiwan/KCA","repo_kind":"official","path":"eval/gpt_judge/gen_summary.py","file_url":"https://github.com/fanqiwan/KCA/blob/HEAD/eval/gpt_judge/gen_summary.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":"7f0044e5a93e33e2"}},{"code_sha256_prefix":"e51c9713fadad16f","entry":"create_prompt_with_llama2_chat_format","repo":"fanqiwan/KCA","repo_kind":"official","path":"examination/templates.py","file_url":"https://github.com/fanqiwan/KCA/blob/HEAD/examination/templates.py","link_basis":"harvester_set","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":"e51c9713fadad16f"}},{"code_sha256_prefix":"697d92a5d51eff3e","entry":"create_prompt_with_tulu_chat_format","repo":"fanqiwan/KCA","repo_kind":"official","path":"examination/templates.py","file_url":"https://github.com/fanqiwan/KCA/blob/HEAD/examination/templates.py","link_basis":"harvester_set","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":"697d92a5d51eff3e"}},{"code_sha256_prefix":"dcad9ac62979ca49","entry":"dispatch_openai_chat_requesets","repo":"fanqiwan/KCA","repo_kind":"official","path":"examination/dispatch_openai_requests.py","file_url":"https://github.com/fanqiwan/KCA/blob/HEAD/examination/dispatch_openai_requests.py","link_basis":"harvester_set","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":"dcad9ac62979ca49"}},{"code_sha256_prefix":"71e4259026911444","entry":"dispatch_openai_prompt_requesets","repo":"fanqiwan/KCA","repo_kind":"official","path":"examination/dispatch_openai_requests.py","file_url":"https://github.com/fanqiwan/KCA/blob/HEAD/examination/dispatch_openai_requests.py","link_basis":"harvester_set","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":"71e4259026911444"}},{"code_sha256_prefix":"352416cd121404a7","entry":"generate_completions","repo":"fanqiwan/KCA","repo_kind":"official","path":"examination/utils.py","file_url":"https://github.com/fanqiwan/KCA/blob/HEAD/examination/utils.py","link_basis":"harvester_set","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":"352416cd121404a7"}},{"code_sha256_prefix":"3a8f2cf897f0d356","entry":"openai_encode_prompt","repo":"fanqiwan/KCA","repo_kind":"official","path":"data_generation/per_instance_query.py","file_url":"https://github.com/fanqiwan/KCA/blob/HEAD/data_generation/per_instance_query.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":"3a8f2cf897f0d356"}},{"code_sha256_prefix":"e34ff3c5b1f3ba89","entry":"query_openai_batch","repo":"fanqiwan/KCA","repo_kind":"official","path":"data_generation/per_instance_query.py","file_url":"https://github.com/fanqiwan/KCA/blob/HEAD/data_generation/per_instance_query.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":"e34ff3c5b1f3ba89"}},{"code_sha256_prefix":"5869d7c37c3993a8","entry":"request_openai_batch","repo":"fanqiwan/KCA","repo_kind":"official","path":"data_generation/per_instance_query.py","file_url":"https://github.com/fanqiwan/KCA/blob/HEAD/data_generation/per_instance_query.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":"5869d7c37c3993a8"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}