{"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/sayself-teaching-llms-to-express-confidence","title":"SaySelf: Teaching LLMs to Express Confidence with Self-Reflective Rationales","arxiv_id":"2405.20974","date":"2024-05-31","proceeding":null,"authors":["Tianyang Xu","Shujin Wu","Shizhe Diao","Xiaoze Liu","Xingyao Wang","Yangyi Chen","Jing Gao"],"abstract":"Large language models (LLMs) often generate inaccurate or fabricated information and generally fail to indicate their confidence, which limits their broader applications. Previous work elicits confidence from LLMs by direct or self-consistency prompting, or constructing specific datasets for supervised finetuning. The prompting-based approaches have inferior performance, and the training-based approaches are limited to binary or inaccurate group-level confidence estimates. In this work, we present the advanced SaySelf, a training framework that teaches LLMs to express more accurate fine-grained confidence estimates. In addition, beyond the confidence scores, SaySelf initiates the process of directing LLMs to produce self-reflective rationales that clearly identify gaps in their parametric knowledge and explain their uncertainty. This is achieved by using an LLM to automatically summarize the uncertainties in specific knowledge via natural language. The summarization is based on the analysis of the inconsistency in multiple sampled reasoning chains, and the resulting data is utilized for supervised fine-tuning. Moreover, we utilize reinforcement learning with a meticulously crafted reward function to calibrate the confidence estimates, motivating LLMs to deliver accurate, high-confidence predictions and to penalize overconfidence in erroneous outputs. Experimental results in both in-distribution and out-of-distribution datasets demonstrate the effectiveness of SaySelf in reducing the confidence calibration error and maintaining the task performance. We show that the generated self-reflective rationales are reasonable and can further contribute to the calibration. The code is made public at https://github.com/xu1868/SaySelf.","url_abs":"https://arxiv.org/abs/2405.20974v3","url_pdf":"https://arxiv.org/pdf/2405.20974v3.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":"sayself-teaching-llms-to-express-confidence","repo_url":"https://github.com/xu1868/sayself","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2405.20974","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2405.20974"}},"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/xu1868/sayself","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"deterministic:regex_extraction","url":"https://github.com/xu1868/SaySelf","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":11,"unverified":2},"by_repo_kind":{"official":{"samples":13,"ran":11,"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":"6c5c81d9c2c06116","entry":"calculate_reward","repo":"xu1868/SaySelf","repo_kind":"official","path":"utils/utils.py","file_url":"https://github.com/xu1868/SaySelf/blob/HEAD/utils/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6c5c81d9c2c06116"}},{"code_sha256_prefix":"b9d2be719e848341","entry":"encode_with_json_format","repo":"xu1868/SaySelf","repo_kind":"official","path":"evaluation/evaluate.py","file_url":"https://github.com/xu1868/SaySelf/blob/HEAD/evaluation/evaluate.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"b9d2be719e848341"}},{"code_sha256_prefix":"0fe2c5386a8e7ffe","entry":"encode_with_messages_format","repo":"xu1868/SaySelf","repo_kind":"official","path":"training/finetune.py","file_url":"https://github.com/xu1868/SaySelf/blob/HEAD/training/finetune.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"0fe2c5386a8e7ffe"}},{"code_sha256_prefix":"2ff0831de5949f6c","entry":"encode_with_messages_format","repo":"xu1868/SaySelf","repo_kind":"official","path":"evaluation/evaluate.py","file_url":"https://github.com/xu1868/SaySelf/blob/HEAD/evaluation/evaluate.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2ff0831de5949f6c"}},{"code_sha256_prefix":"a6a6be18e0e76d28","entry":"encode_with_messages_format","repo":"xu1868/sayself","repo_kind":"official","path":"training/rlhf_train.py","file_url":"https://github.com/xu1868/sayself/blob/HEAD/training/rlhf_train.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a6a6be18e0e76d28"}},{"code_sha256_prefix":"25e9ee7fc7b8741c","entry":"encode_with_qr_format","repo":"xu1868/SaySelf","repo_kind":"official","path":"training/finetune.py","file_url":"https://github.com/xu1868/SaySelf/blob/HEAD/training/finetune.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"25e9ee7fc7b8741c"}},{"code_sha256_prefix":"e3b0d7c3e623b451","entry":"generate_summarized_reason","repo":"xu1868/SaySelf","repo_kind":"official","path":"evaluation/evaluate_reason.py","file_url":"https://github.com/xu1868/SaySelf/blob/HEAD/evaluation/evaluate_reason.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e3b0d7c3e623b451"}},{"code_sha256_prefix":"df9fb4e8e291c1f4","entry":"parse_response","repo":"xu1868/SaySelf","repo_kind":"official","path":"utils/utils.py","file_url":"https://github.com/xu1868/SaySelf/blob/HEAD/utils/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"df9fb4e8e291c1f4"}},{"code_sha256_prefix":"7f4e1be0da09e67d","entry":"parse_response_new","repo":"xu1868/SaySelf","repo_kind":"official","path":"utils/utils.py","file_url":"https://github.com/xu1868/SaySelf/blob/HEAD/utils/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"7f4e1be0da09e67d"}},{"code_sha256_prefix":"351da31d97b7a2c7","entry":"parse_summarized_response","repo":"xu1868/SaySelf","repo_kind":"official","path":"evaluation/evaluate_reason.py","file_url":"https://github.com/xu1868/SaySelf/blob/HEAD/evaluation/evaluate_reason.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"351da31d97b7a2c7"}},{"code_sha256_prefix":"a942e23bce929ae1","entry":"preprocess_dataset","repo":"xu1868/SaySelf","repo_kind":"official","path":"evaluation/generate_reasons_for_evaluation.py","file_url":"https://github.com/xu1868/SaySelf/blob/HEAD/evaluation/generate_reasons_for_evaluation.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a942e23bce929ae1"}},{"code_sha256_prefix":"6ea8e572530aeb5b","entry":"encode_with_files_format","repo":"xu1868/SaySelf","repo_kind":"official","path":"evaluation/evaluate.py","file_url":"https://github.com/xu1868/SaySelf/blob/HEAD/evaluation/evaluate.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6ea8e572530aeb5b"}},{"code_sha256_prefix":"119cad9954acc960","entry":"encode_with_prompt_completion_format","repo":"xu1868/SaySelf","repo_kind":"official","path":"training/finetune.py","file_url":"https://github.com/xu1868/SaySelf/blob/HEAD/training/finetune.py","link_basis":"plan_row","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"119cad9954acc960"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}