{"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/bayesdiff-estimating-pixel-wise-uncertainty","title":"BayesDiff: Estimating Pixel-wise Uncertainty in Diffusion via Bayesian Inference","arxiv_id":"2310.11142","date":"2023-10-17","proceeding":null,"authors":["Siqi Kou","Lei Gan","Dequan Wang","Chongxuan Li","Zhijie Deng"],"abstract":"Diffusion models have impressive image generation capability, but low-quality generations still exist, and their identification remains challenging due to the lack of a proper sample-wise metric. To address this, we propose BayesDiff, a pixel-wise uncertainty estimator for generations from diffusion models based on Bayesian inference. In particular, we derive a novel uncertainty iteration principle to characterize the uncertainty dynamics in diffusion, and leverage the last-layer Laplace approximation for efficient Bayesian inference. The estimated pixel-wise uncertainty can not only be aggregated into a sample-wise metric to filter out low-fidelity images but also aids in augmenting successful generations and rectifying artifacts in failed generations in text-to-image tasks. Extensive experiments demonstrate the efficacy of BayesDiff and its promise for practical applications.","url_abs":"https://arxiv.org/abs/2310.11142v2","url_pdf":"https://arxiv.org/pdf/2310.11142v2.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":"bayesdiff-estimating-pixel-wise-uncertainty","repo_url":"https://github.com/karrykkk/bayesdiff","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"bayesian-inference","task_name":"Bayesian Inference"},{"task_slug":"image-generation","task_name":"Image Generation"}],"methods":[{"method_slug":"diffusion","method_name":"Diffusion"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2310.11142","atlas_url":"https://app.syntology.ai/?focus=2310.11142","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2310.11142"}},"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/karrykkk/BayesDiff","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/karrykkk/bayesdiff","reach":{"status":"ok"}}],"summary":{"ran_draft_wrong":6,"ran":5,"ran_fixture":1,"unverified":1},"by_repo_kind":{"official":{"samples":13,"ran":12,"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":13,"samples":[{"code_sha256_prefix":"c3a6b977022957cb","entry":"Normalize","repo":"karrykkk/BayesDiff","repo_kind":"official","path":"ddpm_and_guided/models/diffusion.py","file_url":"https://github.com/karrykkk/BayesDiff/blob/HEAD/ddpm_and_guided/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":"9215fb189fbfb9f4","entry":"compute_alpha","repo":"karrykkk/BayesDiff","repo_kind":"official","path":"ddpm_and_guided/ddimUQ_utils.py","file_url":"https://github.com/karrykkk/BayesDiff/blob/HEAD/ddpm_and_guided/ddimUQ_utils.py","link_basis":"harvester_set","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":"9215fb189fbfb9f4"}},{"code_sha256_prefix":"3c0b5f643b99df48","entry":"exp_iteration","repo":"karrykkk/bayesdiff","repo_kind":"official","path":"ddpm_and_guided/dpmUQ_utils.py","file_url":"https://github.com/karrykkk/bayesdiff/blob/HEAD/ddpm_and_guided/dpmUQ_utils.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":"3c0b5f643b99df48"}},{"code_sha256_prefix":"741f132771445554","entry":"get_model_input_time","repo":"karrykkk/BayesDiff","repo_kind":"official","path":"ddpm_and_guided/dpmUQ_utils.py","file_url":"https://github.com/karrykkk/BayesDiff/blob/HEAD/ddpm_and_guided/dpmUQ_utils.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":"741f132771445554"}},{"code_sha256_prefix":"cb49209c125de1b4","entry":"get_timestep_embedding","repo":"karrykkk/BayesDiff","repo_kind":"official","path":"ddpm_and_guided/models/diffusion.py","file_url":"https://github.com/karrykkk/BayesDiff/blob/HEAD/ddpm_and_guided/models/diffusion.py","link_basis":"harvester_set","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"cb49209c125de1b4"}},{"code_sha256_prefix":"cd9d1cd248f9be9e","entry":"inverse_data_transform","repo":"karrykkk/BayesDiff","repo_kind":"official","path":"ddpm_and_guided/ddimUQ_utils.py","file_url":"https://github.com/karrykkk/BayesDiff/blob/HEAD/ddpm_and_guided/ddimUQ_utils.py","link_basis":"plan_row","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":"cd9d1cd248f9be9e"}},{"code_sha256_prefix":"778a78e5d08c23b3","entry":"logit_transform","repo":"karrykkk/BayesDiff","repo_kind":"official","path":"ddpm_and_guided/la_train_datasets.py","file_url":"https://github.com/karrykkk/BayesDiff/blob/HEAD/ddpm_and_guided/la_train_datasets.py","link_basis":"plan_row","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"778a78e5d08c23b3"}},{"code_sha256_prefix":"36a45cceb1209d2f","entry":"noise_estimation_loss","repo":"karrykkk/BayesDiff","repo_kind":"official","path":"ddpm_and_guided/functions/losses.py","file_url":"https://github.com/karrykkk/BayesDiff/blob/HEAD/ddpm_and_guided/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":"karrykkk/BayesDiff","repo_kind":"official","path":"ddpm_and_guided/models/diffusion.py","file_url":"https://github.com/karrykkk/BayesDiff/blob/HEAD/ddpm_and_guided/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":"eb05c9da7c2046d2","entry":"sample_from_gaussion","repo":"karrykkk/BayesDiff","repo_kind":"official","path":"ddpm_and_guided/dpmUQ_utils.py","file_url":"https://github.com/karrykkk/BayesDiff/blob/HEAD/ddpm_and_guided/dpmUQ_utils.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":"eb05c9da7c2046d2"}},{"code_sha256_prefix":"6e10634811017cf7","entry":"singlestep_ddim_sample","repo":"karrykkk/BayesDiff","repo_kind":"official","path":"ddpm_and_guided/ddimUQ_utils.py","file_url":"https://github.com/karrykkk/BayesDiff/blob/HEAD/ddpm_and_guided/ddimUQ_utils.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":"6e10634811017cf7"}},{"code_sha256_prefix":"49fb4ce8e31a610a","entry":"singlestep_ddpm_sample","repo":"karrykkk/BayesDiff","repo_kind":"official","path":"ddpm_and_guided/ddpm_skipUQ.py","file_url":"https://github.com/karrykkk/BayesDiff/blob/HEAD/ddpm_and_guided/ddpm_skipUQ.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":"49fb4ce8e31a610a"}},{"code_sha256_prefix":"c4a69cb9142a7670","entry":"data_transform","repo":"karrykkk/BayesDiff","repo_kind":"official","path":"ddpm_and_guided/la_train_datasets.py","file_url":"https://github.com/karrykkk/BayesDiff/blob/HEAD/ddpm_and_guided/la_train_datasets.py","link_basis":"plan_row","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":"c4a69cb9142a7670"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}