Generative models practice problems
15 problems · 0 solved
Generative models learn the shape of a dataset well enough to create new samples that look like it. Different families take different routes: VAEs compress data into a smooth latent space and decode it back, GANs train a generator against a critic, and normalising flows use reversible layers that can be run in both directions. A GAN is often pictured as a forger and a detective improving by competing. These problems cover the key pieces of each family. You will sample a VAE latent with the reparameterization trick, compute the VAE loss with reconstruction and KL terms, schedule the KL weight with cyclical annealing, score a denoising autoencoder, quantize latents to a VQ-VAE codebook with straight-through gradients, compute GAN and WGAN-GP losses, run an affine coupling layer forward and backward, and compute the Inception Score and the Frechet distance between Gaussians. Start with the Easy problems on reparameterization and KL annealing. Then do the VAE and GAN losses and coupling layers, and finish with VQ-VAE, WGAN-GP and the Frechet distance. These ideas sit behind modern image tokenizers and evaluation metrics, and they come up in generative AI interviews.
Easy 5
Medium 5
- Compute the VAE loss: reconstruction BCE plus KL to a standard normalPro
- Compute GAN discriminator and non-saturating generator losses from logitsPro
- Run an affine coupling layer forward and backwardPro
- Compute the Inception Score from class probabilitiesPro
- Build PixelCNN mask A and mask B with colour channel orderingPro
Hard 5
- Compute WGAN-GP critic and generator losses with an analytic input gradientPro
- Quantize latents to a VQ-VAE codebook with straight-through gradientsPro
- Compute the Frechet distance between GaussiansPro
- Take one discriminator and one generator step of a 1D GAN by handPro
- Backpropagate through the VAE reparameterization and KL termPro