Guide

What is a generative adversarial network?

Updated 15 July 2026 Part of Artificial Intelligence

A generative adversarial network, or GAN, is a machine-learning system where a generator tries to make convincing fake examples and a discriminator tries to spot which examples are fake. The generator improves by learning what fooled the discriminator. The discriminator improves by seeing better fakes. That contest can train the generator to produce new images, sounds, or other data that resemble the training examples without simply being a normal copy-and-paste tool.

How the generator and discriminator work

The generator starts with random input and turns it into a sample: for example, an image-like pattern. At the beginning, its output may be poor. It does not yet know what makes the real examples look real.

The discriminator receives examples from the real training data and examples made by the generator. Its job is to judge which are real and which are synthetic. When it gets the answer wrong, its internal settings change so it can judge better next time. When the generator fails, its settings change so its next attempt is more likely to pass.

A useful way to picture this is a forger and a detective training each other to get better at their jobs. The forger learns from the detective’s suspicions. The detective learns from the forger’s latest tricks. Neither improves in isolation; the pressure between them is the point.

Why the contest matters

The word “adversarial” means the parts are working against each other during training. That opposition gives the system its learning signal. The generator is not told, in plain terms, “draw this kind of eye” or “make this texture smoother”. It receives feedback through the discriminator’s judgement.

This matters because some data is hard to describe with simple rules. A face, a handwritten letter, or a musical phrase has patterns that people recognise quickly but struggle to define completely. A GAN learns those patterns indirectly. The generator keeps adjusting until its samples fit the shape of the real data closely enough to confuse the discriminator.

Training can be unstable. If the discriminator becomes too strong, the generator may receive feedback that is not helpful. If the generator exploits a weakness in the discriminator, it may produce narrow or repetitive results instead of varied ones. A good GAN depends on keeping the contest useful, not letting either side make the other irrelevant.

What GANs can be used for

GANs are best known for making realistic synthetic images, but the idea is broader than images. They can support image restoration, style transfer, simulation, and synthetic data generation. In each case, the aim is not magic creativity. The aim is to learn the patterns in a set of examples and produce new samples that fit those patterns.

That same ability creates risk. A system that can make convincing synthetic media can also support deception, including fake images or altered video. Understanding GANs helps explain both sides: why synthetic media can look plausible, and why detection tools also become part of the same contest between making and spotting fakes.

A GAN is therefore less a single model that “knows” the answer and more a training arrangement. The generator learns by trying to deceive. The discriminator learns by trying not to be deceived. The useful result comes from the pressure between them.