4.5.17 · D3Generative Models

Worked examples — Evaluating generative models (FID, IS)

3,587 words16 min readBack to topic

You have already met the two headline scores on the parent note Evaluating generative models (FID, IS):

  • IS (Inception Score) — bigger is better, measures sharpness + spread of labels.
  • FID (Fréchet Inception Distance) — smaller is better, measures distance between feature clouds.

This page does one thing: it hunts down every case class these scores can throw at you and works each one to the last decimal. No new theory — just relentless coverage. If you have not seen , , or a matrix before, each is re-earned the moment it appears.

Before anything else, one symbol we will lean on constantly:


The scenario matrix

Think of "cases" as the different shapes of input a metric can receive. If we only ever practise the nice symmetric case, we get ambushed by the degenerate ones. Here is the full board we will clear:

Cell Metric Scenario class What could surprise you
A IS Perfect, balanced generator The "textbook" answer — a reference point
B IS Mode collapse (all one class) IS stays high — the famous blind spot
C IS Pure noise / uniform predictions IS crashes to (the floor)
D IS Confident but imbalanced labels Diversity term drags the score down
E FID Identical distributions FID (the floor)
F FID Mean shift only, same spread Only the term fires
G FID Same mean, different spread Only the trace term fires
H FID Degenerate: zero variance () Square-root term vanishes
I Word problem Two GAN checkpoints, pick the winner IS and FID disagree
J Exam twist Add a duplicated sample Which metric notices?

We now clear the board cell by cell.


IS cases (cells A–D)

Everywhere below, is the batch size — the number of generated images we score together (in practice ; in our toy cells or ). is the classifier's probability vector for one image — "how sure am I this is class ?" — and

is the marginal, the average of those vectors: "across the whole batch, how often does each class show up?" The score is

We use (natural log, base ) throughout so that cleanly undoes it — that is the only reason the base- pairing is chosen: , no leftover constants.


Cell A — the balanced, confident generator


Cell B — mode collapse (the blind spot)

The sidebar warning is that this is too clean. Real collapse never produces byte-identical vectors — the classifier wobbles slightly per image. Let us see concretely how that wobble rescues IS from the floor, wrongly.


Cell C — pure noise (uniform predictions)


Cell D — confident but imbalanced


FID cases (cells E–H)

Now switch metric. We drop into feature space — the 2048 numbers Inception-v3's pool3 layer emits per image (see Inception-v3 Architecture and why perceptual features beat raw pixels, Perceptual Loss Functions). For hand-work we pretend features are 2-dimensional so we can draw them.

The figure below shows the whole idea at a glance: three toy feature clouds. The magenta cloud is the real data centred at . The violet cloud is a generator whose samples have the same spread but a shifted centre — the little navy arrow between the two X markers is the "mean gap" that FID's first term measures (this is Cell F). The orange cloud sits somewhere else and is visibly tighter — a low-diversity generator whose small spread is what FID's trace term catches (the flavour of Cells G and H). Keep this picture in mind: FID literally adds "how far apart are the centres" to "how differently do they spread".

Figure — Evaluating generative models (FID, IS)

We model each cloud as a Gaussian with mean (its centre) and covariance (its spread + tilt). The score:

("trace") just means "add up the diagonal entries of a matrix" — for a matrix, top-left plus bottom-right. We use it because the diagonal sums the mismatch across every feature dimension at once.


Cell E — identical clouds (the floor)


Cell F — mean shift only


Cell G — spread mismatch only


Cell H — degenerate: zero-variance generator


Cell I — the word problem (IS and FID as tie-breakers)


Cell J — the exam twist (duplicated sample)


Recall Quiz yourself

What does stand for in these formulas? ::: The number of classes the classifier can output; a probability vector has entries summing to . Which cell shows IS being fooled by mode collapse in realistic conditions? ::: Cell B2 — slight per-image jitter breaks marginal conditional, so IS climbs above even though diversity is dead. What is the FID of two identical Gaussians? ::: (Cell E) — the floor; centre gap and trace term both cancel. If only the covariances differ, which FID term fires? ::: The trace term (Cell G); the mean gap is . A zero-variance generator against real spread gives what FID? ::: (Cell H), because the square-root cross term vanishes. Why does the perfect IS equal the number of classes ? ::: Because the exponent maxes out at (uniform marginal) with , and . IS floor value and FID floor value? ::: IS floor ; FID floor .


Connections

  • Parent: Evaluating generative models (FID, IS)
  • Mode Collapse in GANs — the failure IS hides (Cells B2, I) and FID/Recall expose.
  • Precision and Recall for Generative Models — decomposes what IS/FID lump together.
  • Inception-v3 Architecture — source of the and 2048-dim features.
  • Perceptual Loss Functions — why feature space beats pixel space (Cells E–H).