liveBook · Manning

Generative adversarial network

As explained in Grokking AI Algorithms, Second Edition

A generative adversarial network is a machine-learning model consisting of a generator and a discriminator trained through competition to produce increasingly realistic synthetic data.

A generative adversarial network (GAN) uses two competing neural networks: a generator creates synthetic data, while a discriminator judges whether it looks real. Their competition improves both generation and evaluation, producing increasingly convincing results. section 9.30

GANs are useful when a model must create realistic images or other media rather than merely classify existing examples. The generator proposes a result, the discriminator compares it with real examples, and the resulting error guides further improvement. section 9.30

A simple GAN interaction works like a contest:

  • The generator creates a potential solution, such as a landscape image. section 9.30
  • The discriminator examines the generated result alongside real landscape images and estimates whether the result is realistic. section 9.30
  • An error or cost is fed back so the generator improves its creations and the discriminator improves its judgments. section 9.30

From a 2D chair to a 3D object

A GAN can estimate missing information in a two-dimensional chair image and generate a corresponding three-dimensional chair. The task demonstrates how adversarial generation can create structure from an incomplete source. section 9.30

Figure 9.34 Simple example of a GAN
09_34

Use the simple GAN diagram to follow the generator–discriminator competition and the feedback loop that improves their results. section 9.30

GANs can generate convincing fake videos, including deepfakes, and can overlay hairstyles on faces. They also belong to the broader family of generative image models, alongside diffusion models; CNNs and U-Net have become standard approaches for modern image generation. section 9.30 section 12.1

How Grokking AI Algorithms, Second Edition covers it

How deep it goes
Explains the generator–discriminator loop and feedback intuition, but stops short of implementation or mathematical training details.
Examples
Uses landscapes, deepfakes, hairstyle overlays, and 3D chairs generated from 2D images.
What you can do after
Understand how generator–discriminator competition improves synthetic data and supports image-generation applications.
How it connects
Connects neural networks, adversarial competition, generative image models, diffusion models, CNNs, and U-Net.

Also explained in

Compare how 12 books explain generative adversarial network →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking AI Algorithms, Second Edition. The section links point to the parts of the book it draws on.