{"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/temporal-feature-matters-a-framework-for","title":"Temporal Feature Matters: A Framework for Diffusion Model Quantization","arxiv_id":"2407.19547","date":"2024-07-28","proceeding":null,"authors":["Yushi Huang","Ruihao Gong","Xianglong Liu","Jing Liu","Yuhang Li","Jiwen Lu","DaCheng Tao"],"abstract":"The Diffusion models, widely used for image generation, face significant challenges related to their broad applicability due to prolonged inference times and high memory demands. Efficient Post-Training Quantization (PTQ) is crucial to address these issues. However, unlike traditional models, diffusion models critically rely on the time-step for the multi-round denoising. Typically, each time-step is encoded into a hypersensitive temporal feature by several modules. Despite this, existing PTQ methods do not optimize these modules individually. Instead, they employ unsuitable reconstruction objectives and complex calibration methods, leading to significant disturbances in the temporal feature and denoising trajectory, as well as reduced compression efficiency. To address these challenges, we introduce a novel quantization framework that includes three strategies: 1) TIB-based Maintenance: Based on our innovative Temporal Information Block (TIB) definition, Temporal Information-aware Reconstruction (TIAR) and Finite Set Calibration (FSC) are developed to efficiently align original temporal features. 2) Cache-based Maintenance: Instead of indirect and complex optimization for the related modules, pre-computing and caching quantized counterparts of temporal features are developed to minimize errors. 3) Disturbance-aware Selection: Employ temporal feature errors to guide a fine-grained selection between the two maintenance strategies for further disturbance reduction. This framework preserves most of the temporal information and ensures high-quality end-to-end generation. Extensive testing on various datasets, diffusion models and hardware confirms our superior performance and acceleration..","url_abs":"https://arxiv.org/abs/2407.19547v2","url_pdf":"https://arxiv.org/pdf/2407.19547v2.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":"temporal-feature-matters-a-framework-for","repo_url":"https://github.com/modeltc/tfmq-dm","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"denoising","task_name":"Denoising"},{"task_slug":"image-generation","task_name":"Image Generation"},{"task_slug":"quantization","task_name":"Quantization"}],"methods":[{"method_slug":"align","method_name":"ALIGN"},{"method_slug":"diffusion","method_name":"Diffusion"},{"method_slug":"set","method_name":"SET"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2407.19547","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2407.19547"}},"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/modeltc/tfmq-dm","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"ran_draft_wrong":6,"ran":5,"ran_fixture":2,"ran_violates":1},"by_repo_kind":{"listed":{"samples":14,"ran":14,"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":"c3a6b977022957cb","entry":"Normalize","repo":"modeltc/tfmq-dm","repo_kind":"listed","path":"ddim/models/diffusion.py","file_url":"https://github.com/modeltc/tfmq-dm/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":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"c3a6b977022957cb"}},{"code_sha256_prefix":"8241c0562bc710fd","entry":"chunk","repo":"modeltc/tfmq-dm","repo_kind":"listed","path":"txt2img.py","file_url":"https://github.com/modeltc/tfmq-dm/blob/HEAD/txt2img.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"8241c0562bc710fd"}},{"code_sha256_prefix":"e5efe151009836e9","entry":"create_logger","repo":"modeltc/tfmq-dm","repo_kind":"listed","path":"linklink/log_helper.py","file_url":"https://github.com/modeltc/tfmq-dm/blob/HEAD/linklink/log_helper.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"e5efe151009836e9"}},{"code_sha256_prefix":"834bbad6b027b869","entry":"custom_to_np","repo":"modeltc/tfmq-dm","repo_kind":"listed","path":"sample_diffusion_ldm.py","file_url":"https://github.com/modeltc/tfmq-dm/blob/HEAD/sample_diffusion_ldm.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"834bbad6b027b869"}},{"code_sha256_prefix":"73fba7367428c8a5","entry":"custom_to_pil","repo":"modeltc/tfmq-dm","repo_kind":"listed","path":"sample_diffusion_ldm.py","file_url":"https://github.com/modeltc/tfmq-dm/blob/HEAD/sample_diffusion_ldm.py","link_basis":"plan_row","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"73fba7367428c8a5"}},{"code_sha256_prefix":"bd1f17e427bf51a5","entry":"dict2namespace","repo":"modeltc/tfmq-dm","repo_kind":"listed","path":"sample_diffusion_ddim.py","file_url":"https://github.com/modeltc/tfmq-dm/blob/HEAD/sample_diffusion_ddim.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":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"bd1f17e427bf51a5"}},{"code_sha256_prefix":"cb49209c125de1b4","entry":"get_timestep_embedding","repo":"modeltc/tfmq-dm","repo_kind":"listed","path":"ddim/models/diffusion.py","file_url":"https://github.com/modeltc/tfmq-dm/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":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"cb49209c125de1b4"}},{"code_sha256_prefix":"77865748740d72a6","entry":"kl","repo":"modeltc/tfmq-dm","repo_kind":"listed","path":"quant/quant_layer.py","file_url":"https://github.com/modeltc/tfmq-dm/blob/HEAD/quant/quant_layer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"77865748740d72a6"}},{"code_sha256_prefix":"968eb3375c1d67e1","entry":"logs2pil","repo":"modeltc/tfmq-dm","repo_kind":"listed","path":"sample_diffusion_ldm.py","file_url":"https://github.com/modeltc/tfmq-dm/blob/HEAD/sample_diffusion_ldm.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"968eb3375c1d67e1"}},{"code_sha256_prefix":"71aaede90c9c1031","entry":"minmax","repo":"modeltc/tfmq-dm","repo_kind":"listed","path":"quant/quant_layer.py","file_url":"https://github.com/modeltc/tfmq-dm/blob/HEAD/quant/quant_layer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"71aaede90c9c1031"}},{"code_sha256_prefix":"180ea8ce084d4e63","entry":"mse","repo":"modeltc/tfmq-dm","repo_kind":"listed","path":"quant/quant_layer.py","file_url":"https://github.com/modeltc/tfmq-dm/blob/HEAD/quant/quant_layer.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"180ea8ce084d4e63"}},{"code_sha256_prefix":"36a45cceb1209d2f","entry":"noise_estimation_loss","repo":"modeltc/tfmq-dm","repo_kind":"listed","path":"ddim/functions/losses.py","file_url":"https://github.com/modeltc/tfmq-dm/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":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"36a45cceb1209d2f"}},{"code_sha256_prefix":"3137073275f8c21a","entry":"nonlinearity","repo":"modeltc/tfmq-dm","repo_kind":"listed","path":"ddim/models/diffusion.py","file_url":"https://github.com/modeltc/tfmq-dm/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":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"3137073275f8c21a"}},{"code_sha256_prefix":"1e63d588563eb90a","entry":"numpy_to_pil","repo":"modeltc/tfmq-dm","repo_kind":"listed","path":"txt2img.py","file_url":"https://github.com/modeltc/tfmq-dm/blob/HEAD/txt2img.py","link_basis":"harvester_set","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"1e63d588563eb90a"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}