A generator and a discriminator duel — a forger versus a detective — until the fakes are indistinguishable.
A GAN trains two neural networks against each other, like a forger and a detective locked in a duel. The generator turns random noise into fake samples; the discriminator tries to tell those fakes from real training data. Each one's improvement forces the other to improve.
G: maps a random noise vector z to a fake sample G(z) — an image, say. Its goal is to fool the discriminator.D: takes a sample and outputs the probability it's real. Its goal is to catch fakes.D on real-vs-fake, then improve G to fool the freshly improved D.p_g = p_data, and the discriminator is reduced to guessing at 50/50. At that point the generator has learned to reproduce the data.min_G max_D E[ log D(x) ] # D wants real x scored high
+ E[ log(1 - D(G(z))) ] # D wants fakes scored low; G wants the oppositeD rejects fakes so confidently that G's gradient vanishes. In practice G is trained to maximize `log D(G(z))` instead of minimize log(1 - D(G(z))) — same direction, stronger gradient when G is losing.D and produces only those, ignoring the diversity of real data. If one network overpowers the other, gradients dry up and learning stalls. Balancing the two is the central practical challenge.