{"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/stochastic-normalizing-flows","title":"Stochastic Normalizing Flows","arxiv_id":"2002.06707","date":"2020-02-16","proceeding":"NeurIPS 2020 12","authors":["Hao Wu","Jonas Köhler","Frank Noé"],"abstract":"The sampling of probability distributions specified up to a normalization constant is an important problem in both machine learning and statistical mechanics. While classical stochastic sampling methods such as Markov Chain Monte Carlo (MCMC) or Langevin Dynamics (LD) can suffer from slow mixing times there is a growing interest in using normalizing flows in order to learn the transformation of a simple prior distribution to the given target distribution. Here we propose a generalized and combined approach to sample target densities: Stochastic Normalizing Flows (SNF) -- an arbitrary sequence of deterministic invertible functions and stochastic sampling blocks. We show that stochasticity overcomes expressivity limitations of normalizing flows resulting from the invertibility constraint, whereas trainable transformations between sampling steps improve efficiency of pure MCMC/LD along the flow. By invoking ideas from non-equilibrium statistical mechanics we derive an efficient training procedure by which both the sampler's and the flow's parameters can be optimized end-to-end, and by which we can compute exact importance weights without having to marginalize out the randomness of the stochastic blocks. We illustrate the representational power, sampling efficiency and asymptotic correctness of SNFs on several benchmarks including applications to sampling molecular systems in equilibrium.","url_abs":"https://arxiv.org/abs/2002.06707v3","url_pdf":"https://arxiv.org/pdf/2002.06707v3.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":"stochastic-normalizing-flows","repo_url":"https://github.com/noegroup/stochastic_normalizing_flows","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"BSD-3-Clause"}},{"paper_slug":"stochastic-normalizing-flows","repo_url":"https://github.com/XinPeng76/Flow_Perturbation","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[],"methods":[{"method_slug":"normalizing-flows","method_name":"Normalizing Flows"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2002.06707","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2002.06707"}},"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/XinPeng76/Flow_Perturbation","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/noegroup/stochastic_normalizing_flows","reach":{"status":"ok","spdx":"BSD-3-Clause"}}],"summary":{"unverified":8},"by_repo_kind":{"official":{"samples":8,"ran":0,"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":"8ff2c04c57b4106f","entry":"ModelEval","repo":"noegroup/stochastic_normalizing_flows","repo_kind":"official","path":"flow_models.py","file_url":"https://github.com/noegroup/stochastic_normalizing_flows/blob/HEAD/flow_models.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"8ff2c04c57b4106f"}},{"code_sha256_prefix":"00c82805e8638ada","entry":"log_weights","repo":"noegroup/stochastic_normalizing_flows","repo_kind":"official","path":"bgtorch/bgtorch/bg.py","file_url":"https://github.com/noegroup/stochastic_normalizing_flows/blob/HEAD/bgtorch/bgtorch/bg.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"00c82805e8638ada"}},{"code_sha256_prefix":"5b1a9cf0842aab9f","entry":"prepare_image","repo":"noegroup/stochastic_normalizing_flows","repo_kind":"official","path":"snf_code/snf_code/image.py","file_url":"https://github.com/noegroup/stochastic_normalizing_flows/blob/HEAD/snf_code/snf_code/image.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"5b1a9cf0842aab9f"}},{"code_sha256_prefix":"7af2b13628f6b4d0","entry":"sample_bg_histogram","repo":"noegroup/stochastic_normalizing_flows","repo_kind":"official","path":"snf_code/snf_code/imagetools.py","file_url":"https://github.com/noegroup/stochastic_normalizing_flows/blob/HEAD/snf_code/snf_code/imagetools.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"7af2b13628f6b4d0"}},{"code_sha256_prefix":"f16fdd2af62521f2","entry":"sample_energy","repo":"noegroup/stochastic_normalizing_flows","repo_kind":"official","path":"snf_code/snf_code/analysis.py","file_url":"https://github.com/noegroup/stochastic_normalizing_flows/blob/HEAD/snf_code/snf_code/analysis.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"f16fdd2af62521f2"}},{"code_sha256_prefix":"20a354810e79e29f","entry":"statistical_efficiency","repo":"noegroup/stochastic_normalizing_flows","repo_kind":"official","path":"snf_code/snf_code/analysis.py","file_url":"https://github.com/noegroup/stochastic_normalizing_flows/blob/HEAD/snf_code/snf_code/analysis.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"20a354810e79e29f"}},{"code_sha256_prefix":"4c47027dfade7db2","entry":"unnormalized_kl_div","repo":"noegroup/stochastic_normalizing_flows","repo_kind":"official","path":"bgtorch/bgtorch/bg.py","file_url":"https://github.com/noegroup/stochastic_normalizing_flows/blob/HEAD/bgtorch/bgtorch/bg.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"4c47027dfade7db2"}},{"code_sha256_prefix":"72227dbc057d84e7","entry":"unormalized_nll","repo":"noegroup/stochastic_normalizing_flows","repo_kind":"official","path":"bgtorch/bgtorch/bg.py","file_url":"https://github.com/noegroup/stochastic_normalizing_flows/blob/HEAD/bgtorch/bgtorch/bg.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-3-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"72227dbc057d84e7"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}