Skip to content

Phase 9 - Capstone Projects

The eight phases before this one each isolated a mechanism. This one puts the whole thing together three times, on three problems that fail in three different ways — and in every case the deliverable is not the model. It is the evidence that the model works, in a form someone sceptical can check.

Everything below was measured on this machine: TensorFlow 2.21, Keras 3.15, CPU only, 8 cores.

CapstoneProblemWhat it turns out to be about
1 — An image classifierFashion-MNIST, 12,000 train / 3,000 held outA ladder that climbs, and the rung whose gain is negative
2 — A text classifierIMDB sentiment, 6,000 train / 3,000 held outA ladder that stops at rung three and what to report when it does
3 — A generative modelMNIST, a VAE with an 8-dimensional latent spaceA result with no accuracy column, and the adversary it has to survive

Capstone 1 built six rungs from a constant predictor to a deployed TFLite artefact:

RungAccuracyGain
Always predict one class0.0993
Nearest class centroid0.6713+0.5720
Linear (softmax)0.8290+0.1577
MLP0.8603+0.0313
Convnet0.8773+0.0170
Convnet + augmentation0.8643−0.0130

The last row is the finding. Augmentation cost 0.0130 on the clean test set and gained 0.4207 on the same test set shifted three pixels — 0.2947 against 0.7153. A single held-out number said the change was bad; six of them said the opposite.

Capstone 2 built the same kind of ladder on text and watched it stop:

ModelSecondsAccuracy
Bag of words + linear30.8507
Embedding + pooling60.8587
LSTM530.8353
Bidirectional LSTM1130.7887
Self-attention1650.7957

A linear model with no word-order information at all beat every sequence model, at 18× to 55× less training time. The page’s job is then to say why — 6,000 examples, 6 epochs, a 200-token window truncating 43.3% of reviews — so the result reads as a claim about the budget rather than a claim about recurrence.

Capstone 3 removed the accuracy column entirely. A VAE produces images; there is no label to score them against. So the evaluation itself became the deliverable, and it was tested against a twelve-line adversary that copies 150 training images and generates nothing:

SourceFréchetKL from uniformNearest training
Real, held out (floor)1.1010.00165.0696
VAE, 25 epochs17.3430.02344.8392
Memorised, 150 images16.4250.02940.0035

The memoriser beat the real model on Fréchet distance and tied it on coverage. Only the distance to the training split exposed it — and the first version of that check, run against held-out data, ranked the memoriser as the least suspicious source of the three.

figure The same two models, six versions of the test set matplotlib
Grouped bars comparing the plain convnet against the augmented one across six conditions. On clean data the plain model leads 0.8773 to 0.8643, but on shifted and rotated test sets the augmented model leads by increasing margins, reaching 0.7153 against 0.2947 at a three-pixel shift. Grouped bars comparing the plain convnet against the augmented one across six conditions. On clean data the plain model leads 0.8773 to 0.8643, but on shifted and rotated test sets the augmented model leads by increasing margins, reaching 0.7153 against 0.2947 at a three-pixel shift.
The clean column is the only one where the plain convnet wins, and it wins by 0.0130. On a three-pixel shift — a change no human would remark on — the plain model collapses to 0.2947 while the augmented one holds 0.7153, a gap of 0.4207. Augmentation did not cost accuracy; it moved accuracy from a distribution you will not deploy on to distributions you might.
figure 1,500 samples each, one judge matplotlib
Left: grouped bars for four sources across four metrics, each metric scaled to its largest value. The memorised source is lowest on distance to the nearest training image at 0.00 while the others sit near 5. Right: share of samples per digit class for each source, with the 2-epoch VAE spiking on some digits and missing two entirely. Left: grouped bars for four sources across four metrics, each metric scaled to its largest value. The memorised source is lowest on distance to the nearest training image at 0.00 while the others sit near 5. Right: share of samples per digit class for each source, with the 2-epoch VAE spiking on some digits and missing two entirely.
The left panel is scaled per metric, so bar heights compare within a group and not across groups. The only column where the memoriser looks different from real data is the last one — distance to the nearest training image, 0.0035 against 5.0696. On the other three it is indistinguishable from a working model, and on Frechet distance it beats one.
figure Every claim this phase set out to test matplotlib
Horizontal bars, one per page in the phase, each labelled with the claim it tested and coloured by the verdict: green where the standard story held, amber where it held at a price, red where the measurement contradicted it. 5 of 6 claims contradicted, 1 held at a price, 0 held. Horizontal bars, one per page in the phase, each labelled with the claim it tested and coloured by the verdict: green where the standard story held, amber where it held at a price, red where the measurement contradicted it. 5 of 6 claims contradicted, 1 held at a price, 0 held.
Collected from the runs behind each page's own figures rather than measured afresh, so every bar is traceable to the page it names. Bar length is the log of the effect size, because the effects span from 0.0014 to 5,376 — the number that matters is printed on each bar. Across all nine phases, 34 of 54 claims were contradicted outright, 11 held at a cost that was worth stating, and 9 held as advertised.
diagram Diagram mermaid

Three habits recur across all three pages, and they are the transferable part.

A number needs a floor. 0.8773 means nothing without 0.0993 beside it; 17.343 means nothing without 1.101. Every capstone starts by measuring the cheapest thing that could possibly work, because that is what makes every later number readable.

One test set answers one question. Augmentation looked like a regression on clean data and a 0.4207 improvement three pixels away. The IMDB ladder looked flat until reviews were bucketed by length. A single held-out score is a measurement of one distribution, not a property of the model.

Report the rungs that lost. The negative gain, the LSTM that came fourth, the metric the memoriser won — those are the results that let someone else trust the ones that went your way.

sketch One test set answers one question p5.js
Pick a test set. The two capstone-1 models swap places depending on which distribution you judge them on - and neither is better in general.
sketch How often the standard story survived p5.js
Step through the phases. Each bar splits the claims that phase tested into contradicted, held at a price, and held as advertised - the totals are summed live.

The capstones are the end of the module. If you want to keep going, the two directions with the most immediate return are the ones this module could only gesture at: pretrained models, which remove the most expensive part of every project here (learning representations from scratch, on 6,000 examples), and GPU access, which changes the feasible experiment size by an order of magnitude and makes several of Phase 8’s negative results — mixed precision at 40.65× slower, distribution at 1.50× overhead — flip sign.

Back to the Deep Learning overview.

pch.quizTag pch.quizDefaultTitle
  1. Augmentation cost 0.0130 on the clean test set and gained 0.4207 on the same test set shifted three pixels. What does that say about single-number evaluation?

    pch.quizShowAnswer

    B — A held-out score measures one distribution, not a property of the model - and the distribution you measured may not be the one you deploy on

  2. On IMDB, a bag of words scored 0.8507 in 3 seconds and self-attention 0.7957 in 165. What does capstone 2 do with that instead of stopping at 'the LSTM lost'?

    pch.quizShowAnswer

    B — States the budget - 6,000 examples, 6 epochs, a 200-token window truncating 43.3% of reviews - so the result reads as a claim about this budget rather than about recurrence

  3. Capstone 3's memoriser copied 150 training images and beat the real VAE on Frechet distance (16.425 against 17.343). Why did the first memorisation check fail to catch it?

    pch.quizShowAnswer

    B — It compared against held-out data while the memoriser copied training data - so its samples were ordinary unseen digits by that measure, scoring 5.3939 against the VAE's 5.0886

  4. Every capstone begins by measuring the cheapest thing that could possibly work - 0.0993, 0.5220, or a real-data floor of 1.101. Why?

    pch.quizShowAnswer

    B — Because a number is only readable against a floor: 0.8773 means nothing without 0.0993, and 17.343 means nothing without 1.101

  5. Capstone 1's ladder has a NEGATIVE last rung and capstone 2's ladder stops climbing at rung three. Why are both reported rather than trimmed?

    pch.quizShowAnswer

    B — Because the losing rungs are the findings - they say where the returns ran out on this data, which is exactly what someone repeating the work needs to know

pch.coffeeTagline

pch.coffeeCta

pch.feedbackHeading

pch.feedbackSubheading