# Boltzmann machine

A graphical representation of an example Boltzmann machine. Each undirected edge represents dependency. In this example there are 3 hidden units and 4 visible units. This is not a restricted Boltzmann machine.

A Boltzmann machine (also called stochastic Hopfield network with hidden units) is a type of stochastic recurrent neural network (and Markov random field[citation needed]).

Boltzmann machines can be seen as the stochastic, generative counterpart of Hopfield networks. They were one of the first neural networks capable of learning internal representations,[clarification needed] and are able to represent and (given sufficient time) solve difficult combinatoric problems.

They are theoretically intriguing because of the locality and Hebbian[clarification needed] nature of their training algorithm, and because of their parallelism and the resemblance of their dynamics to simple physical processes. Boltzmann machines with unconstrained connectivity have not proven useful for practical problems in machine learning or inference, but if the connectivity is properly constrained, the learning can be made efficient enough to be useful for practical problems.[1]

They are named after the Boltzmann distribution in statistical mechanics, which is used in their sampling function. That's why they are called "energy based models" (EBM). They were invented in 1985 by Geoffrey Hinton, then a Professor at Carnegie Mellon University, and Terry Sejnowski, then a Professor at Johns Hopkins University.[2]

## Structure

A graphical representation of a Boltzmann machine with a few weights labeled. Each undirected edge represents dependency and is weighted with weight ${\displaystyle w_{ij}}$. In this example there are 3 hidden units (blue) and 4 visible units (white). This is not a restricted Boltzmann machine.

A Boltzmann machine, like a Hopfield network, is a network of units with an "energy" defined for the overall network. Its units produce binary results. Unlike Hopfield nets, Boltzmann machine units are stochastic. The global energy, ${\displaystyle E}$, in a Boltzmann machine is identical in form to that of a Hopfield network:

${\displaystyle E=-\left(\sum _{i

Where:

• ${\displaystyle w_{ij}}$ is the connection strength between unit ${\displaystyle j}$ and unit ${\displaystyle i}$.
• ${\displaystyle s_{i}}$ is the state, ${\displaystyle s_{i}\in \{0,1\}}$, of unit ${\displaystyle i}$.
• ${\displaystyle \theta _{i}}$ is the bias of unit ${\displaystyle i}$ in the global energy function. (${\displaystyle -\theta _{i}}$ is the activation threshold for the unit.)

Often the weights, ${\displaystyle w_{ij}}$, are represented as a symmetric matrix ${\displaystyle W=[w_{ij}]}$, with zeros along the diagonal.

## Unit state probability

The difference in the global energy that results from a single unit ${\displaystyle i}$ equaling 0 (off) versus 1 (on), written ${\displaystyle \Delta E_{i}}$, assuming a symmetric matrix of weights, is given by:

${\displaystyle \Delta E_{i}=\sum _{j>i}w_{ij}\,s_{j}+\sum _{j

This can be expressed as the difference of energies of two states:

${\displaystyle \Delta E_{i}=E_{\text{i=off}}-E_{\text{i=on}}}$

Substituting the energy of each state with its relative probability according to the Boltzmann factor (the property of a Boltzmann distribution that the energy of a state is proportional to the negative log probability of that state) gives:

${\displaystyle \Delta E_{i}=-k_{B}\,T\ln(p_{\text{i=off}})-(-k_{B}\,T\ln(p_{\text{i=on}}))}$

where ${\displaystyle k_{B}}$ is Boltzmann's constant and is absorbed into the artificial notion of temperature ${\displaystyle T}$. We then rearrange terms and consider that the probabilities of the unit being on and off must sum to one:

${\displaystyle {\frac {\Delta E_{i}}{T}}=\ln(p_{\text{i=on}})-\ln(p_{\text{i=off}})}$
${\displaystyle {\frac {\Delta E_{i}}{T}}=\ln(p_{\text{i=on}})-\ln(1-p_{\text{i=on}})}$
${\displaystyle {\frac {\Delta E_{i}}{T}}=\ln \left({\frac {p_{\text{i=on}}}{1-p_{\text{i=on}}}}\right)}$
${\displaystyle -{\frac {\Delta E_{i}}{T}}=\ln \left({\frac {1-p_{\text{i=on}}}{p_{\text{i=on}}}}\right)}$
${\displaystyle -{\frac {\Delta E_{i}}{T}}=\ln \left({\frac {1}{p_{\text{i=on}}}}-1\right)}$
${\displaystyle \exp \left(-{\frac {\Delta E_{i}}{T}}\right)={\frac {1}{p_{\text{i=on}}}}-1}$

Solving for ${\displaystyle p_{\text{i=on}}}$, the probability that the ${\displaystyle i}$-th unit is on gives:

${\displaystyle p_{\text{i=on}}={\frac {1}{1+\exp(-{\frac {\Delta E_{i}}{T}})}}}$

where the scalar ${\displaystyle T}$ is referred to as the temperature of the system. This relation is the source of the logistic function found in probability expressions in variants of the Boltzmann machine.

## Equilibrium state

The network runs by repeatedly choosing a unit and resetting its state. After running for long enough at a certain temperature, the probability of a global state of the network depends only upon that global state's energy, according to a Boltzmann distribution, and not on the initial state from which the process was started. This means that log-probabilities of global states become linear in their energies. This relationship is true when the machine is "at thermal equilibrium", meaning that the probability distribution of global states has converged. Running the network beginning from a high temperature, its temperature gradually decreases until reaching a thermal equilibrium at a lower temperature. It then may converge to a distribution where the energy level fluctuates around the global minimum. This process is called simulated annealing.

To train the network so that the chance it will converge to a global state is according to an external distribution over these states, the weights must be set so that the global states with the highest probabilities get the lowest energies. This is done by training.

## Training

The units in the Boltzmann machine are divided into 'visible' units, V, and 'hidden' units, H. The visible units are those that receive information from the 'environment', i.e. the training set is a set of binary vectors over the set V. The distribution over the training set is denoted ${\displaystyle P^{+}(V)}$.

As is discussed above, the distribution over global states converges as the Boltzmann machine reaches thermal equilibrium. We denote this distribution, after we marginalize it over the hidden units, as ${\displaystyle P^{-}(V)}$.

Our goal is to approximate the "real" distribution ${\displaystyle P^{+}(V)}$ using the ${\displaystyle P^{-}(V)}$ produced (eventually) by the machine. To measure how similar the two distributions are, the Kullback–Leibler divergence, ${\displaystyle G}$ is

${\displaystyle G=\sum _{v}{P^{+}(v)\ln \left({\frac {P^{+}(v)}{P^{-}(v)}}\right)}}$

where the sum is over all the possible states of ${\displaystyle V}$. ${\displaystyle G}$ is a function of the weights, since they determine the energy of a state, and the energy determines ${\displaystyle P^{-}(v)}$, as promised by the Boltzmann distribution. Hence, we can use a gradient descent algorithm over ${\displaystyle G}$, so a given weight, ${\displaystyle w_{ij}}$ is changed by subtracting the partial derivative of ${\displaystyle G}$ with respect to the weight.

There are two alternating phases to Boltzmann machine training. One is the "positive" phase where the visible units' states are clamped to a particular binary state vector sampled from the training set (according to ${\displaystyle P^{+}}$). The other is the "negative" phase where the network is allowed to run freely, i.e. no units have their state determined by external data. Surprisingly enough, the gradient with respect to a given weight, ${\displaystyle w_{ij}}$, is given by the simple proven equation[3]:

${\displaystyle {\frac {\partial {G}}{\partial {w_{ij}}}}=-{\frac {1}{R}}[p_{ij}^{+}-p_{ij}^{-}]}$

where:

• ${\displaystyle p_{ij}^{+}}$ is the probability that units i and j are both on when the machine is at equilibrium on the positive phase.
• ${\displaystyle p_{ij}^{-}}$ is the probability that units i and j are both on when the machine is at equilibrium on the negative phase.
• ${\displaystyle R}$ denotes the learning rate

This result follows from the fact that at thermal equilibrium the probability ${\displaystyle P^{-}(s)}$ of any global state ${\displaystyle s}$ when the network is free-running is given by the Boltzmann distribution (hence the name "Boltzmann machine").

Remarkably, this learning rule is fairly biologically plausible because the only information needed to change the weights is provided by "local" information. That is, the connection (or synapse biologically speaking) does not need information about anything other than the two neurons it connects. This is far more biologically realistic than the information needed by a connection in many other neural network training algorithms, such as backpropagation.

The training of a Boltzmann machine does not use the EM algorithm, which is heavily used in machine learning. By minimizing the KL-divergence, it is equivalent to maximizing the log-likelihood of the data. Therefore, the training procedure performs gradient ascent on the log-likelihood of the observed data. This is in contrast to the EM algorithm, where the posterior distribution of the hidden nodes must be calculated before the maximization of the expected value of the complete data likelihood during the M-step.

Training the biases is similar, but uses only single node activity:

${\displaystyle {\frac {\partial {G}}{\partial {\theta _{i}}}}=-{\frac {1}{R}}[p_{i}^{+}-p_{i}^{-}]}$

## Problems

The Boltzmann machine would theoretically be a rather general computational medium. For instance, if trained on photographs, the machine would theoretically model the distribution of photographs, and could use that model to, for example, complete a partial photograph.

Unfortunately, there is a serious practical problem with the Boltzmann machine, namely that it seems to stop learning correctly when the machine is scaled up to anything larger than a trivial machine.[citation needed] This is due to a number of effects, the most important of which are:

• the time the machine must be run in order to collect equilibrium statistics grows exponentially with the machine's size, and with the magnitude of the connection strengths[citation needed]
• connection strengths are more plastic when the units being connected have activation probabilities intermediate between zero and one, leading to a so-called variance trap. The net effect is that noise causes the connection strengths to follow a random walk until the activities saturate.

## Restricted Boltzmann machine

Graphical representation of a restricted Boltzmann machine. The four blue units represent hidden units, and the three red units represent visible states. In restricted Boltzmann machines there are only connections (dependencies) between hidden and visible units, and none between units of the same type (no hidden-hidden, nor visible-visible connections).

Although learning is impractical in general Boltzmann machines, it can be made quite efficient in an architecture called the "restricted Boltzmann machine" or "RBM" which does not allow intralayer connections between hidden units. After training one RBM, the activities of its hidden units can be treated as data for training a higher-level RBM. This method of stacking RBMs makes it possible to train many layers of hidden units efficiently and is one of the most common deep learning strategies. As each new layer is added the overall generative model gets better.

There is an extension to the restricted Boltzmann machine that affords using real valued data rather than binary data. Along with higher order Boltzmann machines, it is outlined here [1].

One example of a practical application of Restricted Boltzmann machines is the performance improvement of speech recognition software.[4]

## Deep Boltzmann machine

A deep Boltzmann machine (DBM) is a type of binary pairwise Markov random field (undirected probabilistic graphical model) with multiple layers of hidden random variables. It is a network of symmetrically coupled stochastic binary units. It comprises a set of visible units ${\displaystyle {\boldsymbol {\nu }}\in \{0,1\}^{D}}$ and layers of hidden units ${\displaystyle {\boldsymbol {h}}^{(1)}\in \{0,1\}^{F_{1}},{\boldsymbol {h}}^{(2)}\in \{0,1\}^{F_{2}},\ldots ,{\boldsymbol {h}}^{(L)}\in \{0,1\}^{F_{L}}}$. No connection links units of the same layer (like RBM). For the DBM, the probability assigned to vector ν is

${\displaystyle p({\boldsymbol {\nu }})={\frac {1}{Z}}\sum _{h}e^{\sum _{ij}W_{ij}^{(1)}\nu _{i}h_{j}^{(1)}+\sum _{jl}W_{jl}^{(2)}h_{j}^{(1)}h_{l}^{(2)}+\sum _{lm}W_{lm}^{(3)}h_{l}^{(2)}h_{m}^{(3)}},}$

where ${\displaystyle {\boldsymbol {h}}=\{{\boldsymbol {h}}^{(1)},{\boldsymbol {h}}^{(2)},{\boldsymbol {h}}^{(3)}\}}$ are the set of hidden units, and ${\displaystyle \theta =\{{\boldsymbol {W}}^{(1)},{\boldsymbol {W}}^{(2)},{\boldsymbol {W}}^{(3)}\}}$ are the model parameters, representing visible-hidden and hidden-hidden interactions.[5] In a DBN only the top two layers form a restricted Boltzmann machine (which is an undirected graphical model), while lower layers form a directed generative model. In a DBM all layers are symmetric and undirected.

Like DBNs, DBMs can learn complex and abstract internal representations of the input in tasks such as object or speech recognition, using limited, labeled data to fine-tune the representations built using a large supply of unlabeled sensory input data. However, unlike DBNs and deep convolutional neural networks, they adopt the inference and training procedure in both directions, bottom-up and top-down pass, which allow the Deep Boltzmann machine to better unveil the representations of the input structures.[6][7][8]

However, the slow speed of DBMs limits their performance and functionality. Because exact maximum likelihood learning is intractable for DBMs, only approximate maximum likelihood learning is possible. Another option is to use mean-field inference to estimate data-dependent expectations and approximate the expected sufficient statistics by using Markov chain Monte Carlo (MCMC).[5] This approximate inference, which must be done for each test input, is about 25 to 50 times slower than a single bottom-up pass in DBMs. This makes joint optimization impractical for large data sets, and restricts the use of DBMs for tasks such as feature representation.

## History

The Boltzmann machine is a Monte Carlo version of the Hopfield network.

The idea of using stochastic weights in Ising models considered by:

• David Sherrington and Scott Kirkpatrick, Solvable Model of a Spin-Glass, Phys. Rev. Lett. 35, 1792 (1975)

However, in cognitive sciences, it is often thought to have been first described by:

• Geoffrey E. Hinton and Terrence J. Sejnowski, Analyzing Cooperative Computation. In Proceedings of the 5th Annual Congress of the Cognitive Science Society, Rochester, New York, May 1983.
• Geoffrey E. Hinton and Terrence J. Sejnowski, Optimal Perceptual Inference. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 448–453, IEEE Computer Society, Washington, D.C., June 1983.

However, it should be noted that these articles appeared after the seminal publication by John Hopfield, where the connection to physics and statistical mechanics was made in the first place, mentioning spin glasses:

• John J. Hopfield, Neural networks and physical systems with emergent collective computational abilities, Proc. Natl. Acad. Sci. USA, vol. 79 no. 8, pp. 2554–2558, April 1982.

The idea of applying the Ising model with annealed Gibbs sampling is also present in Douglas Hofstadter's Copycat project:

• Hofstadter, Douglas R., The Copycat Project: An Experiment in Nondeterminism and Creative Analogies. MIT Artificial Intelligence Laboratory Memo No. 755, January 1984.
• Hofstadter, Douglas R., A Non-Deterministic Approach to Analogy, Involving the Ising Model of Ferromagnetism. In E. Caianiello, ed. The Physics of Cognitive Processes. Teaneck, New Jersey: World Scientific, 1987.

Similar ideas (with a change of sign in the energy function) are also found in Paul Smolensky's "Harmony Theory".

The explicit analogy drawn with statistical mechanics in the Boltzmann Machine formulation led to the use of terminology borrowed from physics (e.g., "energy" rather than "harmony"), which has become standard in the field. The widespread adoption of this terminology may have been encouraged by the fact that its use led to the importation of a variety of concepts and methods from statistical mechanics. However, there is no reason to think that the various proposals to use simulated annealing for inference described above were not independent. (Helmholtz made a similar analogy during the dawn of psychophysics.)

Ising models are now considered to be a special case of Markov random fields, which find widespread application in various fields, including linguistics, robotics, computer vision, and artificial intelligence.

${\displaystyle G'=\sum _{v}{P^{-}(v)\ln \left({\frac {P^{-}(v)}{P^{+}(v)}}\right)}}$.

## References

1. ^ Osborn, Thomas R. (1 January 1990). "Fast Teaching of Boltzmann Machines with Local Inhibition". International Neural Network Conference. Springer Netherlands. p. 785. doi:10.1007/978-94-009-0643-3_76. ISBN 978-0-7923-0831-7.
2. ^ Ackley, David H; Hinton Geoffrey E; Sejnowski, Terrence J (1985), "A learning algorithm for Boltzmann machines", Cognitive Science, 9 (1): 147–169
3. ^ Ackley, David H.; Hinton, Geoffrey E.; Sejnowski, Terrence J. (1985). "A Learning Algorithm for Boltzmann Machines" (PDF). Cognitive Science. 9 (1): 147–169. doi:10.1207/s15516709cog0901_7. Archived from the original (PDF) on 18 July 2011.
4. ^ Yu, Dong; Dahl, George; Acero, Alex; Deng, Li (2011). "Context-Dependent Pre-trained Deep Neural Networks for Large Vocabulary Speech Recognition" (PDF). Microsoft Research. 20.
5. ^ a b Hinton, Geoffrey; Salakhutdinov, Ruslan (2012). "A better way to pretrain deep Boltzmann machines" (PDF). Advances in Neural. 3: 1–9.
6. ^ Hinton, Geoffrey; Salakhutdinov, Ruslan (2009). "Efficient Learning of Deep Boltzmann Machines" (PDF). 3: 448–455.
7. ^ Bengio, Yoshua; LeCun, Yann (2007). "Scaling Learning Algorithms towards AI" (PDF). 1: 1–41.
8. ^ Larochelle, Hugo; Salakhutdinov, Ruslan (2010). "Efficient Learning of Deep Boltzmann Machines" (PDF): 693–700.
9. ^ Liou, C.-Y.; Lin, S.-L. (1989). "The other variant Boltzmann machine". International Joint Conference on Neural Networks. Washington, D.C., USA: IEEE. pp. 449–454. doi:10.1109/IJCNN.1989.118618.