Discuss the working principle of Generative Adversarial Networks. Illustrate the minimax game between the Generator and Discriminator with a suitable diagram and explain the objective function.
What's actually being asked
How GANs work as a two-player game, a diagram of the Generator-vs-Discriminator setup, and a full explanation of the minimax objective function.
Answer
The working principle
A GAN has two networks trained against each other:
- Generator G takes random noise
z ~ p_z(usuallyN(0,I)or uniform) and transforms it into a fake sampleG(z), trying to make it look like it came from the real data distributionp_data. - Discriminator D takes a sample (real x, or fake
G(z)) and outputs a scalarD(·) ∈ (0,1), its estimate of the probability that the sample is real.
They're trained with opposing goals: D wants to correctly tell real from fake; G wants to fool D into saying "real" about its fakes. Neither network sees hand-labelled "fake vs real" training examples in the usual supervised sense — the only supervision is this adversarial back-and-forth, which is what makes it a minimax game: G minimizes what D maximizes.
The diagram above traces this: noise z flows through G to produce a fake sample; both the fake and a real sample are fed into D; D's classification output feeds a loss/gradient signal back to update both networks.
The objective function
min_G max_D V(D,G) = 𝔼_{x∼p_data}[log D(x)] + 𝔼_{z∼p_z}[log(1 − D(G(z)))]
Reading it term by term:
𝔼_{x∼p_data}[log D(x)]— D wants this high, i.e.,D(x)→1for real x.𝔼_{z∼p_z}[log(1−D(G(z)))]— D also wants this high, i.e.,D(G(z))→0, correctly flagging fakes.- D's move:
max_Dthe fullV(D,G)— it maximizeslog D(x) + log(1−D(G(z))), pushing it toward confidently separating real from fake. - G's move:
min_Gthe sameV(D,G)— since G can't affect the first term (it only depends on real data and D), this reduces to minimizinglog(1−D(G(z))), i.e., G wantsD(G(z))→1(fooling D into calling fakes "real").
Why it's a genuine game, not just two separate losses
The two networks are updated alternately: freeze G, take a gradient-ascent step on D's objective; then freeze D, take a gradient step on G's objective; repeat for many iterations. Each network's loss landscape keeps shifting because the other network is also changing — textbook minimax/Nash-equilibrium territory, not ordinary single-objective optimization. At the theoretical optimum, D can no longer tell real from fake at all: D(x) = D(G(z)) = 0.5 everywhere, and G's output distribution matches p_data exactly.
A practical twist — the non-saturating generator loss
Early in training, D rejects G's (still poor) fakes confidently, so D(G(z)) ≈ 0, and log(1−D(G(z))) sits in a region where its gradient w.r.t. G's parameters is nearly flat (saturates) — G barely learns. In practice, G is instead trained to maximize log D(G(z)) (the non-saturating loss) — the same fooling goal, but with much stronger gradients exactly when G most needs them (when it's doing badly).
Exam tip
State explicitly that G never sees real data directly — it only ever gets a gradient signal relayed through D. This single fact is a favourite "trick" short-answer question on its own.