The Minimax Game
min_G max_D V(D, G): two players, one value function
By the end of this lesson you can
- Read and interpret the value function V(D, G) from Eq. 1
- Understand why D maximises and G minimises the same quantity
- Recognise a saddle point as the solution of a two-player zero-sum game
Put the generator and the discriminator together and you get the central equation of the paper. One value function, two players pulling it in opposite directions.
Equation 1
The paper writes the training problem as a two-player minimax game with value function V(G, D):
Take it apart term by term:
- E_x∼p_data[log D(x)]: on real data, how confidently does D say "real"? It is 0 when D(x) = 1 and very negative when D(x) ≈ 0.
- E_z∼p_z[log(1 − D(G(z)))]: on generated data, how confidently does D say "fake"? It is 0 when D(G(z)) = 0 and very negative when D(G(z)) ≈ 1.
Both logs are of numbers in (0, 1), so V ≤ 0 always. V close to 0 means D is winning decisively.
Each Player's View
The discriminator maximises
D controls both terms. It pushes D(x) toward 1 on real data and D(G(z)) toward 0 on fakes. As the previous lesson showed, this is the same as minimising binary cross-entropy.
The generator minimises
G cannot touch the first term: real data does not depend on θ_g. It can only change the second term, by moving its samples to places where D(G(z)) is high. From G's point of view the objective is:
This is the paper's "train G to minimise log(1 − D(G(z)))". G never sees a real example. Everything it knows about the data arrives through D.
A Zero-Sum Game
D's payoff is V, G's payoff is −V. Whatever one gains the other loses. That makes this a two-player zero-sum game, the setting of classical game theory. The order of the operators matters: in min_G max_D, D gets to respond to whatever G does. G is choosing the generator whose best-case detector does worst.
The Solution Is a Saddle Point
We are not looking for a minimum of V, nor a maximum. We want a pair (G*, D*) where neither player can improve by moving alone:
Along D's direction the point is a maximum; along G's direction it is a minimum. Geometrically this is a saddle point, like the middle of a horse saddle: uphill along one axis, downhill along the other. In game theory it is a Nash equilibrium.
Lessons 5 and 6 show what this equilibrium is for GANs: the generator reproduces the data (p_g = p_data), the discriminator outputs 1/2 everywhere, and V = −log 4. Try it now: plug D(x) = 1/2 into Eq. 1 and you get log(1/2) + log(1/2) = −log 4, no matter what G is.
Edit the code and press Ctrl + Enter to run it in your browser.
Compute V(D, G) for the constant discriminator D(x) = 1/2, for an arbitrary generator. What does this imply about max_D V(D, G) for every G?
In the code cell, D(x) = σ(w·x) has no bias. Add a bias c and search over (w, c). How does max_D V change for θ = 1 and θ = 2? Why was the no-bias D weaker?
Explain in your own words why the equilibrium of a GAN is a saddle point of V rather than a minimum or a maximum. What would go wrong if both players minimised V?
Key takeaway
GAN training is a zero-sum game: D pushes V up by classifying well, G pushes V down by fooling D, and the solution is a saddle point.
Up next
If D plays perfectly for a fixed G, what does it look like? There is a closed form.