4.5.8 · D1Generative Models

Foundations — GAN training instability and mode collapse

2,215 words10 min readBack to topic

This page builds the vocabulary for GAN training instability and mode collapse from nothing. Nothing here assumes you have seen probability notation, expectations, logarithms-as-scores, or gradients before. Every symbol earns its place before we use it.


1. A "distribution" and the symbol

Picture a landscape of hills. Where the hill is tall, that kind of shows up often. Where the ground is flat and low, that is rare. The whole area under all the hills adds up to (something always happens). Written precisely, for a continuous this "total area is one" rule is

Figure — GAN training instability and mode collapse

We need two of these landscapes:

  • — the landscape of real data (real photos, real digits). This is fixed; it is the target.
  • — the landscape of what the generator currently produces. This one moves during training.

2. The sampling arrow

Picture throwing a dart at the hill-landscape: you are more likely to hit where the hills are tall. Each dart-hit is one sample . We need this because networks never see the whole landscape — they only ever see a bucket of samples drawn from it.


3. Noise and the generator

Figure — GAN training instability and mode collapse

Picture a slot machine: pull a random lever () and the machine () prints a picture. Different → different picture. As learns, the pictures it prints get more realistic.

  • Why noise at all? Randomness is where variety comes from. If were always the same, would print one fixed picture. Mode collapse is exactly the failure where different all get mapped to the same output — the variety in gets thrown away.

4. The discriminator and the interval

Picture a dial the judge turns: hard left = fake, hard right = real, middle = shrug. The judge is good when it turns the dial to for real photos and to for the generator's fakes.


5. The logarithm as a "surprise / reward" meter

Why does appear all over the objective? Because we want to reward the judge for confident-correct answers and punish confident-wrong ones — and does exactly that stretching.

Figure — GAN training instability and mode collapse
  • Why not just use itself as the score? Compare two nudges of the same size, . Measured with plain , moving from to and moving from to look identical — both are "worth ". Measured with , the first nudge is worth , while the second is worth — over seven times more reward. So deliberately makes changes near certainty count for very little and changes near ignorance count for a lot.

6. Expectation — the "average over the bucket"

Picture: score every dart-hit on the hill, then average all the scores — but hits in the tall regions count more because there are more of them (that is exactly the weight inside the integral). We need because the objective must judge and over the whole landscape, not one lucky sample.


7. The full objective, now readable

With every symbol built, the parent's headline formula is now plain English:

Here is the judge's belief that the fake is fake; of it rewards the judge for spotting fakes, and wants that reward to be small.


8. Gradients — the "which way to step" arrow, and who steps which way

Picture standing on a foggy hillside feeling for the steepest slope with your foot, then stepping down. That's gradient descent.

We care about all this because " receives no learning signal" — the heart of instability — literally means the arrow has near-zero length, so the foot feels flat ground and can't decide which way to step.

  • (gradient with respect to the input , not the weights) measures how much the judge's verdict changes if you nudge the picture. When the judge is over-confident its verdict is flat everywhere, so — no nudge changes its mind, so gets no hint. That is the vanishing gradient in one line, exactly the saturation warned about in Section 5.

Prerequisite map

distribution p(x)

sampling x from p

noise z

generator G(z)

discriminator D(x)

log as a score

GAN objective V

expectation E

gradient grad theta

training and instability

mode collapse

GAN instability and mode collapse

Each foundation feeds the next: landscapes → sampling → the two players → their shared score → the arrows that move them → the failures the topic is about.


Where this connects

  • The whole GAN setup comes from 4.5.01-Generative-Adversarial-Networks-fundamentals.
  • The "flat foot / no downhill" gradient trouble is a general theme in 3.4.05-Optimization-challenges-in-deep-learning.
  • The cleaner-score fix that replaces lives in 4.5.07-Wasserstein-GAN-and-improved-training.
  • Once stable, richer architectures follow in 4.5.09-StyleGAN-and-progressive-growing and 4.5.10-Conditional-GANs-and-control.
  • Layer statistics that also affect stability: 4.3.06-Batch-normalization-and-alternatives.
  • Hinglish version: 4.5.08 GAN training instability and mode collapse (Hinglish).

Equipment checklist

What does being tall at some mean?
That kind of real example is common; a dart aimed at the landscape often lands there.
Write the normalization condition every distribution obeys.
(or for discrete ) — the total area/probability is one.
Read in plain words.
" is a fresh blob of random numbers drawn from a simple known noise landscape."
What does signify?
The judge genuinely cannot tell if is real or fake.
Why instead of plain as a score?
makes a fixed-size nudge near ignorance count far more than the same nudge near certainty, sharpening the training signal.
Write the integral definition of .
— the value of averaged, weighted by the likelihood .
What is , and which way does a player step?
The arrow of fastest increase of that player's loss ; the player steps the opposite (downhill) way.
Does climb or descend the objective , and why?
effectively climbs (gradient ascent on ) because its loss is ; descends because its loss is .
What happens to as , and how is it handled in code?
It diverges to (undefined at ); code clamps to so no occurs.
In one line, what makes the generator's gradient vanish?
An over-confident judge has a flat verdict, so and no nudge to the fake changes its mind.
What would mode collapse look like in terms of ?
is one tall spike on a single real hill, ignoring every other mode of .
Recall Self-test: can you state the core game?

Two networks: turns noise into fakes and wants high; scores real-vs-fake and wants it low. Training slides onto ; ascends the objective while descends it, and instability and mode collapse are the two main ways this fails.