{"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/on-memorization-in-diffusion-models","title":"On Memorization in Diffusion Models","arxiv_id":"2310.02664","date":"2023-10-04","proceeding":null,"authors":["Xiangming Gu","Chao Du","Tianyu Pang","Chongxuan Li","Min Lin","Ye Wang"],"abstract":"Due to their capacity to generate novel and high-quality samples, diffusion models have attracted significant research interest in recent years. Notably, the typical training objective of diffusion models, i.e., denoising score matching, has a closed-form optimal solution that can only generate training data replicating samples. This indicates that a memorization behavior is theoretically expected, which contradicts the common generalization ability of state-of-the-art diffusion models, and thus calls for a deeper understanding. Looking into this, we first observe that memorization behaviors tend to occur on smaller-sized datasets, which motivates our definition of effective model memorization (EMM), a metric measuring the maximum size of training data at which a learned diffusion model approximates its theoretical optimum. Then, we quantify the impact of the influential factors on these memorization behaviors in terms of EMM, focusing primarily on data distribution, model configuration, and training procedure. Besides comprehensive empirical results identifying the influential factors, we surprisingly find that conditioning training data on uninformative random labels can significantly trigger the memorization in diffusion models. Our study holds practical significance for diffusion model users and offers clues to theoretical research in deep generative models. Code is available at https://github.com/sail-sg/DiffMemorize.","url_abs":"https://arxiv.org/abs/2310.02664v1","url_pdf":"https://arxiv.org/pdf/2310.02664v1.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":"on-memorization-in-diffusion-models","repo_url":"https://github.com/sail-sg/DiffMemorize","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"on-memorization-in-diffusion-models","repo_url":"https://github.com/sixuli/ddpm_and_kde","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"denoising","task_name":"Denoising"},{"task_slug":"memorization","task_name":"Memorization"}],"methods":[{"method_slug":"diffusion","method_name":"Diffusion"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2310.02664","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2310.02664"}},"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/sail-sg/DiffMemorize","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/sixuli/ddpm_and_kde","reach":{"status":"ok"}}],"summary":{"ran_draft_wrong":3,"ran":3,"ran_honours":2,"ran_fixture":1,"unverified":5},"by_repo_kind":{"official":{"samples":14,"ran":9,"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":"a2b45afa097b55b6","entry":"file_ext","repo":"sail-sg/DiffMemorize","repo_kind":"official","path":"dataset_utils/dataset_diversity.py","file_url":"https://github.com/sail-sg/DiffMemorize/blob/HEAD/dataset_utils/dataset_diversity.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a2b45afa097b55b6"}},{"code_sha256_prefix":"2bc3b7a1e6f0984b","entry":"find_class_folders","repo":"sail-sg/DiffMemorize","repo_kind":"official","path":"dataset_utils/sample_imagenet.py","file_url":"https://github.com/sail-sg/DiffMemorize/blob/HEAD/dataset_utils/sample_imagenet.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":"2bc3b7a1e6f0984b"}},{"code_sha256_prefix":"674eca7b9e1b6439","entry":"format_time","repo":"sail-sg/DiffMemorize","repo_kind":"official","path":"dnnlib/util.py","file_url":"https://github.com/sail-sg/DiffMemorize/blob/HEAD/dnnlib/util.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"674eca7b9e1b6439"}},{"code_sha256_prefix":"32af001972a0699f","entry":"format_time_brief","repo":"sail-sg/DiffMemorize","repo_kind":"official","path":"dnnlib/util.py","file_url":"https://github.com/sail-sg/DiffMemorize/blob/HEAD/dnnlib/util.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"32af001972a0699f"}},{"code_sha256_prefix":"dd1dc700e87f36cc","entry":"maybe_min","repo":"sail-sg/DiffMemorize","repo_kind":"official","path":"dataset_utils/dataset_diversity.py","file_url":"https://github.com/sail-sg/DiffMemorize/blob/HEAD/dataset_utils/dataset_diversity.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"dd1dc700e87f36cc"}},{"code_sha256_prefix":"cacd4f6ec202d9b4","entry":"parse_int_list","repo":"sail-sg/DiffMemorize","repo_kind":"official","path":"generate_edm.py","file_url":"https://github.com/sail-sg/DiffMemorize/blob/HEAD/generate_edm.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"cacd4f6ec202d9b4"}},{"code_sha256_prefix":"07b21b35ecb4815c","entry":"parse_tuple","repo":"sail-sg/DiffMemorize","repo_kind":"official","path":"dataset_utils/dataset_diversity.py","file_url":"https://github.com/sail-sg/DiffMemorize/blob/HEAD/dataset_utils/dataset_diversity.py","link_basis":"harvester_set","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":"07b21b35ecb4815c"}},{"code_sha256_prefix":"f1eb8f458487f3ab","entry":"sample_images","repo":"sail-sg/DiffMemorize","repo_kind":"official","path":"dataset_utils/sample_imagenet.py","file_url":"https://github.com/sail-sg/DiffMemorize/blob/HEAD/dataset_utils/sample_imagenet.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":"f1eb8f458487f3ab"}},{"code_sha256_prefix":"d41a4250066bce93","entry":"weight_init","repo":"sail-sg/DiffMemorize","repo_kind":"official","path":"training/networks.py","file_url":"https://github.com/sail-sg/DiffMemorize/blob/HEAD/training/networks.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d41a4250066bce93"}},{"code_sha256_prefix":"9fbf646e18eed1db","entry":"ablation_sampler","repo":"sail-sg/DiffMemorize","repo_kind":"official","path":"generate_edm.py","file_url":"https://github.com/sail-sg/DiffMemorize/blob/HEAD/generate_edm.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9fbf646e18eed1db"}},{"code_sha256_prefix":"9d31d2c4cd16bb2d","entry":"ask_yes_no","repo":"sail-sg/DiffMemorize","repo_kind":"official","path":"dnnlib/util.py","file_url":"https://github.com/sail-sg/DiffMemorize/blob/HEAD/dnnlib/util.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9d31d2c4cd16bb2d"}},{"code_sha256_prefix":"8b16b0674af254db","entry":"edm_sampler","repo":"sail-sg/DiffMemorize","repo_kind":"official","path":"generate_edm.py","file_url":"https://github.com/sail-sg/DiffMemorize/blob/HEAD/generate_edm.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8b16b0674af254db"}},{"code_sha256_prefix":"b1986232479684ae","entry":"file_ext","repo":"sail-sg/DiffMemorize","repo_kind":"official","path":"mem_ratio.py","file_url":"https://github.com/sail-sg/DiffMemorize/blob/HEAD/mem_ratio.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"b1986232479684ae"}},{"code_sha256_prefix":"ad63e5e1c1e32ab7","entry":"load_cifar10_zip","repo":"sail-sg/DiffMemorize","repo_kind":"official","path":"mem_ratio.py","file_url":"https://github.com/sail-sg/DiffMemorize/blob/HEAD/mem_ratio.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"ad63e5e1c1e32ab7"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}