On the mapping between Hopfield networks and Restricted Boltzmann Machines

Matthew Smart, Anton Zilman · DOI

Abstract: Hopfield networks (HNs) and Restricted Boltzmann Machines (RBMs) are two important models at the interface of statistical physics, machine learning, and neuroscience. Recently, there has been interest in the relationship between HNs and RBMs, due to their similarity under the statistical mechanics formalism. An exact mapping between HNs and RBMs has been previously noted for the special case of orthogonal (uncorrelated) encoded patterns. We present here an exact mapping in the case of correlated pattern HNs, which are more broadly applicable to existing datasets. Specifically, we show that any HN with $N$ binary variables and $p$ patterns can be mapped to an RBM with $N$ visible units and $p$ Gaussian hidden units.

Introduction

Bridging the gap between the Hopfield Network (HN) and the Restricted Boltzmann Machine (RBM) has long been a goal in neural network theory. While these models share roots in statistical physics, an exact mathematical mapping was previously restricted to the rare case of perfectly orthogonal patterns. This research provides the "missing link" for correlated patterns—the type ubiquitous in real-world datasets—demonstrating how this theoretical connection can significantly accelerate RBM training.

RBMs are powerful generative models but are notoriously difficult to train, typically requiring slow optimization via Contrastive Divergence from random initialization. Conversely, HNs offer transparent associative memory but are often considered less practical due to their $N^2$ parameter scaling. By mapping a transparent HN onto an efficient RBM, we can leverage the strengths of both architectures.

Methods: The Mathematical Bridge

The core contribution is a two-way mathematical bridge facilitated by QR decomposition.

Forward Mapping (HN to RBM)

Starting with a Hopfield Network using the "projection rule" (or pseudo-inverse rule) designed for correlated patterns, the authors apply QR decomposition to the pattern matrix $\xi$. This transformation shows that the HN’s energy function is equivalent to the Hamiltonian of an RBM with binary visible units and Gaussian hidden units.

The exact mapping between a Hopfield Network (left) and an RBM-like bipartite structure (right) using QR decomposition.

Reverse Mapping and One-Shot Initialization

The reverse mapping investigates how to extract learned "binary patterns" from a pre-trained RBM by minimizing binarization error. This allows for the interpretation of RBM weights as recognizable prototypes.

For practical application, the researchers propose "one-shot" initialization. Instead of random noise, RBM weights are initialized by calculating class means from a dataset (e.g., MNIST), orthogonalizing them via the derived mapping, and setting them as the initial weights. This process has a negligible computational cost of $O(MN)$.

Experimental Evaluation

The theory was evaluated using the MNIST dataset, with images binarized to $\{-1, +1\}$. Hierarchical clustering was employed to identify sub-patterns within digit classes, allowing the number of hidden units to scale effectively.

Key Results

The Hopfield-initialized RBMs demonstrated immediate high performance. Models with zero epochs of training outperformed randomly initialized RBMs that had undergone over 25 epochs of standard training.

Training curves for 50 hidden units showing that Hopfield and PCA initializations reach high performance almost instantly compared to random initialization.

In generative tasks, these models reached higher log-likelihoods faster than PCA-based or random alternatives. Furthermore, in classification tasks using a "Product-of-Experts" architecture, Hopfield-initialized RBMs achieved a 3.0% error rate on MNIST, a significant improvement over the 4.5% error rate of their randomly initialized counterparts.

Discussion

The mapping reveals that RBMs can be viewed as compressed HNs. While a full HN requires $N^2$ weights, an RBM with $p < N$ hidden units acts as an efficient, compressed associative memory. The research also identifies a "melting transition" where the temperature parameter $\beta$ must be carefully tuned to balance pattern stability and model flexibility.

While the current exact mapping requires Gaussian hidden units, the authors suggest that these principles could extend to deeper architectures like Deep Belief Networks (DBNs). This work transforms the RBM from a "black box" into an interpretable system of recognizable memories, providing a robust theoretical foundation for efficient neural network initialization.

Summary updated

Abstract

Hopfield networks (HNs) and Restricted Boltzmann Machines (RBMs) are two important models at the interface of statistical physics, machine learning, and neuroscience. Recently, there has been interest in the relationship between HNs and RBMs, due to their similarity under the statistical mechanics formalism. An exact mapping between HNs and RBMs has been previously noted for the special case of orthogonal (uncorrelated) encoded patterns. We present here an exact mapping in the case of correlated pattern HNs, which are more broadly applicable to existing datasets. Specifically, we show that any HN with $N$ binary variables and $p
BibTeX
@inproceedings{smart2021mapping,
  author = {Matthew Smart and Anton Zilman},
  title = {{On the mapping between Hopfield networks and Restricted Boltzmann Machines}},
  booktitle = {International Conference on Learning Representations},
  year = {2021},
  url = {https://openreview.net/forum?id=RGJbergVIoO},
}

Loading related content...

Figure