Generative models · 2022

Generative Models, Side by Side

GANs, VAEs, and normalizing flows in one repo, so the trade-offs are felt, not read.

Solo · learning build3
PyTorchGANVAENormalizing FlowsJupyter

Why one repo, three models

Most tutorials teach generative models in isolation, so you never develop a feel for why you'd pick one over another. I wanted them in the same place, trained on the same data, so the differences were tangible: the adversarial min-max game of a GAN, the variational lower bound of a VAE, and the exact, invertible likelihood of a normalizing flow.

What it shows

Built side by side, the trade-offs stop being abstract:

  • GANs gave the sharpest samples but were the least stable to train — mode collapse and balancing the discriminator were constant companions.
  • VAEs trained calmly and gave a clean latent space, at the cost of blurrier samples from the Gaussian likelihood.
  • Normalizing flows were the only family giving exact likelihoods, paid for with architectural constraints (every layer must be invertible with a tractable Jacobian).

It became the reference I return to whenever I need to reason about a generative approach from first principles.

What I'd improve

This is one of the repos I'd most like to bring up to portfolio standard: a proper README with sample grids for each model, a shared training harness instead of separate notebooks, and a short write-up of the likelihood-vs-quality trade-off with figures. The understanding is there; the presentation hasn't caught up to it yet.

What I took away

  • Training all three on the same data makes the quality/likelihood/stability trade-offs intuitive.
  • GAN sharpness vs. VAE stability vs. flow exactness is a decision I can now reason about from first principles.
← all projectsview the code ↗