A Helmholtz machine (Dayan, Hinton, Neal & Zemel, 1995) is one stack of stochastic binary units with two sets of connections. Recognition weights carry a handwritten digit up from 256 pixels through 128 and 48 hidden units to a guess at its label; generative weights carry causes back down and dream a digit. It learns with the wake-sleep algorithm: in the wake phase a real digit goes up and the generative weights learn to predict each layer from the one above, and in the sleep phase the network dreams and the recognition weights learn to recover the causes that made the dream. The label units sit at the top as a second data stream, like hearing the word "six" while seeing one, so the network never learns to read labels from real digits: it learns only from its own dreams. This is the same top-down prediction, bottom-up inference idea that predictive coding uses to describe the layered cortex, and the variational autoencoder is its direct descendant.
Parameters — how to use them
Direction
See ↑ shows unseen test digits one after another and how the recognition weights read them. Imagine ↓ runs the generative weights from the top: a label goes down through h2 and h1 and a digit forms in the pixels. Learn ↕ trains live, alternating a wake pass (a real digit up) and a sleep pass (a dream down).
Imagine a digit
Pick a label and the network dreams one version of it; with Play on it dreams a new one every period, so you see how many ways it can draw a 4. Any samples the label too. You can also click a label box on the stage.
Time per digit
Seconds per digit or per dream (0.4–4 s). The signal takes a fraction of this to cross each layer, so slow it down to follow the wave up or down the stack.
Connections drawn
How many connections are drawn (40–600). They are the strongest contributions weight × activity for the current pass, so they show what is actually being sent: green pushes the next unit on, red pushes it off. Only units that are active send anything.
Learning rate
Step size of the wake-sleep delta rule, per batch of 20 digits (0.005–0.1). The pretrained network used 0.05, then 0.02 and 0.01. A high rate on the pretrained network makes it forget part of what it knew; Start from random weights raises it to at least 0.05.
Start from random weights
Throw the trained weights away and learn from small random ones, live. Held-out accuracy starts near chance (10%); in a test run on a desktop browser it passed 65% after 10 seconds and 80% within a minute, and slower devices take longer. Reset restores the pretrained network.
Next digit
Load the next of the 1,000 held-out digits the network never trained on and read it.
Clear
Blank the pixel pad and pause, then draw your own digit with the mouse or a finger (a 2×2 brush; start a stroke on a lit pixel to erase). The label bars update as you draw.
What to watch for
Pixel brightness is the input (See) or the probability each pixel is on (Imagine). Hidden squares show how strongly each unit fires; in a dream they are the sampled 0/1 states. The bars over the ten labels are the recognition network's probabilities, or the orange label that was given. Hover over an h1 unit to see the pixels its generative weights draw, which is also its tile in the grid on the right: many are pen strokes or parts of loops. The accuracy plot is measured on 1,000 digits held out from training. Expect about 88%, well below a backpropagation classifier's 97–99%: the labels here are learned only from dreams, and dreams are imperfect. Bits / digit is how many bits the generative model needs to describe each training digit given what recognition proposed; it falls as the two networks agree.