Model A scored 84.7%, model B 85.1%, on the same 500 images. One axis choice makes B look 57% better. That is a lie factor of 121, about a gap that is noise.
Pick a rendering and watch the same two numbers change their story. Then we build, piece by piece, the honest version of every plot an evaluation needs: distributions, error bars, loss curves, ROC and PR, calibration, scaling and slices.
You need an average, a percentage and a little Python. The Statistics of Evaluation helps for the error bars. We build the rest from zero.
Part of the Evaluation and Analytics family, with eval statistics, metric design, the metrics ladder, experiment design, summarizing distributions, estimator evaluation, regression testing and generative model evaluation.
The two accuracies and n = 500 are an illustrative eval used through Chapters 0 and 2. The lie factor and the interval are computed from them exactly.
Chapter 0
Put a number on how much a plot exaggerates
Your team scored two camera-trap classifiers on the same 500 images. Model A got 84.7%. Model B got 85.1%. Two engineers each make one slide from the same CSV.
Slide one draws bars on a y-axis from 84% to 86%. B's bar towers over A's, and the caption says "B crushes A". Slide two starts the axis at 0% and adds 95% confidence whiskers. The bars look equal and the whiskers overlap.
Nobody touched the data. The engineers changed the encoding: the choices that turn numbers into marks, such as where the axis starts and whether uncertainty shows. A plot is an argument, and the encoding carries it.
Blue is A, warm is B. Drag the baseline up from zero and watch B's bar grow in the eye. Turn on the whiskers, then raise n until they stop overlapping.
Illustrative accuracies 0.847 and 0.851. Whiskers are 1.96 standard errors of each accuracy at the chosen n.
How much does slide one exaggerate? Edward Tufte gave the answer a number in 1983. Measure two sizes: how big the effect looks in the picture, and how big it is in the data. Call the values vA and vB. Call the drawn bar heights, measured from the axis start, hA and hB.
LF equals h-B minus h-A over h-A, divided by v-B minus v-A over v-A.
Find how much taller B's bar looks than A's, as a fraction of h-A. Find how much bigger v-B is than v-A, as a fraction of v-A. Divide the first by the second.
With the axis at 0.84: h-A = 0.007 and h-B = 0.011, so B looks (0.011 − 0.007) / 0.007 = 0.571 bigger. The data says (0.851 − 0.847) / 0.847 = 0.0047. LF = 0.571 / 0.0047 = 121. A 0.47% edge looks like a 57% gap.
Tufte calls a lie factor outside 0.95 to 1.05 a substantial distortion. Slide one also hides the noise. At 500 images per model, the standard error of the gap is 0.0226, almost six times the gap itself. Chapter 2 builds that number.
The rule is about what the eye measures. A bar encodes its value as length from zero, so bars need a zero baseline. A dot or a line encodes value as position, so it may zoom, if the axis is labelled.
The symptom: a small gap looks dramatic. To measure, read where the y-axis starts and compute the lie factor. The fix: draw bars from zero, or switch to dots with labelled intervals on a marked zoom.
Chapter 1
See the whole shape before you trust one number
Your speech service logs the latency of every request. The mean is 34 ms. Behind it could be one tight hump. It could be two humps: cache hits near 15 ms and misses near 55 ms. Or it could be a long tail of rare 400 ms disasters. Each shape needs a different fix, and the mean cannot tell them apart.
The usual tool is the histogram: cut the range into bins and count the points in each. Its hidden knob is the bin width. Too few bins merge two humps into one. Too many turn the shape into noise.
Top: a histogram of 200 fixed latencies. Bottom: their ECDF. Drag the bins and watch only the top story change. Drag the teal threshold to read a fraction off the ECDF.
Illustrative data from a seeded generator: 60% cache hits around 15 ms, 40% misses around 55 ms. The marks on the bin axis show Sturges and Freedman-Diaconis.
The ECDF, the empirical cumulative distribution function, has no knob. Call the n measured latencies x1 to xn. For any value x, the ECDF is the fraction of them at or below x.
F-hat of x equals the count of i such that x-i is at most x, over n.
Sort the latencies. For a value x, count how many are at or below x. Divide by n. Each point adds one step of height 1/n.
Eight latencies: 12, 15, 18, 22, 30, 45, 80, 210 ms. Five are at or below 30, so F-hat of 30 = 5 / 8 = 0.625. The median is 26 ms, but the mean is 54 ms: one 210 ms request pulls it.
Read the staircase by its slope. A steep climb is a crowd of points: a mode. A flat shelf is a gap with no points: two humps. A long shallow right end is a heavy tail. The median and p95 sit where the curve crosses 0.5 and 0.95.
| Plot | Knob | Hides |
|---|---|---|
| Histogram | Bin width. Sturges: ⌈1 + log2n⌉ bins, 9 for n = 200. Freedman-Diaconis: width 2 × IQR / n1/3, 36.5 ms for the eight points. | Modes, at the wrong width. |
| Density curve (KDE) | Bandwidth. | The same modes, smoothly. |
| Box plot | None, but it keeps 5 numbers. | Two humps and one hump can draw the same box. |
| ECDF | None. | Nothing. Shape is read from slope, which takes practice. |
The symptom: mean latency rose 2 ms. It could be a small shift of every request, or a new 1% tail of 500 ms requests. To measure, overlay the old and new ECDFs. The fix: report p50, p95 and p99 from the ECDF, not the mean.
Chapter 2
Label each whisker and test the difference, not the overlap
You ran 25 fine-tuning runs. The mean score is 0.72 and the runs spread with a standard deviation of 0.10. Three different whiskers fit this one result.
| Whisker | What it shows | Half-width |
|---|---|---|
| SD, standard deviation | How far one run lands from the mean. | 0.100 |
| SE, standard error | How far the mean itself could be off: SD / √n = 0.10 / 5. | 0.020 |
| 95% CI, confidence interval | A range that catches the true mean in 95% of repeats: t × SE = 2.064 × 0.02. | 0.041 |
Same data, whiskers five times apart. An unlabelled whisker is decoration. Use SD when run-to-run spread is the question. Use SE or CI when the claim is about the mean.
Left: the runs with SD, SE and CI whiskers. Right: two means with 95% CIs, and their difference with its own CI. Move B until the CIs overlap but the difference still clears zero.
Illustrative runs with SD 0.10 around each mean. Intervals use 1.96 SE for the comparison panel so the overlap arithmetic matches the text.
Now compare two models. Call their standard errors SEA and SEB. The gap between the means has its own standard error, SEdiff. Independent variances add, so the standard errors add in squares.
SE-diff equals the square root of SE-A squared plus SE-B squared.
Square SE-A and SE-B. Add them. Take the square root. Divide the gap by SE-diff to get z; if z is above 1.96, the gap is significant at 5%.
Means 0.72 and 0.78, each SE 0.02. SE-diff = √(0.0004 + 0.0004) = 0.0283. z = 0.06 / 0.0283 = 2.12, so p = 0.034. Yet the CIs [0.681, 0.759] and [0.741, 0.819] overlap by 0.018.
Why both? Non-overlap of two 95% CIs needs the means 2 × 1.96 = 3.92 SE apart. Significance needs only 1.96 × √2 = 2.77 SE. The eye test is too strict by a factor of √2. Two 84% intervals that just touch give z = 1.99, p = 0.047: that visual test matches the real one.
If both models answered the same examples, plot the per-example differences instead. Pairing removes example difficulty and often shrinks the interval a lot. Evan Miller's 2024 note Adding Error Bars to Evals argues for the same habits.
The symptom: a reviewer dismisses a real gain because the whiskers overlap. To measure, compute z for the difference. The fix: plot the difference with its own CI. Caption every whisker with the statistic, the n and the unit resampled: runs, seeds or examples.
Chapter 3
Match the axis to the quantity and know what smoothing hides
A pretraining run drops its loss from 8.0 to 4.0 in the first 2% of steps, then from 4.0 to 2.0 over the rest. On a linear y-axis the second phase is a flat line near the bottom. Yet that is where the model learns the most.
Loss gains are ratios, so use a log y-axis: equal heights mean equal ratios. Then 8 to 4 and 4 to 2 are both one halving and get the same height. Scaling papers plot log-log for the same reason (Chapter 6).
The second trap is smoothing. Raw loss jumps from batch to batch, so dashboards draw an exponential moving average (EMA). Call the raw loss at step t Lt, the smoothed value et, and the memory knob β.
e-t equals beta times e-t-minus-one, plus one minus beta times L-t.
Keep beta of the old smoothed value e-t-minus-one. Mix in 1 − beta of the new raw loss L-t. Because e starts at 0, divide by 1 − beta to the t to remove the early pull toward zero.
Raw losses 4.0, 3.0, 2.5, 2.2, 2.0 with beta 0.9. After step 5, e = 1.0816 and 1 − 0.95 = 0.4095, so the dashboard shows 2.64. The true loss is 2.00: the display lags by 0.64.
Faint warm is the raw loss, bold warm the EMA, yellow the true loss. Pick a run, then raise beta and watch the spike shrink and arrive late.
Synthetic runs from a seeded generator. The EMA is bias-corrected, the same as pandas ewm(adjust=True).
Smoothing lags in both directions. While loss falls, the display reads worse than the truth. During a spike it reads better, and the spike appears late and small. That is the case you most need to see.
| Shape | What it usually means |
|---|---|
| Fast drop, then smooth decay | Healthy. |
| Big oscillation, plateau high | Learning rate too high. |
| Slow, nearly straight descent | Learning rate too low. |
| Spike, then blow-up | Divergence. Check gradient norms. |
| Train falls, validation turns up | Overfitting. Always plot both. |
| Steps or scallops at epoch edges | A data bug or repeated data. |
The symptom: two screenshots say run B is better. To measure, check each panel's smoothing, x-axis unit and y-scale. The fix: replot the raw scalars with the same EMA, a log y-axis and tokens on the x-axis.
Chapter 4
See why a good ROC curve can hide a useless detector
Your camera-trap model flags a rare species. It gives each image a score, and you pick a threshold: above it, the model says "present". Test 10 images, 3 with the species and 7 without, at threshold 0.5. The four outcomes form the confusion matrix.
| Says present | Says absent | |
|---|---|---|
| Species present (3) | TP = 2 | FN = 1 |
| Species absent (7) | FP = 1 | TN = 6 |
The true positive rate TPR is TP / (TP + FN) = 2/3 = 0.667. The false positive rate FPR is FP / (FP + TN) = 1/7 = 0.143. The ROC curve plots TPR against FPR at every threshold. Its area, the AUC, is the chance that a random positive outscores a random negative. Here 18 of the 21 positive-negative pairs are in the right order, so AUC = 0.857, the same value scikit-learn returns.
TPR and FPR are each computed inside one class. So the ROC curve ignores how rare the positives are. The PR curve plots precision, TP / (TP + FP), against recall (recall is TPR). Precision mixes both classes, so it feels every false alarm. Call the share of images with the species the prevalence π.
Precision equals TPR times pi, over TPR times pi plus FPR times one minus pi.
Of every image, a share pi is positive, and TPR of those get flagged. A share 1 − pi is negative, and FPR of those get flagged too. Precision is the first group over both groups.
TPR 0.667 and FPR 0.143. On the test set, pi = 0.3 and precision = 0.667. In the wild, pi = 0.03: 0.020 / (0.020 + 0.139) = 0.126. Same ROC point, and now about seven false alarms per true catch.
Left: scores of pink positives and grey negatives, with your teal threshold. Middle: ROC. Right: PR. Slide the prevalence down and watch which curve moves.
Illustrative classifier: positive scores normal with mean 1.6, negative scores normal with mean 0, both with SD 1. Curves are exact for this model (AUC 0.871).
In a seeded run of this classifier with 2,000 images per class, average precision (the PR summary) is 0.858. With 3% positives it falls to 0.289, while AUC stays near 0.87. Two samples of the same model gave AUC 0.860 and 0.885, so an AUC gap of 0.01 needs an error band before it means anything.
The symptom: a vendor shows ROC AUC 0.98 for a filter on 1% of traffic, and reviewers drown in flags. To measure, draw the PR curve at the real prevalence. The fix: mark the threshold you will deploy as a dot on the PR curve, with a bootstrap band.
Chapter 5
Check that 90% confident means right 90% of the time
Your model says "species present, 90% sure" on 1,000 images. If it is honest, about 900 of them have the species. A router, an abstain rule or a judge that reads these numbers assumes they are honest. Ranking well does not make them honest.
A reliability diagram tests it. Group the predictions into bins by confidence. For each bin, plot the mean confidence on x and the share that came true on y. A perfectly calibrated model sits on the diagonal. Points below it are overconfident: the model claims more than it delivers.
Warm bars are the share that came true in each bin; yellow is the diagonal; red is the gap. Drag the sharpening and find where ECE is smallest. Then change the bin count.
Illustrative: 5,000 seeded outcomes from a calibrated model. Sharpening multiplies each logit; 1.00× is the calibrated model, so its ECE is only sampling noise.
One number sums the gaps: the expected calibration error. Call the number of predictions N, the count in bin b nb, the bin's mean confidence confb and its share correct accb.
ECE equals the sum over b of n-b over N, times the absolute value of conf-b minus acc-b.
For each bin, take the gap between conf-b and acc-b. Weight it by the bin's share n-b / N. Add the weighted gaps.
Two bins of 10. Bin 1: conf 0.90, acc 0.70, gap 0.20. Bin 2: conf 0.60, acc 0.65, gap 0.05. ECE = (10 × 0.20 + 10 × 0.05) / 20 = 0.125. Bin 1 sits below the diagonal, so the model is overconfident where it is most sure.
In a seeded NumPy run of the same setup, doubling the logits gives ECE 0.102: predictions above 0.9 claim 0.965 on average and deliver 0.857. The calibrated model scores 0.014, which is noise. ECE moves with the bin count, the same knob as Chapter 1, so report the bins. Calibration for LLMs goes deeper on reliability diagrams and temperature scaling.
A regressor gets the same check as a scatter of predicted against true, with the line y = x. Its residual plot (predicted minus true, against the prediction) should be a shapeless cloud. A fan that opens to the right means the error grows with size, so one RMSE number hides it.
The symptom: accuracy rose, but the abstain rule now lets more errors through. To measure, draw the reliability diagram before and after. The fix: fit a temperature on held-out data and report ECE with its bin count.
Chapter 6
Fit a power law by hand and mark where the data ends
You trained a code model at three sizes: 1 million, 10 million and 100 million parameters. The losses were 4.00, 3.17 and 2.52. Leadership asks what 1 billion parameters would give.
Loss against size often follows a power law, L = a · N−α. On linear axes it is a curve that flattens. Take logs of both sides and it becomes a straight line.
Log of L equals log of a, minus alpha times log of N.
Take log of N and log of L for each run. Fit a straight line by least squares. Its slope is minus alpha. Each tenfold step in N multiplies L by 10 to the minus alpha.
The points (6, 0.602), (7, 0.501), (8, 0.401) give slope −0.1003 and intercept 1.2038. So alpha = 0.100, and each tenfold step multiplies loss by 0.794, a 21% cut. At N = 109 the line says 100.3009 = 2.00.
Warm dots are the three runs. The line goes dashed inside the purple zone past the last run. Drag the target out, then add a fourth run that bends.
Illustrative runs. The 4th run (loss 2.45 at 3.2 × 108) is a made-up bend, above the line.
The 1-billion prediction sits a full decade past the data. Three points cannot tell you if the line bends there. Power laws do bend when data, context length or a task ceiling runs out. The field has revised fits before. Chinchilla (2022) changed the compute-optimal recipe of Kaplan et al. (2020). A 2024 replication attempt could not reproduce one of Chinchilla's three fits.
The y-variable is a choice too. Schaeffer, Miranda and Koyejo (2023) showed that many "emergent" jumps of accuracy against scale turn smooth when you plot a continuous metric for the same models. Ablation plots follow the earlier rules: bars from zero, a CI on each bar, and every benchmark shown, not only the ones that helped.
The symptom: a solid line runs to 1010 and a budget follows it. To measure, count decades between the last run and the target. The fix: dash and shade the extrapolation, state the prediction as a range, and buy one intermediate run first.
Chapter 7
Split the headline number by slice and print the n
The new model raised overall accuracy. You shipped. Two weeks later, complaints from night-time camera sites tripled. The headline plot never had a chance to warn you.
Overall accuracy is a weighted average of the slices. Call a slice s (a group of inputs, such as night images), its size ns, its accuracy accs, and the total N.
acc equals the sum over s of n-s over N, times acc-s.
Weight each slice's accuracy acc-s by its share n-s / N. Add them. A small slice has a small weight, so its losses barely move acc.
900 day images and 100 night images. Old: (900 × 0.92 + 100 × 0.50) / 1000 = 0.878. New: day 0.95, night 0.40, so (855 + 40) / 1000 = 0.895. Overall up 1.7 points; night down 10.
Blue is the old model, warm the new one. Purple whiskers are 95% CIs from each slice's n. Drag the night share and find where the headline turns down.
Illustrative slice accuracies, held fixed: day 0.92 to 0.95, night 0.50 to 0.40, on 1,000 images in total.
The headline falls only when the night share passes 0.03 / 0.13 = 23%. Below that, the average hides the collapse. Only a per-slice view answers "is anyone worse off?"
The workhorse is a slice heatmap: rows are slices, columns are model versions, and each cell prints its value and its n. Better still is one delta heatmap of new minus old, with a colour scale centred at zero. The n decides belief. At n = 100 and accuracy 0.40, the SE is 0.049, so the CI is about ±0.10. At n = 8 the SE is near 0.18, which is unreadable.
Over time, draw a noise band. At 0.878 on 1,000 weekly examples, the SE is 0.0104, so ±2 SE is ±0.021. Mark every deploy and data change with a vertical line. Regression testing turns this view into a release gate.
The symptom: the headline rises and one group complains. To measure, split the eval by slice with n printed. The fix: review a delta heatmap with noise cells greyed out before every launch.
Chapter 8
Stack the lies on one fixed result, then catch them in a stranger's plot
Two code models, A and B, each trained with 5 seeds on the same benchmark. Model A scored 0.850, 0.847, 0.852, 0.845 and 0.851. Model B scored 0.849, 0.856, 0.851, 0.842 and 0.853.
The means are 0.8490 and 0.8502, a gap of 0.0012. The seed SDs are 0.0029 and 0.0053. Welch's t-test gives t = 0.45 and p = 0.67. The truth is "no detectable difference". Any plot that says otherwise is a lie about this data.
The new lever is seed selection. B's best seed against A's mean shows 0.856 − 0.849 = 0.007, 5.8 times the true gap. For 5 normal draws, the best sits on average 1.16 SDs above the mean. So "best of N" adds about one SD of fake progress, before any axis game.
Set the four levers and read the caption a hurried reader would write. Then press Deal: the levers hide, and you name the lies before you reveal.
Baseline
Error bars
Seeds reported
Which lies are active?
The ten seed scores are illustrative and fixed. The caption comes from a simple rule: compare the visible gap with the visible whiskers and the baseline.
Selection lives upstream of the rendering, so no axis fix repairs it. The 2025 Leaderboard Illusion study by Singh et al. found providers on Chatbot Arena testing private variants and publishing only the best. The defence is the same: show every run as a dot and state the selection rule.
The exit test is the Honest Plot Contract:
Chapter 9
Keep the plots, the numbers, the contract and the code in one place
A plot is an argument with free choices: the baseline, the bins, the whiskers, the smoothing, the scale, the slices and the runs shown. Each choice can carry a lie. Match the encoding to what the eye measures, show the uncertainty, and show everything you selected from.
| Plot | Question it answers | Lie to check |
|---|---|---|
| ECDF | Shape, percentiles, tails. | None: no knob. |
| Histogram | Shape, for a general audience. | Bin width makes or erases modes. |
| Bars with CI | Two or more means. | Truncated axis; unlabelled whisker; overlap read as no difference. |
| Difference with CI | Is B better than A? | Missing: the honest form of the comparison. |
| Loss curve | Learning of one run. | Linear y; heavy smoothing; wall-clock x. |
| ROC | Ranking quality, blind to prevalence. | Hides rare-positive collapse. |
| PR curve | Usefulness at real prevalence. | An area instead of the deployed point. |
| Reliability diagram | Are confidences honest? | ECE depends on the bin count. |
| Log-log fit | Scaling exponent. | Solid line past the data. |
| Slice heatmap | Who got worse? | Missing n; uncentred colours. |
| Term | Meaning | Number from this lesson |
|---|---|---|
| Lie factor | Visual effect over data effect. | Axis at 84%: 121 |
| ECDF | Share of points at or below x. | F-hat of 30 ms = 0.625 |
| SE of a difference | √(SEA² + SEB²). | 0.0283; z = 2.12 though CIs overlap |
| EMA lag | Window about 1 / (1 − β). | Shows 2.64 while truth is 2.00 |
| Precision at prevalence | TPR·π / (TPR·π + FPR·(1 − π)). | 0.667 at 30%, 0.126 at 3% |
| ECE | Weighted gap to the diagonal. | 0.125 (two bins) |
| Power-law slope | −α in log-log. | α = 0.100; 2.00 at 109, unmeasured |
| Weighted average | Σ (ns/N)·accs. | 0.878 to 0.895, night 0.50 to 0.40 |
| Best-of-5 bias | Expected max of 5 normal draws. | +1.16 SD; gap inflated 5.8× |
pythonimport numpy as np, pandas as pd def lie_factor(base, va, vb): ha, hb = va - base, vb - base # drawn heights return ((hb - ha) / ha) / ((vb - va) / va) # lie_factor(0.84, .847, .851) = 121 def ecdf(ax, x, **kw): # every recipe takes ax first xs = np.sort(x); ys = np.arange(1, len(x) + 1) / len(x) ax.step(xs, ys, where='post', **kw) def diff_panel(ax, ma, mb, sea, seb): d, sed = mb - ma, np.sqrt(sea**2 + seb**2) ax.errorbar([0], [d], yerr=1.96 * sed, fmt='s', capsize=5) ax.axhline(0, ls='--') # does the gap clear zero? def loss_curve(ax, raw, beta=0.9): ax.plot(raw, alpha=0.25) # raw, faint ax.plot(pd.Series(raw).ewm(alpha=1 - beta, adjust=True).mean(), lw=2) ax.set_yscale('log') def loglog_fit(ax, N, L, target): slope, b = np.polyfit(np.log10(N), np.log10(L), 1) # slope = -alpha ax.loglog(N, L, 'o') xe = np.array([N[-1], target]) ax.plot(xe, 10**(b + slope * np.log10(xe)), ls='--') # dashed ax.axvspan(N[-1], target, alpha=0.1) # shaded # sklearn one-liners: RocCurveDisplay / PrecisionRecallDisplay.from_predictions(y, s), # calibration_curve(y, p, n_bins=10). Small multiples: plt.subplots(3, 4, sharey=True).
| Lesson | What it adds |
|---|---|
| The Statistics of Evaluation | The SE, CI, t-test and bootstrap machinery behind every interval here. |
| Metric Design | What belongs on the y-axis; AUC and ECE derived. |
| Summarizing Distributions | Means, medians, quantiles and the shapes behind them. |
| Calibration for LLMs | Reliability diagrams and temperature scaling for language models. |
| Experiment Design | Causal claims about users need A/B tests, not offline plots. |
| Regression Testing for ML | The delta slice heatmap and noise band as a release gate. |
| Evaluating Generative Models | pass@k curves and rating intervals under the same rules. |
| Evaluating Estimators | Consistency plots: Chapter 2's bands for state estimators. |
| The Metrics Ladder | Business dashboards, the layer above eval plots. |
E. R. Tufte, The Visual Display of Quantitative Information (1983), for the lie factor. E. Miller, Adding Error Bars to Evals (2024). R. Schaeffer, B. Miranda and S. Koyejo, Are Emergent Abilities of Large Language Models a Mirage? (2023). T. Besiroglu et al., Chinchilla Scaling: A replication attempt (2024). S. Singh et al., The Leaderboard Illusion (2025). Every other number on this page comes from illustrative data, checked with NumPy, SciPy and scikit-learn.
Now press Present or Teach. Explain from memory three things: the lie factor of 121, the overlap fallacy, and why rare positives need the PR curve. Then go back to the three renderings and say which caption each one earns.