Before diffusion models, GANs were how AI learned to generate realistic images. The idea is a game between two networks — and you can watch it reach its eerie equilibrium on a 2D scatter. Here's a live GAN-training demo.
🎭 Watch the fakes become real: https://dev48v.infy.uk/dl/day14-gans.html
Two networks, one game
- The Generator turns random noise into fake data, trying to mimic the real distribution.
- The Discriminator is a detective: given a sample, is it real or fake?
They train against each other. The generator wants to fool the discriminator; the discriminator wants to catch fakes. Forger vs. detective.
The equilibrium
At first the fakes are obvious noise and the discriminator nails them (~90% accuracy). As the generator improves, its fakes drift onto the real distribution — until the discriminator can't do better than a coin flip (~50%). That stalemate means the fakes are indistinguishable from real. In the demo, the rose "fake" cloud morphs onto the teal "real" ring while the accuracy bar slides to 50%.
The catch
GANs are famously unstable to train — mode collapse (the generator outputs one thing), oscillation, sensitive hyperparameters. Variants like DCGAN and StyleGAN tamed it (StyleGAN's faces went viral). Today, diffusion models have largely taken over image generation — but the adversarial idea is foundational.
🔨 Full build (G and D nets → sample noise → train D on real+fake → train G to fool D) on the page: https://dev48v.infy.uk/dl/day14-gans.html
Part of DeepLearningFromZero. 🌐 https://dev48v.infy.uk
Top comments (0)