TL;DR
Training energy-based models (EBMs) has long relied on the Contrastive Divergence (CD) algorithm, which is fast but mathematically biased, often leading to poor convergence. This paper introduces Unbiased Contrastive Divergence (UCD), a method that leverages MCMC "coupling" techniques to produce perfectly unbiased gradient estimates. The result is a training algorithm with solid theoretical convergence guarantees that outperforms standard CD and Persistent CD (PCD) on benchmark tasks.
The Challenge of Training Energy-Based Models
Energy-based latent variable models, such as Restricted Boltzmann Machines (RBMs), are powerful generative tools, but they are notoriously difficult to train. To update the model's parameters using Maximum Likelihood Estimation, one must calculate the gradient of the log-likelihood. This gradient is the difference between two expectations: one over the data distribution and one over the model's distribution.
The "model expectation" is the primary bottleneck, as it is usually intractable. For decades, researchers have relied on Contrastive Divergence (CD), which approximates this expectation by running a Markov Chain Monte Carlo (MCMC) sampler for just a few steps ($k$). While computationally efficient, this truncation introduces a systematic bias. This bias can accumulate during training, causing the model to diverge or fail to reach a local optimum, even in relatively simple scenarios.
Unbiased Contrastive Divergence (UCD)
To address the shortcomings of traditional CD, the authors propose Unbiased Contrastive Divergence (UCD). The core innovation lies in applying recent advances in unbiased MCMC theory to the EBM training loop.
Key components of the UCD approach include:
- Coupled Markov Chains: Instead of running a single chain, UCD runs two chains ($\xi_t$ and $\eta_t$) designed to eventually "meet" and remain identical after a random time $\tau$.
- The Unbiased Estimator: By utilizing a telescoping sum of the differences between these two chains, the authors construct an estimator for the gradient that is mathematically proven to be unbiased, provided the chains meet in finite time.
- Specialized RBM Coupling: While a general coupling for Gibbs samplers is provided, the authors develop a highly optimized version specifically for RBMs that significantly reduces the time it takes for the chains to meet.
- Adaptive Stopping: Unlike CD-$k$, which uses a fixed number of steps, UCD runs until the chains meet. Consequently, the algorithm automatically allocates more computational effort to "harder" distributions where the chains take longer to converge.
Experimental Datasets
The authors evaluated UCD against CD and PCD on three types of data:
- Bars-and-Stripes (BAS): A classic synthetic benchmark for RBMs. Its small size allows for the exact log-likelihood to be calculated, making it ideal for verifying convergence.
- Simulated RBM Data: Data generated from a known RBM to test the algorithm's ability to recover true parameters in an overparameterized setting.
- Fashion-MNIST: A more complex, high-dimensional dataset of clothing images used to assess the scalability and performance of UCD on realistic data.
Key Insights
- Bias is More Dangerous than Variance: In stochastic gradient methods, a small amount of noise (variance) is generally acceptable, but systematic bias is detrimental. The paper demonstrates that even though UCD might exhibit slightly higher variance than CD, the elimination of bias is what ultimately prevents the model from diverging.
- The "Meeting Time" as a Diagnostic: The time it takes for the coupled chains to meet ($\tau$) serves as an indicator of training difficulty. In experiments, $\tau$ often spiked exactly when the biased CD algorithm began to fail, suggesting UCD automatically "works harder" when the model enters a difficult phase of learning.
- Efficiency through Specialization: The general coupling method can be slow. By tailoring the coupling to the specific conditional distributions of an RBM (using maximal coupling of Bernoulli variables), the authors made the unbiased approach computationally practical.
Key Results
The empirical results highlight the advantages of UCD over traditional methods:
- Guaranteed Convergence: On the BAS dataset, CD and PCD failed to converge to the maximum likelihood value and eventually diverged. In contrast, UCD converged steadily and maintained the optimum.
- Stability on Fashion-MNIST: While CD variants (CD-10, 20, and 30) showed oscillating or decreasing log-likelihoods on Fashion-MNIST, UCD reached a stable, higher log-likelihood.
- Computational Trade-off: UCD is slower per iteration than CD-1 (e.g., ~16s vs ~5s on BAS). However, the authors argue this is a necessary trade-off for guaranteed convergence. Interestingly, UCD's average stopping time was often quite low (around 2.4 steps for BAS), making it more efficient than running a high-$k$ CD algorithm (like CD-20) which still remains biased.
Limitations and Future Work
- Computational Cost: UCD is more computationally expensive than the simplest CD methods. For very large-scale models, the memory and time overhead of running parallel coupled chains could become significant.
- Hybrid Strategies: A promising future direction suggested by the authors is to start training with fast, biased methods (CD/PCD) to get near the optimum, and then switch to UCD to fine-tune the model and guarantee convergence.
- Continuous Variables: While the underlying theory supports continuous variables, the most efficient coupling demonstrated was for discrete RBMs. Extending these specialized, high-efficiency couplings to continuous energy-based models is a logical next step for future research.
Summary updated