Foundations to Frontier
Tests
E. Deep Learning › E6 Early and Energy-Based Networks

Deep Belief Networks

A deep belief network (DBN) is built by training RBMs one layer at a time, each on the hidden activities of the one below, and then fine-tuning the whole stack, generatively or as a classifier. Hinton, Osindero and Teh's 2006 paper showed this greedy pretraining could train deep networks when random initialisation failed, which restarted deep learning. This page covers greedy layer-wise training, why it improves a variational bound, generation by up-down passes, and why pretraining largely faded once better initialisation and optimisers arrived. In the exercises you build a two-RBM stack that encodes and decodes images far better than random weights, then show that pretraining on 1000 unlabelled images raised a sigmoid network's accuracy by 4 points with 20 labels and 17 points with 200.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Build a deep network one layer at a time

In the early 2000s deep networks trained from random weights mostly failed. Deep belief networks offered a workaround: first train a single RBM on the raw data, so its hidden units learn simple features; then treat those features as data and train another RBM on top; and so on. No labels are needed for this. Only at the end are the labels used to fine-tune the whole stack. Each layer starts already doing something sensible.

Gibbs sampling a 4-unit Boltzmann machine
0000000100100011010001010110011110001001101010111100110111101111
KL(sample ‖ exact) = 0.015 · switches between all-down (0000) and all-up (1111): 54
Outlines: exact probabilities of the 16 states; filled bars: fraction of sweeps the chain spent in each. With weak coupling the chain mixes quickly and the histogram matches. With strong coupling at low temperature the two aligned states dominate and are separated by improbable states, so the chain rarely switches: after a few hundred sweeps it may never have visited one of them. That slow mixing is why exact Boltzmann-machine learning is impractical and why RBMs use contrastive divergence.
Why engineers care

DBNs restarted deep learning in 2006 and showed the power of unsupervised pretraining, the idea behind today’s self-supervised foundation models. Pretraining on plentiful unlabelled data, then fine-tuning on a few labels, is still how most perception and language systems are built, just with different pretraining tasks.

📝 Quick check (Level 0)
0/3 answered
  1. 1. A DBN is pretrained…
  2. 2. Pretraining uses…
  3. 3. DBNs were introduced in…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

By hand

  • Greedy training:

    1. Train RBM 1 on the data v.
    2. Compute h¹ = p(h | v) for every example.
    3. Train RBM 2 on h¹, and so on.

    For layer sizes 784–500–500–2000 the RBMs are (784, 500), (500, 500) and (500, 2000).

  • Parameters of a stack: each RBM has a·b weights and a + b biases. For 36–32–32: 1152 + 68 + 1024 + 64 = 2308.

  • Fine-tuning as a classifier: use the stack’s weights to initialise a sigmoid MLP, add an output layer and train with labels.

  • Generation: run Gibbs sampling in the top RBM, then pass downwards through the lower layers’ generative weights.

  • Up-down reconstruction: with all parameters zero, every probability is 0.5, so the reconstruction of any input is 0.5 everywhere.

📝 Quick check (Level 1)
0/3 answered
  1. 1. The second RBM is trained on…
  2. 2. RBMs in a 784–500–500–2000 stack:
  3. 3. Fine-tuning a DBN as a classifier adds…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.

DBNs in code

Exercise 1. On 400 noisy copies of four 20-bit prototypes, one trained RBM (12 hidden units) gave an up-down reconstruction error of 0.041 against 0.250 for random weights; stacking a second RBM (6 units) gave 0.046. The stack compressed each image to 6 numbers and decoded it nearly as well.

Practice.

  • Today, unsupervised pretraining is done with autoencoders (masked or denoising), contrastive learning or next-token prediction rather than RBMs.
  • RBM pretraining still helps where labels are scarce and architectures are small and sigmoidal (as in exercise 2).
  • With ReLU, careful initialisation, normalisation and Adam, deep networks train from random initialisation, which is why DBN pretraining faded after about 2012.
layers, inp = [], X
for size in (500, 500, 2000):
    W, b, c = train_rbm(inp, size); layers.append((W, b, c)); inp = sigmoid(inp @ W + c)
🐍 Exercise 1: stacking RBMs
Train an RBM on data and a second on its hidden probabilities, and compare the stack's reconstruction error with random weights.
📝 Quick check (Level 2)
0/3 answered
  1. 1. Modern unsupervised pretraining mostly uses…
  2. 2. DBN pretraining faded because…
  3. 3. In exercise 1 the stack encoded each image into…

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

Why greedy stacking is justified. Hinton, Osindero and Teh (2006) showed that adding a layer, initialised as the transpose of the one below and then trained on its hidden activities, never decreases a variational lower bound on the log-likelihood of the data. Each new layer models the “aggregated posterior” of the layer below better than its own prior did.

The generative model. A DBN is a hybrid: the top two layers form an RBM (undirected), and lower layers are directed sigmoid belief networks pointing down to the data. Inference uses the approximate up-pass, which is exact only for the first layer.

Why pretraining helped. Erhan et al. (2010) found that unsupervised pretraining acts as a regulariser and an initialisation that places parameters in a basin with better generalisation, especially for deep sigmoid networks with few labels. Exercise 2 is such a case.

Successors. Deep Boltzmann machines, stacked denoising autoencoders and, later, self-supervised pretraining continued the idea that unlabelled data can shape representations.

📝 Quick check (Level 3)
0/3 answered
  1. 1. Adding a layer greedily never decreases…
  2. 2. In a DBN the top two layers form…
  3. 3. Erhan et al. found pretraining acts as…

Level 4: Expert

★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.

Does pretraining help with few labels?

History.

  • G. Hinton, S. Osindero and Y.-W. Teh (2006) introduced DBNs; G. Hinton and R. Salakhutdinov (2006) used them for dimensionality reduction.
  • Y. Bengio et al. (2007) extended greedy pretraining to autoencoders.
  • D. Erhan et al. (2010) analysed why it helps.
  • A. Krizhevsky et al. (2012) trained a deep network without pretraining, and the practice faded.

Exercise 2. 6 × 6 binary images of four shape classes at random positions with 10% pixel noise. A 36–32–32–4 sigmoid network trained by full-batch gradient descent on 20 or 200 labelled images, initialised either randomly or from two RBMs pretrained on 1000 unlabelled images. Test accuracy, three seeds:

labelled examples random initialisation RBM-pretrained
20 0.441 0.485
200 0.674 0.849
  • Pretraining helped in both cases: by 4 points with 20 labels and 17 points with 200.
  • The comparison is like for like (same sigmoid network, same optimiser). With ReLU, Adam and modern initialisation the gap would be expected to shrink, which is why pretraining by RBMs is rare today; unsupervised pretraining by other objectives remains standard.
🐍 Exercise 2 (research): does pretraining help with few labels?
Pretrain a two-layer RBM stack on unlabelled images, fine-tune with 20 or 200 labels, and compare with random initialisation.

DBNs in AI, robotics and aerospace

  • Historical impact: DBNs were the first deep models to beat hand-built features in speech recognition (2009–2012).
  • Label-scarce engineering data: the pretrain-then-fine-tune pattern applies to fault data, where unlabelled operating data are plentiful and labelled failures rare.
  • Today’s equivalent: self-supervised pretraining of perception backbones on unlabelled flight or driving logs.

References

  1. G. E. Hinton, S. Osindero, Y.-W. Teh (2006). “A fast learning algorithm for deep belief nets.” Neural Computation 18(7).
  2. G. E. Hinton, R. R. Salakhutdinov (2006). “Reducing the dimensionality of data with neural networks.” Science 313.
  3. D. Erhan, Y. Bengio, A. Courville, P.-A. Manzagol, P. Vincent, S. Bengio (2010). “Why does unsupervised pre-training help deep learning?” JMLR 11.
  4. Y. Bengio, P. Lamblin, D. Popovici, H. Larochelle (2007). “Greedy layer-wise training of deep networks.” Advances in NeurIPS.