# Generative adversarial network

A generative adversarial network (GAN) pairs a generator and a discriminator neural network in adversarial training, producing a generator capable of creating realistic synthetic data such as images.

A generative adversarial network, or GAN, is a class of [machine-learning](https://www.wikiprompt.org/wiki/machine-learning) model in which two [neural-network](https://www.wikiprompt.org/wiki/neural-network)s, a generator and a discriminator, are trained together in opposition: the generator tries to produce synthetic data realistic enough to fool the discriminator, while the discriminator tries to correctly distinguish the generator's fake outputs from real examples. Training proceeds as an adversarial game in which improvements in one network push the other to improve in turn, ideally converging on a generator capable of producing highly realistic synthetic data.

## History

GANs were introduced in a 2014 paper by [ian-goodfellow](https://www.wikiprompt.org/wiki/ian-goodfellow) and colleagues at the University of Montreal, reportedly conceived after a late-night argument about generative modeling. The original formulation trained relatively small networks on simple image datasets, but the architecture improved rapidly: DCGAN in 2015 established stable convolutional architectures for image generation, and Progressive GAN in 2017 and StyleGAN, released by NVIDIA researchers in 2018 and refined through StyleGAN2 and StyleGAN3, produced photorealistic human faces convincing enough to power public "this person does not exist" demonstrations and much of the technology later used for [deepfake](https://www.wikiprompt.org/wiki/deepfake) media.

## How training works

The generator takes random noise as input and transforms it into a synthetic sample, while the discriminator, a standard classifier, is given a mix of real and generated samples and trained to label each correctly. The generator's [loss-function](https://www.wikiprompt.org/wiki/loss-function) rewards it for outputs the discriminator misclassifies as real, and both networks are updated via [gradient-descent](https://www.wikiprompt.org/wiki/gradient-descent) in alternating steps. In principle this adversarial process drives the generator's output distribution toward matching the real data distribution, but in practice GAN training is notoriously unstable and prone to mode collapse, where the generator learns to produce only a narrow range of convincing outputs rather than the full diversity of the real data, a problem that motivated years of architectural and loss-function research.

## Applications

Beyond photorealistic face and image synthesis, GANs have been used for image-to-image translation, such as turning sketches into photos or daytime photos into nighttime ones, super-resolution upscaling, data augmentation for training other models, and voice conversion. They were also an early architecture behind practical [text-to-image](https://www.wikiprompt.org/wiki/text-to-image) systems before being largely overtaken by [diffusion-model](https://www.wikiprompt.org/wiki/diffusion-model)s. GAN-based synthesis is central to concerns about [deepfake](https://www.wikiprompt.org/wiki/deepfake) media, since the same generator technology that produces convincing synthetic faces can be aimed at impersonating real people in photos and video, prompting research into GAN-output detection and [ai-watermarking](https://www.wikiprompt.org/wiki/ai-watermarking).

## Decline relative to diffusion models

Since roughly 2021, [diffusion-model](https://www.wikiprompt.org/wiki/diffusion-model)s have displaced GANs as the dominant approach for high-quality image and video generation, including in systems such as [dall-e](https://www.wikiprompt.org/wiki/dall-e), [stable-diffusion](https://www.wikiprompt.org/wiki/stable-diffusion), and [midjourney](https://www.wikiprompt.org/wiki/midjourney), because diffusion training is generally more stable, avoids mode collapse, and produces greater output diversity, even though GANs typically generate a sample in a single fast forward pass compared to a diffusion model's many iterative denoising steps. GANs remain in active use where that inference speed advantage matters, and their core adversarial training principle continues to influence loss-function design well beyond pure image generation.

---
Source: https://www.wikiprompt.org/wiki/generative-adversarial-network
License: CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0/)
Last updated: 2026-09-02T20:29:54.651072+00:00
