Machine Learning

Generative Adversarial Network (GAN)

A generative adversarial network is a pair of neural networks trained against each other, one producing synthetic data and the other judging whether it is real, until the output becomes convincing.

What is a generative adversarial network?

A generative adversarial network (GAN) is a machine learning setup in which two neural networks compete. The generator takes random noise and produces a synthetic example, such as an image. The discriminator receives a mix of real examples and generated ones and tries to tell them apart. The generator is trained to fool the discriminator, and the discriminator is trained to avoid being fooled. As both improve, the generated examples become increasingly realistic.

GANs were the first method to produce photorealistic synthetic images, and they made deepfakes possible. For most image generation, diffusion models have since taken over, but GANs remain in use for fast generation, image-to-image translation, and synthetic data in industrial settings.

How a generative adversarial network works

Training alternates between the two networks. The discriminator is updated to classify a batch of real and fake examples correctly, then the generator is updated using the discriminator’s feedback on where its fakes gave themselves away. The balance is delicate. If the discriminator wins too easily, the generator receives no useful signal. If the generator finds one output that fools the discriminator, it may produce only that, a failure called mode collapse. Conditional GANs add a label or a source image as input, so the generator can be asked for a specific class or can translate a sketch into a photo.

Generative adversarial networks in practice

A manufacturer of automotive castings has a visual inspection model that performs poorly on a rare porosity defect, because only a few dozen real examples exist. A conditional GAN trained on those examples and on defect-free parts generates thousands of plausible defect images, which quality engineers review before adding them to the training set. A regional bank uses a GAN to create synthetic customer records that preserve the statistical relationships of the real data, so developers can test a new onboarding system without touching production personal data.

What to watch for

  • Synthetic data can leak the real data it was trained on, so test for memorized records before treating it as anonymized.
  • Have domain experts review generated examples, because a convincing image can still be physically wrong.
  • Training is unstable and needs experienced hands, and for new image generation work diffusion models are usually the easier choice.
  • Any system that can generate realistic faces or voices needs an acceptable use policy and provenance marking.

← Back to AI Glossary