Revisiting Contrastive Divergence for Density Estimation and Sample Generation

Abstract

Energy-based models (EBMs) have recently attracted renewed attention as models for complex distributions of data, like natural images. Improved image generation under the maximum-likelihood (MLE) objective has been achieved by combining very complex energy functions, in the form of deep neural networks, with Langevin dynamics for sampling from the model. However, Nijkamp and colleagues have recently shown that such EBMs become good generators without becoming good density estimators: an impractical number of Langevin steps is typically required to exit the burn-in of the Markov chain, so the training merely sculpts the energy landscape near the distribution used to initialize the chain. Careful hyperparameter choices and the use of persistent chains can significantly shorten the required number of Langevin steps, but at the price that new samples can be generated only in the vicinity of the persistent chain and not from noise. Here we introduce a simple method to achieve both convergence of the Markov chain in a practical number of Langevin steps (L = 500) and the ability to generate diverse, high-quality samples from noise. Under the hypothesis that Hinton’s classic contrastive-divergence (CD) training does yield good density estimators, but simply lacks a mechanism for connecting the noise manifold to the learned data manifold, we combine CD with an MLE-like loss. We demonstrate that a simple ConvNet can be trained with this method to be good at generation as well as density estimation for CIFAR-10, Oxford Flowers, and a synthetic dataset in which the learned density can be verified visually.

Cite

Text

Abdulsalam and Makin. "Revisiting Contrastive Divergence for Density Estimation and Sample Generation." Transactions on Machine Learning Research, 2025.

Markdown

[Abdulsalam and Makin. "Revisiting Contrastive Divergence for Density Estimation and Sample Generation." Transactions on Machine Learning Research, 2025.](https://mlanthology.org/tmlr/2025/abdulsalam2025tmlr-revisiting/)

BibTeX

@article{abdulsalam2025tmlr-revisiting,
  title     = {{Revisiting Contrastive Divergence for Density Estimation and Sample Generation}},
  author    = {Abdulsalam, Azwar and Makin, Joseph G.},
  journal   = {Transactions on Machine Learning Research},
  year      = {2025},
  url       = {https://mlanthology.org/tmlr/2025/abdulsalam2025tmlr-revisiting/}
}