Post

Bayesian Generative Adversarial Networks

We reproduced and evaluated a Bayesian GAN that uses stochastic-gradient MCMC to improve mode diversity and semi-supervised learning.

Bayesian Generative Adversarial Networks

Generative adversarial networks can produce compelling samples, but their adversarial training dynamics are unstable and susceptible to mode collapse, where the generator represents only a narrow part of the data distribution. In this Harvard course project, we reproduced the Bayesian GAN proposed by Yunus Saatchi and Andrew Gordon Wilson and explored whether Bayesian inference could make those dynamics more robust.

Bayesian formulation

Instead of learning one fixed set of generator and discriminator weights, a Bayesian GAN places distributions over both networks. The method uses stochastic-gradient Hamiltonian Monte Carlo to sample from their conditional posteriors, then marginalizes predictions across multiple weight samples. This produces an ensemble within a single probabilistic formulation and encourages the generator to represent multiple modes.

Experiments

We adapted the reference implementation and evaluated it in two settings:

  • Unsupervised four-shapes generation: We trained on translated, rotated, and scaled images of circles, rectangles, triangles, and stars. The model generated diverse samples across several modes without feature matching or minibatch discrimination, although squares and triangles remained more difficult.
  • Semi-supervised MNIST: With 1,000 labeled digits, we compared Bayesian and maximum-likelihood GAN classifiers. Their accuracy was similar in this regime, consistent with the Bayesian model’s expected advantage being strongest when labels are scarcer.

Takeaway

The project showed how posterior sampling can provide a principled response to GAN mode collapse, but also exposed the method’s substantial computational cost. The Bayesian formulation was scientifically appealing and produced diverse outputs, while a well-tuned conventional GAN could remain more practical when compute was limited.

This was a team project with Anna Davydova and Michael Emanuel for Harvard’s Advanced Scientific Computing course in Fall 2018.

Explore the project source and experiments or read the original Bayesian GAN paper.

This post is licensed under CC BY 4.0 by the author.