learn-ml-strategy-with-phoebe / Leader session 5 of 6
Learn ML Strategy with Phoebe · Leader session 5 of 6

The pipeline that hides its weakest part

Lanternfish does not run one model. A frame arrives, a motion detector decides whether there is an animal in it, and only then does the species classifier say what the animal is. The dev error rate, 12 percent, is a number about the pair. It does not say which of the two was wrong, and the error sheet quietly assumes the answer is whichever box spoke last. Tonight is the method that settles it: give one stage a perfect version of what the stage before it should have produced, and see whether the error survives. It costs an afternoon of hand-correcting, and at Lanternfish it moved a whole category of errors off the classifier's ledger.

🟠 Advanced Data and product leaders 45 min
0-3 · Welcome 3-22 · Error analysis by parts 22-40 · Build-along: attribute one error 40-45 · Q&A
Part 0

Where this sits in the leader track

Session 3 built the sheet that ranks projects by what they could fix. Session 4 split the error into unavoidable bias, avoidable bias and variance, so that the diagnosis chooses the project rather than the loudest sponsor. Both of those assumed one model. Almost no production system is one model. Tonight the same discipline is applied to a chain of them, where the arithmetic that worked for a single classifier gives an answer that is confidently wrong. Session 6 then puts the whole thing on one page.

Live = presented in the 45 minutes Self-study = the full depth, after class 🔍 Every diagram zooms

★ What you walk out with tonight. A drawing of your own system as boxes, which most teams have never made. One question that attributes any single error to one box: which box would a human have to fix for this error to disappear. A per-box tally from ten errors, which is enough to change a funding decision. And the rule that saves a quarter: if every box is already at human-level and the system still is not, no box is the problem and the design is.

LiveWhy a single error rate stops being useful3 min▶

One model, one error rate, one place to send the money. That is why the previous sessions work. A pipeline breaks the link: the error rate is measured at the end of the chain, the money has to go to one link, and nothing in the number says which link. Every stage is a candidate and every stage has a sponsor who can explain why it is not their stage.

What fills the gap, in most teams, is the error sheet's category name. A frame with no animal in it comes out labelled deer, so the row says "empty frame called animal", and the word "called" points at the thing that does the calling. The category describes the symptom at the end of the pipe. It was never a claim about the cause, and it gets read as one.

Real world

Lanternfish's classifier is genuinely wrong on 120 of its 1,000 dev images. When the team drew its system on a whiteboard for the first time, halfway through session 5, three people discovered there was a motion detector in front of the classifier at all. It had been written by a contractor, it had never been measured, and it was in front of every single one of those 120 decisions.

Self-studyThe words for tonight4 min▶
  • Pipeline - a system where the output of one learned component is the input of the next. Lanternfish has two stages: motion detector, then species classifier.
  • Stage, or part - one box in that chain. The unit a project is funded against.
  • Error analysis by parts - attributing each mistake of the whole system to one box, rather than to a symptom category. Chapter 53.
  • Attribution by perfect input - hand the later stage a hand-corrected version of the earlier stage's output. If the error disappears, it was the earlier stage's. Chapter 54.
  • Human-level performance for a stage - how well a person does that stage's job alone, given that stage's input. The yardstick from session 4, applied one box at a time.
  • A flawed pipeline - every stage at human-level, system still short. The chain's shape is the problem. Chapter 57.
  • End-to-end learning - replacing the whole chain with one model trained input to output. A real alternative, and a different course.
Part 1 · covers chapters 53 and 54

Error analysis by parts

10 min live

Chapter 53 of Machine Learning Yearning is titled "Error analysis by parts", and the problem it solves is exactly the one above: a system made of components, an error rate measured on the whole, and a decision that has to be made about one component. The instrument is not a better metric. It is a way of asking, error by error, which box was actually responsible, using the one thing a machine learning team always has available and rarely uses: a person who can do the job by hand.

What the system did, and who got blamed Empty frame no animal in it Motion detector says: animal here Species classifier says: deer Logged: deer counted as error Sheet category: empty frame called animal Blamed: classifier a symptom name read as a cause the box that spoke last The same frame, with a perfect first stage Same frame no animal in it Corrected by hand says: no animal Classifier not called it never sees this No error frame logged empty Error disappeared so it belonged to the first stage a classifier project removes none of these ten Hand the next stage a perfect input. If the error vanishes, it was the earlier stage's error.
🔍 Click to zoom - the same frame twice, once through the real detector and once through a hand-corrected one.
LiveThe overall number hides which stage caused it3 min▶

Consider one Lanternfish frame. A branch moves in the wind at three in the morning. The motion detector decides there is an animal and passes the frame on. The species classifier, whose entire job is to name an animal, is handed a picture with no animal in it and does the only thing it can do: it names the closest thing, and says deer. The frame is logged as a deer sighting, the conservation group's report has a deer in it that was never there, and the error sheet gets a row.

Every part of that story is the detector's doing except the last two. The classifier was not wrong in any sense it could have been right about; nothing in its training or its architecture would have saved it, because it was never asked whether there was an animal. It was asked which animal. Yet the sheet's row says the classifier said deer, and the classifier is what gets funded.

This is not a labelling slip. It is structural: the last stage in a chain is the one that produces the visible output, so the visible output carries its name. In a longer pipeline the effect compounds, and the last box acquires a reputation for being the weak one purely by standing at the exit.

LiveAttributing error to one part4 min▶

Chapter 54 is called "Attributing error to one part", and the move it describes is small enough to do on a laptop in an afternoon. Take one error the whole system made. Give the second stage a perfect version of what the first stage should have produced, made by hand, by a person looking at the frame. Then run the second stage again and see what happens.

  • The error disappears. The second stage was capable all along, given a correct input. The error belonged to the first stage.
  • The error survives. Even handed a perfect input, the second stage still gets it wrong. The error is genuinely the second stage's, and a project on the first stage will not remove it.
  • Both stages contributed. It happens, and it is not a problem for the tally: attribute it to the stage whose correction removed the error, and note the row. If correcting either one removes it, the cheaper correction wins the funding argument.

The reason this works is that it turns an argument into an experiment. Before it, two engineers hold two opinions about a frame and neither can be checked. After it, there is a frame, a corrected input, and a result that both of them can look at. Nothing about the model changed; the question changed from "whose fault do you think this is" to "watch what happens when we fix one thing at a time".

LiveTen empty-frame errors that were never the classifier's3 min▶

Lanternfish's Eyeball spreadsheet has 64 errors on it. Ten of them, 16 percent, sit in the category "empty frame called animal". Before tonight, those ten were classifier errors, because that is where the sheet put them and nobody had drawn the system as boxes.

Correcting the detector's decision by hand on all ten made all ten errors disappear. Not most of them. All of them, because an empty frame that never reaches the classifier cannot be misclassified. Every one of the ten belonged to the motion detector, which had never been measured, and none of them could have been touched by any amount of work on the species model.

  • The project that fixes them is the motion-trigger filter, first stage, two weeks, ceiling 1.6 points, 0.80 points per week. It was on the sheet from session 3, sitting third.
  • The project that cannot fix them is the deer-versus-elk specialist model, eight weeks, 0.21 points per week, and the one the room wanted. It is a second-stage project, and these are first-stage errors.
  • What the attribution changed was not the ranking of those two projects, which was already clear, but the reason. The room could argue about points per week. It could not argue with ten frames where correcting the detector made the error go away.
Real world

The contractor who wrote the motion detector had tuned it to miss nothing, on the reasonable-sounding grounds that a missed animal is a lost sighting and a false trigger is only a wasted classification. That trade was made before there was a classifier downstream turning every false trigger into a confident, published, wrong species. Nobody revisited it, because the person who owned the trade-off never saw the error sheet, and the error sheet never named their box.

Self-studyTwo failures that look identical on the sheet4 min▶

Take two rows from the Lanternfish sheet, both filed under a species being named wrongly. On paper they are the same failure. Under attribution they are two different projects.

  • Row one. The detector cropped tightly around a moving shape and handed the classifier a corner of an elk. Given the full frame by hand, the classifier names it correctly. First-stage error. A better classifier changes nothing.
  • Row two. The detector produced a clean, correctly cropped animal, and the classifier said deer where a person says elk. Given a perfect crop, the error survives. Second-stage error, and it is one of the twelve the specialist model exists to fix.

Both rows say the same thing in the category column. One of them belongs to a two-week project and one to an eight-week project, and only the attribution step can tell them apart. This is why the tally is worth an afternoon even when the sheet already looks well organised: a good category scheme describes what the output looked like, and funding needs to know what produced it.

Part 2 · covers chapters 56 and 57

Comparing each part to human-level, and spotting a flawed pipeline

9 min live

Attribution says which box owns an error. It does not yet say which box to fund, because a box can own the most errors and still be close to as good as anything could be. Session 4's yardstick handles that, applied one box at a time: measure each stage against how well a person does that stage's job alone, and fund the stage with the widest gap. Then chapter 57 supplies the case that saves a quarter, where the answer is no stage at all.

Each stage against human-level for that stage alone Stage 1 · motion detector is there an animal in this frame? 91 percent correct 99 human gap 8 points · fund this widest distance from what a person does Stage 2 · species classifier given a correct detector call 94 percent correct 98 human gap 4 points closer to human-level than it looked Fund the widest gap, not the biggest box The classifier owns more errors overall and sits closer to the ceiling of what anyone could do. If both bars reached their dashed line and the system was still short, no stage is the problem. The chain's design is. Chapter 57. A stage is worth funding by its distance from human-level, not by its share of the errors.
🔍 Click to zoom - two stages, two human-level bars, and the gap that decides the funding.
LiveMeasure each stage against human-level for that stage alone3 min▶

Chapter 56 extends session 4's yardstick to a chain. Human-level performance for the whole system is not the useful number here; human-level performance for each stage in isolation is. Show a person only what the motion detector sees, a single frame, and ask only the detector's question: is there an animal in this. Then show a person only what the classifier sees, a correctly cropped animal, and ask only which species. Two separate exercises, two separate numbers.

At Lanternfish the detector is right 91 times in 100 on its own question and a person is right 99 times: a gap of eight points. The classifier, handed a correct detector call, is right 94 times where a person is right 98: a gap of four. The stage with the wider gap is the one where work has somewhere to go, and it is the stage nobody had been funding.

  • A wide gap means headroom. Something a person can do and the model cannot is, by demonstration, learnable.
  • A narrow gap means diminishing returns. The classifier can still be improved, and each point will cost more than the last, because it is close to what anyone can do with that input.
  • The share of errors does not decide this. The classifier owns more of the 120 errors and is nearer its ceiling. Both are true at once, and only the second one prices a project.
LiveSpotting a flawed ML pipeline3 min▶

Chapter 57 is titled "Spotting a flawed ML pipeline", and it names the situation every stage-by-stage analysis has to be able to reach: each stage is performing at human-level for its own job, and the system as a whole is still not good enough. When that happens, there is no stage left to fund. The problem is the shape of the chain.

The usual cause is that the interface between two stages throws away something the later stage needed. A motion detector that outputs a yes or a no has already discarded where in the frame the movement was, how large it was, and how fast. A person doing the detector's job perfectly, under that interface, still hands the classifier a bare yes. If the classifier needs the crop and the interface cannot carry it, both stages can be flawless and the pair can still be wrong.

  • The test is cheap. Give every stage a perfect input by hand and let it run. If the system is still short, the design is the finding.
  • The remedy is a design change, not a training run: widen the interface, merge two stages, or reorder them.
  • It is worth reaching this conclusion early, because it is the one conclusion that no amount of funding a stage can arrive at, and teams can spend a year discovering it the slow way.
Self-studyEnd-to-end learning, named and not taught3 min▶

There is an alternative to fixing a chain, and chapters 47 to 52 of Machine Learning Yearning are about it: replace the whole pipeline with a single model trained straight from the raw input to the final answer, so no hand-designed interface exists to lose anything. It is a genuine option, it has a real cost in data volume, and the trade-off between the two designs belongs to the deep learning course, which owns architecture decisions. It is named here so that a leader reading a flawed-pipeline finding knows the option exists, and does not conclude that the only move is to keep widening interfaces.

Self-studyThe honest limit: a perfect input has to be made by hand4 min▶

The method has one real cost and it should be stated before anybody commits to it. A perfect input for a stage rarely exists in any system. Somebody has to make it, one example at a time, by looking at a frame and writing down what the earlier stage should have said. For Lanternfish that is a person, a screen, and a morning.

  • Ten errors is enough to change a decision. Not a hundred. Ten hand-corrected examples that all point at one box is a finding, and a team can produce ten in an hour.
  • Not every stage can be hand-corrected cheaply. If a stage's output is a learned embedding, no person can write down its perfect value. Attribute what you can and say plainly which stages the method could not reach.
  • The labelling is reusable. Corrected first-stage outputs are training data for the first stage, so the afternoon spent attributing errors is also the start of the project it recommends.
  • It is worth it because the alternative is a guess with a two-week project and an eight-week project riding on it. An afternoon against eight weeks is not a close call.
Build-along

Attribute one error, then ten

★ 18 min · everyone builds

Bring a system your team runs and a handful of recent mistakes from it. If you have nothing to hand, use Lanternfish: two stages, 120 errors in 1,000 dev images, and a sheet that files ten of them as "empty frame called animal". Paper is enough. Nothing here needs a keyboard.

Draw your system as boxes. One box per component that makes a decision, left to right, with an arrow between each pair and a word on the arrow saying what passes along it. Stop when the last box produces the thing the user sees. Most teams find a box that half the room did not know was there, and finding it is already worth the ten minutes.

Take one recent error and ask which box a human would have to fix. Not which box looks suspect. Walk the frame through the boxes and ask, at each arrow, whether what passed along it was correct. The first arrow carrying something wrong points at the box behind it.

Check the answer by correcting that box's output by hand. Write down what it should have said, hand that to the next box, and run the rest of the chain. If the error disappears, the attribution is confirmed. If it survives, keep walking: a later box owns it too.

Do it for ten errors and count per box. One tally mark per error against one box. Ten is enough; the point is not a precise distribution but which box the marks cluster on. Lanternfish's ten empty-frame errors all landed on the detector.

For the box with the most marks, estimate two numbers. How well a person does that box's job alone, given only that box's input, and how well the box currently does it. Ten hand-judged examples give both. Lanternfish: detector 91 against a person's 99, classifier 94 against 98.

Write which stage you would fund and why the sheet pointed elsewhere. Two sentences. The second one is the important one, because it is the sentence that stops the sheet's category names from making the same wrong recommendation next quarter.

★ The attribution tally, as it goes to the team Lanternfish species pipeline. Ten errors walked through the boxes by hand, 9 September. Stage 1, motion detector ........ 7 marks of which: empty frames passed as animals .... 5 animal cropped so tightly the species was gone .... 2 Stage 2, species classifier ..... 3 marks of which: clean crop, correct species available, still named wrong .... 3 Human-level, stage 1 alone: 99 percent. Current: 91. Gap 8 points. Human-level, stage 2 alone: 98 percent. Current: 94. Gap 4 points. Funding: the motion-trigger filter, stage 1, 2 weeks, 0.80 points per week. Not funding this sprint: the deer-vs-elk specialist model, stage 2, 8 weeks, 0.21 points per week. Why the sheet disagreed: its category names describe what came out of the last box, not which box produced the fault. The ten empty-frame rows were filed against the classifier and every one of them belonged to the detector.

If the marks are spread evenly across every box, that is a finding too. It usually means the boxes are all roughly as good as each other and the interfaces between them are where the losses are. Run the human-level comparison on each box before concluding anything: if every box is at its dashed line and the system is still short, chapter 57 has already named what you are looking at.

Homework

Before session 6

40 min
  1. Draw one production system you fund as boxes and arrows, then send the drawing to the two people who know it best and ask what is missing. Note how long the list is.
  2. Attribute ten recent errors to one box each, using the hand-corrected input test rather than an opinion. Count the marks.
  3. For the box with the most marks, get an estimate of human-level performance on that box's job alone. A person doing ten examples is enough for a first number.
  4. Find one funded project and check which box it targets. If it targets a box that owns few of the marks, take the tally to its sponsor before the sprint starts, not after.
  5. Write down which stages your team could not hand-correct cheaply, and what you would need in order to reach them. That list is the honest limit of tonight's method on your system.
Check yourself

Three questions

An empty frame passes Lanternfish's motion detector, the species classifier names it a deer, and the error sheet files the row under "empty frame called animal". Who owns the error?

Attributing error to one part: give the later stage a perfect version of the earlier stage's output. If the error vanishes, it belonged to the earlier stage. The category name described the symptom at the exit of the pipe, not the cause.

The motion detector is right 91 times in 100 where a person is right 99. The classifier, given a correct detector call, is right 94 where a person is right 98, and it owns more of the errors overall. Which stage do you fund?

Measure each stage against human-level for that stage alone and fund the widest gap. Share of errors ranks the classifier first; distance from what a person can do ranks the detector first, and only the second one says where work has somewhere to go.

Every stage of a pipeline is measured at human-level for its own job, and the system as a whole is still not good enough. What does that tell you?

Spotting a flawed ML pipeline. It is the one conclusion that funding a stage can never reach, which is why it is worth testing for early rather than after a year of stage-by-stage projects.

Sources covered

What tonight maps to

✓ Machine Learning Yearning, chapter 53 Error analysis by parts: why a system-level error rate cannot say which component caused a mistake, and why the sheet's category names point at the last box in the chain.
✓ Machine Learning Yearning, chapter 54 Attributing error to one part: hand the later stage a perfect version of the earlier stage's output, and watch whether the error survives. Done on the ten empty-frame errors.
✓ Machine Learning Yearning, chapter 56 Each stage compared to human-level performance on that stage's job alone, so the stage with the widest gap is the one funded. Detector 91 against 99; classifier 94 against 98.
✓ Machine Learning Yearning, chapter 57 Spotting a flawed ML pipeline: every stage at human-level and the system still short means the design is the finding, not any component.
◐ Machine Learning Yearning, chapters 47 to 52 End-to-end learning named in one sentence as the alternative to a chain. The trade-off belongs to the deep learning course, which owns architecture decisions.
◐ Human-level performance as a yardstick Session 4 establishes it on one model, with the chapter 22 arithmetic. Tonight applies it one stage at a time.
· How to build or retrain either stage Not covered by design. Tonight decides which stage gets the money; the intro ML and deep learning courses own what happens after that decision.

Session 5 cheat sheet

One error rate, several boxesA system-level number says nothing about which stage caused a mistake.
Category names blame the exitThe last box produces the visible output, so it carries the name of the symptom.
Attribute with a perfect inputHand-correct the earlier stage's output. Error gone means the error was the earlier stage's.
Ten empty frames, ten detector errorsNone of them removable by any amount of work on the species classifier.
Human-level, one stage at a timeAsk a person only that stage's question, given only that stage's input.
Fund the widest gapDetector 91 against 99 beats classifier 94 against 98, whoever owns more errors.
All stages at human-level, system shortThe design is the problem. Widen the interface, merge the stages, or reorder them.
An afternoon against eight weeksPerfect inputs are made by hand, ten are enough, and the labels feed the project they recommend.