On the Partition Function and Random Maximum A-Posteriori Perturbations

Tamir Hazan, Tommi S. Jaakkola

Introduction

This paper reveals a surprising and powerful link between counting (the partition function) and optimization (Maximum A-Posteriori or MAP inference). The core insight is that the log-partition function of a probabilistic model is exactly equivalent to the expected maximum value of that model when subjected to random Gumbel perturbations. By applying this mathematical bridge, the authors develop novel ways to bound and approximate the partition function using highly efficient MAP solvers like graph-cuts, particularly excelling in "high-coupling" regimes where traditional methods typically fail.

The Challenge of the Partition Function

In probabilistic graphical models, the partition function ($Z$) is the crucial normalization constant that converts raw energy scores into valid probabilities. Calculating $Z$ is notoriously difficult—technically #P-hard—because it requires summing over an exponentially large number of possible states.

While the field has efficient algorithms for finding the single most likely state (MAP inference), calculating $Z$ is frequently required for essential tasks like evaluating likelihoods or training Conditional Random Fields (CRFs). Existing approximation methods, such as Markov Chain Monte Carlo (MCMC) sampling or Belief Propagation (BP), often struggle in "ragged energy landscapes." These are scenarios characterized by strong local signals and strict constraints (high coupling), which cause standard algorithms to get trapped in local optima or fail to converge entirely.

Bridging Summation and Maximization: The Gumbel Trick

The authors overcome these limitations by bridging the gap between maximization and summation using the theory of extreme value statistics. Their methodology relies on several key innovations:

  1. The Gumbel Trick: The foundational proof shows that if independent Gumbel-distributed noise is added to the energy of every possible assignment in a model, the expected value of the resulting MAP assignment exactly equals the log-partition function ($\log Z$). This effectively frames a "Log-Sum-Exp" operation as an expectation over a "Max" operation.
  2. Low-Dimensional Perturbations: Because adding noise to exponentially many states is computationally impossible, the authors propose injecting noise into lower-dimensional components, such as individual nodes or edges.
  3. Upper Bounds: By moving the expectation outside the maximization step, they derive a computable upper bound on $\log Z$. This allows researchers to estimate the partition function simply by averaging the results of several MAP inferences on perturbed models.
  4. Surrogate Loss for CRFs: They introduce a new, provenly convex and smooth objective function for training CRFs. This replaces the intractable log-partition function with an expected MAP value.

By leveraging combinatorial solvers (like graph-cuts or MPLP) instead of probabilistic sampling, this framework essentially "probes" the peaks of a distribution rather than exhaustively exploring the space. This makes it highly robust to ragged landscapes where probability mass is concentrated in distant modes.

Datasets and Key Results

The approach was rigorously evaluated on two primary tasks: synthetic Spin Glass Models and Binary Image Denoising.

Spin Glass Accuracy

Spin glass models—synthetic grids with varying "coupling strengths" (how strongly adjacent variables influence each other)—serve as a standard benchmark in physics and machine learning.

Estimation error on Attractive Field 1

In the "high signal - high coupling" regime, the proposed MAP-based approximation proved significantly more accurate than standard methods. As coupling strength increases, the estimation error of the Gumbel approximation drops significantly compared to Tree Re-Weighted (TRW) methods, showcasing its robustness in highly constrained environments.

Binary Image Denoising

The authors also tested their method on a dataset of $100 \times 70$ binary images corrupted by 10% random pixel flips.

Denoised silhouette using the proposed method

On the image denoising task, the parameters learned using the perturbed MAP surrogate achieved a remarkable 1.8% pixel error on the test set. This is a massive improvement over the 8.2% error achieved by a standard Structured-SVM, which fails to account for the partition function. Furthermore, because the method utilizes graph-cuts for attractive potentials, it operates considerably faster than belief propagation variants.

Limitations and Future Directions

While highly effective, the authors note a few limitations to the current framework:

  • Lower Bounds: The derived lower bounds are currently somewhat weaker than the upper bounds and are often outperformed by simpler methods like mean-field approximations in practice.
  • Sampling Variance: Although the upper bound is easy to compute, it remains a stochastic estimate. Depending on the model's complexity, achieving a low-variance estimate of the partition function might require a large number of MAP "samples."
  • Mixed Potentials: The most efficient version of this approximation relies on graph-cuts, which are restricted to "attractive" models. For "mixed" models containing both positive and negative correlations, the framework must fall back on approximate MAP solvers like MPLP, which reduces both overall speed and theoretical guarantees.

Summary updated

BibTeX
@inproceedings{hazan2012partition,
  author = {Tamir Hazan and Tommi S. Jaakkola},
  title = {{On the Partition Function and Random Maximum A-Posteriori Perturbations}},
  booktitle = {International Conference on Machine Learning},
  year = {2012},
  url = {https://openreview.net/forum?id=SJWa9o-_ZH},
}
Figure