This is a great question about GANs (Generative Adversarial Networks). Let me structure a comprehensive answer covering:
- The GAN minimax objective function
- Why the roles are what they are
- The theoretical optimum for the discriminator
1. The GAN Minimax Objective Function
The classic GAN minimax objective is:
minGmaxDV(D,G)=Ex∼pdata[logD(x)]+Ez∼pz[log(1−D(G(z)))]
Or equivalently:
minGmaxD
where:
- D(x) = discriminator's probability that x is real
- G(z) = generator's output from noise z
- p = real data distribution
2. Why Discriminator Maximizes and Generator Minimizes
Discriminator's Perspective:
- The discriminator wants to correctly identify real vs fake samples
- First term Ex∼pdata[logD(x)]: maximize when (correctly classifies real data)
Generator's Perspective:
The generator's goal is to deceive the discriminator by producing samples that appear real. Since the generator only appears in the second term, it wants to make D(G(z))≈1, which drives log(1−D(G(z))) toward large negative values. By minimizing the objective, the generator effectively maximizes the discriminator's error. This creates the fundamental adversarial dynamic where both networks work against each other's interests.
3. Theoretical Optimum for the Discriminator
Given a fixed generator, the optimal discriminator takes the form:
DG∗(x)=p
To find this, I maximize the discriminator's objective by taking the functional derivative. The discriminator wants to maximize:
V(D,G)=∫xp
For each point x, maximizing f(D(x))=pdat requires setting the derivative equal to zero:
dD(x)df=
Solving this yields the optimal discriminator that balances the ratio of real to generated data densities.
The discriminator's behavior reflects the relative likelihoods: it outputs 1/2 when both distributions are equally likely, approaches 1 when data is clearly real, and approaches 0 when samples are clearly generated. At the Nash equilibrium where both networks are optimal, the distributions converge and the discriminator becomes maximally uncertain.
GAN Minimax Objective Function
The Objective
minGmaxD
Or equivalently:
minGmaxD
Terms:
- D(x) = discriminator's estimated probability that x is real
- G(z) = generator output from noise z
- p = real data distribution
Why These Opposing Roles?
Discriminator Maximizes
The discriminator seeks to correctly classify real vs. fake:
- First term E[logD(x)]: Maximize when D(x)→1 on real data
- Second term : Maximize when on fake data
It's correctly identifying both classes.
Generator Minimizes
The generator seeks to fool the discriminator:
- When the generator improves, D(G(z))→1
- This makes log(1−D(G(z)))→−∞
This is a minimax game with conflicting objectives.
Theoretical Optimum for the Discriminator
Given a fixed generator G, the optimal discriminator is:
DG∗(x)=p
Derivation
Maximize the discriminator objective w.r.t. D pointwise:
f(D)=pdatalogD+pg
dDdf=D
Solving:
pdata(1−D)=pg
Interpretation
| Condition | D∗(x) | Meaning |
|---|
| pg=p |
Global Equilibrium (Nash Equilibrium)
When both are optimal:
- Generator: pg=pdata (perfect match)
- Discriminator: D everywhere (random guessing)
The discriminator can no longer distinguish—the game reaches equilibrium.