Quiz: training GANs and what goes wrong

Short questions on mode collapse, oscillation, the Wasserstein idea and judging samples. Try each on paper first, then open the answer.


Q1. A GAN trained on cell images produces sharp, realistic cells, but almost all of them are round interphase nuclei; no dividing cells appear. What is this failure called, and which of precision and recall shows it?

Realism or variety?

Mode dropping (in the extreme, mode collapse). Precision stays high (the samples are realistic); recall is low (part of the real variety, the dividing cells, has no samples nearby).


Q2. Why does nothing in the generator’s loss reward variety?

The loss is an average over samples of -\log D(G(z)). What is best for each sample on its own?

Each sample is scored on its own: for a fixed discriminator the best is to put every sample where D is highest. Variety only comes from the discriminator reacting to the pile-up.


Q3. The data and the generated distribution do not overlap at all. Their Jensen–Shannon divergence is \ln 2. What is it after the generator has moved halfway towards the data, still without overlap? What does this mean for training?

JS depends only on the overlap.

Still \ln 2. The divergence does not change, so it gives no slope: the generator gets no signal about which way the data are (vanishing gradients). The earth mover’s (Wasserstein) distance has halved, so it does give a slope.


Q4. Two equally large samples in 1D: (4, 0, 2) and (1, 5, 3). What is their Wasserstein-1 distance?

Sort both, pair by rank.

Sorted: (0, 2, 4) and (1, 3, 5); every pair is 1 apart, so W_1 = 1.


Q5. The generator loss of your GAN rises during training. Is training going badly?

Against whom is the loss measured?

Not necessarily: a stronger discriminator raises the generator’s loss even when the samples get better. Judge by the samples, precision and recall on held-out data, not by the losses.


Q6. You compute precision and recall of 1 000 generated cell images against 1 000 real ones and get precision 0.97, recall 0.95. Name one problem these numbers cannot rule out.

What if the generator copies its training images?

Memorisation: copies of training images score well on both. Check the distance of each sample to its nearest training image (it should not be much smaller than for held-out real images). Also: the metrics live in a feature space, so differences the features ignore (e.g. intensities you want to measure) are invisible.


Q7. (math) With simultaneous gradient steps of size \eta on the game \min_x\max_y xy, by what factor does the distance from the equilibrium grow per step?

x \leftarrow x - \eta y, y \leftarrow y + \eta x.

(x - \eta y)^2 + (y + \eta x)^2 = (1 + \eta^2)(x^2 + y^2): the distance grows by \sqrt{1 + \eta^2} per step, for every \eta > 0.