GANs Explained: How Two AI Models Create New Images

GANs explained in plain terms means a way of teaching AI to create new things, such as images of people who do not exist, by setting two AI models against each other in a contest. The central question is how a machine can learn to make something realistic without ever being shown the rules of realism, and the short answer is competition: one model tries to create fakes, the other tries to catch them, and both get better until the fakes are hard to tell from the real thing.

Think of an art forger and an art expert locked in a room together. The forger paints, the expert points out every flaw, and the forger paints again, better each time. After enough rounds, the forger’s work is so good that even the expert is fooled. A GAN is that contest, played out in mathematics, thousands of times a second.

GAN stands for Generative Adversarial Network, a name that describes the idea precisely: it generates, it is adversarial, and it is a network. The design was introduced in a 2014 paper, and it drove the first wave of AI-generated images, long before the newer diffusion models arrived.

Key takeaways

  • A GAN pairs a generator, which creates fakes, with a discriminator, which tries to spot them.
  • The two models train against each other, and both improve as the contest continues.
  • GANs can create realistic images, art, and other data that resembles their training set.
  • Training is famously unstable and can fail in several distinctive ways.
  • Newer methods have overtaken GANs for images, but the idea remains influential.

What a GAN is

A GAN is a machine learning system made of two neural networks that train together by competing. The generator takes random noise as its input and tries to turn it into something that looks like the training data, for example a photograph of a face. The discriminator takes images, some real and some from the generator, and tries to judge which are which. The generator’s goal is to fool the discriminator; the discriminator’s goal is not to be fooled.

The two networks are trained in turns. First the discriminator is shown a mix of real and generated images and learns to tell them apart a little better. Then the generator creates new images, the discriminator judges them, and the generator learns from its mistakes, adjusting itself to produce fakes that are harder to catch. Each round makes both sides slightly stronger, and the competition drives the whole system forward.

What is remarkable is that nobody teaches the generator what a face looks like. It learns only through the discriminator’s feedback, trying variations and keeping whatever fools the judge. Over time it discovers, on its own, the structure of eyes, noses, lighting, and skin, because those are the features the discriminator checks. The knowledge emerges from the contest, not from a set of rules.

GANs were introduced by Ian Goodfellow and colleagues in 2014, in a paper that framed the two networks as players in a game, each trying to outwit the other. Our guide to generative AI explains the wider family of systems that create new content, of which GANs were one of the first famous members.

How a GAN works

Training begins with the generator producing nonsense. It takes random numbers and turns them into an image, and at first the result is meaningless noise, which the discriminator rejects easily. But each rejection carries information: the discriminator’s judgement, expressed as a number, tells the generator how far off it was, and the generator adjusts its internal settings to do slightly better next time.

The discriminator is learning at the same time. It is shown real photographs and the generator’s attempts, and it adjusts itself to spot the differences more reliably. Early on it can rely on obvious flaws, such as strange colours or broken shapes. As the generator improves, the discriminator must notice subtler tells, such as asymmetry in a face or unnatural texture in hair.

The ideal end point is an equilibrium, where the generator’s images are so convincing that the discriminator can do no better than guessing. At that point the generator has learned the distribution of the training data: it can produce new faces that look real, yet are not copies of any person in the training set, because it has learned the patterns, not memorised the examples.

In practice, reaching that balance is hard. The two networks must stay evenly matched: if the discriminator becomes too strong, the generator gets no useful feedback, because everything is rejected; if the generator becomes too strong, the discriminator stops learning. Much of the research on GANs has been about keeping this contest stable, and about preventing the failures that follow when it is not.

A photograph of a dark studio at night with a large monitor showing two glowing green faces side by side, one real and one generated
A GAN is a contest: the generator tries to create images real enough to fool the discriminator, and both improve with every round.

Comparing GANs with diffusion models

Aspect GANs Diffusion models
How images are made One step, from noise Many steps, removing noise gradually
Training stability Often unstable, hard to tune More stable and reliable
Image quality High, when training succeeds Very high, more consistently
Variety of output Can collapse to few examples Usually broad and varied
Typical use today Specialised tasks, research Most image generation tools

Where GANs are used

Generating faces is the use that made GANs famous. A trained GAN can produce photographs of people who do not exist, realistic enough to fool most viewers, which has been used for stock photography, avatars, and privacy, where a realistic face is needed without using a real person’s photograph. The same idea generates animals, cars, rooms, and landscapes.

Artists and designers have used GANs to explore new styles, blending and transforming images in ways that would be hard to do by hand. A GAN can transfer the style of one painting onto a photograph, or generate endless variations on a theme, giving designers a starting point to work from rather than a finished product.

GANs are also used to improve data. A medical imaging team with few examples of a rare condition can generate realistic synthetic scans to train other models on, and a robotics team can generate varied training scenes without photographing them all. The generated data is not a substitute for real data, but it can fill gaps where real data is scarce or sensitive.

They appear in less visible places too: restoring old photographs, sharpening blurry images, and converting sketches into realistic pictures. Our guide to deep learning explains the neural networks that both halves of a GAN are built from, and how they learn from examples.

Strengths and limits

The greatest strength of a GAN is that it learns to generate without being told the rules. Given enough examples, the contest teaches the generator the structure of the data on its own, and the results can be strikingly realistic. For a time, GANs produced the best AI-generated images in the world, and they remain fast: a trained generator creates an image in a single step.

Its limits are dominated by training. GANs are notoriously hard to train, and they fail in distinctive ways. The most famous is mode collapse, where the generator discovers one image that fools the discriminator and produces endless variations of it, ignoring the rest of the variety in the training data. Another is instability, where the balance between the two networks breaks and training spirals into uselessness.

GANs also raise difficult questions. A generator trained on photographs of real people can produce fake images of them, and the same technology that creates harmless avatars can create deceptive deepfakes. The technology itself is neutral, but its uses are not, and the line between creative tool and deception is one the field continues to argue about.

Finally, newer methods have overtaken GANs for most image work. Diffusion models, which build images by gradually removing noise, train more reliably and produce more varied results, and they now power most image generation tools. GANs remain influential and are still used for specialised tasks, but the spotlight has moved on.

GANs checklist

  • Understand the contest: generator creates, discriminator judges, both learn.
  • Expect training to be unstable; budget time for tuning and failures.
  • Watch for mode collapse: many identical outputs mean the generator gave up on variety.
  • Keep the two networks balanced, or neither learns anything useful.
  • Use diverse, high-quality training data; the generator can only copy what it sees.
  • Check outputs for memorised examples, not just realistic-looking ones.
  • Consider diffusion models for general image generation today.
  • Label generated images clearly when they could be mistaken for real.
  • Respect consent and copyright in the data you train on.

Frequently asked questions

What is a GAN?

A GAN, or Generative Adversarial Network, is a machine learning system of two neural networks that train by competing. The generator creates fake data, the discriminator tries to spot it, and both improve until the fakes are hard to tell from real data.

How do GANs create images of people who do not exist?

By learning the patterns of real faces from thousands of photographs, then generating new ones that follow those patterns. The faces are not copies of real people; they are new combinations of the features the generator learned.

What is mode collapse?

Mode collapse is a common GAN failure in which the generator produces only a small number of outputs, because it found one trick that fools the discriminator and stopped exploring. The results look realistic but lack variety.

Are GANs still used today?

Yes, for specialised tasks and research, and in applications such as image restoration and data augmentation. For general image generation, diffusion models have largely taken over, because they train more reliably.

What is the difference between a GAN and a diffusion model?

A GAN creates an image in one step, through a contest between two networks. A diffusion model builds an image gradually, starting from noise and removing it step by step. Diffusion models are usually more stable to train and produce more varied results.

Can GANs be used for harm?

Yes. The same technology that creates avatars and art can create deceptive images of real people, known as deepfakes. Responsible use means labelling generated images and respecting consent and copyright in training data.

The bottom line

GANs explained in one line is this: two AI models in a contest, one forging and one judging, until the forgeries are good enough to fool the judge.

That contest taught machines to create, and it opened the modern era of AI-generated media. The technology has moved on, but the idea, that competition can teach what rules cannot, remains one of the most elegant in AI.

This article is general information about how GANs work, not advice about which generative approach suits a particular project.

Latest articles

Scroll to Top