{"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/large-language-models-are-good-prompt","title":"Large Language Models are Good Prompt Learners for Low-Shot Image Classification","arxiv_id":"2312.04076","date":"2023-12-07","proceeding":"CVPR 2024 1","authors":["Zhaoheng Zheng","Jingmin Wei","Xuefeng Hu","Haidong Zhu","Ram Nevatia"],"abstract":"Low-shot image classification, where training images are limited or inaccessible, has benefited from recent progress on pre-trained vision-language (VL) models with strong generalizability, e.g. CLIP. Prompt learning methods built with VL models generate text features from the class names that only have confined class-specific information. Large Language Models (LLMs), with their vast encyclopedic knowledge, emerge as the complement. Thus, in this paper, we discuss the integration of LLMs to enhance pre-trained VL models, specifically on low-shot classification. However, the domain gap between language and vision blocks the direct application of LLMs. Thus, we propose LLaMP, Large Language Models as Prompt learners, that produces adaptive prompts for the CLIP text encoder, establishing it as the connecting bridge. Experiments show that, compared with other state-of-the-art prompt learning methods, LLaMP yields better performance on both zero-shot generalization and few-shot image classification, over a spectrum of 11 datasets. Code will be made available at: https://github.com/zhaohengz/LLaMP.","url_abs":"https://arxiv.org/abs/2312.04076v2","url_pdf":"https://arxiv.org/pdf/2312.04076v2.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":"large-language-models-are-good-prompt","repo_url":"https://github.com/zhaohengz/llamp","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"classification-1","task_name":"Classification"},{"task_slug":"few-shot-image-classification","task_name":"Few-Shot Image Classification"},{"task_slug":"image-classification","task_name":"Image Classification"},{"task_slug":"prompt-learning","task_name":"Prompt Learning"},{"task_slug":"zero-shot-generalization","task_name":"Zero-shot Generalization"},{"task_slug":"image-classification","task_name":"image-classification"}],"methods":[{"method_slug":"clip","method_name":"CLIP"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2312.04076","atlas_url":"https://app.syntology.ai/?focus=2312.04076","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2312.04076"}},"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":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/zhaohengz/llamp","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran":5,"ran_fixture":1,"ran_draft_wrong":1,"unverified":2},"by_repo_kind":{"official":{"samples":9,"ran":7,"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":"69e2a5fdc6cac875","entry":"build_optimizer_parameters","repo":"zhaohengz/llamp","repo_kind":"official","path":"train_llamp.py","file_url":"https://github.com/zhaohengz/llamp/blob/HEAD/train_llamp.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":"69e2a5fdc6cac875"}},{"code_sha256_prefix":"e1f2aca5ffc5a9b3","entry":"calculate_margines","repo":"zhaohengz/llamp","repo_kind":"official","path":"models/common.py","file_url":"https://github.com/zhaohengz/llamp/blob/HEAD/models/common.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":"e1f2aca5ffc5a9b3"}},{"code_sha256_prefix":"aa81d03f07735ab8","entry":"compute_acc","repo":"zhaohengz/llamp","repo_kind":"official","path":"utils/utils.py","file_url":"https://github.com/zhaohengz/llamp/blob/HEAD/utils/utils.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"aa81d03f07735ab8"}},{"code_sha256_prefix":"ad12a494674d23fb","entry":"compute_n_params","repo":"zhaohengz/llamp","repo_kind":"official","path":"utils/utils.py","file_url":"https://github.com/zhaohengz/llamp/blob/HEAD/utils/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":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"ad12a494674d23fb"}},{"code_sha256_prefix":"d7a1b72fcd850451","entry":"get_cosine_schedule_lambda_with_warmup","repo":"zhaohengz/llamp","repo_kind":"official","path":"train_llamp.py","file_url":"https://github.com/zhaohengz/llamp/blob/HEAD/train_llamp.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":"d7a1b72fcd850451"}},{"code_sha256_prefix":"943413eae000b356","entry":"get_norm_values","repo":"zhaohengz/llamp","repo_kind":"official","path":"utils/utils.py","file_url":"https://github.com/zhaohengz/llamp/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":"943413eae000b356"}},{"code_sha256_prefix":"59725ffc3ce58459","entry":"same_domain_triplet_loss","repo":"zhaohengz/llamp","repo_kind":"official","path":"models/common.py","file_url":"https://github.com/zhaohengz/llamp/blob/HEAD/models/common.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":"59725ffc3ce58459"}},{"code_sha256_prefix":"f0dc6096293370b9","entry":"get_cosine_schedule_with_warmup","repo":"zhaohengz/llamp","repo_kind":"official","path":"train_llamp.py","file_url":"https://github.com/zhaohengz/llamp/blob/HEAD/train_llamp.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":"f0dc6096293370b9"}},{"code_sha256_prefix":"2a1c66c4d01008db","entry":"l2_all_batched","repo":"zhaohengz/llamp","repo_kind":"official","path":"models/common.py","file_url":"https://github.com/zhaohengz/llamp/blob/HEAD/models/common.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":"2a1c66c4d01008db"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}