{"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/modulated-diffusion-accelerating-generative","title":"Modulated Diffusion: Accelerating Generative Modeling with Modulated Quantization","arxiv_id":"2506.22463","date":"2025-06-18","proceeding":null,"authors":["Weizhi Gao","Zhichao Hou","Junqi Yin","Feiyi Wang","Linyu Peng","Xiaorui Liu"],"abstract":"Diffusion models have emerged as powerful generative models, but their high computation cost in iterative sampling remains a significant bottleneck. In this work, we present an in-depth and insightful study of state-of-the-art acceleration techniques for diffusion models, including caching and quantization, revealing their limitations in computation error and generation quality. To break these limits, this work introduces Modulated Diffusion (MoDiff), an innovative, rigorous, and principled framework that accelerates generative modeling through modulated quantization and error compensation. MoDiff not only inherents the advantages of existing caching and quantization methods but also serves as a general framework to accelerate all diffusion models. The advantages of MoDiff are supported by solid theoretical insight and analysis. In addition, extensive experiments on CIFAR-10 and LSUN demonstrate that MoDiff significant reduces activation quantization from 8 bits to 3 bits without performance degradation in post-training quantization (PTQ). Our code implementation is available at https://github.com/WeizhiGao/MoDiff.","url_abs":"https://arxiv.org/abs/2506.22463v1","url_pdf":"https://arxiv.org/pdf/2506.22463v1.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":"modulated-diffusion-accelerating-generative","repo_url":"https://github.com/WeizhiGao/MoDiff","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"quantization","task_name":"Quantization"}],"methods":[{"method_slug":"diffusion","method_name":"Diffusion"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2506.22463","atlas_url":"https://app.syntology.ai/?focus=2506.22463","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2506.22463"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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":"deterministic:regex_extraction","url":"https://github.com/WeizhiGao/MoDiff","reach":null}],"summary":{"ran":9,"ran_draft_wrong":5,"ran_honours":1,"ran_fixture":1,"unverified":16},"by_repo_kind":{"official":{"samples":32,"ran":16,"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":32,"samples":[{"code_sha256_prefix":"fe821a135405b676","entry":"BasicTransformerBlock","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"fe821a135405b676"}},{"code_sha256_prefix":"edbc6b070aba0b51","entry":"CrossAttention","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"edbc6b070aba0b51"}},{"code_sha256_prefix":"389bb673f605c6d2","entry":"CrossQKMatMul","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"389bb673f605c6d2"}},{"code_sha256_prefix":"9ec250f0fac4b765","entry":"CrossSMVMatMul","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.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":"9ec250f0fac4b765"}},{"code_sha256_prefix":"3abfca8077fe9d76","entry":"FeedForward","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"3abfca8077fe9d76"}},{"code_sha256_prefix":"941d1452fb38ca5e","entry":"QKVAttention","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.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":"941d1452fb38ca5e"}},{"code_sha256_prefix":"90bafd5717a0d799","entry":"QKVAttentionLegacy","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"90bafd5717a0d799"}},{"code_sha256_prefix":"a3c010461a312c81","entry":"SMVMatMul","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"a3c010461a312c81"}},{"code_sha256_prefix":"d88476b54e8ec555","entry":"UniformAffineQuantizer","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d88476b54e8ec555"}},{"code_sha256_prefix":"86ac950feea0e0fd","entry":"cross_attn_forward","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"86ac950feea0e0fd"}},{"code_sha256_prefix":"834bbad6b027b869","entry":"custom_to_np","repo":"weizhigao/modiff","repo_kind":"official","path":"scripts/sample_diffusion_ldm.py","file_url":"https://github.com/weizhigao/modiff/blob/HEAD/scripts/sample_diffusion_ldm.py","link_basis":"first_harvest_node","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":"834bbad6b027b869"}},{"code_sha256_prefix":"1f425be38a5fdeb5","entry":"custom_to_pil","repo":"weizhigao/modiff","repo_kind":"official","path":"scripts/sample_diffusion_ldm.py","file_url":"https://github.com/weizhigao/modiff/blob/HEAD/scripts/sample_diffusion_ldm.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"1f425be38a5fdeb5"}},{"code_sha256_prefix":"584a23812bb846a3","entry":"dict2namespace","repo":"weizhigao/modiff","repo_kind":"official","path":"scripts/sample_diffusion_ddim.py","file_url":"https://github.com/weizhigao/modiff/blob/HEAD/scripts/sample_diffusion_ddim.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"584a23812bb846a3"}},{"code_sha256_prefix":"ca0cea1ca1eeec89","entry":"get_beta_schedule","repo":"weizhigao/modiff","repo_kind":"official","path":"scripts/sample_diffusion_ddim.py","file_url":"https://github.com/weizhigao/modiff/blob/HEAD/scripts/sample_diffusion_ddim.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ca0cea1ca1eeec89"}},{"code_sha256_prefix":"2eaadefc68b9b67f","entry":"logs2pil","repo":"weizhigao/modiff","repo_kind":"official","path":"scripts/sample_diffusion_ldm.py","file_url":"https://github.com/weizhigao/modiff/blob/HEAD/scripts/sample_diffusion_ldm.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2eaadefc68b9b67f"}},{"code_sha256_prefix":"c27a10ca9f6b75f3","entry":"torch2hwcuint8","repo":"weizhigao/modiff","repo_kind":"official","path":"scripts/sample_diffusion_ddim.py","file_url":"https://github.com/weizhigao/modiff/blob/HEAD/scripts/sample_diffusion_ddim.py","link_basis":"first_harvest_node","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":"c27a10ca9f6b75f3"}},{"code_sha256_prefix":"df7a4ce615fa6435","entry":"AttentionBlock","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.py","link_basis":"first_harvest_node","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":"df7a4ce615fa6435"}},{"code_sha256_prefix":"ae77b73557079f18","entry":"AttnBlock","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.py","link_basis":"first_harvest_node","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":"ae77b73557079f18"}},{"code_sha256_prefix":"141229083c7d82ac","entry":"BaseQuantBlock","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.py","link_basis":"first_harvest_node","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":"141229083c7d82ac"}},{"code_sha256_prefix":"cdf30b4cf1e20928","entry":"QKMatMul","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.py","link_basis":"first_harvest_node","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":"cdf30b4cf1e20928"}},{"code_sha256_prefix":"6fec188e5dfb1249","entry":"QuantAttentionBlock","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.py","link_basis":"first_harvest_node","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":"6fec188e5dfb1249"}},{"code_sha256_prefix":"3767d1fd2725d986","entry":"QuantAttnBlock","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.py","link_basis":"first_harvest_node","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":"3767d1fd2725d986"}},{"code_sha256_prefix":"aff831fe69321097","entry":"QuantBasicTransformerBlock","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.py","link_basis":"first_harvest_node","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":"aff831fe69321097"}},{"code_sha256_prefix":"a243ad022c69789a","entry":"QuantModel","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.py","link_basis":"first_harvest_node","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":"a243ad022c69789a"}},{"code_sha256_prefix":"64b7930a97c62f16","entry":"QuantModule","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.py","link_basis":"first_harvest_node","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":"64b7930a97c62f16"}},{"code_sha256_prefix":"8c76a82ae15256d9","entry":"QuantQKMatMul","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.py","link_basis":"first_harvest_node","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":"8c76a82ae15256d9"}},{"code_sha256_prefix":"e5fc108495799e81","entry":"QuantResBlock","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.py","link_basis":"first_harvest_node","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":"e5fc108495799e81"}},{"code_sha256_prefix":"8bfaf266f4ee379f","entry":"QuantResnetBlock","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.py","link_basis":"first_harvest_node","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":"8bfaf266f4ee379f"}},{"code_sha256_prefix":"e73fa8043b1b13e1","entry":"QuantSMVMatMul","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.py","link_basis":"first_harvest_node","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":"e73fa8043b1b13e1"}},{"code_sha256_prefix":"00e230e8cf8490b7","entry":"ResBlock","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.py","link_basis":"first_harvest_node","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":"00e230e8cf8490b7"}},{"code_sha256_prefix":"0c239a04ebd27a00","entry":"ResnetBlock","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.py","link_basis":"first_harvest_node","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":"0c239a04ebd27a00"}},{"code_sha256_prefix":"40f7990566ab7d99","entry":"get_specials","repo":"WeizhiGao/MoDiff","repo_kind":"official","path":"qdiff/quant_model.py","file_url":"https://github.com/WeizhiGao/MoDiff/blob/HEAD/qdiff/quant_model.py","link_basis":"first_harvest_node","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":"40f7990566ab7d99"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}