# Generative adversarial network (GAN)

> Canonical: https://skillalmanac.com/glossary/generative-adversarial-network | Last verified: 2026-11-24 | Index status: index-eligible

A generative adversarial network (GAN) trains a generator to produce samples and a discriminator to distinguish generated samples from training data. Their competing objectives guide learning; useful or realistic results are not guaranteed.

Also called: GAN, GANs, what is a GAN, generative adversarial networks, GAN AI.

## In plain language

A GAN is like a forger and a detective training against each other. The generator makes samples; the discriminator tries to distinguish them from training examples. The generator uses that feedback to change its parameters. Training can be unstable or produce too little variety, so the game need not improve each round. After training, the generator can make samples without running the discriminator. Image generation is one application, not the definition.

## Technical definition

Goodfellow et al. (arXiv 1406.2661, submitted June 2014) proposed training generative models through an adversarial process. The generator learns to produce samples resembling the training data; the discriminator learns to tell real samples from generated ones. The generator is trained to maximise the discriminator's errors, a two-player minimax game. The paper argues that in the ideal case the generator reproduces the data distribution and the discriminator outputs one half everywhere. When both networks are multilayer perceptrons, the whole system trains with backpropagation.

## How it shows up when you use agents

A language-model-based coding agent can help write code that trains or uses a GAN. The GAN is a model in that project, not another name for the agent. It matters when a proposed generative method uses adversarial training. See [Generative AI](/glossary/generative-ai).

What breaks when the term is misunderstood: people call every image generator a GAN, then pick the wrong tools or read the wrong documentation. Others assume a GAN can safely replace real data for testing; its samples only reflect the data it learned from, so errors and gaps carry over. Mock records built from rules are often enough for tests.

Your next action: when someone says "GAN", ask what is generating what, and from which training data. For another way to generate images, read [Diffusion model](/glossary/diffusion-model). For test data without training a model, see [Synthetic data](/glossary/synthetic-data).

## Worked example (illustrative)

For an image GAN, a training batch can mix examples from a dataset with samples from the generator. The discriminator is trained to distinguish the two sources; feedback from it supplies a learning signal to the generator. A high discriminator score does not certify factual accuracy, originality or legal permission. This illustrates the training roles, not a recorded experiment or a guarantee of convergence.

## Common confusions

- **GAN versus diffusion model.** A GAN trains two networks against each other. A diffusion model denoises step by step. Both make new data, by different methods.
- **Generator versus discriminator.** The generator makes samples; the discriminator judges them. After training, the generator is the part you use to make new samples.
- **Generative AI versus GAN.** GANs are one technique inside generative AI, not the whole field. Autoregressive language generation does not by itself imply adversarial training.
- **Myth.** A GAN does not just replay its training images. It learns to produce samples that resemble the data, though close resemblance to training examples can still happen.

## Worked examples in this catalogue

### [mock-record-generator](https://skillalmanac.com/skills/skill-almanac/mock-record-generator)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: The skill generates seeded mock records as CSV or JSON from a JSON field list or a simple TypeScript interface.

Why it exercises the concept: It is a contrast case. Mock records come from rules and a seed, not from a model that learned a real dataset, which is what a GAN does. Use it when you need fake test records without training anything.

### [algorithmic-art](https://skillalmanac.com/skills/anthropic/algorithmic-art)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: The skill makes generative art in p5.js with seeded randomness and adjustable parameters.

Why it exercises the concept: It shows another meaning of the word generative: code plus randomness. A GAN is different, since its generator is a trained neural network that learned from examples.

### [imagegen](https://skillalmanac.com/skills/openai/imagegen)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: The skill generates or edits raster images such as mockups, textures and illustrations.

Why it exercises the concept: It is a way to try machine-made images from an agent. Our catalogue does not say which method the underlying model uses, so do not assume it is a GAN.

## Related terms

- [Neural network](https://skillalmanac.com/glossary/neural-network.md)
- [Deep learning](https://skillalmanac.com/glossary/deep-learning.md)
- [Generative AI (gen AI)](https://skillalmanac.com/glossary/generative-ai.md)
- [Unsupervised learning](https://skillalmanac.com/glossary/unsupervised-learning.md)
- [Synthetic data](https://skillalmanac.com/glossary/synthetic-data.md)
- [Diffusion model](https://skillalmanac.com/glossary/diffusion-model.md)

## Sources

- [Generative Adversarial Networks](https://arxiv.org/abs/1406.2661), arXiv (Goodfellow et al., 2014) (accessed 2026-11-23)
- [Machine Learning Glossary](https://developers.google.com/machine-learning/glossary), Google for Developers (accessed 2026-11-23)

Definitions are written by Skill Almanac from the sources above and checked against them on 2026-11-24. [Glossary index](https://skillalmanac.com/glossary.md).
