Basis Lab

Many Models, One Job

Who Decides the Next Step, and What Deciding Costs

Last timeThe Four Shapes a Split Can Take

A router is a step with an accuracy of its own, and it multiplies everything behind it. The arithmetic for choosing in code against choosing with a model call, on one order-answering service.

Something has to decide which step runs next. On the service this course is

built around, the first thing that happens to a customer's written question

about an order is that it gets sorted, and what the sorting produces decides

which lookup, which draft and which check follow. That decision can be made by

ordinary code reading a field, or by a model call reading the question.

The two look interchangeable in a design document. They are not remotely

interchangeable in the arithmetic, and the gap is larger than almost anyone

guesses before working it out.

FIG 1The same three steps, with two different things choosing in front of them
The two sides of the fork at the top are not two implementations of one thing. The left one cannot be wrong unless the ticket is wrong, and the right one has an error rate, a latency and a bill. Which side a system belongs on is decided by where the information lives, not by which is more interesting to build.

The decision is a step, so it has a step's arithmetic

Take the service as three steps behind a chooser: find the matching order and

policy, draft the reply, check the draft against the policy. Each is right 95

times in 100, so a correctly routed request comes out right

0.953=0.8573750.95^3 = 0.857375 of the time, which is 0.857.

Now the chooser. Assume, and this is the assumption everything below rests on,

that a request sent down the wrong branch produces a wrong answer. A refund

question answered by the delivery branch is wrong no matter how good the

delivery branch is.

FIG 2A chooser in front of a chain
how often the whole request comes out right
how often the chooser picks a branch that is able to answer
how often step i of the chosen branch is right
how many steps the chosen branch has, which is three here
how long the chooser takes, which is 0.8 seconds for a model call and effectively nothing for a rule
how long step i takes, which is 0.8 seconds throughout this course
The chooser's accuracy sits outside the product as a multiplier, not inside the sum as another term, and that is the whole lesson in one line. Its time, by contrast, does sit inside the sum, added at the front where nothing can overlap it.

So the arithmetic has three cases. A rule that reads a field is right whenever

the field is right, which makes r=1r = 1 and leaves the system at 0.857. A model

call that sorts as well as the other steps do has r=0.95r = 0.95, giving

0.95×0.857375=0.8145060.95 \times 0.857375 = 0.814506, which is 0.815, and that is exactly the four

step entry of the compounding table from two lessons back and agrees with the

81 in 100 the four step service actually measures. And a router right 9 times in

10 has r=0.9r = 0.9, giving 0.9×0.857375=0.7716380.9 \times 0.857375 = 0.771638, which is 0.772.

The lesson stops here

7 more paragraphs to go

You have read the opening. The rest of the argument, the problems that check whether it landed, and the lines worth keeping at the end all come with a plan.

The first lesson of every course in the library reads the whole way through, free, so you can see exactly what the rest of them are.

See the planThe contents

This is the reading half

Starting the course gives you your own copy of it. Every idea on every page has problems standing under it, marked with a reason rather than a tick, and any sentence you do not believe can be opened and argued with. None of that can happen on a page nobody owns.

The contents

The rest of this course

  1. 01What Splitting a Job Across Model Calls Buys, and What It Charges
  2. 02A Step Good 95 Times in 100 Is Not Good Enough to Be the Fourth of Fouropening only
  3. 03Chain, Fork, Loop and Crowd, Priced on One Jobopening only
  4. 04Who Decides the Next Step, and What Deciding Costsyou are here
  5. 05What One Step Has to Tell the Next, and What It Must Notopening only
  6. 06What a Gate Catches, What It Destroys and What It Costsopening only
  7. 07The Loop That Will Not Settle, and the Loop That Settles on Something Wrongopening only
  8. 08Three Points of Accuracy for Twice the Costopening only

Read alongside