{"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/saeuron-interpretable-concept-unlearning-in","title":"SAeUron: Interpretable Concept Unlearning in Diffusion Models with Sparse Autoencoders","arxiv_id":"2501.18052","date":"2025-01-29","proceeding":null,"authors":["Bartosz Cywiński","Kamil Deja"],"abstract":"Diffusion models, while powerful, can inadvertently generate harmful or undesirable content, raising significant ethical and safety concerns. Recent machine unlearning approaches offer potential solutions but often lack transparency, making it difficult to understand the changes they introduce to the base model. In this work, we introduce SAeUron, a novel method leveraging features learned by sparse autoencoders (SAEs) to remove unwanted concepts in text-to-image diffusion models. First, we demonstrate that SAEs, trained in an unsupervised manner on activations from multiple denoising timesteps of the diffusion model, capture sparse and interpretable features corresponding to specific concepts. Building on this, we propose a feature selection method that enables precise interventions on model activations to block targeted content while preserving overall performance. Evaluation with the competitive UnlearnCanvas benchmark on object and style unlearning highlights SAeUron's state-of-the-art performance. Moreover, we show that with a single SAE, we can remove multiple concepts simultaneously and that in contrast to other methods, SAeUron mitigates the possibility of generating unwanted content, even under adversarial attack. Code and checkpoints are available at: https://github.com/cywinski/SAeUron.","url_abs":"https://arxiv.org/abs/2501.18052v2","url_pdf":"https://arxiv.org/pdf/2501.18052v2.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":"saeuron-interpretable-concept-unlearning-in","repo_url":"https://github.com/cywinski/saeuron","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"adversarial-attack","task_name":"Adversarial Attack"},{"task_slug":"denoising","task_name":"Denoising"},{"task_slug":"machine-unlearning","task_name":"Machine Unlearning"},{"task_slug":"feature-selection","task_name":"feature selection"}],"methods":[{"method_slug":"base","method_name":"BASE"},{"method_slug":"diffusion","method_name":"Diffusion"},{"method_slug":"feature-selection","method_name":"Feature Selection"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2501.18052","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2501.18052"}},"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/cywinski/saeuron","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"unverified":6},"by_repo_kind":{"official":{"samples":6,"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":"94434469ea2ebc0d","entry":"assert_type","repo":"cywinski/saeuron","repo_kind":"official","path":"SAE/utils.py","file_url":"https://github.com/cywinski/saeuron/blob/HEAD/SAE/utils.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":"94434469ea2ebc0d"}},{"code_sha256_prefix":"60a0e56b8b722db5","entry":"compute_feature_importance","repo":"cywinski/saeuron","repo_kind":"official","path":"SAE/unlearning_utils.py","file_url":"https://github.com/cywinski/saeuron/blob/HEAD/SAE/unlearning_utils.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":"60a0e56b8b722db5"}},{"code_sha256_prefix":"1fdd7b303ef76f9d","entry":"get_percentile_threshold","repo":"cywinski/saeuron","repo_kind":"official","path":"SAE/unlearning_utils.py","file_url":"https://github.com/cywinski/saeuron/blob/HEAD/SAE/unlearning_utils.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":"1fdd7b303ef76f9d"}},{"code_sha256_prefix":"4645950ce9c90012","entry":"randn_tensor","repo":"cywinski/saeuron","repo_kind":"official","path":"SAE/utils.py","file_url":"https://github.com/cywinski/saeuron/blob/HEAD/SAE/utils.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":"4645950ce9c90012"}},{"code_sha256_prefix":"f873ffebfd0749e6","entry":"retrieve","repo":"cywinski/saeuron","repo_kind":"official","path":"SAE/hooked_sd_noised_pipeline.py","file_url":"https://github.com/cywinski/saeuron/blob/HEAD/SAE/hooked_sd_noised_pipeline.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":"f873ffebfd0749e6"}},{"code_sha256_prefix":"77ce5b8dcbc5200c","entry":"retrieve_timesteps","repo":"cywinski/saeuron","repo_kind":"official","path":"SAE/utils.py","file_url":"https://github.com/cywinski/saeuron/blob/HEAD/SAE/utils.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":"77ce5b8dcbc5200c"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}