{"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/harmonizing-generalization-and","title":"Harmonizing Generalization and Personalization in Federated Prompt Learning","arxiv_id":"2405.09771","date":"2024-05-16","proceeding":null,"authors":["Tianyu Cui","Hongxia Li","Jingya Wang","Ye Shi"],"abstract":"Federated Prompt Learning (FPL) incorporates large pre-trained Vision-Language models (VLM) into federated learning through prompt tuning. The transferable representations and remarkable generalization capacity of VLM make them highly compatible with the integration of federated learning. Addressing data heterogeneity in federated learning requires personalization, but excessive focus on it across clients could compromise the model's ability to generalize effectively. To preserve the impressive generalization capability of VLM, it is crucial to strike a balance between personalization and generalization in FPL. To tackle this challenge, we proposed Federated Prompt Learning with CLIP Generalization and low-rank Personalization (FedPGP), which employs pre-trained CLIP to provide knowledge-guidance on the global prompt for improved generalization and incorporates a low-rank adaptation term to personalize the global prompt. Further, FedPGP integrates a prompt-wise contrastive loss to achieve knowledge guidance and personalized adaptation simultaneously, enabling a harmonious balance between personalization and generalization in FPL. We conduct extensive experiments on various datasets to explore base-to-novel generalization in both category-level and domain-level scenarios with heterogeneous data, showing the superiority of FedPGP in balancing generalization and personalization.","url_abs":"https://arxiv.org/abs/2405.09771v2","url_pdf":"https://arxiv.org/pdf/2405.09771v2.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":"harmonizing-generalization-and","repo_url":"https://github.com/tianyucuiovo/fedpgp","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"federated-learning","task_name":"Federated Learning"},{"task_slug":"prompt-learning","task_name":"Prompt Learning"}],"methods":[{"method_slug":"clip","method_name":"CLIP"},{"method_slug":"focus","method_name":"Focus"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2405.09771","atlas_url":"https://app.syntology.ai/?focus=2405.09771","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2405.09771"}},"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/tianyucuiovo/fedpgp","reach":{"status":"ok"}}],"summary":{"ran_draft_wrong":4,"unverified":10},"by_repo_kind":{"official":{"samples":14,"ran":4,"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":14,"samples":[{"code_sha256_prefix":"ab2485d028020739","entry":"average_weights","repo":"tianyucuiovo/fedpgp","repo_kind":"official","path":"utils.py","file_url":"https://github.com/tianyucuiovo/fedpgp/blob/HEAD/utils.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ab2485d028020739"}},{"code_sha256_prefix":"98f385d847636a3e","entry":"basic_clean","repo":"tianyucuiovo/fedpgp","repo_kind":"official","path":"clip/simple_tokenizer.py","file_url":"https://github.com/tianyucuiovo/fedpgp/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":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"98f385d847636a3e"}},{"code_sha256_prefix":"d919ae32e5e4e616","entry":"get_pairs","repo":"tianyucuiovo/fedpgp","repo_kind":"official","path":"clip/simple_tokenizer.py","file_url":"https://github.com/tianyucuiovo/fedpgp/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":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d919ae32e5e4e616"}},{"code_sha256_prefix":"9542161e9640b858","entry":"whitespace_clean","repo":"tianyucuiovo/fedpgp","repo_kind":"official","path":"clip/simple_tokenizer.py","file_url":"https://github.com/tianyucuiovo/fedpgp/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":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"9542161e9640b858"}},{"code_sha256_prefix":"697e29e1bbc08d3d","entry":"average_weights","repo":"tianyucuiovo/fedpgp","repo_kind":"official","path":"fed_utils.py","file_url":"https://github.com/tianyucuiovo/fedpgp/blob/HEAD/fed_utils.py","link_basis":"harvester_set","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":"697e29e1bbc08d3d"}},{"code_sha256_prefix":"83bfcd868a539277","entry":"build_model","repo":"tianyucuiovo/fedpgp","repo_kind":"official","path":"clip/model.py","file_url":"https://github.com/tianyucuiovo/fedpgp/blob/HEAD/clip/model.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":"83bfcd868a539277"}},{"code_sha256_prefix":"a064a0985b120c40","entry":"cluster_weights","repo":"tianyucuiovo/fedpgp","repo_kind":"official","path":"fed_utils.py","file_url":"https://github.com/tianyucuiovo/fedpgp/blob/HEAD/fed_utils.py","link_basis":"harvester_set","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":"a064a0985b120c40"}},{"code_sha256_prefix":"0791530eb1d82a07","entry":"cosine_match_weights","repo":"tianyucuiovo/fedpgp","repo_kind":"official","path":"fed_utils.py","file_url":"https://github.com/tianyucuiovo/fedpgp/blob/HEAD/fed_utils.py","link_basis":"harvester_set","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":"0791530eb1d82a07"}},{"code_sha256_prefix":"fbf8c0143d9c48e3","entry":"load","repo":"tianyucuiovo/fedpgp","repo_kind":"official","path":"clip/clip.py","file_url":"https://github.com/tianyucuiovo/fedpgp/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":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"fbf8c0143d9c48e3"}},{"code_sha256_prefix":"bed6b7031114cf91","entry":"prepare_data_domainNet","repo":"tianyucuiovo/fedpgp","repo_kind":"official","path":"data_utils.py","file_url":"https://github.com/tianyucuiovo/fedpgp/blob/HEAD/data_utils.py","link_basis":"harvester_set","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":"bed6b7031114cf91"}},{"code_sha256_prefix":"c4ffa511340e3179","entry":"prepare_data_domainNet_partition_client_train","repo":"tianyucuiovo/fedpgp","repo_kind":"official","path":"data_utils.py","file_url":"https://github.com/tianyucuiovo/fedpgp/blob/HEAD/data_utils.py","link_basis":"harvester_set","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":"c4ffa511340e3179"}},{"code_sha256_prefix":"235669fb66eef25a","entry":"prepare_data_domainNet_partition_train","repo":"tianyucuiovo/fedpgp","repo_kind":"official","path":"data_utils.py","file_url":"https://github.com/tianyucuiovo/fedpgp/blob/HEAD/data_utils.py","link_basis":"harvester_set","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":"235669fb66eef25a"}},{"code_sha256_prefix":"49d5e536fa27cddc","entry":"record_net_data_stats","repo":"tianyucuiovo/fedpgp","repo_kind":"official","path":"datasplit.py","file_url":"https://github.com/tianyucuiovo/fedpgp/blob/HEAD/datasplit.py","link_basis":"harvester_set","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":"49d5e536fa27cddc"}},{"code_sha256_prefix":"03564ffca35b29ce","entry":"renormalize","repo":"tianyucuiovo/fedpgp","repo_kind":"official","path":"datasplit.py","file_url":"https://github.com/tianyucuiovo/fedpgp/blob/HEAD/datasplit.py","link_basis":"harvester_set","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":"03564ffca35b29ce"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}