{"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/ualign-leveraging-uncertainty-estimations-for","title":"UAlign: Leveraging Uncertainty Estimations for Factuality Alignment on Large Language Models","arxiv_id":"2412.11803","date":"2024-12-16","proceeding":null,"authors":["Boyang Xue","Fei Mi","Qi Zhu","Hongru Wang","Rui Wang","Sheng Wang","Erxin Yu","Xuming Hu","Kam-Fai Wong"],"abstract":"Despite demonstrating impressive capabilities, Large Language Models (LLMs) still often struggle to accurately express the factual knowledge they possess, especially in cases where the LLMs' knowledge boundaries are ambiguous. To improve LLMs' factual expressions, we propose the UAlign framework, which leverages Uncertainty estimations to represent knowledge boundaries, and then explicitly incorporates these representations as input features into prompts for LLMs to Align with factual knowledge. First, we prepare the dataset on knowledge question-answering (QA) samples by calculating two uncertainty estimations, including confidence score and semantic entropy, to represent the knowledge boundaries for LLMs. Subsequently, using the prepared dataset, we train a reward model that incorporates uncertainty estimations and then employ the Proximal Policy Optimization (PPO) algorithm for factuality alignment on LLMs. Experimental results indicate that, by integrating uncertainty representations in LLM alignment, the proposed UAlign can significantly enhance the LLMs' capacities to confidently answer known questions and refuse unknown questions on both in-domain and out-of-domain tasks, showing reliability improvements and good generalizability over various prompt- and training-based baselines.","url_abs":"https://arxiv.org/abs/2412.11803v1","url_pdf":"https://arxiv.org/pdf/2412.11803v1.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":"ualign-leveraging-uncertainty-estimations-for","repo_url":"https://github.com/amourwaltz/ualign","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"question-answering","task_name":"Question Answering"}],"methods":[{"method_slug":"align","method_name":"ALIGN"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2412.11803","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2412.11803"}},"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/amourwaltz/ualign","reach":{"status":"ok"}}],"summary":{"ran_draft_wrong":1,"unverified":12},"by_repo_kind":{"official":{"samples":13,"ran":1,"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":13,"samples":[{"code_sha256_prefix":"d07d04439cd1d44f","entry":"jload","repo":"amourwaltz/ualign","repo_kind":"official","path":"code/utils.py","file_url":"https://github.com/amourwaltz/ualign/blob/HEAD/code/utils.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":"d07d04439cd1d44f"}},{"code_sha256_prefix":"88d00d042fe3cc57","entry":"calculate_confidence","repo":"amourwaltz/ualign","repo_kind":"official","path":"code/uncertainty.py","file_url":"https://github.com/amourwaltz/ualign/blob/HEAD/code/uncertainty.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":"88d00d042fe3cc57"}},{"code_sha256_prefix":"23b0e66b13795f6e","entry":"calculate_entropy","repo":"amourwaltz/ualign","repo_kind":"official","path":"code/uncertainty.py","file_url":"https://github.com/amourwaltz/ualign/blob/HEAD/code/uncertainty.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":"23b0e66b13795f6e"}},{"code_sha256_prefix":"d995aae91bfab9fb","entry":"calculate_probabilities","repo":"amourwaltz/ualign","repo_kind":"official","path":"code/uncertainty.py","file_url":"https://github.com/amourwaltz/ualign/blob/HEAD/code/uncertainty.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":"d995aae91bfab9fb"}},{"code_sha256_prefix":"6d1515784df90ddb","entry":"format_examplar","repo":"amourwaltz/ualign","repo_kind":"official","path":"code/infer.py","file_url":"https://github.com/amourwaltz/ualign/blob/HEAD/code/infer.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":"6d1515784df90ddb"}},{"code_sha256_prefix":"91592110883e0f36","entry":"make_supervised_data_module","repo":"amourwaltz/ualign","repo_kind":"official","path":"code/train_sft.py","file_url":"https://github.com/amourwaltz/ualign/blob/HEAD/code/train_sft.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":"91592110883e0f36"}},{"code_sha256_prefix":"67edb48169125783","entry":"output_split","repo":"amourwaltz/ualign","repo_kind":"official","path":"code/infer.py","file_url":"https://github.com/amourwaltz/ualign/blob/HEAD/code/infer.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":"67edb48169125783"}},{"code_sha256_prefix":"8efdb337e4892760","entry":"prep_sciq_dataset","repo":"amourwaltz/ualign","repo_kind":"official","path":"code/prep.py","file_url":"https://github.com/amourwaltz/ualign/blob/HEAD/code/prep.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":"8efdb337e4892760"}},{"code_sha256_prefix":"00bac655587e2bf0","entry":"prep_triviaqa_dataset","repo":"amourwaltz/ualign","repo_kind":"official","path":"code/prep.py","file_url":"https://github.com/amourwaltz/ualign/blob/HEAD/code/prep.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":"00bac655587e2bf0"}},{"code_sha256_prefix":"b46ab02018bb18f6","entry":"prep_webqa_dataset","repo":"amourwaltz/ualign","repo_kind":"official","path":"code/prep.py","file_url":"https://github.com/amourwaltz/ualign/blob/HEAD/code/prep.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":"b46ab02018bb18f6"}},{"code_sha256_prefix":"c855c225b6c71721","entry":"preprocess","repo":"amourwaltz/ualign","repo_kind":"official","path":"code/train_sft.py","file_url":"https://github.com/amourwaltz/ualign/blob/HEAD/code/train_sft.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":"c855c225b6c71721"}},{"code_sha256_prefix":"8e230efd4b919022","entry":"read_json","repo":"amourwaltz/ualign","repo_kind":"official","path":"code/utils.py","file_url":"https://github.com/amourwaltz/ualign/blob/HEAD/code/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":"8e230efd4b919022"}},{"code_sha256_prefix":"d5792c4c85064ef5","entry":"read_jsonl","repo":"amourwaltz/ualign","repo_kind":"official","path":"code/utils.py","file_url":"https://github.com/amourwaltz/ualign/blob/HEAD/code/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":"d5792c4c85064ef5"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}