{"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/erasediff-erasing-data-influence-in-diffusion","title":"Erasing Undesirable Influence in Diffusion Models","arxiv_id":"2401.05779","date":"2024-01-11","proceeding":"CVPR 2025 1","authors":["Jing Wu","Trung Le","Munawar Hayat","Mehrtash Harandi"],"abstract":"Diffusion models are highly effective at generating high-quality images but pose risks, such as the unintentional generation of NSFW (not safe for work) content. Although various techniques have been proposed to mitigate unwanted influences in diffusion models while preserving overall performance, achieving a balance between these goals remains challenging. In this work, we introduce EraseDiff, an algorithm designed to preserve the utility of the diffusion model on retained data while removing the unwanted information associated with the data to be forgotten. Our approach formulates this task as a constrained optimization problem using the value function, resulting in a natural first-order algorithm for solving the optimization problem. By altering the generative process to deviate away from the ground-truth denoising trajectory, we update parameters for preservation while controlling constraint reduction to ensure effective erasure, striking an optimal trade-off. Extensive experiments and thorough comparisons with state-of-the-art algorithms demonstrate that EraseDiff effectively preserves the model's utility, efficacy, and efficiency.","url_abs":"https://arxiv.org/abs/2401.05779v4","url_pdf":"https://arxiv.org/pdf/2401.05779v4.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":"erasediff-erasing-data-influence-in-diffusion","repo_url":"https://github.com/jingwu321/erasediff","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"denoising","task_name":"Denoising"},{"task_slug":"image-generation","task_name":"Image Generation"},{"task_slug":"memorization","task_name":"Memorization"},{"task_slug":"unconditional-image-generation","task_name":"Unconditional Image Generation"}],"methods":[{"method_slug":"diffusion","method_name":"Diffusion"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2401.05779","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2401.05779"}},"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/jingwu321/erasediff","reach":{"status":"ok"}}],"summary":{"ran":6,"ran_fixture":3,"ran_draft_wrong":2,"unverified":1},"by_repo_kind":{"official":{"samples":11,"ran":10,"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":12,"samples":[{"code_sha256_prefix":"29136f2953d790e8","entry":"GetImageFolderLoader","repo":"jingwu321/erasediff","repo_kind":"official","path":"ddpm/classifier_evaluation.py","file_url":"https://github.com/jingwu321/erasediff/blob/HEAD/ddpm/classifier_evaluation.py","link_basis":"harvester_set","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":"29136f2953d790e8"}},{"code_sha256_prefix":"2ccf562d07794d65","entry":"get_param","repo":"jingwu321/erasediff","repo_kind":"official","path":"sd/train_scripts/erasediff.py","file_url":"https://github.com/jingwu321/erasediff/blob/HEAD/sd/train_scripts/erasediff.py","link_basis":"harvester_set","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":"2ccf562d07794d65"}},{"code_sha256_prefix":"cb49209c125de1b4","entry":"get_timestep_embedding","repo":"jingwu321/erasediff","repo_kind":"official","path":"ddpm/models/diffusion.py","file_url":"https://github.com/jingwu321/erasediff/blob/HEAD/ddpm/models/diffusion.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"cb49209c125de1b4"}},{"code_sha256_prefix":"f398bc270e4f4ffe","entry":"moving_average","repo":"jingwu321/erasediff","repo_kind":"official","path":"sd/train_scripts/erasediff.py","file_url":"https://github.com/jingwu321/erasediff/blob/HEAD/sd/train_scripts/erasediff.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":"f398bc270e4f4ffe"}},{"code_sha256_prefix":"36a45cceb1209d2f","entry":"noise_estimation_loss","repo":"jingwu321/erasediff","repo_kind":"official","path":"ddpm/functions/losses.py","file_url":"https://github.com/jingwu321/erasediff/blob/HEAD/ddpm/functions/losses.py","link_basis":"harvester_set","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":"36a45cceb1209d2f"}},{"code_sha256_prefix":"ca8a1bf21579d253","entry":"noise_estimation_loss_conditional","repo":"jingwu321/erasediff","repo_kind":"official","path":"ddpm/functions/losses.py","file_url":"https://github.com/jingwu321/erasediff/blob/HEAD/ddpm/functions/losses.py","link_basis":"harvester_set","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":"ca8a1bf21579d253"}},{"code_sha256_prefix":"3137073275f8c21a","entry":"nonlinearity","repo":"jingwu321/erasediff","repo_kind":"official","path":"ddpm/models/diffusion.py","file_url":"https://github.com/jingwu321/erasediff/blob/HEAD/ddpm/models/diffusion.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":"3137073275f8c21a"}},{"code_sha256_prefix":"3c6433dd421724e0","entry":"prob_mask_like","repo":"jingwu321/erasediff","repo_kind":"official","path":"ddpm/models/diffusion.py","file_url":"https://github.com/jingwu321/erasediff/blob/HEAD/ddpm/models/diffusion.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"3c6433dd421724e0"}},{"code_sha256_prefix":"0bae0d076b1ae674","entry":"read_images_folder","repo":"jingwu321/erasediff","repo_kind":"official","path":"ddpm/evaluator.py","file_url":"https://github.com/jingwu321/erasediff/blob/HEAD/ddpm/evaluator.py","link_basis":"harvester_set","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":"0bae0d076b1ae674"}},{"code_sha256_prefix":"15e005b12a64650d","entry":"sample_model","repo":null,"repo_kind":null,"path":null,"file_url":null,"link_basis":"identical_code_first_harvested_elsewhere","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":null,"inline_ok":false,"mcp_get_code":{"code_sha256":"15e005b12a64650d"}},{"code_sha256_prefix":"8168d4d8419b92c3","entry":"set_param","repo":"jingwu321/erasediff","repo_kind":"official","path":"sd/train_scripts/erasediff.py","file_url":"https://github.com/jingwu321/erasediff/blob/HEAD/sd/train_scripts/erasediff.py","link_basis":"harvester_set","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":"8168d4d8419b92c3"}},{"code_sha256_prefix":"d278a27b738c2136","entry":"all_but_one_class_dataset","repo":"jingwu321/erasediff","repo_kind":"official","path":"ddpm/save_base_dataset.py","file_url":"https://github.com/jingwu321/erasediff/blob/HEAD/ddpm/save_base_dataset.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":"d278a27b738c2136"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}