rapid
RAPID: Training energy-based models through Restricted Axons and Pattern-InDuced correlations
view repo
We present an efficient method for unsupervised learning using Boltzmann machines. The method is rooted in the control of the spin-glass properties of the Ising model described by the Boltzmann machine's weights. This allows for very easy access to low-energy configurations. We apply RAPID, the combination of Restricting the Axons (RA) of the model and training via Pattern-InDuced correlations (PID), to learn the Bars and Stripes dataset of various sizes and the MNIST dataset. We show how, in these tasks, RAPID quickly outperforms standard techniques for unsupervised learning in generalization ability. Indeed, both the number of epochs needed for effective learning and the computation time per training step are greatly reduced. In its simplest form, PID allows to compute the negative phase of the log-likelihood gradient with no Markov chain Monte Carlo sampling costs at all.
READ FULL TEXT VIEW PDF
We propose a Las Vegas transformation of Markov Chain Monte Carlo (MCMC)...
read it
We review Boltzmann machines and energy-based models. A Boltzmann machin...
read it
Estimating the log-likelihood gradient with respect to the parameters of...
read it
Restricted Boltzmann Machine (RBM) is an energy based, undirected graphi...
read it
Unsupervised learning is about capturing dependencies between variables ...
read it
We introduce Delay Pruning, a simple yet powerful technique to regulariz...
read it
Restricted Boltzmann Machine (RBM) is a generative stochastic neural net...
read it
RAPID: Training energy-based models through Restricted Axons and Pattern-InDuced correlations
Machine learning has emerged as a disruptive technology transforming industries, society and science. Its perhaps most remarkable recent developments are based on supervised learning in deep neural networks. Yet unsupervised learning is expected to be much more important in the long term 2015LecunNature
. Energy-based models, with their ability of unsupervised learning of probability distributions for generative purposes, are promising building blocks of future machine learning systems. Among them, Boltzmann machines (BMs) have especially prospective properties. Their latent variables—called
hidden neurons
—allow for deep neural network architectures while the learning algorithm is remarkably simple 1983HintonProceedings.Yet training of BMs, as a particular instance of probabilistic graphical models Bishop2006PRML
, is hard due to the need of obtaining samples from the model built. Specifically, a set of averages with respect to training data and the defined model needs to be determined for every learning step. In general, such averages cannot be computed exactly for large networks because of the large dimensionality of the vector spaces involved, but they can be estimated by sampling through Markov chain Monte Carlo (MCMC) methods. Unfortunately, the sampling of BMs is hard and MCMC algorithms are numerically costly. At present, the most popular BMs are restricted Boltzmann machines (RBMs) with only one layer of hidden neurons and no intra-layer connections. This architecture usually allows for acceptable learning by means of simple MCMC-based algorithms such as Contrastive Divergence (CD). Improving sampling offers huge learning benefits and more numerically demanding methods, like Persistent Contrastive Divergence (PCD)
Tieleman2008pcd and Population Annealing Hukushima2003Population, have been developed to this end.Energy-based models are closely related to problems of statistical physics. In fact, the Boltzmann machine is a neural network with stochastic dynamics that resemble the thermal fluctuations of a physical system. Therefore, the powerful methods developed for statistical physics are among the most promising for dealing with the sampling problem of Boltzmann machines. These include modern MCMC algorithms for physical systems like Parallel Tempering Desjardins2010pt, Simulated Annealing 1992MarinariEPL or the Wang-Landau algorithm 2001WangPRL, which inspire the sampling of deep Boltzmann machines (DBMs) 2010SalakhutdinovProceedings. Other methods include Langevin dynamics Du2019EBM, or the use of mean-field equations like TAP Mezard2017Message.
The problem of sampling of BMs is so relevant and challenging that special hardware systems exploiting some physical processes have been developed to deal with such task. These include systems operating in the regime of classical physics Inagaki2016NTT; McMahon2016NTT, as well as based on purely quantum or hybrid classical-quantum machines. The two latter are examples of quantum-assisted machine learning. For example a purely quantum Boltzmann machine has been proposed based on the learning of a Boltzmann distribution of a quantum Hamiltonian 2018AminPRX. In the hybrid approach, quantum devices are used to sample from both classical and quantum Gibbs distributions as an alternative to MCMC methods 2018Perdomo_OrtizQST
. Both routes are promising, but have important drawbacks for practical applications. In the former, the applications are limited to small size cases due to the small number of qubits available in current quantum computers. Several experimental implementations of generative models have been realized in different quantum computing platforms, such as superconducting quantum integrated circuits
2019Hamilton; 2019Leyton-Ortega or quantum computers based in trapped ions 2019Zhu. For the sampling problem, one has to overcome the challenge posed by the sparse connectivity among qubits existing in current devices (see Ref. 2017Benedetti, where efforts in this direction are discussed and experimentally tested in a D-Wave quantum annealer, and Ref. Hauke2019 for a thorough review in quantum annealers). Importantly, there are classical-quantum hybrid approaches based in trapped-ion analog quantum systems, see e.g. Kokail2018.Perhaps the most profound result stemming from the statistical physics perspective of BMs is the understanding of the origin of the sampling hardness of such networks. The Boltzmann probability distribution is dominated by contributions from low energy configurations and efficient sampling must probe such configurations well. However, at the beginning of training, when typically the couplings between neurons are drawn at random, a Boltzmann machine is equivalent to the Ising model with long-range random couplings—known as the Sherrington-Kirkpatrick (SK) spin-glass model SpinGlassRev. Determining the lowest energy configuration of the Ising spin-glass model defined on a non-planar graph is an NP-complete problem Barahona1982complexity. Furthermore, Parisi’s replica symmetry breaking solution Parisi_1980 of the SK spin-glass model reveals that at low temperatures, the free energy landscape is composed of local minima separated by energy barriers which lead to ergodicity breaking. As the temperature is lowered, more minima and barriers arise and “ergodic components” further split in a stochastic branching process. The resulting structure of such thermodynamic states is ultrametric SGultrametricity; ultrametricity. Simple MCMC sampling algorithms which imitate thermal fluctuations, like Gibbs sampling, get trapped in the phase space (i.e. they present poor “mixing”) while global algorithms have to deal with an exponential number of local minima. Note that this is not a deficiency of the algorithms but a manifestation of the glassy nature of such systems. Indeed, real spin-glass materials exhibit glassy properties such as exponentially long relaxation times.
The first key point we rise in this paper is that BMs reproducing typical training data probability distributions are not in the true SK spin-glass phase. After the successful training of a BM, the low energy states representing training data cannot be very difficult to reach and Gibbs sampling should not get stuck in one of exponentially many local energy minima. Furthermore, if the training data is not ultrametrically distributed, the distribution of sampled outputs of properly trained BMs should neither be ultrametric. The fact that present, standard methods for training BMs lead to outputs that are more ultrametrically distributed than the training data BMultrametricity points actually to a deficiency of such methods. On the other hand, such outputs are still substantially less ultrametrically distributed than in SK spin-glass phase. In this paper, we explicitly show on a simple example that during training of RBMs, the accessibility of the low energy states via Gibbs sampling rises dramatically and that low energy states form only a few minima. This seems to indicate that the SK spin-glass phase of untrained Boltzmann machines constitutes an unnecessary bottleneck in the process of training.
Therefore, instead of pursuing the paramount problem of efficient sampling in the SK spin-glass phase, we take a radically different approach: we regularize the couplings in the Boltzmann machine in order to avoid a spin-glass behavior at any point of training. The way we impose such regularization while allowing for efficient training is the second key point of this paper and is presented in detail in Section II. This regularization suggests a new algorithm for estimating the gradient of the log-likelihood function, which we employ to train RBMs in various datasets, showing that the proposed technique allows for efficient learning and generalization. Furthermore, we show an improvement in training speed of orders of magnitude, both in the epoch time and in the number of epochs needed for learning, over traditional training methods. Indeed, we show how MCMC sampling is not a necessary requirement for training, reducing the numerical effort to a minimum.
We begin by recalling the standard BM, which consists of binary neurons (here we use values , which are standard in the physics of spin systems), separated into two disjoint sets of visible and hidden neurons. The energy of a given configuration of visible and hidden neurons is defined as:
(1) |
where weights describe connections (axons) between neurons, while are local biases. Alternatively, such BM setup describes spin systems where the weights describe interactions of pairs of spins and the biases are local magnetic fields. Different architectures of connections (i.e. different graphs whose vertices are neurons and edges denote non-zero weights) can be considered. For example, in RBMs, there are only connections between visible and hidden neurons, and no intra-layer connections are considered. However, in the most general case the neural network is fully connected. In the following we will neglect biases, as the main issues we discuss are related to the distribution of weights.
The probability of having a visible configuration is given by a Boltzmann distribution
(2) |
The goal of the training is to determine the parameters of the energy function (1) such that represents as close as possible the distribution underlying some training dataset . This is usually done by minimizing the negative log-likelihood,
(3) |
with respect to the weights of the . As is independent on these variables, the minimization is only performed to . The derivative of this term takes the form of
(4) |
where the bracket denotes the expectation value with respect to the probability distributions or for the data and model averages, respectively. Sampling from such distributions is the main challenge of BMs, as discussed previously. In fact, RBMs were introduced in order to facilitate sampling from . However, even for RBMs, efficient sampling from is still very difficult if the weights are random and thus the system is in the SK spin-glass phase.
The SK spin-glass phase is related to the so-called spin frustration, which occurs when there is no configuration that minimizes the energy of all pairwise interactions at the same time. For any closed loop of weights, at least one of the interaction energies cannot be minimized if the product of weight signs is negative. The exponential number of low energy minima characteristic of the SK spin-glass phase occurs with strong frustration. However, not all models with random weights exhibit such phenomena. In Ref. MattisFrustration, Mattis introduced a model with random weights but no frustration: consider a set of variables taking values . Defining the interaction between spins as given by , for any loop of weights the product of their signs is positive, since every enters such product squared. As a result the model has no frustration and its ground state is easily reachable. In fact, the configuration corresponds to the desired ground state. Mattis’ construction suggests a way to regularize weights with the aim of avoiding the SK spin-glass phase. However, in a learning scenario, a single configuration it is not flexible enough to allow for a wide range of values for (i.e., the model does not have enough plasticity to learn typical data distributions).
Here we employ a generalization of Mattis’ approach, with an arbitrary number of configurations—we will call these configurations patterns—, each described by a set of variables . The BM weights are constructed from the patterns via
(5) |
Such form of the weights is well known in machine learning from the Hopfield model of associative memory 1974little; 1982Hopfield, which implements the Hebbian rule that “neurons wire together if they fire together” 1949Hebb. Although the main focus in the Hopfield model is the retrieval of fixed patterns from the dynamics of a neural network instead of generalizing data probability distribution as in BMs, these models are closely related 2012Barra.
One of the standard figures of merit of the Hopfield model is the capacity, i.e., the number of independent random patterns that can be faithfully retrieved from a neural network of neurons. This quantity has been thoroughly studied 1985Amit; amit_1989, and in general, there exists a constant such that if the ratio the model is in a spin-glass phase, and patterns cannot be faithfully retrieved. However, if , the model is a desired “retrieval phase”, in which it is able to recover the patterns “stored” per as Eq. (5). For instance, for the Hopfield model at very low temperatures the value of this critical parameter is .
We employ Eq. (5
) as a way of regularizing the weights of a BM in order to avoid the SK spin-glass phase at any moment of training. In a typical instance of training a BM with Regularized Axons (RA), one would proceed to first choose a number of patterns
high enough to faithfully learn the data, and only then the choice of the number of hidden neurons would be performed, taking into account the desire of being outside the SK spin-glass phase by making the ratio small enough. In such regime, frustration in the system should be reduced and sampling of the low energy configurations greatly enabled. Furthermore, the patterns themselves are explicit low-energy states of the BM. This property was elaborated in PhysRevA.32.1007 for independent patterns of the Hopfield model in deep retrieval phase.Let us emphasize that we use Eq. (5) in conjunction with a low ratio in order to regularize the weights of the BM, not merely to alternatively represent a given set of weights. While the latter is possible through the mapping described in Ref. 2012Barra, if the weights of the BM describe a model in the SK spin-glass phase the associated Hopfield network will have a high ratio, thus being in the undesired non-retrieval phase.
patterns. The shaded regions denote the standard deviations after
instances of independent training.As mentioned above, for weights of the form of Eq. (5), when , the patterns are themselves low-energy configurations of the spin model of Eq. (1). Recalling that Boltzmann distributions of the form (2) give exponentially larger weights to low-energy configurations with respect to higher-energy ones, a consequence is that the model averages required for training, , can be well approximated by
(6) |
This suggests a natural procedure for minimizing the loss function in Eq. (
3): first, choose random patterns and compute the model’s weights via Eq. (5); second, compute and its derivatives with respect to each individual pattern component , and replace all averages over the model by averages over the patterns, as per Eq. (6); third, update according to such gradients,(7) |
where is some learning rate. The exact form of can be found in Appendix A.
To perform the last step, we relax the binary constraint on the values of —the fact that they take values in —since the gradients in Eq. (7), and therefore the updates to the patterns, take continuous values. This will lead to not representing real spin configurations. Different procedures, which we describe in Appendix C, can be implemented in order to solve such problem and to return to representing real spin configurations. Our results (depicted in Section III) show the prominence of two methods: (a) after a given number of updates, replace the value of a given by ; (b) bound the values of such that . Both methods show great results in simple datasets. The latter, despite losing the significance of as spin configurations, is better suited for more complex problems since it allows for continuous-valued weights.
Note that the presented procedure of estimating model averages, Eq. (6), does not require any MCMC sampling. Still, as is demonstrated in Section III, it already gives good results in learning various datasets. Avoiding MCMC decreases the complexity of the method, as the computational time of a single epoch of PID scales as while for CD it scales as . More importantly, by avoiding the frustrated SK spin-glass phase, the sampling from the model is very effective, and allows much faster training also in terms of the number of epochs.
In summary, the novelty of the combination of Regularized Axons and training via Pattern-InDuced correlations (RAPID) comes from: (i) avoiding the SK spin-glass phase at any moment of training by utilizing weights constructed via Eq. (5) while scaling to keep a low ratio (ii) exploiting the patterns introduced in Eq. (5) for approximating the low-energy space of the associated spin model in an efficient way, and (iii) relaxing the constraint of having binary pattern variables, in conjunction with a subsequent discretization/regularization, in order to easily implement updates while keeping patterns reasonably close to real configurations of binary spins. As we shown next, this recipe is sufficient for employing BMs to learn typical probability distributions in a practical way.
We proceed now to analyze the performance of RAPID in learning different datasets. To compare it with BMs trained through standard methods we will focus on the restricted architectures which are typically used. The models employed in this section, which can be found in compapp
, are implemented in PyTorch
pytorch via theebm-torch
module ebm-torch.As a first example, we trained an RBM architecture with a small number of visible neurons, , and relative to that, a large number of hidden neurons, . The small , along with the restricted architecture, allows for the exact calculation of the denominator in Eq. (2) in a reasonable time. This enables the exact computation of the loss function, Eq. (3), and thus to employ the exact gradients in Eq. (7) for unbiased training. Furthermore, the ground state energy can be exactly determined at any moment of training, irrespective of whether the system is in a SK spin-glass phase or not. Therefore, we can meaningfully contrast RAPID with training of exactly solved RBMs. Moreover, we also contrast it against standard methods employed for training larger RBMs when training with the exact gradients is intractable. In particular, we will perform comparisons against RBMs trained with CD and PCD with 10 Gibbs steps and—in the case of PCD—2048 fantasy particles. An appropriate benchmark problem is learning the Bars dataset, consisting of images with full vertical bars, containing a total of inequivalent images. The results of the comparisons are shown in Figs. 1 and 2.
Let us begin by discussing how the machines themselves change during successful learning. From the training perspective, the most important aspect of the machine being in the SK spin-glass regime or not is how hard it is to obtain a faithful distribution of states via sampling. To estimate this, we assess the ease of reaching the ground state via Gibbs sampling starting from random visible configurations. For doing so, after every epoch of training we initialize the visible neurons in a random configuration and we use Gibbs sampling to extract a representative configuration of the model. We perform Gibbs steps, after which we calculate the energy of the resulting configuration in the visible and hidden layers. We define the ratio of such energy to the true ground state energy as the Gibbs sampling GS accessibility.
In Fig. (a)a we show how the Gibbs sampling GS accessibility changes during learning. For RBMs trained with CD, PCD and exact gradients, one can see that: (i) they are initialized in a regime where Gibbs sampling does not reach low energy configurations, which is typical for SK spin-glasses; (ii) after training, they end up in a regime where Gibbs sampling is efficiently reaching the low energy sector (especially for machines trained with PCD and exact gradients). This strongly suggests that, after training, the machines are not in the SK spin-glass regime. Furthermore, it is clearly apparent that the regime of efficient Gibbs sampling is reached significantly faster with a more accurate gradient estimation (note the logarithmic scale of the horizontal axis). On the other hand, the RBM with RA presents efficient Gibbs sampling from the beginning. This proves that the weight regularization proposed is an effective method of avoidance of SK spin-glass regime.
In Fig. (b)b we consider a quantity more relevant during the training process: the proximity of the configurations employed by each method to compute the negative phase, , to the respective ground states. For the various training methods, we look for the lowest-energy configuration employed for the computation of the negative phase and calculate the ratio of that energy to the ground state energy, obtaining the method sampling accessibility. Note that, when employing the exact gradients, we have an explicit expression for and therefore there is no need of taking any samples from the model. Therefore, there is no curve in Fig. (b)b for the exact training method. For CD, the Gibbs sampling and method accessibilities are very similar, since the method for computing both is in eesence the same. The method accessibility is slightly better due to the fact that, in this case, the initial configurations before sampling are set to be images to be learnt. A similar penomenon can be observed in the curves for PCD. In this case, the method accessibility is better than Gibbs accessibility due to the fact that the fantasy particles employed in the sampling are always close to the ground state. For PID, the most dramatic improvement is noticed in the initial moments of training. The samples employed for computing the negative phase are much closer to the ground state than in any other method. This leads, as will be explicitly apparent from Fig. 2, to a much faster learning of the dataset. However, in later stages of training, other methods appear to give a better characterization of the ground state. This may, in fact, constitute a problem when learning more complex datasets. However, since the ground state is still accessible via standard Gibbs sampling (recall Fig. 1), one can abdicate Eq. (6) and go back to standard sampling techniques in RA models. In Section III.2 we elaborate in this matter.
In order to quantify the performance on the Bars learning task, we ask the models to reconstruct corrupted images from the dataset. Given an image A, we fix the top row of pixels (perpendicular to the direction of the bars), which implies fixing a set of neurons in the visible layer of the RBM. We perform Gibbs sampling, allowing for the rest of the visible neurons to be updated. Then, the Hamming distance (HD) between the machine generated image B and the given one A is calculated. We normalize such distance by dividing over the number of pixels of the image, this is, the number of visible neurons . In this way, for a random reconstruction, a pixel has a probability of of coinciding with the desired one, hence being the upper bound of our measure. Following the standard procedure of unsupervised learning, we divide the Bars images into two sets: a training set consisting of 10 images, and a test set containing the remaining 4 images. Note that, in the case of spin values and no biases, the energies of configurations and are the same. Therefore, in order to ensure that there is no “information leakage” from the training set to the test set, we design them in such a way that the negative of every configuration in the training set is also in the training set, and the negative of every configuration in the test set is also in the test set.
In Figs. (a)a and (b)b we plot how the reconstruction of the training and test sets, respectively, change during training. One observes that: (i) the different training methods for standard RBMs lead to identical memorization (the reduction of the HD in the training set) while generalization (the reduction of the HD in the test set, which is never used in training) is best when training with exact gradients, then with PCD, and finally with CD. (ii) The RAPID approach leads to orders of magnitude faster training when measured in epochs (recall the logarithmic scale of the horizontal axis). In fact, even after the first epoch of training the HD is already notably below the random-reconstruction limit. (iii) There is almost no difference between the performance on memorization and generalization when employing RAPID. This constitutes a proof that the corresponding model not only truly learns, but also does it very efficiently. It is important to note that, in this example, PID is not employing any sort of MCMC sampling, so the actual speed up of training time measured in terms of processor operations is even greater.
Finally, one may wonder how similar are RA- and standard RBMs after training. For doing so, we perform a Singular Value Decomposition (SVD) of the weight matrices of trained models. Such results are shown in Fig.
3. Clearly, in all cases, four large singular values stand out. Interestingly, the form of the singular value decomposition of weight matrix (see, for instance, (SVDRBM, Eq. (10))) invokes Eq. (5), such that a clear analogy between the patterns employed in RA and the SVD eigenvectors can be drawn. The four large singular values observed in Fig.
3 suggest that only patterns are needed to describe the weight matrix of a standard machine trained in 4x4 Bars problem, in all cases of training methods studied. We note that SVD analysis of standard RBMs trained in MNIST has been already performed in Ref. SVDRBM, where it was reported that the SVD spectrum develops a “tail” of relatively few but large singular values. Taking also into account that the standard RBMs presented on Fig. (a)a evolved towards an easy-sampling regime, we can interpret that the RA-RBM may be regarded as an actual general model of trained standard RBMs., a batch size of 120 and was trained with 80% of the dataset (6550 images). The shaded regions denote the standard deviations in 100 independent training instances. The inset shows instances sampled from the model. The leftmost samples, surrounded in orange, were not part of the training set. (b) In more complex datasets, such as MNIST, it is more difficult to assess quantitatively the effectiveness of training. Nevertheless, rank-restricted weights with Hebbian training are able to generate valid instances of the binarized-MNIST dataset. For generating these results, we used a model with
, , and .We now proceed to apply RAPID for unsupervised learning of more complex datasets. First, we consider the -pixel Bars and Stripes (BAS) dataset, which consists of 8188 images containing only vertical bars or horizontal stripes. As the complexity of the problem to solve increases, one needs to increase the number of auxiliary patterns and the number of hidden neurons . In Fig. (a)a we show the results for the HD of reconstructed images. The HD for the training and test set decrease parallel to each other, proving that the model trained is not just memorizing the images of the training set, but learning its fundamental features and being able to generalize the results to the test set. The inset shows images generated from sampling the model starting from an unbiased blank image where (recall that the allowed values for the neurons are ). As a powerful print of the generalization power of the model, we see that not only it reconstructs satisfactorily corrupted unknown images (the results on the HD), but moreover it is able to generate images that were not contained in the training set. Remarkably, while standard RBMs were learning 12x12 BAS much slower than 4x4 Bars (note this is standard behaviour), RAPID allowed to learn bigger datasets much faster than smaller ones, as measured by the number of epochs. The explanation for this phenomenon lies in both the larger plasticity of the weights allowed by a larger and a larger training data set, as each epoch contains much more updating iterations in larger datasets.
As a final example, we employ RAPID to train an RBM in the MNIST dataset. Here, the complexity of the dataset is much higher than in the BAS example, and so it requires to increase the size of the machine both in terms of and . However, due to its RA construction and PID training, scaling up these parameters does not cause an important impact in terms of computation speed.
This is the first case in which we observe that the low-energy space characterization of PID is not satisfactory to perform proper learning (recall Fig. (b)b). In fact, employing just Eq. (6) for computing the negative phase led to a strong overfitting. In order to avoid this and to achieve a good approximation of , we employ the patterns as initial seeds for steps of Gibbs sampling. The resulting configurations after the sampling are those employed for computing the average under the model. This produces two things: first, Gibbs sampling enhances the proximity of the patterns to the ground state of the model; second, due to the stochastic nature of the sampling, it introduces fluctuations which are shown to help to overcome overfitting. While this procedure brings the cost of computing thje negative phase back to , the reduction in training epochs consequence of using RA is still present.
We show the results of generating MNIST images in Fig. (b)b. In this case it is considerably more difficult to produce a quantitative assessment of the effectiveness of training, since the ground state can not be exactly computed efficiently (therefore, one cannot reliably compute the accessibilities of Fig. 1), and a discrepancy in Hamming distance does not necessarily imply a bad generation of instances. Therefore, in this case we restrict ourselves to present qualitative images obtained by sampling from the model.
We have argued that the SK spin-glass phase occurring in the initial instances of training BMs is an unnecessary complication for learning typical probability distributions. Indeed, we have shown in simple examples that during the training of typical problems, BMs leave the SK spin-glass regime they begin at. We substantiated this claim by studying the evolution of standard RBMs trained with CD, PCD and exact gradient methods for the simple 4x4 Bars dataset. We measured the Gibbs sampling accessibility of low-energy states for such machines and observed radical changes during learning.
Our main result is the RAPID approach, which consists of: (i) Regularizing the Axons (RA) on the model by utilizing the Hebbian rule to construct the weights of a Boltzmann machine by means of random patterns. The number of hidden neurons in the model is chosen in order to keep the ratio low enough so as to avoid an SK spin-glass regime in the first place; (ii) training via Pattern-InDuced correlations (PID), Eq. (6), to approximate the negative phase in the log-likelihood gradient. Together, RAPID solves in practice the sampling problem of BM for modeling typical probability distributions. The speedup is shown to be large in terms of epochs and even greater measured in number of operations, even when MCMC is used to boost the PID method. Finally, we have proven with several examples that RAPID leads to models that learn very efficiently and generalize training data, outperforming existing training techniques.
Although the cases presented are significant examples, the question on how restrictive the RA construction is for learning general probability distributions still remains. Based on the training evolution of the Gibbs sampling accessibility, and the singular value decomposition of weight matrices of trained RBMs shown in this article and in Ref. SVDRBM, we conjecture that trained RBMs are well approximated by RA-RBMs. In that view, the possibility of deficient training of RA-RBMs may only come from a low number of patterns in the model.
This brings up the question about the interpretation of the patterns . Contrary to the patterns in the Hopfield model, those in RA certainly do not contain just memorized training data. First, because the typical number of patterns in our experiments ( for the Bars dataset, for the BAS dataset, and for MNIST) is much smaller than the size of the training data set or than the number of neurons in the model. Second, because we showed that RAPID effectively learns to generalize beyond the training data. Third, because each pattern has visible and hidden parts—the latter usually much bigger—whereas training images are inputs only for the visible part. An interesting line of future work is therefore analyzing how the information is generalized and actually stored in the patterns, and how to employ this information for discrimination or assisted discovery carter2017AIA.
In practical implementations of RAPID, we observed that the number of patterns plays a major role in the performance of the model. We observed that a too small for complex problems may lead to overfitting. On the other hand, increasing results in the need of increasing accordingly to avoid the spin-glass phase. This implies an increase on the RAM that, nevertheless, is heavily countered by the speedup in learning time offered by RAPID.
In this paper, we focused on experiments with restricted Boltzmann machines, in order to carefully compare RAPID with standard machines and training algorithms. However, RAPID is by no means restricted to RBMs. In fact we expect that RAPID, or variations of it, will bring the long-sought-after effective sampling and training of deep Boltzmann machines, as the principles behind RAPID can be applied to any energy-based model.
We acknowledge Fundació Obra Social “la Caixa” (LCF/BQ/ES15/10360001 and LCF-ICFO), the Spanish Ministry MINECO (FISICATEAMO FIS2016-79508-P, QIBEQI FIS2016-80773P, Severo Ochoa grants SEV-2015-0522 and FPI), the European Social Fund, the AXA Chair in Quantum Information Science, Fundació Cellex, Generalitat de Catalunya (AGAUR Grants No. 2017 SGR 1341, SGR 1381 and CERCA Programme), the ERC AdG OSYRIS and NOQIA, the ERC CoG QITBOX, EU FETPRO QUIC, and the National Science Centre, Poland-Symfonia Grant No. 2016/20/W/ST4/00314.
In a model with RA, the weights are not the ultimate parameters to be fixed by training. These are, rather, the values of the auxiliary patterns . In this appendix we detail the calculation of the update rule for the auxiliary patterns. We focus here in the training of an RBM, just as explained in the main text. We start by recalling that the probability of observing a state of the visible variables is given by
(8) |
where the free energy is defined from the expression . As stated in the main text, we will consider here a RBM with no biases. For the case of a binary hidden layer where , one can give a closed-form expression to it:
(9) |
Our goal is to find the set of parameters (which we call for simplicity) such that becomes as close as possible to the underlying some training dataset . To compare them we employ the log-likelihood . Introducing Eq. (8) to the previous we find that
(10) |
Expanding this expression and writing it in terms of the free energy, we obtain
(11) | ||||
(12) | ||||
(13) |
where for simplicity we have introduced the partition function , and denotes the cardinality of .
Once the loss function is defined, we can update the weights using, e.g., the gradient descent method , which in our case means
(14) |
One can distinguish clearly here the positive and negative phases. The positive phase is the first term, evaluated only on the instances of the training set, while the negative phase is the negative term, that is evaluated on every possible configuration of the visible nodes. In the case of standard RBMs, the ultimate parameter that one desires to fix are the weights . For these, the derivative of the free energy function is
(15) |
where we have assumed the requirements of the models in the main text, namely that we have spin variables (i.e., ) and that all biases are zero. When considering RAPID, the ultimate parameters to be determined are the auxiliary patterns , with which the weights are later computed by using Eq. (5). The gradient of the free energy with respect to the individual pattern neurons is
(16) |
(17) |
Note that, in this case, we employ roman indices for denoting the visible neurons in a pattern, and greek indices for the hidden neurons.
In this appendix we analytically calculate the computational cost of training RBMs following both PID and CD, the most-used sampler in this machines. The main difference in complexity is the calculation of the negative phase, namely the second term of Eq. (4). In the case of PID, computing this term is trivial as it is the averaged outer product of the auxiliary patterns. However, one needs to take into account the cost of calculating the weights after each update following Eq. (5). This implies multiplying times a vector of size (i.e. each auxiliary pattern). The complexity of such procedure scales as .
In the case of CD, the most basic algorithm consists on doing Gibbs steps from an initial random visible configuration. From here, one calculates the activation probability of each hidden neuron as
(18) |
where
is the sigmoid function. This calculation has a computational cost of
. Note that here we consider the general case where the biases can take nonzero values. To complete a Gibbs step, one needs to calculate the value of the visible layer given the hidden vector obtained from Eq. (18) by(19) |
which again has a computational cost of . Summing up both contributions and taking into account that these procedure is performed times to approximate unbiased sampling, the total complexity of CD procedure scales as . Considering that , this shows the superiority of PID in terms of computational cost.
Due to the gradient calculated in Eq. (7), , being continuous, the values of the neurons in the auxiliary patterns will also be continuous after the updates are applied. In the following we describe two methods to bring the continuous-valued, updated parameters back into discrete, real spin configurations:
Sign discretization: The first method amounts to simply substitute the value of each of the continuous variable by its sign, i.e.,
(20) |
This not only ensures that the auxiliary neurons are binary, but also acts as a regularizer, avoiding the divergence of the .
Value restriction: When training in more complex datasets, the expressivity of the machine can be enhanced by considering that the auxiliary neurons are continuous. In such case, we no longer discretize them. In order to prevent the divergence of the weights, we restrict . The value of is arbitrary. In the examples shown in this paper we choose . However, for other values considered, we observe similar results in terms of the quality of training.
In both procedures it is crucial to choose when to perform either the discretization or the restriction in the given range. For the former, discretizing too often may result in the erasure of the information learnt by the machine, as the cumulant of the updates before the discretization may have not be as big as to change the sign of a given . Not discretizing often enough may result on a similar result. For example, if the first updates of a are positive, subsequent negative updates will have no effect in , as its value may be very different from zero. This method was applied to the BAS examples shown below, both the and datasets, by discretizing the patterns after every epoch of training, this is, after the end of every pass of the full dataset. Note that an alternative solution may be to employ a learning rate large enough so as to permit an appropriate size of the cumulants.
For the latter, i.e. the restriction of , a similar approach holds. However, given that the effect of such procedure on the value of the patterns is not as dramatic as in the previous case, it can be applied much often. We show the validity of this procedure in the MNIST example. There, the value of the patterns is checked and bound after every update.
Comments
There are no comments yet.