{"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/qncd-quantization-noise-correction-for","title":"QNCD: Quantization Noise Correction for Diffusion Models","arxiv_id":"2403.19140","date":"2024-03-28","proceeding":null,"authors":["Huanpeng Chu","Wei Wu","Chengjie Zang","Kun Yuan"],"abstract":"Diffusion models have revolutionized image synthesis, setting new benchmarks in quality and creativity. However, their widespread adoption is hindered by the intensive computation required during the iterative denoising process. Post-training quantization (PTQ) presents a solution to accelerate sampling, aibeit at the expense of sample quality, extremely in low-bit settings. Addressing this, our study introduces a unified Quantization Noise Correction Scheme (QNCD), aimed at minishing quantization noise throughout the sampling process. We identify two primary quantization challenges: intra and inter quantization noise. Intra quantization noise, mainly exacerbated by embeddings in the resblock module, extends activation quantization ranges, increasing disturbances in each single denosing step. Besides, inter quantization noise stems from cumulative quantization deviations across the entire denoising process, altering data distributions step-by-step. QNCD combats these through embedding-derived feature smoothing for eliminating intra quantization noise and an effective runtime noise estimatiation module for dynamicly filtering inter quantization noise. Extensive experiments demonstrate that our method outperforms previous quantization methods for diffusion models, achieving lossless results in W4A8 and W8A8 quantization settings on ImageNet (LDM-4). Code is available at: https://github.com/huanpengchu/QNCD","url_abs":"https://arxiv.org/abs/2403.19140v2","url_pdf":"https://arxiv.org/pdf/2403.19140v2.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":"qncd-quantization-noise-correction-for","repo_url":"https://github.com/huanpengchu/qncd","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"denoising","task_name":"Denoising"},{"task_slug":"image-generation","task_name":"Image Generation"},{"task_slug":"quantization","task_name":"Quantization"}],"methods":[{"method_slug":"diffusion","method_name":"Diffusion"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2403.19140","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2403.19140"}},"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/huanpengchu/qncd","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"ran_draft_wrong":6,"ran_violates":1,"ran_fixture":2,"ran":2,"unverified":1},"by_repo_kind":{"official":{"samples":12,"ran":11,"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":"6a35b62fbc80f70a","entry":"interpolate_fn","repo":"huanpengchu/qncd","repo_kind":"official","path":"ddim/dpm_solver_pytorch.py","file_url":"https://github.com/huanpengchu/qncd/blob/HEAD/ddim/dpm_solver_pytorch.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":2,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"6a35b62fbc80f70a"}},{"code_sha256_prefix":"675da8641c602b03","entry":"round_ste","repo":"huanpengchu/qncd","repo_kind":"official","path":"quant/quant_layer.py","file_url":"https://github.com/huanpengchu/qncd/blob/HEAD/quant/quant_layer.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":2,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"675da8641c602b03"}},{"code_sha256_prefix":"c3a6b977022957cb","entry":"Normalize","repo":"huanpengchu/qncd","repo_kind":"official","path":"ddim/models/diffusion.py","file_url":"https://github.com/huanpengchu/qncd/blob/HEAD/ddim/models/diffusion.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":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c3a6b977022957cb"}},{"code_sha256_prefix":"aa5486a3650902d8","entry":"exists","repo":"huanpengchu/qncd","repo_kind":"official","path":"ldm/modules/attention.py","file_url":"https://github.com/huanpengchu/qncd/blob/HEAD/ldm/modules/attention.py","link_basis":"harvester_set","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"aa5486a3650902d8"}},{"code_sha256_prefix":"e6110366588c5c65","entry":"expand_dims","repo":"huanpengchu/qncd","repo_kind":"official","path":"ddim/dpm_solver_pytorch.py","file_url":"https://github.com/huanpengchu/qncd/blob/HEAD/ddim/dpm_solver_pytorch.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"e6110366588c5c65"}},{"code_sha256_prefix":"cb49209c125de1b4","entry":"get_timestep_embedding","repo":"huanpengchu/qncd","repo_kind":"official","path":"ddim/models/diffusion.py","file_url":"https://github.com/huanpengchu/qncd/blob/HEAD/ddim/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":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"cb49209c125de1b4"}},{"code_sha256_prefix":"08c6ea7576220a13","entry":"lp_loss","repo":"huanpengchu/qncd","repo_kind":"official","path":"quant/quant_layer.py","file_url":"https://github.com/huanpengchu/qncd/blob/HEAD/quant/quant_layer.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"08c6ea7576220a13"}},{"code_sha256_prefix":"0e7df13e9be17236","entry":"model_wrapper","repo":"huanpengchu/qncd","repo_kind":"official","path":"ddim/dpm_solver_pytorch.py","file_url":"https://github.com/huanpengchu/qncd/blob/HEAD/ddim/dpm_solver_pytorch.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":"0e7df13e9be17236"}},{"code_sha256_prefix":"36a45cceb1209d2f","entry":"noise_estimation_loss","repo":"huanpengchu/qncd","repo_kind":"official","path":"ddim/functions/losses.py","file_url":"https://github.com/huanpengchu/qncd/blob/HEAD/ddim/functions/losses.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":"36a45cceb1209d2f"}},{"code_sha256_prefix":"3137073275f8c21a","entry":"nonlinearity","repo":"huanpengchu/qncd","repo_kind":"official","path":"ddim/models/diffusion.py","file_url":"https://github.com/huanpengchu/qncd/blob/HEAD/ddim/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":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"3137073275f8c21a"}},{"code_sha256_prefix":"9a299fe5ae09e407","entry":"uniq","repo":"huanpengchu/qncd","repo_kind":"official","path":"ldm/modules/attention.py","file_url":"https://github.com/huanpengchu/qncd/blob/HEAD/ldm/modules/attention.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9a299fe5ae09e407"}},{"code_sha256_prefix":"51cfe301474f7004","entry":"cross_attn_forward","repo":"huanpengchu/qncd","repo_kind":"official","path":"ldm/modules/attention.py","file_url":"https://github.com/huanpengchu/qncd/blob/HEAD/ldm/modules/attention.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":"51cfe301474f7004"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}