Does the Wake-sleep Algorithm Produce Good Density Estimators?

Brendan J. Frey, Geoffrey E. Hinton, Peter Dayan

Introduction

In unsupervised learning, generative models aim to capture the underlying structure of data by maximizing the probability that the model would generate the observed data. However, for multilayer networks of stochastic neurons—such as the Helmholtz machine—calculating the exact derivatives needed for learning is notoriously intractable. Computing these derivatives requires considering every possible configuration of hidden units that could have produced a specific data point, leading to an exponential explosion of possibilities.

This paper evaluates the wake-sleep algorithm, an efficient training method designed to bypass this intractability. The core question is whether this algorithm, which approximates the posterior distribution over hidden units, can produce high-quality density estimators without sacrificing the model's ability to represent complex data. The findings reveal that the wake-sleep algorithm is orders of magnitude faster than traditional methods like Gibbs sampling or Mean Field inference, while delivering comparable—and sometimes superior—performance on complex, high-dimensional data.

The Helmholtz Machine and the Wake-Sleep Algorithm

The authors focus their evaluation on the Helmholtz machine, a multilayer network characterized by two sets of connections:

  • Top-down weights: These define the generative model, representing how the network believes the world creates data.
  • Bottom-up weights: These define the recognition model, representing how the network interprets observed data.

Training this architecture relies on the two-phase wake-sleep algorithm:

  1. The "Wake" Phase: The model is presented with real data. The bottom-up recognition weights are used to "guess" the hidden states. Then, the top-down generative weights are updated to better reconstruct the data from those specific guesses.
  2. The "Sleep" Phase: The model "dreams" by using its top-down weights to generate a synthetic sample. It then uses this dream to train the bottom-up recognition weights, teaching them how to recover the hidden states that originally produced the dream.

Instead of minimizing the exact log-probability of the data, the algorithm minimizes the Helmholtz free energy, which serves as an upper bound on the negative log-likelihood. The authors compared this approach against several competitors, including Gibbs Machines (using Monte Carlo sampling), Mean Field methods, Binary Mixture Models, and Fully Visible Belief Networks (FVBN).

Experimental Setup

The study utilized a mix of synthetic and real-world datasets to probe different structural strengths:

  • Synthetic Data: Five datasets were designed with specific properties, such as 20-component mixtures, hierarchical belief networks (BN), and Markov Random Fields (MRF). These were calibrated to have matched complexities (1,000–2,500 parameters).
  • Real-World Data: Two versions of the USPS handwritten digit dataset (8x8 binary images) were used. One version featured single digits, while the other featured concatenated pairs of digits to test the models' ability to handle independent, simultaneous causes.

Key Results and Insights

Speed and Density Quality

The most significant advantage of the wake-sleep algorithm is its speed. It proved to be roughly 10 to 100 times faster than Gibbs sampling or Mean Field methods. In the time it takes a Gibbs machine to finish a single task, the Helmholtz machine can be trained on dozens.

Despite this speed, the density estimation quality remains highly competitive. On synthetic tasks, the Helmholtz machine (HM) achieved costs (measured in bits) very close to the true entropy of the data. For instance, on the MRF task, HM achieved 19.4 bits compared to the true Entropy of 19.2 bits, far outpacing the Base Rate model (42.2 bits). Furthermore, the quality of density estimation between HM and Mean Field methods was virtually indistinguishable, despite HM's massive speed advantage.

Comparative performance of different models across tasks

Handling Multiple Causes vs. "One-of-N" Weakness

The Helmholtz machine significantly outperformed mixture models on tasks where multiple independent factors influenced the data. This was most evident in the "digit pairs" task. Mixture models struggle here because they inherently assume only one "component" or cause is active at a time. In contrast, the Helmholtz machine can activate multiple hidden units simultaneously to explain complex, multi-causal data.

However, this flexibility becomes a liability on tasks where only one cause should be active (the "One-of-N" problem). On a specific synthetic task (Mixture 20→100), the algorithm lacked a "softmax" constraint to prevent multiple hidden units from trying to explain the same data point, leading to poorer density estimation than a simple mixture model.

Performance on Real-World Digits

When applied to the USPS handwritten digits, the Helmholtz machine demonstrated strong performance, though with some surprising caveats.

Performance on single and paired digit tasks

On single digits, HM achieved a cost of 39.1 bits, outperforming Gzip (44.3) and Mean Field (39.5). Interestingly, the Fully Visible Belief Network (FVBN)—a model with no hidden units but full connectivity—performed surprisingly well, achieving 35.9 bits and beating the Helmholtz machine while being much faster to train. On the digit pairs task, HM (80.4 bits) successfully outperformed the Mixture model (92.7 bits), validating its ability to handle simultaneous independent causes.

Limitations and Future Directions

While powerful, the wake-sleep algorithm has structural limitations. Because the recognition model is restricted to a simple "product distribution" (assuming hidden units are independent given the data), there is an inherent gap between the Helmholtz free energy and the true log-likelihood. Although the model learns to avoid areas where this gap is excessively large, it remains a fundamental constraint.

To address the "one-of-N" weakness, the authors suggest that "hard-wiring" softmax groups into the hidden layers could help the model learn mutually exclusive categories more effectively. Finally, the results suggest a scaling heuristic: for very simple datasets, the complexity of a Helmholtz machine might be unnecessary, and a well-tuned FVBN may offer a more efficient and accurate alternative.

Summary updated

BibTeX
@inproceedings{frey1995does,
  author = {Brendan J. Frey and Geoffrey E. Hinton and Peter Dayan},
  title = {{Does the Wake-sleep Algorithm Produce Good Density Estimators?}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {1995},
}
Figure