{"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/uncertainty-decomposition-and-quantification","title":"Uncertainty Quantification for In-Context Learning of Large Language Models","arxiv_id":"2402.10189","date":"2024-02-15","proceeding":null,"authors":["Chen Ling","Xujiang Zhao","Xuchao Zhang","Wei Cheng","Yanchi Liu","Yiyou Sun","Mika Oishi","Takao Osaki","Katsushi Matsuda","Jie Ji","Guangji Bai","Liang Zhao","Haifeng Chen"],"abstract":"In-context learning has emerged as a groundbreaking ability of Large Language Models (LLMs) and revolutionized various fields by providing a few task-relevant demonstrations in the prompt. However, trustworthy issues with LLM's response, such as hallucination, have also been actively discussed. Existing works have been devoted to quantifying the uncertainty in LLM's response, but they often overlook the complex nature of LLMs and the uniqueness of in-context learning. In this work, we delve into the predictive uncertainty of LLMs associated with in-context learning, highlighting that such uncertainties may stem from both the provided demonstrations (aleatoric uncertainty) and ambiguities tied to the model's configurations (epistemic uncertainty). We propose a novel formulation and corresponding estimation method to quantify both types of uncertainties. The proposed method offers an unsupervised way to understand the prediction of in-context learning in a plug-and-play fashion. Extensive experiments are conducted to demonstrate the effectiveness of the decomposition. The code and data are available at: https://github.com/lingchen0331/UQ_ICL.","url_abs":"https://arxiv.org/abs/2402.10189v2","url_pdf":"https://arxiv.org/pdf/2402.10189v2.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":"uncertainty-decomposition-and-quantification","repo_url":"https://github.com/lingchen0331/uq_icl","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"hallucination","task_name":"Hallucination"},{"task_slug":"in-context-learning","task_name":"In-Context Learning"},{"task_slug":"uncertainty-quantification","task_name":"Uncertainty Quantification"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2402.10189","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2402.10189"}},"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/lingchen0331/uq_icl","reach":null}],"summary":{"ran_draft_wrong":1,"ran":1,"unverified":3},"by_repo_kind":{"official":{"samples":5,"ran":2,"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":"221aadea28e3360f","entry":"create_prompt","repo":"lingchen0331/uq_icl","repo_kind":"official","path":"sources/utils.py","file_url":"https://github.com/lingchen0331/uq_icl/blob/HEAD/sources/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"221aadea28e3360f"}},{"code_sha256_prefix":"1b683939410b3b38","entry":"entropy_calculation","repo":"lingchen0331/uq_icl","repo_kind":"official","path":"sources/utils.py","file_url":"https://github.com/lingchen0331/uq_icl/blob/HEAD/sources/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":"1b683939410b3b38"}},{"code_sha256_prefix":"0699f27827f28608","entry":"answer_generation","repo":"lingchen0331/uq_icl","repo_kind":"official","path":"sources/utils.py","file_url":"https://github.com/lingchen0331/uq_icl/blob/HEAD/sources/utils.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":"0699f27827f28608"}},{"code_sha256_prefix":"9cb1be1e04d4cd16","entry":"create_demonstrations","repo":"lingchen0331/uq_icl","repo_kind":"official","path":"sources/utils.py","file_url":"https://github.com/lingchen0331/uq_icl/blob/HEAD/sources/utils.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":"9cb1be1e04d4cd16"}},{"code_sha256_prefix":"02c496ec73fe7caa","entry":"uncertainty_calculation","repo":"lingchen0331/uq_icl","repo_kind":"official","path":"sources/utils.py","file_url":"https://github.com/lingchen0331/uq_icl/blob/HEAD/sources/utils.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":"02c496ec73fe7caa"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}