Generative Adversarial Network
Two networks compete: a generator makes fakes, a discriminator tries to spot them. Each improves until the fakes are hard to tell from real data.
Also GAN · generator · discriminator
Goodfellow et al., 2014
An art forger and a detective. The forger paints fakes, the detective tries to catch them. Every time the detective gets better, the forger has to get better too, until the paintings look real.
Where it fits
+All relationships as a list
How it works
A GAN trains two neural networks against each other:
- The generator takes random noise and turns it into a sample, such as an image.
- The discriminator looks at an image and guesses: real (from the dataset) or fake (from the generator)?
They train in turns. The discriminator learns from its mistakes to spot fakes better. The generator is updated, through the discriminator, to produce images the discriminator would call real. Neither network ever sees a “correct” image to copy; the generator learns purely from the discriminator’s feedback.
When it works, the result is striking: GANs produced the first truly photorealistic synthetic faces. When it doesn’t, the two networks oscillate, or the generator finds one image that fools the discriminator and produces nothing else (mode collapse).
Since about 2021, diffusion models have taken over most image generation because they train more reliably and cover more variety, though GAN ideas live on in fast generators and upscalers.
The math
Everyday use cases
- Case 01
Faces of people who don't exist
StyleGAN produced the famous photorealistic faces of nonexistent people.
- Case 02
Photo upscaling
Super-resolution GANs sharpen low-resolution images.
Famous examples
Strengths, weaknesses and when to use it
Strengths
- Very sharp, realistic samples.
- Fast generation: one network pass per image.
Weaknesses
- Unstable, finicky training.
- Mode collapse, where the generator only produces a few kinds of output.
- Largely overtaken by diffusion models for text-to-image.
When to use itWhen you need very fast, sharp generation in a narrow domain (faces, a single product type) and can afford careful tuning.
Compare with
Check yourself
- Q01
What is the discriminator's job?
Show answer
B: Tell real samples from generated ones
- Q02
What is mode collapse?
Show answer
A: The generator produces only a few kinds of output instead of the full variety