Course contents 13 / 34

13 / 34 · Evaluation

Human evaluation of generative models

How to ask people about generated samples so that the answers mean something, with real-or-generated tests, pairwise preferences and ratings, and the statistics that say how many judgements a conclusion needs.

On this page 7

Salimans et al. (2016) showed crowd workers a mix of real CIFAR-10 images and samples from their best generator, half and half, and asked which were real. The workers labelled 78.7% of the images correctly. The authors themselves, looking at the same kind of images, were right more than 95% of the time. And when workers were told after each answer whether they had been right, they quickly learned the generator’s flaws and became harsher judges.

One generator, three different verdicts, depending on who looks and how they are asked. Every metric of this section so far, IS, FID, precision and recall, replaces a person by a network and inherits the network’s blind spots. Human judgement is the reference those metrics are checked against. It is also noisy, expensive and easy to collect badly, and the protocol decides what the numbers mean.

What can be asked#

Four questions cover most human evaluations of generative models:

QuestionWhat the rater seesNumber reportedMeasures
Real or generated?one image at a timeerror rate on a balanced setrealism
Which of two is better?outputs of two models for the same inputwin rate, Bradley–Terry or Elo scoresrelative preference
How good is it?one outputmean rating on a fixed scaleabsolute quality
Does it match the input?a prompt and an outputshare of matching outputs, or a win ratealignment with the condition

The first question asks the rater to detect something; the others ask for an opinion. Detection has a correct answer on every trial, which makes it easier to check and to calibrate.

Real or generated#

Show an image and ask whether it is real. The fool rate, the share of generated images judged real, approaches 50% when people cannot tell and guess with even odds. But it counts only generated images, so it also measures how readily a rater says “real”. Mixing in an equal number of real images and scoring the error rate over all of them removes this response bias, as the last section of this note works out.

HYPE (Zhou et al., 2019) standardises the protocol. Each rater labels 100 images, 50 real and 50 generated, in random order. HYPE∞ is the error rate with unlimited viewing time: misjudged generated images plus misjudged real ones, divided by 100. At 50% the rater is at chance; above 50% the generated images look more real than the real ones.

HYPE time flashes each image for 100 to 1000 ms and adapts the exposure with a staircase: correct answers shorten it, wrong ones lengthen it. The score is the exposure people need to tell generated from real, so longer means more realistic.

A run uses 30 raters, and the confidence interval comes from resampling whole raters, each with all their answers. In the paper, StyleGAN, a GAN of the next section, trained on FFHQ faces and sampled with the truncation trick, reaches a HYPE∞ of 27.6%, against 19.0% without truncation, with non-overlapping intervals. Truncation narrows the generator toward typical faces: the precision side of the trade-off, which people reward.

Worked example: is 38% different from chance?#

In a balanced test with 100 real and 100 generated images, raters make 76 errors in 200 judgements, an error rate of p^=0.38\hat p = 0.38. The textbook interval p^±1.96p^(1−p^)/n\hat p \pm 1.96 \sqrt{\hat p(1 - \hat p)/n} misbehaves near 0 and 1 and for small nn; the Wilson interval (Wilson, 1927) inverts the score test instead and behaves well everywhere (intervals from the normal approximation). With z=1.96z = 1.96 its centre and half-width are

c=p^+z2/(2n)1+z2/n,h=z1+z2/np^(1−p^)n+z24n2.\begin{aligned} c &= \frac{\hat p + z^2/(2n)}{1 + z^2/n} , \\ h &= \frac{z}{1 + z^2/n} \sqrt{\frac{\hat p (1 - \hat p)}{n} + \frac{z^2}{4n^2}} . \end{aligned}
Where the centre and half-width come from

The interval collects every pp that the score test at level 5% does not reject, the test that uses the standard error under pp itself rather than under p^\hat p:

(p^−p)2≤z2 p(1−p)n.(\hat p - p)^2 \le z^2\, \frac{p (1 - p)}{n} .

Multiplying out and collecting powers of pp gives a quadratic inequality:

(1+z2n)p2−(2p^+z2n)p+p^2≤0.\Big(1 + \frac{z^2}{n}\Big) p^2 - \Big(2\hat p + \frac{z^2}{n}\Big) p + \hat p^2 \le 0 .

Its solutions lie between the two roots. Their midpoint is the coefficient of pp over twice the leading one, which is cc. Their half-distance is the square root of the discriminant over twice the leading coefficient; the discriminant simplifies as

(2p^+z2n)2−4(1+z2n)p^2=4z2p^(1−p^)n+z4n2,\begin{aligned} &\Big(2\hat p + \frac{z^2}{n}\Big)^2 - 4\Big(1 + \frac{z^2}{n}\Big)\hat p^2 \\ &\quad= \frac{4 z^2 \hat p (1 - \hat p)}{n} + \frac{z^4}{n^2} , \end{aligned}

and taking out 4z24z^2 gives hh.

QuantityValue
centre (0.38+0.0096)/1.0192(0.38 + 0.0096) / 1.01920.3820.382
half-width 1.923⋅0.001178+0.0000241.923 \cdot \sqrt{0.001178 + 0.000024}0.0670.067
95% interval[0.316, 0.449][0.316,\ 0.449]
exact binomial test of 76 out of 200 against p=0.5p = 0.5p=0.0008p = 0.0008

The interval excludes 0.5: raters can tell these images from real ones.

Both calculations treat the 200 judgements as independent trials with one error probability. Judgements by the same rater, or about the same image, are correlated, so a real study’s interval is wider. It should come from resampling raters and images as clusters, as HYPE resamples raters, or from a model with rater and image effects. The numbers here are an idealised baseline.

Figure

How many judgements an answer of ±0.05 takes

Interval width and the number of judgementsA decreasing curve from ±0.26 at 10 judgements to ±0.018 at 3000. Marked: 100 judgements (±0.096), 200 (±0.069) and 783 (±0.035).00.10.20.3103010030010003000number of judgements n (log scale)± half-width of the 95% interval100 judgements, ±0.096200: the example in the text, ±0.069783: 0.45 against 0.5, ±0.035Interval width and the number of judgementsA decreasing curve from ±0.26 at 10 judgements to ±0.018 at 3000. Marked: 100 judgements (±0.096), 200 (±0.069) and 783 (±0.035).00.10.20.3103010030010003000number of judgements n (log scale)± half-width of the 95% intervaln = 100, ±0.096n = 200, ±0.069n = 783, ±0.035
Half-width of the 95% Wilson interval for an error rate near 0.5 against the number of judgements. It shrinks like 1/√n: 200 judgements give ±0.069, and halving it takes four times as many. Telling 45% from 50% with power 0.8 takes about 783 independent judgements.

How many judgements a comparison needs#

The half-width shrinks like 1/n1/\sqrt n, so precision is expensive. To tell a model with a true balanced error rate of p1=0.45p_1 = 0.45 from one indistinguishable from data, p0=0.5p_0 = 0.5, with a two-sided test at the 5% level and power 0.8, we need a sample size that comes from the same normal approximation as the A/B test, here for one rate against a fixed p0p_0. The test rejects when p^\hat p is far from p0p_0 in units of the standard error under p0p_0; under the alternative, p^\hat p is approximately normal around p1p_1 with its own standard error. With Z∼N(0,1)Z \sim \mathcal N(0, 1) and the far tail p^>p0+…\hat p > p_0 + \dots neglected,

reject if p^<p0−z0.975p0q0/n,p^≈p1+p1q1/n  Z.\begin{aligned} \text{reject if } \hat p &< p_0 - z_{0.975} \sqrt{p_0 q_0 / n} , \\ \hat p &\approx p_1 + \sqrt{p_1 q_1 / n}\; Z . \end{aligned}

Power 0.8 means the rejection threshold sits z0.8z_{0.8} standard errors above p1p_1: p0−z0.975p0q0/n=p1+z0.8p1q1/np_0 - z_{0.975} \sqrt{p_0 q_0 / n} = p_1 + z_{0.8} \sqrt{p_1 q_1 / n}. Multiplying by n\sqrt n and solving for nn,

n=(z0.975p0q0+z0.8p1q1)2(p1−p0)2=(1.96⋅0.5+0.842⋅0.497)20.052≈783\begin{aligned} n &= \frac{\big(z_{0.975} \sqrt{p_0 q_0} + z_{0.8} \sqrt{p_1 q_1}\big)^2}{(p_1 - p_0)^2} \\ &= \frac{(1.96 \cdot 0.5 + 0.842 \cdot 0.497)^2}{0.05^2} \\ &\approx 783 \end{aligned}

judgements, with q=1−pq = 1 - p. A study of 100 judgements per model detects only large differences. Correlated judgements raise the number further, so 783 is a floor for the study size.

Which of two is better#

Absolute questions are hard to answer consistently; comparisons are easier. Show two outputs for the same input, one from each model, and ask which is better. Many such votes over many pairs of models are summarised by the Bradley–Terry model (Bradley and Terry, 1952). Every model has a score ss, and the probability that A is preferred to B is

P(A≻B)=11+e−(sA−sB).P(A \succ B) = \frac{1}{1 + e^{-(s_A - s_B)}} .

The scores are fitted by maximum likelihood over all observed votes, so models that were never compared directly are placed on one scale through the models they share. The Elo scale is the same model in other units, with ratings R=400 s/ln⁡10R = 400\, s / \ln 10:

P(A≻B)=11+10−(RA−RB)/400.P(A \succ B) = \frac{1}{1 + 10^{-(R_A - R_B)/400}} .

A worked example. Model A wins 60% of its comparisons against B. Then

10(RA−RB)/400=0.6/0.4=1.5,RA−RB=400log⁡101.5=70.4.\begin{aligned} 10^{(R_A - R_B)/400} &= 0.6 / 0.4 = 1.5 , \\ R_A - R_B &= 400 \log_{10} 1.5 = 70.4 . \end{aligned}

If B beats C by the same margin, A is 140.9140.9 points above C. The odds of a win are esA−sBe^{s_A - s_B}, so odds multiply along a chain, esA−sC=esA−sBesB−sC=1.52e^{s_A - s_C} = e^{s_A - s_B} e^{s_B - s_C} = 1.5^2, and the model predicts that A beats C with probability 1.52/(1.52+1)=0.6921.5^2 / (1.5^2 + 1) = 0.692, although no one compared them. This transitivity is an assumption. If the votes contradict it, as with rock–paper–scissors preferences, the fit is poor and the scores mislead.

Figure

The Bradley–Terry model on the Elo scale

Win probability and rating differenceAn S-shaped curve from 0.09 at d = −400 to 0.91 at d = 400, equal to 0.5 at d = 0. Marked: d = 70.4 with probability 0.60 and d = 140.9 with probability 0.69.00.250.50.751-400-2000200400rating difference dP(A preferred to B)A against B: 0.60A against C: 0.69Win probability and rating differenceAn S-shaped curve from 0.09 at d = −400 to 0.91 at d = 400, equal to 0.5 at d = 0. Marked: d = 70.4 with probability 0.60 and d = 140.9 with probability 0.69.00.250.50.751-400-2000200400rating difference dP(A preferred to B)A against B: 0.60A against C: 0.69
The probability that A is preferred to B against their rating difference d: 1 / (1 + 10^(−d/400)). Winning 60% against B puts A 70.4 points higher. If B beats C by the same margin, A is 140.9 points above C and is predicted to win 69% against C, a pair never compared.

Public arenas apply this at scale. A user submits a prompt, sees two anonymous outputs, votes, and the scores are refitted. Chatbot Arena does this for language models and fits Bradley–Terry coefficients (Chiang et al., 2024); GenAI-Arena does the same for text-to-image, text-to-video and image editing (Jiang et al., 2024). The same model fitted to labellers’ preferences is the reward model of RLHF, and the LLM evaluation note discusses arenas for text.

How good, and does it match#

Absolute ratings. The rater scores one output on a fixed scale, usually 1 to 5, and the mean opinion score (MOS) averages the ratings. The protocol comes from telephone speech quality testing (ITU-T P.800) and is standard for speech synthesis. Its weakness is the scale itself: raters use it differently, some never give a 5, and anchors drift during a session, so MOS values are comparable only within one study with the same raters and instructions.

Alignment with the condition. A conditional model must also produce what was asked for. Text-to-image benchmarks fix a set of prompts that probe known weaknesses, and raters compare two models on image quality and on prompt alignment separately. DrawBench has 200 prompts in 11 categories (Saharia et al., 2022); PartiPrompts has more than 1,600 (Yu et al., 2022). Counting objects, spatial relations and rendered text are typical categories, because models often get them wrong.

Making judgements reliable#

Most of the work is in the design of the study, before any statistics.

Raters do not know which model produced an output, and both the order of trials and the left–right position in a pair are randomised. Outputs are drawn with random seeds; cherry-picked samples measure the authors’ taste. Trials with a known answer, an obvious artifact or a real image shown twice, catch inattentive raters.

Each item is judged by several raters, and their agreement is measured, for example with Cohen’s κ for two raters (LLM evaluation note); low agreement means the question is ambiguous. What “realistic” or “matches the prompt” means is defined with examples, and viewing time is fixed when it matters, as in HYPE time. Every rate or win probability is reported with its interval and the number of judgements behind it.

Against the automatic metrics, people see artifacts that features miss and judge what users will actually see. They cost hours of paid work instead of minutes of compute, and they are reproducible only statistically, given the protocol. In practice automatic metrics follow every training run, and people make the final comparisons and check that the metrics still agree with them.

Where it breaks#

A fake-only test can be won without looking. Suppose a rater cannot tell real from generated at all and answers “real” on 80% of trials, whatever the image.

TestWhat is countedResult for this rater
fool rate, generated images onlygenerated judged real80%
balanced error rate, 50 real + 50 generatedgenerated judged real, plus real judged generated(40+10)/100=50%(40 + 10) / 100 = 50\%

The fool rate says the generator fools people 80% of the time; it only measured the rater’s habit. On the balanced set the same habit costs as many errors on real images as it gains on generated ones. For a blind rater who answers “real” with any probability rr, the errors are rr on generated images and 1−r1 - r on real ones, and the balanced error rate is 12r+12(1−r)=12\tfrac12 r + \tfrac12 (1 - r) = \tfrac12: exactly chance, as it should be for a rater who sees nothing. This is why HYPE scores errors over a balanced set. A rater who always says “real” has a fool rate of 100% and still a balanced error rate of 50%.

Realism is also not everything. A model that reproduces its training images perfectly reaches 50% on any real-or-generated test, because its outputs are real images. Human realism tests are blind to diversity and to memorisation, the failures that precision and recall and nearest-neighbour searches with LPIPS catch. And numbers from different instructions, interfaces or rater pools are not comparable, as the opening experiment showed.

What you should remember#

  • Ask one of four questions: real or generated, which of two, how good, does it match.
  • Score real-or-generated tests as an error rate over a balanced set; there 50% is chance whatever the rater’s bias. HYPE: 50 real and 50 generated per rater, 30 raters.
  • A rate needs an interval: 200 independent judgements give about ±0.07, telling 0.45 from 0.5 takes about 783, and correlated judgements need more.
  • Bradley–Terry turns pairwise votes into scores; a 60% win rate is 70.4 Elo points.
  • Reliability comes from the design: blind, randomised, random seeds, checks, several raters, measured agreement.

Code#

No course notebook covers human evaluation. The two computations of the worked examples, with the standard library and SciPy:

import math
from scipy.stats import binomtest

def wilson(k, n, z=1.96):
    p = k / n
    d = 1 + z * z / n
    centre = (p + z * z / (2 * n)) / d
    half = z / d * math.sqrt(p * (1 - p) / n + z * z / (4 * n * n))
    return round(centre - half, 3), round(centre + half, 3)

print(wilson(76, 200), round(binomtest(76, 200, 0.5).pvalue, 4))
print(round(400 * math.log10(0.6 / 0.4), 1), 'Elo points for a 60% win rate')
(0.316, 0.449) 0.0008
70.4 Elo points for a 60% win rate

Next#

The evaluation toolkit is complete: IS and FID for sets, LPIPS for pairs, precision and recall for the two kinds of failure, and people as the reference. So far it has judged VAEs, which pay for their likelihood bound with blur. The next note introduces generative adversarial networks, which give up the likelihood altogether and train a generator through a second network that tries to tell its samples from real data. These metrics are how they are judged.

References#