Learning a restricted Boltzmann machine using biased Monte Carlo sampling

Nicolas Béreux, Aurélien Decelle, Cyril Furtlehner, Beatriz Seoane

Introduction

Restricted Boltzmann Machines (RBMs) are powerful generative models capable of encoding complex datasets. However, their practical utility is often hampered by unstable training dynamics and the difficulty of assessing model quality. These issues stem from extremely slow mixing times in Markov Chain Monte Carlo (MCMC) sampling, particularly when dealing with clustered datasets. This paper demonstrates that this sampling bottleneck is a manifestation of phase coexistence—a phenomenon well-known in statistical physics—and proposes a solution using biased sampling techniques.

The Sampling Problem: A Physics Perspective

Training an RBM requires estimating the gradient of the log-likelihood, which involves a "negative phase" where samples are drawn from the model's current distribution. Standard methods like Persistent Contrastive Divergence (PCD) rely on Gibbs sampling. However, when data is clustered, the MCMC chains often become trapped in a single mode, failing to explore the full probability landscape.

The authors show that this "breakdown of ergodicity" is mathematically equivalent to phase coexistence near a first-order phase transition. In this regime, the time required to move between different clusters (phases) grows exponentially with the system size, making standard sampling computationally prohibitive and leading to biased gradients that destabilize training.

Tethered Monte Carlo (TMC)

To overcome this, the authors introduce Tethered Monte Carlo (TMC) to the RBM framework. TMC is a biased sampling method that introduces a "tether" or a soft constraint on an order parameter—typically the projection of the data onto its principal components (PCA).

By constraining the sampler to specific regions of the low-dimensional PCA subspace, TMC forces the model to explore the "valleys" between high-probability clusters. By running multiple independent, constrained simulations across the subspace and integrating the results, the full, unbiased probability distribution and the free-energy profile of the model can be reconstructed accurately.

Key Results and Validation

The effectiveness of TMC was evaluated on synthetic clustered data, MNIST digits, and human genomic data.

Comparison of standard MCMC (orange) and Tethered Monte Carlo (blue) on a 5-cluster synthetic dataset. While standard methods remain trapped in a single mode after $10^5$ sweeps, TMC accurately reconstructs the full distribution in just 30 sweeps.

Ergodicity and Accuracy

On a synthetic 5-cluster dataset, standard MCMC remained trapped in a single cluster even after $10^5$ steps. In contrast, TMC correctly identified and sampled all five clusters in only 30 sweeps. On the MNIST 0-1 dataset, TMC-trained RBMs reproduced the true ratio of digits and their internal variability far more accurately than those trained with standard PCD recipes.

Faster Relaxation Dynamics

One of the most surprising findings is that RBMs trained with TMC exhibit significantly faster relaxation dynamics. For the MNIST dataset, the time required for a random starting point to reach a valid state was approximately four times faster in TMC-trained models compared to standard ones. This suggests that the biased training process leads to a smoother, more navigable energy landscape.

Limitations and Future Work

Despite its advantages, TMC has two primary limitations:

  1. Dimensionality: The method requires discretizing the space of the order parameter. While highly effective for 1D or 2D constraints, it becomes computationally expensive for datasets requiring many dimensions to separate clusters.
  2. Parallelization: The global constraint used in TMC breaks the bipartite structure of RBMs, preventing the massive parallelization of updates typically possible on GPUs. This limits the size of the systems that can be considered in practice.

Future research may explore "tethering" hidden units instead of visible ones to alleviate these bottlenecks, as the hidden layer often possesses a lower effective dimensionality.

Summary updated

BibTeX
@inproceedings{bereux2023learning,
  author = {Nicolas Béreux and Aurélien Decelle and Cyril Furtlehner and Beatriz Seoane},
  title = {{Learning a restricted Boltzmann machine using biased Monte Carlo sampling}},
  booktitle = {SciPost},
  year = {2023},
  doi = {10.21468/scipostphys.14.3.032},
}
Figure