{"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/how-to-train-your-energy-based-models","title":"How to Train Your Energy-Based Models","arxiv_id":"2101.03288","date":"2021-01-09","proceeding":null,"authors":["Yang song","Diederik P. Kingma"],"abstract":"Energy-Based Models (EBMs), also known as non-normalized probabilistic models, specify probability density or mass functions up to an unknown normalizing constant. Unlike most other probabilistic models, EBMs do not place a restriction on the tractability of the normalizing constant, thus are more flexible to parameterize and can model a more expressive family of probability distributions. However, the unknown normalizing constant of EBMs makes training particularly difficult. Our goal is to provide a friendly introduction to modern approaches for EBM training. We start by explaining maximum likelihood training with Markov chain Monte Carlo (MCMC), and proceed to elaborate on MCMC-free approaches, including Score Matching (SM) and Noise Constrastive Estimation (NCE). We highlight theoretical connections among these three approaches, and end with a brief survey on alternative training methods, which are still under active research. Our tutorial is targeted at an audience with basic understanding of generative models who want to apply EBMs or start a research project in this direction.","url_abs":"https://arxiv.org/abs/2101.03288v2","url_pdf":"https://arxiv.org/pdf/2101.03288v2.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":"how-to-train-your-energy-based-models","repo_url":"https://github.com/matbun/EBM--Generative-Energy-Based-Modeling","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"unanswered"}},{"paper_slug":"how-to-train-your-energy-based-models","repo_url":"https://github.com/Ending2015a/toy_gradlogp","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":null},{"paper_slug":"how-to-train-your-energy-based-models","repo_url":"https://github.com/soran-ghaderi/torchebm","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"unanswered"}}],"tasks":[],"methods":[{"method_slug":"ebm","method_name":"EBM"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2101.03288","atlas_url":"https://app.syntology.ai/?focus=2101.03288","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2101.03288"}},"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":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/matbun/EBM--Generative-Energy-Based-Modeling","reach":{"status":"unanswered"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/Ending2015a/toy_gradlogp","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/soran-ghaderi/torchebm","reach":{"status":"unanswered"}}],"summary":{"ran_draft_wrong":3},"by_repo_kind":{"listed":{"samples":3,"ran":3,"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":"9d5b84ff88fd1554","entry":"anneal_langevin_dynamics","repo":"Ending2015a/toy_gradlogp","repo_kind":"listed","path":"toy_gradlogp/utils.py","file_url":"https://github.com/Ending2015a/toy_gradlogp/blob/HEAD/toy_gradlogp/utils.py","link_basis":"first_harvest_node","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":"9d5b84ff88fd1554"}},{"code_sha256_prefix":"0e2fe8d41e723fb9","entry":"langevin_dynamics","repo":"Ending2015a/toy_gradlogp","repo_kind":"listed","path":"toy_gradlogp/utils.py","file_url":"https://github.com/Ending2015a/toy_gradlogp/blob/HEAD/toy_gradlogp/utils.py","link_basis":"first_harvest_node","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":"0e2fe8d41e723fb9"}},{"code_sha256_prefix":"69056e76ee50c6a6","entry":"sample_score_field","repo":"Ending2015a/toy_gradlogp","repo_kind":"listed","path":"toy_gradlogp/utils.py","file_url":"https://github.com/Ending2015a/toy_gradlogp/blob/HEAD/toy_gradlogp/utils.py","link_basis":"first_harvest_node","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":"69056e76ee50c6a6"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}