# Perturb-and-max-product: Sampling and learning in discrete energy-based models

arXiv: https://arxiv.org/abs/2111.02458 · HTML: https://mlsanity.com/paper/2111.02458/

## Key facts

- Cited by 9 papers in the map (data through 14 Oct 2026).
- Builds on 6 of its 41 references that are in the map.
- First posted on arXiv 3 Nov 2021.

## Builds on (most cited first, 6 of 6)

- [Oops I Took A Gradient: Scalable Sampling for Discrete Distributions](https://mlsanity.com/paper/2102.04509/) (2021)
- [Neural Variational Inference and Learning in Undirected Graphical Models](https://mlsanity.com/paper/1711.02679/) (2017)
- [High Dimensional Inference with Random Maximum A-Posteriori Perturbations](https://mlsanity.com/paper/1602.03571/) (2016)
- [To Relieve Your Headache of Training an MRF, Take AdVIL](https://mlsanity.com/paper/1901.08400/) (2019)
- [Amortized Bethe Free Energy Minimization for Learning MRFs](https://mlsanity.com/paper/1906.06399/) (2019)
- [Marginal Weighted Maximum Log-likelihood for Efficient Learning of Perturb-and-Map models](https://mlsanity.com/paper/1811.08725/) (2018)

## Built on by (most cited first, 9 of 9)

- [Topology-Aware Uncertainty for Image Segmentation](https://mlsanity.com/paper/2306.05671/) (2023)
- [Discrete Neural Flow Samplers with Locally Equivariant Transformer](https://mlsanity.com/paper/2505.17741/) (2025)
- [Energy-Based Preference Model Offers Better Offline Alignment than the Bradley-Terry Preference Model](https://mlsanity.com/paper/2412.13862/) (2024)
- [PGMax: Factor Graphs for Discrete Probabilistic Graphical Models and Loopy Belief Propagation in JAX](https://mlsanity.com/paper/2202.04110/) (2022)
- [Energy-Based Modelling for Discrete and Mixed Data via Heat Equations on Structured Spaces](https://mlsanity.com/paper/2412.01019/) (2024)
- [Cyclic Group Projection for Enumerating Quasi-Cyclic Codes Trapping Sets](https://mlsanity.com/paper/2401.14810/) (2024)
- [Learning noisy-OR Bayesian Networks with Max-Product Belief Propagation](https://mlsanity.com/paper/2302.00099/) (2023)
- [Training Discrete Energy-Based Models with Energy Discrepancy](https://mlsanity.com/paper/2307.07595/) (2023)
- [Circular Belief Propagation for Approximate Probabilistic Inference](https://mlsanity.com/paper/2403.12106/) (2024)

## Abstract (arXiv)

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.
