{"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/towards-accurate-guided-diffusion-sampling","title":"Towards Accurate Guided Diffusion Sampling through Symplectic Adjoint Method","arxiv_id":"2312.12030","date":"2023-12-19","proceeding":null,"authors":["Jiachun Pan","Hanshu Yan","Jun Hao Liew","Jiashi Feng","Vincent Y. F. Tan"],"abstract":"Training-free guided sampling in diffusion models leverages off-the-shelf pre-trained networks, such as an aesthetic evaluation model, to guide the generation process. Current training-free guided sampling algorithms obtain the guidance energy function based on a one-step estimate of the clean image. However, since the off-the-shelf pre-trained networks are trained on clean images, the one-step estimation procedure of the clean image may be inaccurate, especially in the early stages of the generation process in diffusion models. This causes the guidance in the early time steps to be inaccurate. To overcome this problem, we propose Symplectic Adjoint Guidance (SAG), which calculates the gradient guidance in two inner stages. Firstly, SAG estimates the clean image via $n$ function calls, where $n$ serves as a flexible hyperparameter that can be tailored to meet specific image quality requirements. Secondly, SAG uses the symplectic adjoint method to obtain the gradients accurately and efficiently in terms of the memory requirements. Extensive experiments demonstrate that SAG generates images with higher qualities compared to the baselines in both guided image and video generation tasks.","url_abs":"https://arxiv.org/abs/2312.12030v1","url_pdf":"https://arxiv.org/pdf/2312.12030v1.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":"towards-accurate-guided-diffusion-sampling","repo_url":"https://github.com/hanshuyan/adjointdpm","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"video-generation","task_name":"Video Generation"}],"methods":[{"method_slug":"diffusion","method_name":"Diffusion"},{"method_slug":"sag-1","method_name":"SAG"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2312.12030","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2312.12030"}},"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/hanshuyan/adjointdpm","reach":{"status":"ok"}}],"summary":{"ran_draft_wrong":4,"ran":3,"ran_fixture":1,"unverified":4},"by_repo_kind":{"official":{"samples":12,"ran":8,"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":12,"samples":[{"code_sha256_prefix":"c3a6b977022957cb","entry":"Normalize","repo":"hanshuyan/adjointdpm","repo_kind":"official","path":"ddpm_and_guided-diffusion/models/diffusion.py","file_url":"https://github.com/hanshuyan/adjointdpm/blob/HEAD/ddpm_and_guided-diffusion/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":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"c3a6b977022957cb"}},{"code_sha256_prefix":"e6293358fb50e129","entry":"betas_for_alpha_bar","repo":"hanshuyan/adjointdpm","repo_kind":"official","path":"adjoint/src/node_solver_noise.py","file_url":"https://github.com/hanshuyan/adjointdpm/blob/HEAD/adjoint/src/node_solver_noise.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":"e6293358fb50e129"}},{"code_sha256_prefix":"cb49209c125de1b4","entry":"get_timestep_embedding","repo":"hanshuyan/adjointdpm","repo_kind":"official","path":"ddpm_and_guided-diffusion/models/diffusion.py","file_url":"https://github.com/hanshuyan/adjointdpm/blob/HEAD/ddpm_and_guided-diffusion/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":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"cb49209c125de1b4"}},{"code_sha256_prefix":"915e1c6c38494be9","entry":"list_dir","repo":"hanshuyan/adjointdpm","repo_kind":"official","path":"ddpm_and_guided-diffusion/datasets/utils.py","file_url":"https://github.com/hanshuyan/adjointdpm/blob/HEAD/ddpm_and_guided-diffusion/datasets/utils.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":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"915e1c6c38494be9"}},{"code_sha256_prefix":"208e196e9582a9a6","entry":"list_files","repo":"hanshuyan/adjointdpm","repo_kind":"official","path":"ddpm_and_guided-diffusion/datasets/utils.py","file_url":"https://github.com/hanshuyan/adjointdpm/blob/HEAD/ddpm_and_guided-diffusion/datasets/utils.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":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"208e196e9582a9a6"}},{"code_sha256_prefix":"36a45cceb1209d2f","entry":"noise_estimation_loss","repo":"hanshuyan/adjointdpm","repo_kind":"official","path":"ddpm_and_guided-diffusion/functions/losses.py","file_url":"https://github.com/hanshuyan/adjointdpm/blob/HEAD/ddpm_and_guided-diffusion/functions/losses.py","link_basis":"harvester_set","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":"36a45cceb1209d2f"}},{"code_sha256_prefix":"3137073275f8c21a","entry":"nonlinearity","repo":"hanshuyan/adjointdpm","repo_kind":"official","path":"ddpm_and_guided-diffusion/models/diffusion.py","file_url":"https://github.com/hanshuyan/adjointdpm/blob/HEAD/ddpm_and_guided-diffusion/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":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"3137073275f8c21a"}},{"code_sha256_prefix":"3846523c8a2b9190","entry":"numpy_to_pil","repo":"hanshuyan/adjointdpm","repo_kind":"official","path":"img_guided_sampling/style_transfer.py","file_url":"https://github.com/hanshuyan/adjointdpm/blob/HEAD/img_guided_sampling/style_transfer.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":"3846523c8a2b9190"}},{"code_sha256_prefix":"a17aa1b06ec919e8","entry":"calculate_activation_statistics","repo":"hanshuyan/adjointdpm","repo_kind":"official","path":"ddpm_and_guided-diffusion/evaluate/fid_score.py","file_url":"https://github.com/hanshuyan/adjointdpm/blob/HEAD/ddpm_and_guided-diffusion/evaluate/fid_score.py","link_basis":"harvester_set","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":"a17aa1b06ec919e8"}},{"code_sha256_prefix":"0def50a351111624","entry":"calculate_frechet_distance","repo":"hanshuyan/adjointdpm","repo_kind":"official","path":"ddpm_and_guided-diffusion/evaluate/fid_score.py","file_url":"https://github.com/hanshuyan/adjointdpm/blob/HEAD/ddpm_and_guided-diffusion/evaluate/fid_score.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":"RAISES","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"0def50a351111624"}},{"code_sha256_prefix":"7345763c9b9300fb","entry":"check_integrity","repo":"hanshuyan/adjointdpm","repo_kind":"official","path":"ddpm_and_guided-diffusion/datasets/utils.py","file_url":"https://github.com/hanshuyan/adjointdpm/blob/HEAD/ddpm_and_guided-diffusion/datasets/utils.py","link_basis":"harvester_set","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":"7345763c9b9300fb"}},{"code_sha256_prefix":"9f5980b8530c7409","entry":"get_activations","repo":"hanshuyan/adjointdpm","repo_kind":"official","path":"ddpm_and_guided-diffusion/evaluate/fid_score.py","file_url":"https://github.com/hanshuyan/adjointdpm/blob/HEAD/ddpm_and_guided-diffusion/evaluate/fid_score.py","link_basis":"harvester_set","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":"9f5980b8530c7409"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}