4.5.8 · D3Generative Models

Worked examples — GAN training instability and mode collapse

3,454 words16 min readBack to topic

This page is the drill hall for the parent topic. The parent built the theory: the minimax game, the optimal discriminator, the vanishing-gradient fix, and mode collapse. Here we run numbers through every corner case so you never meet a scenario you haven't seen worked.

Before we start, one promise: we re-anchor every symbol you'll actually use on this page — including the two the parent leans on heavily, and the optimal game value .


The scenario matrix

Every case this topic can throw at you falls into one of these cells. The 8 worked examples below are each stamped with the cell(s) they cover.

Cell The situation Where numbers get weird Example
A. Perfect generator everywhere , game is a draw Ex 1
B. One-sided region but (a mode the generator missed) , a "hole" Ex 2
C. Over-produced region but (garbage output) Ex 2
D. Saturated-D gradient , confident critic input-gradient : signal vanishes Ex 3
E. Loss swap compare vs gradient scale prefactor vs Ex 4
F. Mode-collapse incentive favours old mode over new mode loss gap Ex 5
G. Oscillation / non-convergence forgets modes, cycles period-2 orbit, no fixed point Ex 6
H. Real-world word problem JS-divergence at optimum value collapses to Ex 7
I. Exam twist (WGAN) critic , Lipschitz bound Wasserstein distance stays finite where JS blows up Ex 8

Case A & the optimal discriminator


Cases B & C — the holes and the garbage

Figure — GAN training instability and mode collapse

The figure shows two histograms on one shelf: blue is , orange is . The three vertical markers pin the exact points used in Ex 2: the green dashed line at (both curves overlap — they agree), the red dashed line at (only blue is present — the generator's hole), and the orange dashed line at (only orange is present — the generator's garbage). Each marker is labelled with its pair so you can read the numbers straight off the picture.


Case D — the vanishing signal, in numbers

Figure — GAN training instability and mode collapse

The figure plots a saturated discriminator: an S-curve (sigmoid) that is nearly flat where the fakes live. The green tangent line is almost horizontal — its steepness is , and that flatness is the vanishing gradient.


Case E — why the loss swap rescues training


Case F — the mode-collapse incentive


Case G — oscillation, no fixed point

Figure — GAN training instability and mode collapse

The figure traces the "1 ↔ 7" cycle from the parent's MNIST example: generator output loops, discriminator focus lags one step behind, and the pair never lands on a fixed point.


Case H — the real-world value at optimum


Case I — the WGAN exam twist


Closing the drill hall

Every cell of the matrix is now worked with real numbers. The through-line: the same disease wears three faces. A too-confident discriminator saturates (, Ex 3–4); disjoint distributions freeze the JS-divergence at so stops moving (Ex 7); and the generator, punished for variety (Ex 5), collapses onto a few safe modes and oscillates (Ex 6). WGAN (Ex 8) attacks all of them at the root by swapping the saturating probability for a smoothly-sloped critic. For where to go next: progressive growing and conditional control build stability into the architecture itself; normalization and optimization tactics tame the orbits in practice.

Recall Self-test — cover the answers

Perfect generator gives ? ::: , and game value . What does mean? ::: the slope of the discriminator's S-curve with respect to the sample — how much the score changes if the sample moves a hair; it vanishes when saturates. A mode the generator never visits () gives ? ::: (certainly real) — a collapse hole. Why does the gradient vanish when is confident? ::: The critic saturates so ; the scalar is NOT the cause. Non-saturating prefactor at ? ::: , vs original (≈99× stronger). What is ? ::: the generator's per-sample loss : small when is fooled, large when suspicious. Mode-collapse gap for ? ::: — penalty for variety. at disjoint supports? ::: , and JSD frozen at so its gradient dies. Why WGAN? ::: JS is stuck at for disjoint supports (no gradient); varies smoothly (gradient 1), realised by the 1-Lipschitz critic .