Generative Adversarial Network
A GAN trains two networks against each other: one generates fake data, the other tries to spot it, and the competition drives both to improve.
Machine Learning
Key takeaways
- Two networks compete: one generates, one detects, and both improve from the contest.
- Neither is told what good looks like. The standard emerges from the competition.
- Training is structurally unstable, and mode collapse is common.
- Diffusion models have largely overtaken GANs for image generation.
A generative adversarial network trains two networks against each other. One generates fake samples, the other tries to tell fakes from real ones, and each improves by beating the other.
Neither network is told what good output looks like. The generator learns from whatever fools the discriminator, and as the discriminator gets sharper, the bar rises on its own.
Think of it like this. Think of a forger and a detective who train against each other for years. Every forgery the detective catches teaches the forger. Every forgery that slips through teaches the detective.
How it works
- The generator makes samples from random noise.
- The discriminator judges whether each sample is real or generated.
- Both learn from the verdict. The generator is rewarded for fooling; the discriminator for catching.
- Training ends in a balance, at least in theory, where fakes are indistinguishable from real.
Trade-offs
- Sharp output, unstable training. GANs produce crisper images than VAEs and are notoriously difficult to train.
- Mode collapse. The generator can find one output that always fools the discriminator and produce only that, over and over.
- No clean progress signal. Loss going down does not mean quality going up, because both networks are moving.
Common mistakes
- "GANs are just hard to tune." The instability is structural. Two networks chasing each other has no stable ground the way ordinary training does.
- "They only generate images." Audio, text, tabular data and video have all been done.
- "Mode collapse is rare." It is one of the most common failure modes there is.
- "They are the state of the art for generation." Diffusion models overtook them for most image work.