{"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/imma-immunizing-text-to-image-models-against","title":"IMMA: Immunizing text-to-image Models against Malicious Adaptation","arxiv_id":"2311.18815","date":"2023-11-30","proceeding":null,"authors":["Amber Yijia Zheng","Raymond A. Yeh"],"abstract":"Advancements in open-sourced text-to-image models and fine-tuning methods have led to the increasing risk of malicious adaptation, i.e., fine-tuning to generate harmful/unauthorized content. Recent works, e.g., Glaze or MIST, have developed data-poisoning techniques which protect the data against adaptation methods. In this work, we consider an alternative paradigm for protection. We propose to ``immunize'' the model by learning model parameters that are difficult for the adaptation methods when fine-tuning malicious content; in short IMMA. Specifically, IMMA should be applied before the release of the model weights to mitigate these risks. Empirical results show IMMA's effectiveness against malicious adaptations, including mimicking the artistic style and learning of inappropriate/unauthorized content, over three adaptation methods: LoRA, Textual-Inversion, and DreamBooth. The code is available at \\url{https://github.com/amberyzheng/IMMA}.","url_abs":"https://arxiv.org/abs/2311.18815v3","url_pdf":"https://arxiv.org/pdf/2311.18815v3.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":"imma-immunizing-text-to-image-models-against","repo_url":"https://github.com/amberyzheng/imma","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"imma-immunizing-text-to-image-models-against","repo_url":"https://github.com/zhengyjzoe/imma","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}},{"paper_slug":"imma-immunizing-text-to-image-models-against","repo_url":"https://github.com/MindCode-4/code-14/tree/main/IMM","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"mindspore","reach":null}],"tasks":[{"task_slug":"data-poisoning","task_name":"Data Poisoning"},{"task_slug":"tag","task_name":"TAG"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2311.18815","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2311.18815"}},"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/amberyzheng/imma","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/zhengyjzoe/imma","reach":{"status":"ok","spdx":"Apache-2.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/MindCode-4/code-14/tree/main/IMM","reach":null}],"summary":{"ran_draft_wrong":1,"unverified":16},"by_repo_kind":{"official":{"samples":7,"ran":1,"repositories":2},"listed":{"samples":10,"ran":0,"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":"256040ccde7473f2","entry":"collate_fn","repo":"zhengyjzoe/imma","repo_kind":"official","path":"train/defend_dreambooth_lora.py","file_url":"https://github.com/zhengyjzoe/imma/blob/HEAD/train/defend_dreambooth_lora.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":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"256040ccde7473f2"}},{"code_sha256_prefix":"690566e1b97cef9c","entry":"Getdcg","repo":"MindCode-4/code-14","repo_kind":"listed","path":"DiffNet++/Metrics.py","file_url":"https://github.com/MindCode-4/code-14/blob/HEAD/DiffNet%2B%2B/Metrics.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"690566e1b97cef9c"}},{"code_sha256_prefix":"084eae410e04a51d","entry":"Getidcg","repo":"MindCode-4/code-14","repo_kind":"listed","path":"DiffNet++/Metrics.py","file_url":"https://github.com/MindCode-4/code-14/blob/HEAD/DiffNet%2B%2B/Metrics.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"084eae410e04a51d"}},{"code_sha256_prefix":"9c1fd5d9c8bc4f4e","entry":"compute_acc","repo":"zhengyjzoe/imma","repo_kind":"official","path":"eval/imgnet_cls.py","file_url":"https://github.com/zhengyjzoe/imma/blob/HEAD/eval/imgnet_cls.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"9c1fd5d9c8bc4f4e"}},{"code_sha256_prefix":"72814d7de33e5aef","entry":"decode","repo":"MindCode-4/code-14","repo_kind":"listed","path":"AECRNet/data.py","file_url":"https://github.com/MindCode-4/code-14/blob/HEAD/AECRNet/data.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"72814d7de33e5aef"}},{"code_sha256_prefix":"cd833e611f7a9e4e","entry":"get_eval_data_from_source","repo":"MindCode-4/code-14","repo_kind":"listed","path":"DiffNet++/datahelper.py","file_url":"https://github.com/MindCode-4/code-14/blob/HEAD/DiffNet%2B%2B/datahelper.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"cd833e611f7a9e4e"}},{"code_sha256_prefix":"e82646a1b0adaae5","entry":"get_val_data_from_source","repo":"MindCode-4/code-14","repo_kind":"listed","path":"DiffNet++/datahelper.py","file_url":"https://github.com/MindCode-4/code-14/blob/HEAD/DiffNet%2B%2B/datahelper.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"e82646a1b0adaae5"}},{"code_sha256_prefix":"0eb3e94e8635150e","entry":"import_model_class_from_model_name_or_path","repo":"zhengyjzoe/imma","repo_kind":"official","path":"train/defend_dreambooth.py","file_url":"https://github.com/zhengyjzoe/imma/blob/HEAD/train/defend_dreambooth.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"0eb3e94e8635150e"}},{"code_sha256_prefix":"e7901acf683fac85","entry":"load_data","repo":"MindCode-4/code-14","repo_kind":"listed","path":"DiffNet++/datahelper.py","file_url":"https://github.com/MindCode-4/code-14/blob/HEAD/DiffNet%2B%2B/datahelper.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"e7901acf683fac85"}},{"code_sha256_prefix":"191312b83f4e21ea","entry":"load_data","repo":"MindCode-4/code-14","repo_kind":"listed","path":"DiffNet++/dataset.py","file_url":"https://github.com/MindCode-4/code-14/blob/HEAD/DiffNet%2B%2B/dataset.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"191312b83f4e21ea"}},{"code_sha256_prefix":"ea40ca66b8b3349e","entry":"load_variavle","repo":"MindCode-4/code-14","repo_kind":"listed","path":"Alexnet-ABeffect/feature_predict_abm.py","file_url":"https://github.com/MindCode-4/code-14/blob/HEAD/Alexnet-ABeffect/feature_predict_abm.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"ea40ca66b8b3349e"}},{"code_sha256_prefix":"71a0f97a99f2dca6","entry":"parse_args","repo":"amberyzheng/imma","repo_kind":"official","path":"train/defend_dreambooth.py","file_url":"https://github.com/amberyzheng/imma/blob/HEAD/train/defend_dreambooth.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"71a0f97a99f2dca6"}},{"code_sha256_prefix":"406be0a733f187e9","entry":"parse_args","repo":"zhengyjzoe/imma","repo_kind":"official","path":"train/defend_dreambooth_lora.py","file_url":"https://github.com/zhengyjzoe/imma/blob/HEAD/train/defend_dreambooth_lora.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"406be0a733f187e9"}},{"code_sha256_prefix":"1a4e15d300f9ff4e","entry":"parse_args","repo":"zhengyjzoe/imma","repo_kind":"official","path":"train/train_dreambooth.py","file_url":"https://github.com/zhengyjzoe/imma/blob/HEAD/train/train_dreambooth.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"1a4e15d300f9ff4e"}},{"code_sha256_prefix":"ecc1b168c8cc280f","entry":"parse_args","repo":"zhengyjzoe/imma","repo_kind":"official","path":"train/train_dreambooth_lora.py","file_url":"https://github.com/zhengyjzoe/imma/blob/HEAD/train/train_dreambooth_lora.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"ecc1b168c8cc280f"}},{"code_sha256_prefix":"f34618312c4fa9c9","entry":"save_variable","repo":"MindCode-4/code-14","repo_kind":"listed","path":"Alexnet-ABeffect/feature_predict_abm.py","file_url":"https://github.com/MindCode-4/code-14/blob/HEAD/Alexnet-ABeffect/feature_predict_abm.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"f34618312c4fa9c9"}},{"code_sha256_prefix":"14c181fabe865cbf","entry":"set_random_seed","repo":"MindCode-4/code-14","repo_kind":"listed","path":"AECRNet/data.py","file_url":"https://github.com/MindCode-4/code-14/blob/HEAD/AECRNet/data.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"14c181fabe865cbf"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}