A Restricted Boltzmann machine (RBM) is a two-layer, undirected generative model made of visible units that represent data and hidden units that capture features, with connections only between the two layers and none within a layer. Among neural networks, it belongs to the family of energy-based models: it assigns a scalar energy to every joint configuration of units and learns weights so that realistic data receives low energy and therefore high probability.
The restriction on connections is what makes the model practical. Because hidden units are conditionally independent given the visible layer, and vice versa, each layer can be sampled in a single parallel step. That property enabled efficient training with contrastive divergence and made RBMs the building block of deep belief networks, which helped revive deep learning in the mid-2000s.
How a Restricted Boltzmann machine defines probability
An RBM defines probability through an energy function over visible units v and hidden units h. For binary units, the energy is the negative sum of visible biases times visible states, hidden biases times hidden states, and the pairwise weights times the products of connected visible and hidden states. The joint probability is proportional to the exponential of the negative energy, divided by the partition function Z, which sums over all possible configurations.
The bipartite structure yields simple conditional distributions. The probability that a hidden unit turns on equals the logistic sigmoid of its bias plus the weighted sum of visible states, and the visible conditionals have the same form. This lets the model alternate between layers, a procedure known as block Gibbs sampling.
The table below lists the main components and their role.
| Component | Symbol | Role in the model |
|---|---|---|
| Visible units | v | Hold the observed data, such as pixels or ratings |
| Hidden units | h | Capture latent features and dependencies |
| Weight matrix | W | Connects every visible unit to every hidden unit |
| Visible biases | b | Set the baseline activity of each visible unit |
| Hidden biases | c | Set the baseline activity of each hidden unit |
| Partition function | Z | Normalizes energies into probabilities; intractable for large models |
Training with contrastive divergence
RBMs are trained to maximize the log-likelihood of the data, and the gradient for each weight is the difference between two correlations: the correlation of visible and hidden states when the visible layer is clamped to data, and the same correlation under the model distribution. The first term is easy to compute; the second requires samples from the model, which exact methods cannot provide efficiently.
Contrastive divergence (CD-k) approximates the model term by starting a Gibbs chain at a training example and running it for only k steps, often k = 1. The resulting gradient is biased but works well in practice. Persistent contrastive divergence keeps chains running across parameter updates, which gives samples closer to the model distribution and usually better generative quality.
| Method | How negative samples are obtained | Main trade-off |
|---|---|---|
| CD-1 | One Gibbs step from each data point | Fast but strongly biased |
| CD-k | k Gibbs steps from each data point | Less bias, more compute |
| Persistent CD | Chains continued across updates | Better likelihood, needs small learning rate |
| Parallel tempering | Chains at several temperatures that swap states | Mixes well, high cost |
Typical practical settings include learning rates around 0.01 to 0.1 for binary data, small random initial weights, mini-batches of tens to hundreds of examples, weight decay and momentum. Monitoring is difficult because the true likelihood depends on Z; practitioners track reconstruction error or estimate likelihood with annealed importance sampling, keeping in mind that reconstruction error can be misleading.
Unit types and RBM variants
The classic RBM uses binary visible and binary hidden units, but the energy function can be adapted to other data types. Choosing the right unit type is one of the main design decisions.
| Variant | Visible units | Typical data |
|---|---|---|
| Bernoulli-Bernoulli RBM | Binary | Binarized images, presence indicators |
| Gaussian-Bernoulli RBM | Real-valued with Gaussian noise | Audio features, normalized pixels |
| Softmax or multinomial RBM | Categorical groups | Discrete ratings, word counts |
| Conditional RBM | Binary or real, plus context inputs | Time series, motion capture |
| Convolutional RBM | Image patches with shared weights | Larger natural images |
Gaussian visible units are notoriously harder to train and generally need lower learning rates and careful data normalization, because the variance parameters can make learning unstable.
RBM compared with related neural network models
An RBM is best understood as a simplified Boltzmann machine that trades expressiveness within a layer for tractable sampling. Its closest neighbors are the general Boltzmann machine, the Hopfield network, the autoencoder and the deep belief network.
| Model | Key difference from an RBM | Practical consequence |
|---|---|---|
| Boltzmann machine | Allows connections within layers | Sampling is far slower |
| Hopfield network | Deterministic, no hidden units | Stores patterns rather than learning a distribution |
| Autoencoder | Directed, trained by backpropagation | No explicit probability model |
| Deep belief network | Stack of RBMs trained layer by layer | Deeper feature hierarchies |
In the greedy layer-wise pretraining scheme, each trained RBM’s hidden activations become the visible data for the next RBM. The stacked weights then initialize a deep feedforward network that is fine-tuned with backpropagation, an approach that was influential before better initialization, ReLU activations and normalization made pretraining largely unnecessary.
Applications, limitations and current relevance
RBMs found practical use in collaborative filtering, dimensionality reduction, feature learning, topic modeling and early speech recognition. In modern practice they have been largely superseded by variational autoencoders, generative adversarial networks, diffusion models and transformers, but they remain important in teaching and in physics-inspired research.
- Intractable partition function: exact likelihood cannot be computed for realistic sizes.
- Slow mixing: Gibbs chains can get stuck in one mode of the distribution.
- Biased gradients: short chains in CD-1 can produce poor generative samples.
- Sensitive hyperparameters: learning rate, hidden layer size and weight decay strongly affect results.
- Active niche: RBMs are used as neural quantum states to represent many-body wave functions.
A plain-language summary
A Restricted Boltzmann machine is a simple network with two rows of switches. One row shows the data. The other row looks for hidden patterns. Switches in the same row never talk to each other. That rule makes the model fast to run.
Imagine a music service. The first row lists songs you liked. The second row learns tastes, such as calm jazz or loud rock. After training, the model can guess which new songs fit your taste. It learns what typical data looks like and can produce similar examples.
An example from practice
A mid-sized online film rental service wants better recommendations for about 50,000 subscribers who have each rated a small share of roughly 5,000 titles. The data team trains a softmax RBM in which every user is a separate training case, visible units encode the five possible star ratings for each rated film, and 100 hidden units capture taste profiles.
Weights are shared across users, and missing ratings are simply left out of each user’s visible layer. Training runs with CD-1 for the first epochs, then CD-3, with a learning rate of 0.01 and weight decay. To predict a rating, the team computes hidden activations from a user’s known ratings and reads the expected value of the target film’s visible units.
On a held-out set, the RBM alone performs similarly to a matrix factorization baseline, but blending the two models lowers prediction error further, because they capture different patterns. The service deploys the blend and retrains it weekly as new ratings arrive.