A generative adversarial network (GAN) is a generative modeling framework in which two neural networks, a generator and a discriminator, are trained in a minimax game. The generator learns to synthesize samples that resemble real data, while the discriminator learns to distinguish real samples from generated ones. Training converges when generated samples become difficult for the discriminator to reliably classify as fake.
What is Generative Adversarial Network (GAN)?
A GAN has two components trained simultaneously on the same data distribution. The generator maps random noise or a conditioned input to a synthetic output such as an image. The discriminator outputs a probability or score indicating whether an input sample is real or generated. During training, the discriminator is optimized to correctly classify real versus fake, while the generator is optimized to fool the discriminator. This adversarial setup makes the discriminator a learned loss function that adapts as the generator improves. In practice, GAN training can be unstable because gradients can vanish or explode, and because the generator can collapse to producing limited modes of the data distribution.
Where GANs are Used and Why they Matter
GANs are used for image synthesis, super resolution, image to image translation, data augmentation, and privacy preserving synthetic data generation. They matter because they can produce sharp, realistic samples and can learn complex high dimensional distributions without explicit likelihood computation. GANs also influenced later generative modeling work by popularizing adversarial training and by providing strong baselines for visual generation.
Types
- DCGAN: uses convolutional architectures for stable image generation.
- Conditional GAN (cGAN): conditions generation on labels, text, or other inputs.
- CycleGAN: learns unpaired image to image translation with cycle consistency.
- Wasserstein GAN (WGAN): improves stability using Wasserstein distance inspired objectives.
FAQs
- Why are GANs hard to train?
The generator and discriminator objectives are coupled, so small changes in one model can destabilize the other. This can cause oscillations, mode collapse, or non convergent dynamics. - What is mode collapse?
Mode collapse occurs when the generator produces a narrow set of outputs that fool the discriminator, failing to represent the full diversity of the training data. - How do GANs compare with diffusion models?
Diffusion models are often easier to train and more stable, while GANs can be faster at sampling and can produce very sharp images. The best choice depends on quality, speed, and implementation constraints. - Can GANs be used outside computer vision?
Yes. GAN variants have been applied to audio, time series, tabular synthetic data, and representation learning, although performance varies by domain.