How GANs Work
The Forger and the Detective
Two networks locked in a creative duel
Obvious fake — discriminator is very confident. A GAN pits a Generator (forger) against a Discriminator (detective). Drag the slider to see how the discriminator's confidence changes as fake quality improves.
Step 1 of 6: The Forger and the Detective
Two networks locked in a creative duel
Obvious fake — discriminator is very confident. A GAN pits a Generator (forger) against a Discriminator (detective). Drag the slider to see how the discriminator's confidence changes as fake quality improves.
Step 2 of 6: The Generator
Creating from random noise
The Generator takes a random noise vector and transforms it through layers. Drag the training slider to see how output quality improves as the network learns. Different noise seeds produce different outputs.
Step 3 of 6: The Discriminator
Learning to spot fakes
The Discriminator outputs a probability for each input. The decision threshold determines its classification boundary. Drag the slider to see how the threshold affects accuracy. Too high or too low, and the discriminator makes mistakes.
Step 4 of 6: The Adversarial Game
Each network improves to beat the other
Training alternates: the Discriminator learns to detect fakes, then the Generator learns to fool it. The fake distribution (purple dots) gradually converges to match the real distribution (green dots). Use the controls to step through training.
Step 5 of 6: Reaching Equilibrium
When the generator fools the discriminator 50% of the time
Near Nash equilibrium: the Discriminator outputs ~0.50 for all inputs. Both networks push each other to improve. Losses converge near ln(2) ≈ 0.693.
Step 6 of 6: What GANs Can Create
Images, music, text, and beyond
GANs learn a smooth latent space where nearby points produce similar outputs. Drag both sliders to navigate the 2D latent space and see how generated images interpolate smoothly between corners. This enables face generation, style transfer, and super-resolution.