Basis Lab

Models That Use Tools

Several Steps and a Budget

Last timeWhen a Tool Fails

A loop with no limit is not a capability, it is an invoice. Bounding the steps, the time and the money is what makes a multi step system safe to run.

Three budgets, not one

The step limit in the second lesson is the obvious bound and on its own it is

the weakest of the three.

Twenty steps might be two seconds of fast lookups or two minutes of web

fetches. It might be a tenth of a penny or several pounds, depending on how

long the history has grown and which model is being used. A limit expressed in

steps says almost nothing about the two things people actually care about,

which are how long they wait and what it costs.

FIG 1How many steps a money budget affords
what one task may cost
the model cost of one step
the tool cost of one step
steps the budget affords
This is the arithmetic that should set the step limit, rather than a round number. At four tenths of a penny of model per step and fifteen hundredths of a penny of tools, twelve steps is about six and a half pence a task, which is fine at a thousand tasks a day and is not fine at a million. Running the sum in the other direction, from an acceptable cost per task, gives a step limit with a reason behind it.

So three budgets, all checked in the loop. Steps, because it is the cheapest to

enforce and catches runaway behaviour immediately. Time, because somebody is

waiting and a correct answer after four minutes is often worth less than an

admission after thirty seconds. And money, because a loop with no cost limit

has no upper bound on a bad day and bad days are when it will run.

FIG 2The three budgets and what each one catches
catches a stuck loopprotects the person waitprotects the billcheap to enforce
a step limit1001
a time budget1101
a cost budget0010
all three together1111
Coded 1 for yes and 0 for no. No single row other than the last has three ones, which is the argument for having all three: they fail in different directions. A cost budget is the awkward one to enforce because the cost of a step is only known after it has been taken, so it is enforced by accumulating as the loop runs and stopping when the total passes the limit, which means a task can exceed its budget by at most one step.

Why the cost grows faster than the length

The second lesson showed the curve and this is the reasoning behind it.

At step one the model reads the question. At step two it reads the question,

the first request and the first result. At step three it reads all of that

again plus one more exchange. Nothing is ever read once.

If each step adds about the same amount to the history, then the total read

across a task of many steps is the sum of one plus two plus three and so on,

which is about half the square of the number of steps. Twice as many steps is

roughly four times the reading.

The lesson stops here

3 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. 01Saying Something and Doing Something
  2. 02The Loopopening only
  3. 03Describing a Tool Wellopening only
  4. 04Checking What the Model Asked Foropening only
  5. 05When a Tool Failsopening only
  6. 06Several Steps and a Budgetyou are here
  7. 07Text From Outside Is Not an Instructionopening only
  8. 08Judging Whether the Whole Thing Workedopening only

Read alongside