Discriminator Architecture and Role
What you'll learn: How the discriminator acts as a judge, classifying inputs as real or fake and providing the learning signal that trains both networks in a GAN.
The Discriminator as Judge
Think of the discriminator as an art critic who must distinguish between authentic paintings and forgeries. Its job is binary classification: given an image, output a probability that it's real (from the training dataset) or fake (generated by the generator).
Architecture Basics
The discriminator is typically a standard convolutional neural network (for images) that performs classification:
- Input: Either a real image from your dataset or a fake image from the generator
- Architecture: Convolutional layers that downsample and extract features
- Output: A single probability value (often via sigmoid activation) representing "realness"
Unlike the generator which creates data, the discriminator analyzes it. It learns to spot telltale signs that an image is synthetic rather than authentic.
Providing the Learning Signal
Here's where it gets interesting: the discriminator serves a dual purpose:
- It trains itself to get better at detection using labeled examples (real=1, fake=0)
- It trains the generator by providing gradient feedback showing what made fakes unconvincing
When the discriminator confidently rejects a fake image, those gradients flow backward through the generator, teaching it exactly what needs improvement. The generator essentially learns by trying to fool an increasingly sophisticated critic.
The Adversarial Dance
The discriminator must stay "just right" in strength—not too powerful (crushing the generator) nor too weak (providing poor feedback). This balance drives the minimax game where both networks push each other toward better performance.
Key Takeaway: The discriminator is a binary classifier that judges real vs. fake inputs, providing critical gradient-based feedback that teaches the generator how to create increasingly realistic samples.