4.5.7 · D1Generative Models

Foundations — Generator and discriminator dynamics

1,817 words8 min readBack to topic

Before you can read a single line of the parent note, you must be able to look at every symbol it uses and immediately know what it means and why it is there. This page builds them one at a time, in an order where each new symbol only uses symbols already defined. Nothing is assumed.


1. The two players: what actually moves

Everything starts with two machines. Let us draw them before we name them.

Figure — Generator and discriminator dynamics

Why two machines and not one? Because we have no direct rule for "what makes a face look real". So we let one machine learn that rule (the detective ) and use it as the teacher for the painter . That is the whole trick.


2. The input symbols: , , and the wavy arrow

We keep saying "noise" and "picture". Let us pin down the exact symbols.

Figure — Generator and discriminator dynamics

Why do we need distributions at all? Because is never judged on one fake — it is judged on the whole population of fakes it can make. Distributions are the language for "the whole population at once".


3. The averaging symbol: (expectation)

The parent note is full of . It looks scary; it is just an average.

Why average instead of one sample? Because a single lucky (or unlucky) picture tells you nothing about whether is generally good. The game is decided on averages, so the objective is written with averages.


4. The logarithm: — why it appears everywhere

The parent note wraps every probability in . Here is the honest reason.

Figure — Generator and discriminator dynamics

Two building blocks you will now recognise on sight:

  • — big (near 0) when correctly calls a real picture real.
  • — big (near 0) when correctly calls a fake picture fake. Here flips "probability real" into "probability fake".

5. Putting it together: the value function

Now every piece of the headline formula is a symbol you have already met.


6. The learning symbols: , , gradient steps

How does a machine "tune itself"? Two more symbols.

Why gradients and not a formula for the best knobs? Because and are giant tangled networks with no closed-form best setting. Feeling your way uphill/downhill one small step at a time is the only tractable option — this is the machinery of the GAN training algorithm.


7. The prerequisite map

noise z and prob p_z

Generator G makes G of z

real sample x and p_data

Discriminator D outputs 0 to 1

fake distribution p_g

log wraps each probability

scoreboard V of D and G

expectation E averages the batch

min G max D the tug of war

parameters theta d and theta g

gradient nabla steps

Nash equilibrium D equals half

Every arrow says "you need the tail before you can understand the head." Read the parent note only once every box here feels obvious.


8. Where these lead next

Once the tug-of-war stalls perfectly you reach everywhere — but the path there can break in two famous ways: mode collapse (the painter cheats with one trick) and vanishing gradients, which motivates the Wasserstein GAN. This page only equips you to read the dynamics; those pages explain when they go wrong.


Equipment checklist

Cover the right side. If you can answer each, you are ready for the parent note.

What does mean in plain words?
The fake picture the generator builds from a noise vector .
What number does output, and what do , , and mean?
A probability in : = certainly real, = certainly fake, = can't tell.
Read the symbol aloud and say what it means.
" is drawn from the real-data distribution" — is one genuine sample.
What is and what is the training goal about it?
The distribution of the generator's fakes; the goal is to make equal .
What does compute?
The average of over many noise draws from the noise distribution.
Why is wrapped around every probability?
It punishes confident mistakes far harder (goes to near 0) and turns products into stable sums.
What does measure?
How correctly labels a fake as fake; near when is right about the fake.
In , who pushes the scoreboard up and who pushes it down?
pushes up (wants to be right); pushes down (wants to fool ).
What are and ?
The internal weights (knobs) of the discriminator and generator respectively.
What does point toward, and who ascends vs descends it?
The steepest-increase direction in knob-space; ascends, descends.