{"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/perturb-and-max-product-sampling-and-learning","title":"Perturb-and-max-product: Sampling and learning in discrete energy-based models","arxiv_id":"2111.02458","date":"2021-11-03","proceeding":"NeurIPS 2021 12","authors":["Miguel Lazaro-Gredilla","Antoine Dedieu","Dileep George"],"abstract":"Perturb-and-MAP offers an elegant approach to approximately sample from a energy-based model (EBM) by computing the maximum-a-posteriori (MAP) configuration of a perturbed version of the model. Sampling in turn enables learning. However, this line of research has been hindered by the general intractability of the MAP computation. Very few works venture outside tractable models, and when they do, they use linear programming approaches, which as we will show, have several limitations. In this work we present perturb-and-max-product (PMP), a parallel and scalable mechanism for sampling and learning in discrete EBMs. Models can be arbitrary as long as they are built using tractable factors. We show that (a) for Ising models, PMP is orders of magnitude faster than Gibbs and Gibbs-with-Gradients (GWG) at learning and generating samples of similar or better quality; (b) PMP is able to learn and sample from RBMs; (c) in a large, entangled graphical model in which Gibbs and GWG fail to mix, PMP succeeds.","url_abs":"https://arxiv.org/abs/2111.02458v2","url_pdf":"https://arxiv.org/pdf/2111.02458v2.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":"perturb-and-max-product-sampling-and-learning","repo_url":"https://github.com/vicariousinc/perturb_and_max_product","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"jax","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2111.02458","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2111.02458"}},"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/vicariousinc/perturb_and_max_product","reach":{"status":"ok","spdx":"MIT"}}],"summary":{"unverified":7},"by_repo_kind":{"official":{"samples":7,"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":"2936452754433fcd","entry":"c2d_latt_mask","repo":"vicariousinc/perturb_and_max_product","repo_kind":"official","path":"experiments/generate_erdos_and_lattice.py","file_url":"https://github.com/vicariousinc/perturb_and_max_product/blob/HEAD/experiments/generate_erdos_and_lattice.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2936452754433fcd"}},{"code_sha256_prefix":"3d522d6b60f4a4d7","entry":"contour_mnist","repo":"vicariousinc/perturb_and_max_product","repo_kind":"official","path":"experiments/generate_mnist_and_contour_mnist.py","file_url":"https://github.com/vicariousinc/perturb_and_max_product/blob/HEAD/experiments/generate_mnist_and_contour_mnist.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"3d522d6b60f4a4d7"}},{"code_sha256_prefix":"ba817fe401de23e8","entry":"grad","repo":"vicariousinc/perturb_and_max_product","repo_kind":"official","path":"pmap/rbm_modeling.py","file_url":"https://github.com/vicariousinc/perturb_and_max_product/blob/HEAD/pmap/rbm_modeling.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"ba817fe401de23e8"}},{"code_sha256_prefix":"c613e60795684456","entry":"grad_from_samples","repo":"vicariousinc/perturb_and_max_product","repo_kind":"official","path":"pmap/rbm_modeling.py","file_url":"https://github.com/vicariousinc/perturb_and_max_product/blob/HEAD/pmap/rbm_modeling.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"c613e60795684456"}},{"code_sha256_prefix":"f03099160b305294","entry":"mean_corr","repo":"vicariousinc/perturb_and_max_product","repo_kind":"official","path":"pmap/ising_modeling.py","file_url":"https://github.com/vicariousinc/perturb_and_max_product/blob/HEAD/pmap/ising_modeling.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f03099160b305294"}},{"code_sha256_prefix":"2084d897d09fc639","entry":"np_mean_corr","repo":"vicariousinc/perturb_and_max_product","repo_kind":"official","path":"pmap/ising_modeling_lp.py","file_url":"https://github.com/vicariousinc/perturb_and_max_product/blob/HEAD/pmap/ising_modeling_lp.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"2084d897d09fc639"}},{"code_sha256_prefix":"364aaefad0d757b2","entry":"or_layer","repo":"vicariousinc/perturb_and_max_product","repo_kind":"official","path":"pmap/conv_or_modeling.py","file_url":"https://github.com/vicariousinc/perturb_and_max_product/blob/HEAD/pmap/conv_or_modeling.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"364aaefad0d757b2"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}