4.5.17 · D1Generative Models

Foundations — Evaluating generative models (FID, IS)

2,485 words11 min readBack to topic

This page assumes you know nothing about the notation on the parent note. We build every symbol from the ground up, in an order where each one leans only on the ones before it.


0. The cast of characters (what a "distribution" even is)

Before any formula, picture a giant bin of photographs.

Figure — Evaluating generative models (FID, IS)

Look at the two clouds above. The teal cloud is real images; the orange cloud is what a generator produces. Every dot is one image. Two things can go wrong:

  • the orange cloud sits in the wrong place (fake images look different from real ones), or
  • the orange cloud is the wrong shape/size (too tight = not diverse, too spread = sloppy).

FID measures exactly these two failures. Keep this picture in your head for the whole page.


1. Symbols for "a sample" and "the generator"

Picture: reaching blindfolded into the orange bin and pulling out one photo. That act is .

Why the topic needs it: FID compares against ; IS studies alone. You cannot state either goal without names for "the real cloud" and "the fake cloud".


2. The averaging symbol: expectation

Almost every formula ahead says "average this over many images." We give that its own symbol now, before it is used.

Why the topic needs it: , the average-KL inside IS, and the parameters are all expectations. Having defined up front means no later formula sneaks in an undefined symbol.


3. From an image to a list of numbers: features

A raw image is a huge grid of pixel brightnesses. Comparing pixels directly is useless — shift a cat one pixel left and every pixel changes, yet it's the same cat. So we first translate the image into meaningful numbers.

Figure — Evaluating generative models (FID, IS)

Think of each image as an arrow into a 2048-dimensional room (we draw it in 2D — same idea, fewer axes). Perceptually similar images land close together; a cat and a car land far apart. This is why we say Inception is a "learned perceptual judge" — closeness of arrows matches closeness to the human eye, unlike raw pixels.

Why the topic needs it: both FID and IS run on these feature vectors, never on raw pixels. Perceptual Loss Functions use the same trick for the same reason.


4. Mean — the centre of a cloud

Recall What does the

(sigma) symbol say to do? Add up everything to its right, one term for each value of the counter from to . ::: "Sum from to ."

The picture: is the centre of the teal cloud, the centre of the orange cloud. If the two centres are far apart, the generator is systematically off. That is the first term of FID: (the squared distance between the two centres — Section 7 explains the ).


5. Covariance — the shape and spread of a cloud

The mean tells you where a cloud sits, not how big or which way it stretches. For that we need covariance.

Figure — Evaluating generative models (FID, IS)

The figure shows three clouds with the same but different : a small ball (low diversity), a large ball (high diversity), and a tilted ellipse (features correlated). Note: being big is not automatically good — you want the generated to match the real , not exceed it. A cloud that is too tight is the visual signature of Mode Collapse in GANs.

Why the topic needs it: FID's second term compares and , catching the mode collapse that IS is blind to.


6. Modelling clouds as Gaussians

The picture: a fuzzy elliptical mound, densest at , fading outward with a spread set by .

Why the topic needs it: comparing two arbitrary clouds is impossibly hard. But if you assume both are Gaussians, the distance between them has a clean formula (Section 8). FID makes exactly this simplifying assumption.


7. Distance symbols: and

Two clouds differ in centre and in shape. We need one number for each gap.

Why the topic needs both: FID adds a centre gap () to a shape gap (a trace expression) to get its final single score.


8. Matrix square root

The FID formula contains a strange-looking object: the square root of a matrix. We build it from the plain-number version.

Figure — Evaluating generative models (FID, IS)

Picture: a matrix takes a circle of arrows and stretches it into an ellipse. Its square root is the "half-strength" version — the stretch you apply twice to get the full ellipse. In FID, is a geometric average of the two cloud shapes: it is large only when the real and fake shapes stretch in the same directions, so subtracting it rewards matching shapes.


9. Entropy and KL divergence — the tools behind IS

IS never looks at clouds of features; it looks at classifier guesses. Different symbols, same classifier.

See Precision and Recall for Generative Models for an alternative that separates quality and diversity into two numbers instead of merging them like IS does.


10. The Fréchet / Wasserstein-2 distance = FID

That whole expression is FID, once come from Inception features. So FID = "Fréchet distance between the Gaussian-modelled real and fake feature clouds," and lower is better.


Prerequisite map

Distribution = cloud of points

Feature vector f from Inception

Expectation E = average

Mean mu = cloud centre

Covariance Sigma = cloud shape

Gaussian N mu Sigma

Matrix square root

Frechet distance = FID

Classifier guess p y given x

Marginal p y entropy H

KL divergence = IS

Evaluating generative models FID IS

Notice the two independent branches feeding the topic: the feature/cloud branch builds FID, the classifier-guess branch builds IS. They share only the Inception network and the expectation symbol.


Equipment checklist

Read each question, answer in your head, then reveal.

What is a "distribution" pictured as?
A cloud of points where dense = common outcome, empty = rare.
What does mean in words?
" is one image sampled from the generator's cloud."
What does compute?
The average of over images drawn from the generator (in practice ).
Why use Inception features instead of raw pixels?
Pixels change for tiny shifts; features capture perceptual meaning, so closeness matches human judgement.
What does the mean represent geometrically?
The centre of gravity of the cloud.
Is the covariance one number or a matrix, and what does it capture?
A matrix; it captures the shape, spread, and tilt of the cloud.
What does (trace) do to a matrix?
Sums the diagonal entries — total spread across all axes.
What is a matrix square root ?
The matrix that multiplied by itself gives ; computed by taking of each eigenvalue and keeping the eigenvectors.
Name one numerical danger when computing and its fix.
Nearly-singular covariances give tiny negative eigenvalues / imaginary results; clip to or add and take the real part.
Write the entropy of a probability list .
.
Write the Inception Score in closed form.
.
When is large?
When each image is sharp (confident) yet the overall label mix is diverse.
Which metric is blind to mode collapse, and which catches it?
IS is blind; FID catches it via the covariance comparison.