A generative adversarial network (GAN) is a machine learning framework in which two neural networks, a generator and a discriminator, are trained against each other so the generator learns to produce data that resembles real data. The discriminator tries to tell real samples from generated ones, and each network improves by competing with the other.
This page is for data science and AI leaders who need a clear definition. It covers how GANs train, the main types, how they compare with CNNs and VAEs, and how to govern generated data.
What is a generative adversarial network?
The original paper, Generative Adversarial Networks by Ian Goodfellow and colleagues, frames the idea as a minimax two player game. One model, the generator, learns to produce samples that resemble the training data. A second model, the discriminator, judges whether a sample came from the training data or from the generator. The generator is trained to maximise the chance that the discriminator makes a mistake.
How does a GAN train?
The Google Machine Learning guide to GAN structure describes the loop in three stages. Early on, the generator makes obviously fake data and the discriminator easily spots it. As training continues, the generator gets closer to fooling the discriminator. If training succeeds, the discriminator becomes less accurate and starts labelling fake data as real.
The discriminator's classification is the signal the generator uses to update its weights, and that feedback reaches it through backpropagation. The paper notes that when both models are multilayer perceptrons, the whole system can be trained with backpropagation.
What are the main types of GAN?
The IBM overview of GANs lists several variants.
| Type | What it adds | Typical use |
| Conditional GAN | Extra inputs, called labels or conditions, so the output can be controlled | Colourising grayscale images, generating images from text |
| DCGAN | Convolutional neural networks in both generator and discriminator | High quality image generation |
| StyleGAN | Layered control over image detail | High resolution images |
| CycleGAN | Cycle consistency, trained on unpaired datasets | Style transfer, image to image translation |
How do GANs differ from CNNs and VAEs?
A CNN is a network architecture, usually trained on labelled data to classify or detect. A GAN is a training set up in which two networks compete, and a DCGAN simply uses CNNs inside it. Because the discriminator learns from real versus generated samples, a GAN can learn from unlabelled data, which is why it is used where labels are scarce or costly.
Against variational autoencoders, IBM states that VAEs typically produce blurrier outputs but are more stable to train, while GANs generate sharper and more realistic outputs but are harder to train because of instability.
What goes wrong when training GANs?
Google's page on common GAN problems names three failure modes, and says none has been fully solved.
| Problem | What happens |
| Vanishing gradients | If the discriminator is too good, generator training can fail |
| Mode collapse | The generator keeps producing the same output or a small set of similar outputs |
| Failure to converge | Training does not settle into a stable state |
What are GANs used for?
IBM lists photorealistic image generation, image super resolution, image to image translation, video retargeting, facial attribute editing and generating synthetic training data for object detection. For enterprises, the practical question is less the image and more the data: generated samples can supplement scarce training data, but they need the same review and lineage as any other training input.
How do GANs relate to AI agents?
Agents increasingly consume or call generative models as one step in a larger workflow. The risk is that a generated artefact enters a decision with no record of where it came from. Treat generated data as a governed input: tag it as synthetic, record the model version and keep the trace with the decision. ElixirClaw, XenonStack's AI agents computing platform, is where teams build and run agents that use models like these.
What should you do first?
- Name the task: generation, augmentation or translation between domains.
- Confirm that a simpler model would not do the job.
- Plan to monitor for mode collapse and unstable training from the first run.
- Label every generated sample as synthetic and record the model version.
- Review outputs with a human before they reach a decision.
To map one decision your agents make, and the data and policy it depends on, book a Context Workshop. See what happens in the workshop.
Related reading: For architectures, types and enterprise applications, read Generative Adversarial Networks: Applications and Types.
Frequently asked questions
What is a GAN in simple terms?
A GAN is a pair of neural networks trained against each other: a generator that creates samples and a discriminator that judges whether they look real.
Does a GAN need labelled data?
A GAN learns from real versus generated samples, so it can work with unlabelled data. Conditional GANs add labels or conditions when you want to control the output.
What is mode collapse?
Mode collapse is a GAN failure in which the generator keeps producing the same output or a small set of similar outputs, according to Google's guide to common GAN problems.
How is a GAN different from a VAE?
IBM states that GANs generate sharper and more realistic outputs but are harder to train, while variational autoencoders are more stable but typically blurrier.
Are GANs and CNNs the same thing?
No. A CNN is a network architecture. A GAN is a training framework, and a DCGAN uses CNNs for both the generator and the discriminator.