What is a generative adversarial network (GAN)?
A generative adversarial network is a generative model architecture in which a generator network that produces realistic samples and a discriminator network that tries to tell them from real data are trained against each other.
It is also called a GAN. It differs from a diffusion model in how it generates: a diffusion model removes noise step by step, while a GAN turns noise into a sample in one step, which makes it very fast, though distilled diffusion models now need few steps. A variational autoencoder samples from a probabilistic latent space instead.
- Topic
- Machine learning, models and training
- Also known as
- GAN
- Origin
- 2014
How a generative adversarial network (GAN) works
- The generator takes a random noise vector and turns it into a sample resembling real data.
- The discriminator sees real training samples mixed with generated ones and predicts which are real.
- The two networks update in turn: the discriminator learns to separate better, the generator to fool it better.
- Training can be unstable; mode collapse, where the generator produces only a few kinds of sample, is a known problem.
In more detail
The minimax objective, vanishing gradients and Wasserstein GAN
Mathematically, GAN training is a two-player minimax game: the discriminator tries to maximise its chance of labelling real samples as real and generated ones as fake, while the generator tries to minimise it. If the discriminator becomes too strong early on, the generator suffers from vanishing gradients; replacing cross-entropy with Wasserstein distance (WGAN, WGAN-GP) stabilises training by providing smoother gradient signals.
Conditional GANs and targeted synthetic data
Unconditional GANs cannot specify which class or attribute to generate. Conditional GANs (cGANs) feed an auxiliary label or embedding (such as defect type or table schema constraints) to both generator and discriminator, enabling targeted data augmentation in enterprise pipelines.
Evaluation metrics: FID, IS and TSTR
Because GANs lack an explicit likelihood score, quality and diversity are evaluated with metrics such as Fréchet Inception Distance (FID) and Inception Score (IS) for images or statistical distribution similarity, downstream utility (Train-on-Synthetic, Test-on-Real) and privacy distance metrics for tabular data.
Commonly confused terms
| Term | How it differs |
|---|---|
| Variational autoencoder | A VAE explicitly models an encoder-decoder mapping to a continuous probabilistic latent space using a reconstruction loss plus KL divergence, making likelihood bounds tractable, whereas a GAN optimises an implicit distribution via a discriminator without an explicit encoder or density estimate. |
Why a generative adversarial network (GAN) matters for on-premises AI
In-house, GANs produce synthetic data that can stand in for real customer data and multiply rare cases such as images of unusual faults. Generated data should still be checked to ensure it has not memorised training examples and leaked personal information. Diffusion models have largely taken over image generation, but GANs remain a choice where speed matters and for tabular data.
A manufacturer multiplies its small set of defective part images with a GAN and trains its quality inspection model on the expanded data on in-house servers.
Common questions
What is the difference between a GAN and a diffusion model?
A GAN is trained by two competing networks and generates in one step. A diffusion model removes noise over many steps, training more stably but generating more slowly.
Do GANs only generate images?
No. They are also used for audio, time series and tabular data.
Related terms
- Diffusion model
- AI synthetic data
- Variational autoencoder (VAE)
- Generative AI
- Neural network
- Data augmentation
Sources
In the glossary: Glossary, E to L