When your GAN collapses into one mode, try asking it for all of them
A 2017 NIPS paper treats GAN weights as distributions rather than point estimates, using MCMC to sample diverse generators and discriminators.

What it does This repository implements the Bayesian GAN, which replaces the standard GAN’s single point estimate of network weights with a full posterior distribution. It uses stochastic gradient Hamiltonian Monte Carlo to sample over both generator and discriminator parameters, producing an ensemble of models rather than one winner-takes-all network. The code supports unsupervised and semi-supervised training on MNIST, CIFAR-10, SVHN, CelebA, or custom datasets.
The interesting bit The core insight is that mode collapse—the bane of standard GANs—can be framed as an inference problem. By maintaining a multimodal posterior over weights, the Bayesian GAN literally keeps multiple “creative hypotheses” alive at once. The README’s synthetic demo is striking: a standard GAN collapses to a single blob, while the Bayesian version preserves the full multi-blob distribution.
Key highlights
- Semi-supervised learning out of the box: train with as few as 100 labeled MNIST examples or 4,000 CIFAR-10 labels
- Includes scripts for standard benchmarks plus a
Digitsclass template for rolling your own dataset loader - Supports Wasserstein-GAN variant via
--wassersteinflag - Can run baseline DCGAN or DCGAN ensemble for direct comparison
- Ships with a Jupyter notebook (
synth.ipynb) for reproducing the paper’s Jensen-Shannon divergence analysis
Caveats
- Pinned to TensorFlow 1.0.0 and Python 2.7, which are both well past end-of-life
- The README warns that even setting
--random_seeddoes not guarantee reproducibility on GPU - Custom datasets require hand-editing
bgan_util.pyandbayesian_gan_hmc.pyto wire in your class
Verdict Grab this if you’re doing research on probabilistic deep learning or need a semi-supervised baseline with theoretical grounding. Skip it if you want production-ready code; the dependency stack is a time capsule from 2017.