{"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/c-tpt-calibrated-test-time-prompt-tuning-for","title":"C-TPT: Calibrated Test-Time Prompt Tuning for Vision-Language Models via Text Feature Dispersion","arxiv_id":"2403.14119","date":"2024-03-21","proceeding":null,"authors":["Hee Suk Yoon","Eunseop Yoon","Joshua Tian Jin Tee","Mark Hasegawa-Johnson","Yingzhen Li","Chang D. Yoo"],"abstract":"In deep learning, test-time adaptation has gained attention as a method for model fine-tuning without the need for labeled data. A prime exemplification is the recently proposed test-time prompt tuning for large-scale vision-language models such as CLIP. Unfortunately, these prompts have been mainly developed to improve accuracy, overlooking the importance of calibration, which is a crucial aspect for quantifying prediction uncertainty. However, traditional calibration methods rely on substantial amounts of labeled data, making them impractical for test-time scenarios. To this end, this paper explores calibration during test-time prompt tuning by leveraging the inherent properties of CLIP. Through a series of observations, we find that the prompt choice significantly affects the calibration in CLIP, where the prompts leading to higher text feature dispersion result in better-calibrated predictions. Introducing the Average Text Feature Dispersion (ATFD), we establish its relationship with calibration error and present a novel method, Calibrated Test-time Prompt Tuning (C-TPT), for optimizing prompts during test-time with enhanced calibration. Through extensive experiments on different CLIP architectures and datasets, we show that C-TPT can effectively improve the calibration of test-time prompt tuning without needing labeled data. The code is publicly accessible at https://github.com/hee-suk-yoon/C-TPT.","url_abs":"https://arxiv.org/abs/2403.14119v3","url_pdf":"https://arxiv.org/pdf/2403.14119v3.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":"c-tpt-calibrated-test-time-prompt-tuning-for","repo_url":"https://github.com/hee-suk-yoon/c-tpt","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"test-time-adaptation","task_name":"Test-time Adaptation"}],"methods":[{"method_slug":"clip","method_name":"CLIP"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2403.14119","atlas_url":"https://app.syntology.ai/?focus=2403.14119","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2403.14119"}},"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/hee-suk-yoon/C-TPT","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/hee-suk-yoon/c-tpt","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":2,"ran_fixture":1,"ran_draft_wrong":5,"unverified":2},"by_repo_kind":{"official":{"samples":10,"ran":8,"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":"45814cb7d8907ddb","entry":"ECE_Loss","repo":"hee-suk-yoon/C-TPT","repo_kind":"official","path":"tpt_classification.py","file_url":"https://github.com/hee-suk-yoon/C-TPT/blob/HEAD/tpt_classification.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":"45814cb7d8907ddb"}},{"code_sha256_prefix":"b0f936d4d6ae3b8c","entry":"accuracy","repo":"hee-suk-yoon/C-TPT","repo_kind":"official","path":"utils/tools.py","file_url":"https://github.com/hee-suk-yoon/C-TPT/blob/HEAD/utils/tools.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"b0f936d4d6ae3b8c"}},{"code_sha256_prefix":"441ae80dd4f616f3","entry":"avg_entropy","repo":"hee-suk-yoon/C-TPT","repo_kind":"official","path":"tpt_classification.py","file_url":"https://github.com/hee-suk-yoon/C-TPT/blob/HEAD/tpt_classification.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"441ae80dd4f616f3"}},{"code_sha256_prefix":"98f385d847636a3e","entry":"basic_clean","repo":"hee-suk-yoon/C-TPT","repo_kind":"official","path":"clip/simple_tokenizer.py","file_url":"https://github.com/hee-suk-yoon/C-TPT/blob/HEAD/clip/simple_tokenizer.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"98f385d847636a3e"}},{"code_sha256_prefix":"d919ae32e5e4e616","entry":"get_pairs","repo":"hee-suk-yoon/C-TPT","repo_kind":"official","path":"clip/simple_tokenizer.py","file_url":"https://github.com/hee-suk-yoon/C-TPT/blob/HEAD/clip/simple_tokenizer.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":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d919ae32e5e4e616"}},{"code_sha256_prefix":"3ce4d11e58de02ad","entry":"select_confident_samples","repo":"hee-suk-yoon/C-TPT","repo_kind":"official","path":"tpt_classification.py","file_url":"https://github.com/hee-suk-yoon/C-TPT/blob/HEAD/tpt_classification.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"3ce4d11e58de02ad"}},{"code_sha256_prefix":"1ca27622f8ca45e9","entry":"validate","repo":"hee-suk-yoon/C-TPT","repo_kind":"official","path":"utils/tools.py","file_url":"https://github.com/hee-suk-yoon/C-TPT/blob/HEAD/utils/tools.py","link_basis":"harvester_set","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":"1ca27622f8ca45e9"}},{"code_sha256_prefix":"9542161e9640b858","entry":"whitespace_clean","repo":"hee-suk-yoon/C-TPT","repo_kind":"official","path":"clip/simple_tokenizer.py","file_url":"https://github.com/hee-suk-yoon/C-TPT/blob/HEAD/clip/simple_tokenizer.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9542161e9640b858"}},{"code_sha256_prefix":"aa56b568a90f8516","entry":"build_model","repo":"hee-suk-yoon/C-TPT","repo_kind":"official","path":"clip/model.py","file_url":"https://github.com/hee-suk-yoon/C-TPT/blob/HEAD/clip/model.py","link_basis":"harvester_set","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":"aa56b568a90f8516"}},{"code_sha256_prefix":"88d0e8acec4aead0","entry":"load","repo":"hee-suk-yoon/C-TPT","repo_kind":"official","path":"clip/clip.py","file_url":"https://github.com/hee-suk-yoon/C-TPT/blob/HEAD/clip/clip.py","link_basis":"harvester_set","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":"88d0e8acec4aead0"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}