{"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/hydra-model-factorization-framework-for-black","title":"HYDRA: Model Factorization Framework for Black-Box LLM Personalization","arxiv_id":"2406.02888","date":"2024-06-05","proceeding":null,"authors":["Yuchen Zhuang","Haotian Sun","Yue Yu","Rushi Qiang","Qifan Wang","Chao Zhang","Bo Dai"],"abstract":"Personalization has emerged as a critical research area in modern intelligent systems, focusing on mining users' behavioral history and adapting to their preferences for delivering tailored experiences. Despite the remarkable few-shot capabilities exhibited by black-box large language models (LLMs), the inherent opacity of their model parameters presents significant challenges in aligning the generated output with individual expectations. Existing solutions have primarily focused on prompt design to incorporate user-specific profiles and behaviors; however, such approaches often struggle to generalize effectively due to their inability to capture shared knowledge among all users. To address these challenges, we propose HYDRA, a model factorization framework that captures both user-specific behavior patterns from historical data and shared general knowledge among all users to deliver personalized generation. In order to capture user-specific behavior patterns, we first train a reranker to prioritize the most useful information from top-retrieved relevant historical records. By combining the prioritized history with the corresponding query, we train an adapter to align the output with individual user-specific preferences, eliminating the reliance on access to inherent model parameters of black-box LLMs. Both the reranker and the adapter can be decomposed into a base model with multiple user-specific heads, resembling a hydra. The base model maintains shared knowledge across users, while the multiple personal heads capture user-specific preferences. Experimental results demonstrate that HYDRA outperforms existing state-of-the-art prompt-based methods by an average relative improvement of 9.01% across five diverse personalization tasks in the LaMP benchmark. Our implementation is available at https://github.com/night-chen/HYDRA.","url_abs":"https://arxiv.org/abs/2406.02888v3","url_pdf":"https://arxiv.org/pdf/2406.02888v3.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":"hydra-model-factorization-framework-for-black","repo_url":"https://github.com/night-chen/hydra","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"general-knowledge","task_name":"General Knowledge"}],"methods":[{"method_slug":"align","method_name":"ALIGN"},{"method_slug":"adapter","method_name":"Adapter"},{"method_slug":"base","method_name":"BASE"},{"method_slug":"hydra","method_name":"Hydra"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2406.02888","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2406.02888"}},"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":"deterministic:regex_extraction","url":"https://github.com/night-chen/HYDRA","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/night-chen/hydra","reach":{"status":"ok"}}],"summary":{"ran":10,"ran_draft_wrong":6},"by_repo_kind":{"official":{"samples":16,"ran":16,"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":16,"samples":[{"code_sha256_prefix":"da25fbe823b3c54e","entry":"LongformerForPersonalizedCls","repo":"night-chen/hydra","repo_kind":"official","path":"adapter/trainer/personalized_trainer.py","file_url":"https://github.com/night-chen/hydra/blob/HEAD/adapter/trainer/personalized_trainer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"da25fbe823b3c54e"}},{"code_sha256_prefix":"2b0e9e1de87f7100","entry":"LongformerPersonalizedClsHead","repo":"night-chen/hydra","repo_kind":"official","path":"adapter/trainer/personalized_trainer.py","file_url":"https://github.com/night-chen/hydra/blob/HEAD/adapter/trainer/personalized_trainer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2b0e9e1de87f7100"}},{"code_sha256_prefix":"8da550fed680318d","entry":"LongformerSequenceClassifierOutput","repo":"night-chen/hydra","repo_kind":"official","path":"adapter/trainer/personalized_trainer.py","file_url":"https://github.com/night-chen/hydra/blob/HEAD/adapter/trainer/personalized_trainer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8da550fed680318d"}},{"code_sha256_prefix":"78978cd98b44b675","entry":"api_key_list","repo":"night-chen/HYDRA","repo_kind":"official","path":"utils/credentials.py","file_url":"https://github.com/night-chen/HYDRA/blob/HEAD/utils/credentials.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"78978cd98b44b675"}},{"code_sha256_prefix":"3c022e0b56a5b9aa","entry":"extract_after_article","repo":"night-chen/HYDRA","repo_kind":"official","path":"prompts/utils.py","file_url":"https://github.com/night-chen/HYDRA/blob/HEAD/prompts/utils.py","link_basis":"plan_row","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":"3c022e0b56a5b9aa"}},{"code_sha256_prefix":"490005de8edac2a7","entry":"extract_after_description","repo":"night-chen/HYDRA","repo_kind":"official","path":"prompts/utils.py","file_url":"https://github.com/night-chen/HYDRA/blob/HEAD/prompts/utils.py","link_basis":"plan_row","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":"490005de8edac2a7"}},{"code_sha256_prefix":"128a6ca41173c482","entry":"extract_numbers","repo":"night-chen/HYDRA","repo_kind":"official","path":"metrics/classification_metrics.py","file_url":"https://github.com/night-chen/HYDRA/blob/HEAD/metrics/classification_metrics.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"128a6ca41173c482"}},{"code_sha256_prefix":"f11dc768dc0cbefb","entry":"extract_strings_between_quotes","repo":"night-chen/HYDRA","repo_kind":"official","path":"prompts/utils.py","file_url":"https://github.com/night-chen/HYDRA/blob/HEAD/prompts/utils.py","link_basis":"plan_row","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":"f11dc768dc0cbefb"}},{"code_sha256_prefix":"4b094583baf62f2f","entry":"get_data","repo":"night-chen/HYDRA","repo_kind":"official","path":"utils/util.py","file_url":"https://github.com/night-chen/HYDRA/blob/HEAD/utils/util.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"4b094583baf62f2f"}},{"code_sha256_prefix":"1a267a44dd55b79b","entry":"get_personalize_data","repo":"night-chen/HYDRA","repo_kind":"official","path":"utils/util.py","file_url":"https://github.com/night-chen/HYDRA/blob/HEAD/utils/util.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"1a267a44dd55b79b"}},{"code_sha256_prefix":"159282975f5b3801","entry":"load_config","repo":"night-chen/HYDRA","repo_kind":"official","path":"utils/util.py","file_url":"https://github.com/night-chen/HYDRA/blob/HEAD/utils/util.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"159282975f5b3801"}},{"code_sha256_prefix":"fe0e2df4d9cb5edd","entry":"mean_pooling","repo":"night-chen/HYDRA","repo_kind":"official","path":"prompts/contriever_retriever.py","file_url":"https://github.com/night-chen/HYDRA/blob/HEAD/prompts/contriever_retriever.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"fe0e2df4d9cb5edd"}},{"code_sha256_prefix":"8b51adb8a6c014e5","entry":"postprocess_text","repo":"night-chen/HYDRA","repo_kind":"official","path":"metrics/generation_metrics.py","file_url":"https://github.com/night-chen/HYDRA/blob/HEAD/metrics/generation_metrics.py","link_basis":"plan_row","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":"8b51adb8a6c014e5"}},{"code_sha256_prefix":"33df4a8be7151fcc","entry":"postprocess_text_cls","repo":"night-chen/HYDRA","repo_kind":"official","path":"metrics/classification_metrics.py","file_url":"https://github.com/night-chen/HYDRA/blob/HEAD/metrics/classification_metrics.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"33df4a8be7151fcc"}},{"code_sha256_prefix":"21eed1ab0d4f98f7","entry":"postprocess_text_reg","repo":"night-chen/HYDRA","repo_kind":"official","path":"metrics/classification_metrics.py","file_url":"https://github.com/night-chen/HYDRA/blob/HEAD/metrics/classification_metrics.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"21eed1ab0d4f98f7"}},{"code_sha256_prefix":"a5c4afa103aa6d76","entry":"prepare_prompts","repo":"night-chen/HYDRA","repo_kind":"official","path":"adapter/generate/generate.py","file_url":"https://github.com/night-chen/HYDRA/blob/HEAD/adapter/generate/generate.py","link_basis":"plan_row","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":"a5c4afa103aa6d76"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}