Bayesian Learning in Undirected Graphical Models: Approximate MCMC algorithms

Iain Murray, Zoubin Ghahramani

TL;DR

Bayesian learning in undirected graphical models is notoriously difficult because calculating the normalization constant (partition function) is NP-hard. This paper explores approximate MCMC algorithms to sample from parameter posteriors, demonstrating that while simple variational bounds fail, methods like loopy belief propagation and brief Langevin sampling provide robust, practical solutions.

What Problem Does This Paper Address?

Undirected Graphical Models (UGMs), such as Boltzmann machines and Markov Random Fields, are powerful tools for modeling complex dependencies and "soft constraints" between variables. However, they come with a major catch: the partition function $Z(\theta)$. This normalization constant ensures the distribution sums to one, but it depends on the model parameters $\theta$ and is generally intractable to compute for large systems.

In Bayesian learning, we want the full posterior distribution of parameters $p(\theta|x)$. Standard Markov Chain Monte Carlo (MCMC) methods, like Metropolis-Hastings, require calculating the ratio of likelihoods at different parameter settings. This involves the ratio $Z(\theta)/Z(\theta')$, which is just as hard to compute as the partition function itself. Consequently, most researchers have stuck to point estimates (like Maximum Likelihood), leaving the benefits of Bayesian uncertainty—such as better predictive averaging and avoiding overfitting—largely untapped for large UGMs.

Methods

The authors propose and evaluate several ways to "plug in" approximations into standard MCMC frameworks:

  1. Approximate Metropolis-Hastings: These methods use deterministic approximations of $Z(\theta)$ to calculate the acceptance probability.
  2. Naive Mean Field & Tree-structured Variational Bounds: These use Jensen's inequality to provide lower bounds on the partition function.
  3. Bethe Approximation: Derived from loopy belief propagation, this provides a more sophisticated (though not necessarily a bound) estimate of the partition function.
  4. Approximate Langevin Dynamics: Instead of acceptance/rejection steps, Langevin methods use the gradient of the log-posterior to "drift" toward high-probability regions. The gradient of a UGM involves expectations over the model variables, which are also intractable.
  5. Brief Langevin: Estimates the required expectations using just a few steps of Gibbs sampling starting from the data. This is conceptually similar to Contrastive Divergence (CD) used in point estimation.
  6. Loopy Langevin: Uses marginals from loopy belief propagation to estimate the gradient.

Datasets

The authors tested their algorithms on three distinct systems:

  • Coronary Heart Disease Data: A small, real-world dataset of 1,841 men and 6 binary risk factors. Its small size allowed for exact calculation of $Z(\theta)$ to serve as a ground-truth baseline.
  • Artificial Boltzmann Machines: 100-node systems with varying edge densities (204 and 500 edges). These were used to test scalability where exact computation is impossible.
  • Semi-supervised Learning Toy Data: A 2D classification problem with 80 variables (some hidden) designed to show how Bayesian parameter uncertainty affects predictions in complex, multi-modal landscapes.

Key Insights and Ideas

  • Variational bounds are dangerous for MCMC: A key "aha" moment was that using a lower bound (like Mean Field) in a Metropolis sampler is disastrous. The sampler gets "stuck" in regions where the bound is loose because the approximate probability of leaving that state becomes artificially tiny.
  • The "Prior" Trap: The authors point out a common mistake: trying to define a joint model that makes the posterior easy to sample. They show that doing so implicitly creates a "prior" that depends on the size of your dataset, which is statistically nonsensical.
  • Brief Sampling is a Winner: The "Brief Langevin" method, despite being biased, proved to be highly robust and computationally efficient. It successfully captured parameter distributions in large systems where other methods failed.
  • Capturing Uncertainty: In the semi-supervised learning task, the authors showed that the parameter posterior can be highly non-Gaussian and multi-modal. A single "optimal" (MAP) parameter setting might completely miss the uncertainty in how data points should be clustered, whereas the Bayesian approach captures it (see Figure 3).

Key Results

  • Heart Disease Baseline: On the small dataset, Loopy Metropolis and Brief Langevin produced histograms that were nearly indistinguishable from the exact MCMC results. In contrast, Mean Field and Tree methods failed to converge or produced wildly inaccurate distributions.
Figure 1: Histograms of samples for every parameter in the heart disease risk factor model. Results from exact Metropolis are shown in solid (blue); loopy Metropolis dashed (purple); brief Langevin dotted (red). These curves are often indistinguishable. The mean-field and tree Metropolis algorithms performed very badly; to reduce clutter these are only shown once each in the plots for WAA and WAB respectively, shown in dash-dotted (black).
  • Scalability: On the 100-node artificial systems, both Loopy Metropolis and Brief Langevin successfully recovered parameter values close to the ground truth. Brief Langevin was noted for being more robust as weights became stronger.
Figure 2: Loopy Metropolis is shown dashed (blue), brief Langevin solid (black). Left: an example histogram as in Figure 1 for the 204 edge BM; the vertical line shows the true weight. Also shown are the fractions of samples, f, within ±0.1 of the true value for every parameter in the 204 edge system (centre) and the 500 edge system (right). The parameters are sorted by f for clarity. Higher curves indicate better performance.
  • Hidden Variables: In the semi-supervised task, the Brief Langevin method successfully mapped out a complex, "L-shaped" posterior for the scale parameters $\sigma_x$ and $\sigma_y$, while Loopy Metropolis failed due to the presence of many tight cycles in the graph.
Figure 3: Bayesian inference for semi-supervised learning with hidden variables.

Limitations and Future Work

The authors acknowledge that their best-performing methods still have drawbacks. Loopy belief propagation can fail on "frustrated" systems or those with very strong weights and tight cycles. Brief Langevin, while robust, introduces a bias similar to Contrastive Divergence.

For future work, they suggest exploring exact sampling (like coupling from the past) to provide unbiased estimates for the Langevin gradients, and techniques like reusing random seeds to reduce the variance of these stochastic approximations.

Summary updated

BibTeX
@inproceedings{murray2004bayesian,
  author = {Iain Murray and Zoubin Ghahramani},
  title = {{Bayesian Learning in Undirected Graphical Models: Approximate MCMC algorithms}},
  booktitle = {Conference on Uncertainty in Artificial Intelligence},
  year = {2004},
}
Figure