{"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/representation-surgery-for-multi-task-model","title":"Representation Surgery for Multi-Task Model Merging","arxiv_id":"2402.02705","date":"2024-02-05","proceeding":null,"authors":["Enneng Yang","Li Shen","Zhenyi Wang","Guibing Guo","Xiaojun Chen","Xingwei Wang","DaCheng Tao"],"abstract":"Multi-task learning (MTL) compresses the information from multiple tasks into a unified backbone to improve computational efficiency and generalization. Recent work directly merges multiple independently trained models to perform MTL instead of collecting their raw data for joint training, greatly expanding the application scenarios of MTL. However, by visualizing the representation distribution of existing model merging schemes, we find that the merged model often suffers from the dilemma of representation bias. That is, there is a significant discrepancy in the representation distribution between the merged and individual models, resulting in poor performance of merged MTL. In this paper, we propose a representation surgery solution called \"Surgery\" to reduce representation bias in the merged model. Specifically, Surgery is a lightweight task-specific module that takes the representation of the merged model as input and attempts to output the biases contained in the representation from the merged model. We then designed an unsupervised optimization objective that updates the Surgery module by minimizing the distance between the merged model's representation and the individual model's representation. Extensive experiments demonstrate significant MTL performance improvements when our Surgery module is applied to state-of-the-art (SOTA) model merging schemes.","url_abs":"https://arxiv.org/abs/2402.02705v2","url_pdf":"https://arxiv.org/pdf/2402.02705v2.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":"representation-surgery-for-multi-task-model","repo_url":"https://github.com/ennengyang/representationsurgery","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"representation-surgery-for-multi-task-model","repo_url":"https://github.com/ennengyang/surgeryv2","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}},{"paper_slug":"representation-surgery-for-multi-task-model","repo_url":"https://github.com/fskong/FT-Classifier-for-Model-Merging","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"computational-efficiency","task_name":"Computational Efficiency"},{"task_slug":"multi-task-learning","task_name":"Multi-Task Learning"},{"task_slug":"model","task_name":"model"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2402.02705","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2402.02705"}},"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/fskong/FT-Classifier-for-Model-Merging","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/ennengyang/representationsurgery","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/ennengyang/surgeryv2","reach":{"status":"ok"}}],"summary":{"ran":3,"ran_draft_wrong":1,"unverified":1},"by_repo_kind":{"official":{"samples":3,"ran":3,"repositories":1},"listed":{"samples":1,"ran":1,"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":2,"samples":[{"code_sha256_prefix":"aeed07d009914ad2","entry":"TaskVector","repo":"fskong/FT-Classifier-for-Model-Merging","repo_kind":"listed","path":"task_vectors.py","file_url":"https://github.com/fskong/FT-Classifier-for-Model-Merging/blob/HEAD/task_vectors.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":"aeed07d009914ad2"}},{"code_sha256_prefix":"7d3451f3e4348847","entry":"get_merging_cofficients","repo":"ennengyang/representationsurgery","repo_kind":"official","path":"src/merging_cofficient.py","file_url":"https://github.com/ennengyang/representationsurgery/blob/HEAD/src/merging_cofficient.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":"7d3451f3e4348847"}},{"code_sha256_prefix":"8adbe30621fbeb18","entry":"make_functional","repo":"ennengyang/representationsurgery","repo_kind":"official","path":"src/merging_model.py","file_url":"https://github.com/ennengyang/representationsurgery/blob/HEAD/src/merging_model.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":"8adbe30621fbeb18"}},{"code_sha256_prefix":"0c501eba6aaad5fa","entry":"softmax_entropy","repo":"ennengyang/representationsurgery","repo_kind":"official","path":"src/merging_model.py","file_url":"https://github.com/ennengyang/representationsurgery/blob/HEAD/src/merging_model.py","link_basis":"harvester_set","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":"0c501eba6aaad5fa"}},{"code_sha256_prefix":"539d129135c1c4c8","entry":"ModelWrapper_Surgery_V2","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"539d129135c1c4c8"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}